@witlink/workflow 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ ## @witlink/workflow 库介绍
2
+ > 工作流模块提供一个页面级组件WfManagePage。
3
+
4
+ ### 如何使用@witlink/workflow
5
+ ##### 1. 安装@witlink/workflow
6
+
7
+ ```bash
8
+ npm install @witlink/workflow
9
+ ```
10
+ ##### 2. 使用@witlink/workflow
11
+ ```js
12
+ import WitlinkWorkflow, {
13
+ setLang, // 宿主切换多语言时调用此方法通知此模块,zh_CN、en_US、fr_FR
14
+ setTimezone, // 设置时区如 Etc/GMT+8
15
+ // Page组件
16
+ WfManagePage, // 流程模板定义
17
+ } from '@witlink/workflow'
18
+ ```
19
+
20
+ + 初始化
21
+
22
+ ```js
23
+ import WitlinkWorkflow from "@witlink/workflow"
24
+
25
+ const app = createApp(App)
26
+ app.use(WitlinkWorkflow, {
27
+ i18n, // 宿主i18n对象
28
+ pinia, // 宿主pinia对象
29
+ tokenKey: 'pro__Access-Token', // localStorage中存储token的key
30
+ timezone: 'Etc/GMT+8', // 时区
31
+ theme: {
32
+ colorPrimary: '#165dff',
33
+ },
34
+ })
35
+ ```
36
+
37
+ + 切换多语言
38
+
39
+ ```js
40
+ import { setLang } from "@witlink/workflow"
41
+ setLang(lang)
42
+ ```
43
+ + Page组件的使用
44
+ ```js
45
+ import type { RouteRecordRaw } from 'vue-router'
46
+ import { WfManagePage } from '@witlink/workflow'
47
+ export const wfRoutes: RouteRecordRaw[]= [
48
+ {
49
+ path: 'wfManage',
50
+ name: 'wfManage',
51
+ component: WfManagePage,
52
+ },
53
+ ]
54
+ ```
55
+ + 接口转发配置
56
+ ```js
57
+ // 在开发环境
58
+ // vite.config.ts中
59
+ server: {
60
+ proxy: {
61
+ '/wfapi': {
62
+ target: '当前系统的接口代理地址', //目标url
63
+ changeOrigin: true, //支持跨域
64
+ secure: false, // 跳过 HTTPS 证书检查
65
+ rewrite: (path) =>
66
+ path.replace(new RegExp("^" + '/wfapi'), ""),
67
+ },
68
+ },
69
+ },
70
+ ```
71
+
72
+ ```bash
73
+ # 配置nginx转发
74
+ location /wfapi/ {
75
+ proxy_pass https://ip:port/; # 注意结尾的斜杠
76
+ # 请求 /wfapi/user 会被转发到 http://ip:port/user
77
+ }
78
+ ```