@cniot/android-pda-components 0.0.32 → 0.1.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.
Files changed (43) hide show
  1. package/build/assets/index.3dc86daa.css +1 -0
  2. package/build/assets/index.60478450.js +372 -0
  3. package/build/assets/vendor.0fcd5cc7.js +38 -0
  4. package/build/index.html +3 -3
  5. package/doc/index.jsx +20 -6
  6. package/es/index.cjs.js +2 -2
  7. package/es/index.es.js +126 -448
  8. package/es/style.css +1 -1
  9. package/package.json +2 -2
  10. package/vite.config.doc.js +8 -0
  11. package/vite.config.js +0 -16
  12. package/build/assets/index.c5691218.css +0 -1
  13. package/build/assets/index.f4cdaf13.js +0 -318
  14. package/build/assets/vendor.1ac3b6a0.js +0 -38
  15. package/test/.gsignore +0 -6
  16. package/test/META-INF/MANIFEST.MF +0 -8
  17. package/test/README.md +0 -29
  18. package/test/_vite_plugins/autoRegisterPages.js +0 -35
  19. package/test/_vite_plugins/importCustomLib.js +0 -17
  20. package/test/_vite_plugins/insertMeta2html.js +0 -64
  21. package/test/config/pre/pageflow.xml +0 -51
  22. package/test/config/prod/pageflow.xml +0 -41
  23. package/test/package.json +0 -22
  24. package/test/pageflow.prog +0 -4
  25. package/test/src/gs/api.gs +0 -38
  26. package/test/src/gs/context.gs +0 -13
  27. package/test/src/gs/lib/common.gs +0 -35
  28. package/test/src/gs/lib/flow.gs +0 -206
  29. package/test/src/gs/lib/request.gs +0 -93
  30. package/test/src/gs/start.gs +0 -116
  31. package/test/src/web/index.html +0 -40
  32. package/test/src/web/index.jsx +0 -53
  33. package/test/src/web/pages/index/index.jsx +0 -47
  34. package/test/src/web/pages/index/index.less +0 -0
  35. package/test/src/web/pages/rfidOnce/index.jsx +0 -57
  36. package/test/src/web/pages/rfidOnce/index.less +0 -0
  37. package/test/src/web/pages/rfidScan/index.jsx +0 -45
  38. package/test/src/web/pages/success/index.jsx +0 -36
  39. package/test/src/web/pages/success/index.less +0 -0
  40. package/test/src/web/system/index-android-pda.jsx +0 -71
  41. package/test/src/web/system/index-pc.jsx +0 -24
  42. package/test/src/web/utils/index.js +0 -4
  43. package/test/vite.config.js +0 -27
@@ -1,64 +0,0 @@
1
- import fs from 'fs';
2
-
3
- export default function inserMeta2html() {
4
- const meta = getLocalInfo();
5
- return {
6
- name: "html-transform",
7
- transformIndexHtml(html) {
8
- return html.replace(
9
- /<title>(.*?)<\/title>/,
10
- `<title>${meta.displayName}</title>
11
- <script>
12
- (function (appMeta) {
13
- var params = new URLSearchParams(location.search);
14
- if (!params.get('appId') && appMeta.appId) {
15
- const url = new URL(location.href);
16
- url.search = '?appId='+appMeta.appId+'&group='+appMeta.groupDev;
17
- location.href = url.toString();
18
- }
19
- })(${JSON.stringify(meta)});
20
- </script>
21
- `
22
- );
23
- },
24
- };
25
- }
26
-
27
-
28
-
29
- // 获取本地信息
30
- function getLocalInfo() {
31
- // const meta = JSON.parse()fs.readFileSync("./META-INF");
32
- const progFiles = fs
33
- .readdirSync("./")
34
- .filter((fileName) => /\.prog$/.test(fileName));
35
- const metaInfo = parseMetaInfo(
36
- fs.readFileSync("./META-INF/MANIFEST.MF").toString()
37
- );
38
- const firstProgFileName = progFiles[0] || "";
39
- return {
40
- ...metaInfo,
41
- appId: `${metaInfo.id}@${firstProgFileName}`,
42
- appIdList: progFiles.map((prog) => {
43
- return `${metaInfo.id}@${prog}`;
44
- }),
45
- group: metaInfo.group,
46
- };
47
- }
48
-
49
- function parseMetaInfo(metaContent) {
50
- try {
51
- const mate = {};
52
- metaContent.split("\n").forEach(function (line) {
53
- const kv = line.split(":");
54
- if(kv.length > 1) {
55
- mate[kv[0].trim()] = kv[1].trim();
56
- }
57
- });
58
- mate.id = mate.appId;
59
- return mate;
60
- } catch (e) {
61
- console.log(e);
62
- return {};
63
- }
64
- }
@@ -1,51 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-
3
- <profile xmlns="http://cainiao-inc.com/iot/binding/v2">
4
- <bean class="com.cainiao.loginx.edge.SystemService" name="sys"/>
5
- <bean class="com.cainiao.loginx.edge.ext.HttpClient" name="httpClient" connectTimeout="5000" readTimeout="5000" writeTimeout="5000" maxIdleConnections="5" keepAliveSeconds="10" />
6
- <bean name="md5" class="com.cainiao.loginx.edge.ext.MessageDigest" defaultCharset="UTF-8" algorithm="MD5"/>
7
- <bean name="base64" class="com.cainiao.loginx.edge.ext.Base64" defaultCharset="UTF-8"/>
8
-
9
- <service name = "pageFlow" class= "com.cainiao.loginx.edge.pageflow.FlowService">
10
- <!-- @cniot/pageflow 指令 start -->
11
- <!-- 在浏览器输出一条日志,log会重置gs的启动点,线上环境请删除所有 log -->
12
- <function name = "log" action="logic" page="/system/log" />
13
- <!-- 从新开始当前流程 -->
14
- <function name = "restart" action="logic" page="/system/restart" />
15
- <!-- 获取宿主机信息 -->
16
- <function name = "getLocalBusInfo" action="logic" page="/system/getLocalBusInfo" />
17
- <!-- 获取本地驱动设备列表 -->
18
- <function name = "getLocalDeviceList" action="logic" page="/system/getLocalDeviceList" />
19
- <function name = "beforeFlow" action="logic" page="/system/beforeFlow" />
20
- <!-- 快捷确认页面 -->
21
- <function name = "confirm" action="overlay" page="/system/confirm" />
22
- <!-- 快捷弹窗页面 -->
23
- <function name = "alert" action="overlay" page="/system/alert" />
24
- <!-- 输入弹窗 -->
25
- <function name = "prompt" action="overlay" page="/system/prompt" />
26
- <!-- 结束当前流程,前端页面会显示开始流程按钮 -->
27
- <function name = "end" action="router" page="/system/end" />
28
- <!-- @cniot/pageflow 指令 end -->
29
-
30
- <!-- 自定义页面 start -->
31
- <function name = "index" action="router" page="/pages/index" />
32
- <function name = "scanContainer" action="router" page="/pages/scanContainer" />
33
- <function name = "rfidOnce" action="router" page="/pages/rfidOnce" />
34
- <function name = "rfidScan" action="router" page="/pages/rfidScan" />
35
- <function name = "continuousRfidScan" action="router" page="/pages/continuousRfidScan" />
36
- <function name = "success" action="router" page="/pages/success" />
37
- <!-- 自定义页面 end -->
38
-
39
- </service>
40
- <!-- http reqeust -->
41
- <!-- https://oneapi.alibaba-inc.com/mock/hexiangdadan/merge/getPackageList -->
42
- <property name="content_json">
43
- {
44
- "Content-Type":"application/json"
45
- }
46
- </property>
47
- <service class="com.cainiao.loginx.edge.adapter.HttpAdapter" name="labourService" baseUrl="https://oneapi.alibaba-inc.com/mock/hexiangdadan">
48
- <function name="getPackageList" path="/merge/getPackageList" headers="${content_json}" method="GET" />
49
- </service>
50
- </profile>
51
-
@@ -1,41 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-
3
- <profile xmlns="http://cainiao-inc.com/iot/binding/v2">
4
- <bean class="com.cainiao.loginx.edge.SystemService" name="sys"/>
5
- <service name = "pageFlow" class= "com.cainiao.loginx.edge.pageflow.FlowService">
6
- <!-- @cniot/pageflow 指令 start -->
7
- <!-- 在浏览器输出一条日志,log会重置gs的启动点,线上环境请删除所有 log -->
8
- <!-- <function name = "log" action="logic" page="/system/log" /> -->
9
- <!-- 从新开始当前流程 -->
10
- <function name = "restart" action="logic" page="/system/restart" />
11
- <!-- 获取宿主机信息 -->
12
- <function name = "getWorkStation" action="logic" page="/system/getWorkStation" />
13
- <!-- 获取本地驱动设备列表 -->
14
- <function name = "getWorkStationDevices" action="logic" page="/system/getWorkStationDevices" />
15
- <!-- 快捷确认页面 -->
16
- <function name = "confirm" action="overlay" page="/system/confirm" />
17
- <!-- 快捷弹窗页面 -->
18
- <function name = "alert" action="overlay" page="/system/alert" />
19
- <!-- 输入弹窗 -->
20
- <function name = "prompt" action="overlay" page="/system/prompt" />
21
- <!-- 结束当前流程,前端页面会显示开始流程按钮 -->
22
- <function name = "end" action="router" page="/system/end" />
23
- <!-- @cniot/pageflow 指令 end -->
24
-
25
- <!-- 自定义页面 start -->
26
- <function name = "scanContainer" action="router" page="/scanContainer" />
27
- <!-- 自定义页面 end -->
28
-
29
- </service>
30
- <!-- http reqeust -->
31
- <!-- https://oneapi.alibaba-inc.com/mock/hexiangdadan/merge/getPackageList -->
32
- <property name="content_json">
33
- {
34
- "Content-Type":"application/json"
35
- }
36
- </property>
37
- <service class="com.cainiao.loginx.edge.adapter.HttpAdapter" name="labourService" baseUrl="https://oneapi.alibaba-inc.com/mock/hexiangdadan">
38
- <function name="getPackageList" path="/merge/getPackageList" headers="${content_json}" method="GET" />
39
- </service>
40
- </profile>
41
-
package/test/package.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "name": "10446",
3
- "scripts": {
4
- "dev": "vite --host 0.0.0.0",
5
- "build": "vite build"
6
- },
7
- "devDependencies": {
8
- "@vitejs/plugin-legacy": "^1.4.4",
9
- "@vitejs/plugin-react-refresh": "^1.3.5",
10
- "vite": "^2.4.1"
11
- },
12
- "description": "",
13
- "dependencies": {
14
- "@alifd/next": "^1.23.16",
15
- "@cniot/android-pda-components": "^0.0.20",
16
- "@cniot/pageflow": "0.2.2",
17
- "EventEmitter": "^1.0.0",
18
- "less": "^4.1.1",
19
- "moment": "^2.29.1",
20
- "sass": "^1.35.2"
21
- }
22
- }
@@ -1,4 +0,0 @@
1
- name: 货到人拣选
2
- script: src/gs/start.gs
3
- profile: pageflow.xml
4
- deviceType: browser
@@ -1,38 +0,0 @@
1
- import * as request from './lib/request.gs'
2
-
3
- const domain = sys.getProperty("domain");
4
- // const domain = '';
5
-
6
- const jsonHeader = {
7
- "context-type": "application/json"
8
- }
9
-
10
- function ioCatchRet(ret) {
11
- if (ret.success) {
12
- ret.data.message = ret.message
13
- return ret.data;
14
- }
15
- throw new Error(ret.code + "," + ret.message);
16
- }
17
-
18
- export function getTestGet(params) {
19
- return ioCatchRet(request.get(domain + "/v1/testapi", {
20
- params,
21
- }))
22
- }
23
-
24
- // function testLink() {
25
- // let content = {
26
- // "nodeCode": "test-code",
27
- // "fortuneToken": "login-token-test",
28
- // }
29
- // let res = linkTest('FETCH_LOADCAR_DATE_ITEMS',content);
30
- // pageFlow.log({ res })
31
- // }
32
-
33
- //link 测试接口
34
- export function linkTest (apiName, params){
35
- var ret = request.linkDo(apiName, params);
36
- // pageFlow.log({ret})
37
- return ioCatchRet(ret);
38
- }
@@ -1,13 +0,0 @@
1
- export const globalData = {};
2
-
3
- export function setData(key, value) {
4
- globalData[key] = value;
5
- }
6
-
7
- export function getData(key) {
8
- return globalData[key];
9
- }
10
-
11
- export function removeData(key) {
12
- delete globalData[key];
13
- }
@@ -1,35 +0,0 @@
1
- var url = null;
2
- var _isDevFlag = false;
3
- var location = {};
4
-
5
- export function setUrl(v) {
6
- url = v;
7
- _isDevFlag = url.indexOf('localhost') >= 0 || url.indexOf('mock=1') >= 0;
8
- }
9
- export function getUrl(url) {
10
- return url;
11
- }
12
- export function isDev() {
13
- return _isDevFlag;
14
- }
15
- export function setLocation(v) {
16
- location = v;
17
- }
18
-
19
- const globalData = {};
20
- export function setData(key, value) {
21
- globalData[key] = value;
22
- }
23
-
24
- export function sumTime(timestamp) {
25
- var ms = timestamp;
26
- var min = ms / 1000 / 60;
27
- var r = min % 1;
28
- var sec = Math.floor(r * 60);
29
- if (sec < 10) {
30
- sec = '0' + sec;
31
- }
32
- min = Math.floor(min);
33
- let time = min ? min : ('0.' + sec);
34
- return time;
35
- }
@@ -1,206 +0,0 @@
1
- import { setUrl, isDev, setLocation, setData } from './common.gs'
2
-
3
- function frameDescribe(stepIndex, data) {
4
- return {
5
- IS_FRAME: true,
6
- stepIndex,
7
- data: data || {}
8
- }
9
- }
10
-
11
- function copy(data) {
12
- return typeof data === 'object' ? JSON.parse(JSON.stringify(data)) : data;
13
- }
14
-
15
- var h5Env = pageFlow.beforeFlow({});
16
- setLocation(h5Env.location);
17
- setUrl(h5Env.location.href);
18
- setData('deviceInfo', h5Env.deviceInfo);
19
-
20
- export function Flow() {
21
- // 历史栈 index 记录
22
- var stepIndexRecord = [];
23
- // 历史栈 关键帧 记录
24
- var stepFrameRecord = [];
25
- var stepDataRecord = [];
26
- var flowList = [];
27
- var eventFlow = {};
28
- var stepIndex = 0;
29
- var context = {}
30
-
31
- function isBack(input) {
32
- return String(input) === "back";
33
- }
34
-
35
- function push(keyFrame, fn) {
36
- if (typeof keyFrame === "string") {
37
- flowList.push([fn, keyFrame]);
38
- } else {
39
- flowList.push([keyFrame]);
40
- }
41
- }
42
-
43
- function start(data) {
44
- stepIndex = 0;
45
- stepIndexRecord = [];
46
- stepFrameRecord = [];
47
- stepDataRecord = []
48
- next(data !== undefined ? data : {});
49
- }
50
-
51
- function next(data) {
52
- // 超出所有步骤
53
- if (stepIndex >= flowList.length) {
54
- stepIndex = 0;
55
- }
56
- var frame = flowList[stepIndex];
57
- if (frame) {
58
- var framefn = frame[0];
59
- // 执行记录
60
- stepIndexRecord.push(stepIndex);
61
- stepFrameRecord.push(frame[1]);
62
- // 数据记录
63
- stepDataRecord.push(copy(data));
64
- // 在当前 flow 中保存 data
65
- context.data = data;
66
- var ret = framefn(data, context);
67
- if (ret && ret.IS_FRAME) {
68
- // 当前 flow 的其他状态
69
- stepIndex = ret.stepIndex;
70
- ret = ret.data;
71
- } else {
72
- stepIndex++;
73
- }
74
- // 正常执行下一步
75
- next(ret);
76
- } else {
77
- throw new Error("not frame index: " + stepIndex);
78
- }
79
- }
80
-
81
- function getKeyFrame(frame, data) {
82
- if (frame === undefined) {
83
- throw new Error("frame must be string");
84
- }
85
-
86
- if (frame === "FLOW_FIRST") {
87
- return frameDescribe(0, data)
88
- }
89
-
90
- if (frame === "FLOW_LAST") {
91
- return frameDescribe(flowList.length - 1, data)
92
- }
93
-
94
- for (var i = 0; i < flowList.length; i++) {
95
- if (flowList[i][1] === frame) {
96
- return frameDescribe(i, data)
97
- }
98
- }
99
-
100
- throw new Error("not find " + frame + " key");
101
- }
102
-
103
- function has(frame) {
104
- try {
105
- getKeyFrame(frame);
106
- return true;
107
- } catch (e) {
108
- return false;
109
- }
110
- }
111
-
112
- function getFirstFrame(frame) {
113
- return getKeyFrame("FLOW_FIRST");
114
- }
115
-
116
- function getLastFrame(frame) {
117
- return getKeyFrame("FLOW_LAST");
118
- }
119
-
120
- function getCurrentFrame(data) {
121
- return frameDescribe(stepIndex, data);
122
- }
123
-
124
- // 从新播放当前帧,不会被记录到历史
125
- function replayCurrentFrame(data) {
126
- var nextFrameDescribe = getCurrentFrame(data);
127
- stepIndexRecord = stepIndexRecord.slice(0, -1);
128
- stepFrameRecord = stepFrameRecord.slice(0, -1);
129
- stepDataRecord = stepDataRecord.slice(0, -1);
130
- return nextFrameDescribe;
131
- }
132
-
133
- // 删除当前帧,使历史记录中不包含当前帧
134
- function deleteCurrentFrame(){
135
- stepIndexRecord = stepIndexRecord.slice(0, -1);
136
- stepFrameRecord = stepFrameRecord.slice(0, -1);
137
- stepDataRecord = stepDataRecord.slice(0, -1);
138
- }
139
-
140
- // 返回上一个来源帧
141
- function back() {
142
- var index = 0;
143
- var data = {}
144
- if (stepIndexRecord.length >= 2) {
145
- // 删除最后一个元素
146
- index = stepIndexRecord[stepIndexRecord.length - 2];
147
- data = stepDataRecord[stepDataRecord.length - 2];
148
- stepIndexRecord = stepIndexRecord.slice(0, -2);
149
- stepFrameRecord = stepFrameRecord.slice(0, -2);
150
- stepDataRecord = stepDataRecord.slice(0, -2);
151
- } else {
152
- stepIndexRecord = [];
153
- stepDataRecord = [];
154
- }
155
- return frameDescribe(index, data);
156
- }
157
- // 返回历史栈里固定的一个关键帧
158
- function backTo(frame, data){
159
- if(frame === undefined){
160
- throw new Error('back to must be frame key')
161
- }
162
- const index = stepFrameRecord.indexOf(frame);
163
- if(index > -1){
164
- var historyData = data || stepDataRecord[index];
165
- stepIndexRecord = stepIndexRecord.slice(0, index);
166
- stepFrameRecord = stepFrameRecord.slice(0, index);
167
- stepDataRecord = stepDataRecord.slice(0, index);
168
- return getKeyFrame(frame, historyData);
169
- };
170
- throw new Error('back to not found :'+ frame)
171
- }
172
-
173
- // 从固定帧开始执行
174
- function startFrom(frameDescribe, data) {
175
-
176
- if (typeof frameDescribe === "string") {
177
- if (has(frameDescribe)) {
178
- frameDescribe = getKeyFrame(frameDescribe, data);
179
- } else {
180
- throw new Error(frameDescribe + " not found")
181
- }
182
- }
183
- stepIndexRecord = [];
184
- stepFrameRecord = [];
185
- stepDataRecord = [];
186
- stepIndex = frameDescribe.stepIndex;
187
- next(frameDescribe.data);
188
- }
189
-
190
- context.push = push;
191
- context.isBack = isBack;
192
- context.start = start;
193
- context.get = getKeyFrame;
194
- context.has = has;
195
- context.back = back;
196
- context.backTo = backTo;
197
- context.getFirstFrame = getFirstFrame;
198
- context.getLastFrame = getLastFrame;
199
- context.getCurrentFrame = getCurrentFrame;
200
- context.replayCurrentFrame = replayCurrentFrame;
201
- context.deleteCurrentFrame = deleteCurrentFrame;
202
- context.restart = start;
203
- context.startFrom = startFrom;
204
-
205
- return context;
206
- }
@@ -1,93 +0,0 @@
1
- import * as context from '../context.gs';
2
- import { isDev } from './common.gs';
3
-
4
- export function getDomain() {
5
- var dev = isDev();
6
- // pageFlow.log({dev})
7
- return dev ? 'https://oneapi.alibaba-inc.com/mock/ktmot9ax/' : "https://daily-link.wt.cainiao.com";
8
- }
9
-
10
- function getDefaultHeader(){
11
- return {
12
- mac: context.getData("mac"),
13
- macAddress: context.getData("mac"),
14
- }
15
- };
16
-
17
- const defaultContextType = {
18
- "context-type": "application/x-www-form-urlencoded"
19
- }
20
-
21
- function generateDigest(content) {
22
- var bytes = md5.digest(content + "!QAZ2wsx3edc");
23
- return base64.encode(bytes);
24
- }
25
-
26
- export function get(url, params, headers) {
27
- const defaultHeaders = getDefaultHeader();
28
- headers = Object.assign(defaultHeaders, headers || defaultContextType);
29
- params = Object.assign({
30
- macAddress: defaultHeaders.mac
31
- }, params || {});
32
- var response = httpClient.get(url, headers, params);
33
- if(context.getData("testLog")){
34
- pageFlow.log({
35
- url,
36
- headers,
37
- params,
38
- response,
39
- data: JSON.parse(response.body)
40
- })
41
- }
42
- return JSON.parse(response.body);
43
- }
44
-
45
- export function post(url, params, headers) {
46
- const defaultHeaders = getDefaultHeader();
47
- headers = Object.assign(defaultHeaders, headers || defaultContextType);
48
- params = Object.assign({
49
- macAddress: defaultHeaders.mac
50
- }, params || {});
51
- const response = httpClient.post(url, headers, params)
52
- if(context.getData("testLog")){
53
- pageFlow.log({
54
- url,
55
- headers,
56
- params,
57
- response,
58
- data: JSON.parse(response.body)
59
- })
60
- }
61
- return JSON.parse(response.body);
62
- }
63
-
64
- export function generateLinkParams(apiName, params) {
65
- var content = JSON.stringify(params);
66
- var paramsObj = {
67
- "api_name": apiName,
68
- "from_code": "device1",
69
- "from_appkey": "iot_industry_fortune_device",
70
- "to_code": 'device1',
71
- "to_appkey": 'iot_industry_fortune_device',
72
- "content": content,
73
- "data_digest": generateDigest(content)
74
- }
75
- return paramsObj
76
- }
77
-
78
- export function linkDo(apiName, params) {
79
- var data = generateLinkParams(apiName, params);
80
- var dev = isDev();
81
- var url = getDomain() + "/gateway/link.do";
82
- if(dev) {
83
- url = url + '/' + apiName
84
- }
85
- var headers = {
86
- "Content-Type": "application/x-www-form-urlencoded",
87
- }
88
- // pageFlow.log({
89
- // dev: dev,
90
- // url: url,
91
- // })
92
- return post(url, data, headers);
93
- }
@@ -1,116 +0,0 @@
1
- // flow.gs 做了一些注册工作,此行勿注释
2
- import { Flow } from "./lib/flow.gs";
3
-
4
- /**
5
- * Flow 工具类,是 GS 流程编码的最佳实践
6
- * 可参考 https://www.yuque.com/cniot/docs/phwel4
7
- */
8
- var flow = Flow();
9
-
10
- // 第一帧
11
- // flow.push(function(data, flow) {
12
- // var code = pageFlow.scanContainer({
13
- // // sys.tr 用于处理文案国际化
14
- // title: sys.tr('第一个界面,这是 GS 传递给页面的数据'),
15
- // });
16
-
17
- // // 直接返回数据,将会作为第二帧的入参, 历史记录 +1
18
- // return {
19
- // code
20
- // }
21
- // });
22
-
23
-
24
- // // 第二帧
25
- // flow.push(function(data, flow) {
26
- // var code = pageFlow.scanContainer({
27
- // title: '你已经来到第二个界面,点击返回可以到第一个界面',
28
- // showBack: true
29
- // });
30
- // // 返回到上一帧, 历史记录-1
31
- // if (String(code) === "back") {
32
- // return flow.back();
33
- // }
34
-
35
- // if (String(code) === "1") {
36
- // // 跳转到第一帧,历史记录+1
37
- // return pageFlow.restart({});
38
- // }
39
- // // 退出流程,页面会显示开始流程的按钮,清空历史记录
40
- // return pageFlow.end({});
41
- // });
42
-
43
- flow.push('index', function(data, flow) {
44
- var ret = pageFlow.index({
45
-
46
- })
47
- var code = ret.code;
48
- pageFlow.log(ret);
49
- if(code === 0) {
50
- pageFlow.log({in: 'continuousRfidScan', code: code});
51
- // 分支1
52
- return flow.get('continuousRfidScan', {})
53
- }
54
- if(String(code) === 'rfidOnce') {
55
- return flow.get('rfidOnce', {})
56
- }
57
- if(String(code) === 'rfidScan') {
58
- return flow.get('rfidScan', {})
59
- }
60
-
61
- if(code === 1) {
62
- pageFlow.log({in: 'success', code: code});
63
- // 分支2
64
- return flow.get('success', {})
65
- }
66
- // 默认按照 push 流程走
67
- return {}
68
- });
69
-
70
-
71
- flow.push('continuousRfidScan', function(data, flow) {
72
- var ret = pageFlow.continuousRfidScan({
73
-
74
- })
75
- })
76
-
77
- flow.push('rfidOnce', function(data, flow) {
78
- var ret = pageFlow.rfidOnce({
79
-
80
- })
81
-
82
- const code = ret.code;
83
- if(code === -1) {
84
- return flow.back({});
85
- }
86
- })
87
- flow.push('rfidScan', function(data, flow) {
88
- var ret = pageFlow.rfidScan({
89
-
90
- })
91
- const code = ret.code;
92
- if(code === -1) {
93
- return flow.back({});
94
- }
95
- })
96
-
97
- flow.push('success', function(data, flow) {
98
- // pageFlow.log({render: 'success'});
99
- var ret = pageFlow.success({
100
-
101
- })
102
- })
103
- flow.push('confirm', function(data, flow) {
104
- pageFlow.confirm({
105
- title: '111',
106
- subMessage: [
107
- {label: 'title1', content: 'content1'},
108
- {label: 'title2', content: 'content2'},
109
- {label: 'title3', content: 'content3'},
110
- ],
111
- okText: "确认",
112
- cancelText:"取消"
113
- })
114
- })
115
-
116
- flow.start();