@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.
- package/build/assets/index.3dc86daa.css +1 -0
- package/build/assets/index.60478450.js +372 -0
- package/build/assets/vendor.0fcd5cc7.js +38 -0
- package/build/index.html +3 -3
- package/doc/index.jsx +20 -6
- package/es/index.cjs.js +2 -2
- package/es/index.es.js +126 -448
- package/es/style.css +1 -1
- package/package.json +2 -2
- package/vite.config.doc.js +8 -0
- package/vite.config.js +0 -16
- package/build/assets/index.c5691218.css +0 -1
- package/build/assets/index.f4cdaf13.js +0 -318
- package/build/assets/vendor.1ac3b6a0.js +0 -38
- package/test/.gsignore +0 -6
- package/test/META-INF/MANIFEST.MF +0 -8
- package/test/README.md +0 -29
- package/test/_vite_plugins/autoRegisterPages.js +0 -35
- package/test/_vite_plugins/importCustomLib.js +0 -17
- package/test/_vite_plugins/insertMeta2html.js +0 -64
- package/test/config/pre/pageflow.xml +0 -51
- package/test/config/prod/pageflow.xml +0 -41
- package/test/package.json +0 -22
- package/test/pageflow.prog +0 -4
- package/test/src/gs/api.gs +0 -38
- package/test/src/gs/context.gs +0 -13
- package/test/src/gs/lib/common.gs +0 -35
- package/test/src/gs/lib/flow.gs +0 -206
- package/test/src/gs/lib/request.gs +0 -93
- package/test/src/gs/start.gs +0 -116
- package/test/src/web/index.html +0 -40
- package/test/src/web/index.jsx +0 -53
- package/test/src/web/pages/index/index.jsx +0 -47
- package/test/src/web/pages/index/index.less +0 -0
- package/test/src/web/pages/rfidOnce/index.jsx +0 -57
- package/test/src/web/pages/rfidOnce/index.less +0 -0
- package/test/src/web/pages/rfidScan/index.jsx +0 -45
- package/test/src/web/pages/success/index.jsx +0 -36
- package/test/src/web/pages/success/index.less +0 -0
- package/test/src/web/system/index-android-pda.jsx +0 -71
- package/test/src/web/system/index-pc.jsx +0 -24
- package/test/src/web/utils/index.js +0 -4
- package/test/vite.config.js +0 -27
package/test/src/web/index.html
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="zh-CN">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
7
|
-
<link rel="shortcut icon" href="//img.alicdn.com/tfs/TB10uQ9KrvpK1RjSZFqXXcXUVXa-32-34.png">
|
|
8
|
-
<title>pageflow</title>
|
|
9
|
-
<meta name="description" content="">
|
|
10
|
-
<meta name="renderer" content="webkit">
|
|
11
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
12
|
-
<link rel="dns-prefetch" href="https://img.alicdn.com">
|
|
13
|
-
<style>
|
|
14
|
-
root,
|
|
15
|
-
html,
|
|
16
|
-
body {
|
|
17
|
-
min-height: 100%;
|
|
18
|
-
background-color: #000;
|
|
19
|
-
font-family: "Roboto,PingFang SC,Helvetica,Helvetica Neue,Microsoft YaHei,Arial,Tahoma";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
* {
|
|
23
|
-
padding: 0;
|
|
24
|
-
margin: 0;
|
|
25
|
-
}
|
|
26
|
-
</style>
|
|
27
|
-
</head>
|
|
28
|
-
|
|
29
|
-
<body>
|
|
30
|
-
<div id="root">
|
|
31
|
-
<div
|
|
32
|
-
style="display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;font-size:26px;color:#999;background-color: #000;">
|
|
33
|
-
加载中...
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
<script crossorigin src="https://g.alicdn.com/mtb/lib-windvane/3.0.6/windvane.js"></script>
|
|
37
|
-
<script type="module" src="./index.jsx"></script>
|
|
38
|
-
</body>
|
|
39
|
-
|
|
40
|
-
</html>
|
package/test/src/web/index.jsx
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import PageFlowApp, { GriffenService } from "@cniot/pageflow";
|
|
2
|
-
import autoRegisterPages from 'autoRegisterPages';
|
|
3
|
-
|
|
4
|
-
// 使用 android 组件库,开发基于 手机浏览器的 的实操流程
|
|
5
|
-
import registerSystemPages from './system/index-android-pda';
|
|
6
|
-
import { isDev } from './utils';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// 从 url 上获取 appId 和 group 参数
|
|
10
|
-
function getConfigByURL() {
|
|
11
|
-
const isLocalhost = isDev();
|
|
12
|
-
const params = new URLSearchParams(location.search);
|
|
13
|
-
return {
|
|
14
|
-
// 当前启动的GS应用 ID
|
|
15
|
-
appId: params.get("appId"),
|
|
16
|
-
// 资源组
|
|
17
|
-
groupId: params.get("group"),
|
|
18
|
-
// 在页面显示所有已注册的页面
|
|
19
|
-
debug: !!params.get("debug"),
|
|
20
|
-
// 设备ID 必须,灰度是通过设备ID来判断的
|
|
21
|
-
deviceId: params.get("deviceId") || "",
|
|
22
|
-
// GS 请求的服务器域名
|
|
23
|
-
domain: isLocalhost ? "https://test-edge.loginx.cainiao.com" : window.location.origin,
|
|
24
|
-
// 发送的 GS 请求是否携带cookie
|
|
25
|
-
credentials: isLocalhost ? "omit" : "include",
|
|
26
|
-
// 全局 LOADING
|
|
27
|
-
globalLoading: true
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const config = getConfigByURL();
|
|
32
|
-
const service = new GriffenService(config)
|
|
33
|
-
const app = new PageFlowApp({
|
|
34
|
-
service,
|
|
35
|
-
// 全局 LOADING
|
|
36
|
-
globalLoading: true,
|
|
37
|
-
// 在页面显示所有已注册的页面,并可以点击跳转
|
|
38
|
-
debug: config.debug,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// --- 以下手动注册的页面
|
|
42
|
-
// app.registerPage("/scanContainer", scanContainer);
|
|
43
|
-
|
|
44
|
-
// -- 注册系统界面
|
|
45
|
-
registerSystemPages(app)
|
|
46
|
-
|
|
47
|
-
// --- 以下是自动注册的页面,与页面文件夹路径一致
|
|
48
|
-
// 比如 src/pages/scanContainer/index.jsx ==> /pages/scanContainer
|
|
49
|
-
// 新增页面需要重启 tnpm run dev
|
|
50
|
-
autoRegisterPages(app);
|
|
51
|
-
|
|
52
|
-
// 把应用输入页面
|
|
53
|
-
app.start(document.getElementById("root"));
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React, {useState, useEffect} from "react";
|
|
2
|
-
import "./index.less";
|
|
3
|
-
// import { Title, BaseLayout, Button, Presentation, WakeKeyborard } from '@cniot/android-pda-components'
|
|
4
|
-
import { Title, BaseLayout, Button, Presentation, WakeKeyborard } from '../../../../../packages'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 标准 React 组件
|
|
8
|
-
* @param String data gs指令下发的数据
|
|
9
|
-
* @param Object service 与gs通信的类,主要方法 service.onNext()
|
|
10
|
-
*/
|
|
11
|
-
export default function (props) {
|
|
12
|
-
const { data, service, isActive } = props;
|
|
13
|
-
const [barcode, setBarcode] = useState('')
|
|
14
|
-
|
|
15
|
-
const header = <Title goBackHandle={e => {console.log('hhhhhh')}}></Title>;
|
|
16
|
-
const footer = (
|
|
17
|
-
<Button.Group>
|
|
18
|
-
<Button type="cutout" onClick={e => service.onNext({code: 'rfidOnce', data: {}})}>Rfid单次</Button>
|
|
19
|
-
<Button
|
|
20
|
-
type="primary"
|
|
21
|
-
onClick={e => {
|
|
22
|
-
service.onNext({code: 'rfidScan', data: {}});
|
|
23
|
-
}
|
|
24
|
-
}>Rfid连续</Button>
|
|
25
|
-
</Button.Group>
|
|
26
|
-
)
|
|
27
|
-
return (
|
|
28
|
-
<BaseLayout
|
|
29
|
-
header={header}
|
|
30
|
-
footer={footer}
|
|
31
|
-
onBarcodeScan = {
|
|
32
|
-
data => {
|
|
33
|
-
console.log('barcode scan');
|
|
34
|
-
console.log(data);
|
|
35
|
-
setBarcode(data.scanData)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
>
|
|
39
|
-
<Presentation text="请靠近箱码进行识别" ></Presentation>
|
|
40
|
-
<p style={{color: 'white'}}>barcode: {barcode}</p>
|
|
41
|
-
<WakeKeyborard
|
|
42
|
-
onWakeKeyboard={() => { console.log('wake keyboard') }}
|
|
43
|
-
onClick={v => { alert(v) }}
|
|
44
|
-
/>
|
|
45
|
-
</BaseLayout>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
File without changes
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React, {useState} from "react";
|
|
2
|
-
import "./index.less";
|
|
3
|
-
// import { Title, BaseLayout, Button, Presentation, WakeKeyborard } from '@cniot/android-pda-components'
|
|
4
|
-
import { Title, BaseLayout, Button, Presentation, WakeKeyborard } from '../../../../../packages'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 标准 React 组件
|
|
8
|
-
* @param String data gs指令下发的数据
|
|
9
|
-
* @param Object service 与gs通信的类,主要方法 service.onNext()
|
|
10
|
-
*/
|
|
11
|
-
export default function (props) {
|
|
12
|
-
const { data, service, isActive } = props;
|
|
13
|
-
const [rfid, setRfid] = useState('')
|
|
14
|
-
const [box, setBox] = useState('')
|
|
15
|
-
|
|
16
|
-
const header = <Title goBackHandle={e => { service.onNext({code: -1, data: {}}) }}></Title>;
|
|
17
|
-
const footer = (
|
|
18
|
-
<Button.Group>
|
|
19
|
-
<Button
|
|
20
|
-
type="cutout"
|
|
21
|
-
onClick={
|
|
22
|
-
e => {
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}>连扫</Button>
|
|
26
|
-
<Button
|
|
27
|
-
type="primary"
|
|
28
|
-
onClick={e => {
|
|
29
|
-
}
|
|
30
|
-
}>完成</Button>
|
|
31
|
-
</Button.Group>
|
|
32
|
-
)
|
|
33
|
-
return (
|
|
34
|
-
<BaseLayout
|
|
35
|
-
header={header}
|
|
36
|
-
footer={footer}
|
|
37
|
-
onRfidBoxOnce= {
|
|
38
|
-
data => {
|
|
39
|
-
setBox(data.rfidData);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
onRfidOnce={
|
|
43
|
-
data => {
|
|
44
|
-
setRfid(data.rfidData);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
>
|
|
48
|
-
<Presentation text="请靠近箱码进行识别" ></Presentation>
|
|
49
|
-
<p style={{color: 'white'}}>rfid: {rfid}</p>
|
|
50
|
-
<p style={{color: 'white'}}>box: {box}</p>
|
|
51
|
-
<WakeKeyborard
|
|
52
|
-
onWakeKeyboard={() => { console.log('wake keyboard') }}
|
|
53
|
-
onClick={v => { alert(v) }}
|
|
54
|
-
/>
|
|
55
|
-
</BaseLayout>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
File without changes
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React, {useEffect} from "react";
|
|
2
|
-
// import "./index.less";
|
|
3
|
-
// import { Title, BaseLayout, Button, Presentation, WakeKeyborard } from '@cniot/android-pda-components'
|
|
4
|
-
import { Title, BaseLayout, Button, Presentation, WakeKeyborard } from '../../../../../packages'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 标准 React 组件
|
|
8
|
-
* @param String data gs指令下发的数据
|
|
9
|
-
* @param Object service 与gs通信的类,主要方法 service.onNext()
|
|
10
|
-
*/
|
|
11
|
-
export default function (props) {
|
|
12
|
-
const { data, service, isActive } = props;
|
|
13
|
-
|
|
14
|
-
const header = <Title goBackHandle={e => { service.onNext({code: -1, data: {}}) }}></Title>;
|
|
15
|
-
const footer = (
|
|
16
|
-
<Button.Group>
|
|
17
|
-
<Button type="cutout" onClick={e => service.onNext({code: 0, data: {}}) }>111</Button>
|
|
18
|
-
<Button
|
|
19
|
-
type="primary"
|
|
20
|
-
onClick={e => {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}>222</Button>
|
|
24
|
-
</Button.Group>
|
|
25
|
-
)
|
|
26
|
-
return (
|
|
27
|
-
<BaseLayout
|
|
28
|
-
header={header}
|
|
29
|
-
footer={footer}
|
|
30
|
-
|
|
31
|
-
// autoRfidScan={true}
|
|
32
|
-
onRfidScan = {
|
|
33
|
-
data => {
|
|
34
|
-
console.log(data);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
>
|
|
38
|
-
<Presentation text="请靠近箱码进行识别" ></Presentation>
|
|
39
|
-
<WakeKeyborard
|
|
40
|
-
onWakeKeyboard={() => { console.log('wake keyboard') }}
|
|
41
|
-
onClick={v => { alert(v) }}
|
|
42
|
-
/>
|
|
43
|
-
</BaseLayout>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "./index.less";
|
|
3
|
-
// import { FinishCard } from '@cniot/android-pda-components'
|
|
4
|
-
import { FinishCard } from '../../../../../packages'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 标准 React 组件
|
|
9
|
-
* @param String data gs指令下发的数据
|
|
10
|
-
* @param Object service 与gs通信的类,主要方法 service.onNext()
|
|
11
|
-
*/
|
|
12
|
-
export default function (props) {
|
|
13
|
-
const { data, service, isActive } = props;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<FinishCard
|
|
17
|
-
title="更换栈板码完成"
|
|
18
|
-
// style={{
|
|
19
|
-
// width: '400px',
|
|
20
|
-
// height: '800px'
|
|
21
|
-
// }}
|
|
22
|
-
infoList={
|
|
23
|
-
[
|
|
24
|
-
{ label: '新栈板码:', content: '111111111' },
|
|
25
|
-
{ label: '原栈板码:', content: '222222222' },
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
okText="返回首页"
|
|
29
|
-
cancelText="其他操作"
|
|
30
|
-
onClick={(isConfirm) => {
|
|
31
|
-
console.log("isConfirm", isConfirm);
|
|
32
|
-
service.onNext();
|
|
33
|
-
}}
|
|
34
|
-
/>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
File without changes
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// import { PageFlowSystemPages } from '@cniot/android-pda-components';
|
|
2
|
-
import { PageFlowSystemPages } from '../../../../packages'
|
|
3
|
-
|
|
4
|
-
// console.log("PageFlowSystemPages", PageFlowSystemPages);
|
|
5
|
-
import "@cniot/android-pda-components/es/style.css";
|
|
6
|
-
// 注册系统默认界面,不同设备可能需要不同的组件库
|
|
7
|
-
function getDevice(cb) {
|
|
8
|
-
window.WindVane.call('WVNativeDetector', 'getModelInfo', {}, function (e) {
|
|
9
|
-
// console.log('deviceInfo', e);
|
|
10
|
-
cb(e);
|
|
11
|
-
// return e
|
|
12
|
-
}, function (e) {
|
|
13
|
-
console.log('failure: ' + JSON.stringify(e));
|
|
14
|
-
// return null
|
|
15
|
-
cb(null);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
function BeforeFlow({data, service, action}) {
|
|
19
|
-
const location = window.location;
|
|
20
|
-
const deviceInfo = getDevice(
|
|
21
|
-
deviceInfo => {
|
|
22
|
-
const option = {
|
|
23
|
-
location: {
|
|
24
|
-
href: location.href,
|
|
25
|
-
},
|
|
26
|
-
deviceInfo: null,
|
|
27
|
-
}
|
|
28
|
-
if(!deviceInfo) {
|
|
29
|
-
service.onNext(option);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
option.deviceInfo = deviceInfo;
|
|
33
|
-
option.deviceInfo = {
|
|
34
|
-
deviceType: 'i3',
|
|
35
|
-
deviceTypeName: 'hfc_rfid_reader',
|
|
36
|
-
deviceName: '7C:71:76:16:BE:28',
|
|
37
|
-
collectionCode: '0',
|
|
38
|
-
collectionName: '0',
|
|
39
|
-
nodeId: 'testnodeid_01',
|
|
40
|
-
nodeCode: 'testnodecode_01',
|
|
41
|
-
nodeName: 'testnodename_01',
|
|
42
|
-
empCode: 'testempcode_01',
|
|
43
|
-
empName: 'testempname_01',
|
|
44
|
-
groupId: 'xufuji'
|
|
45
|
-
};
|
|
46
|
-
service.onNext(option);
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default function registerSystemPages(app){
|
|
53
|
-
// system
|
|
54
|
-
app.registerPage("/system/alert", PageFlowSystemPages.Alert);
|
|
55
|
-
app.registerPage("/system/toast", PageFlowSystemPages.Toast);
|
|
56
|
-
app.registerPage("/system/confirm", PageFlowSystemPages.Confirm);
|
|
57
|
-
app.registerPage("/system/end", PageFlowSystemPages.Start);
|
|
58
|
-
app.registerPage("/system/prompt", PageFlowSystemPages.Prompt);
|
|
59
|
-
app.registerPage("/system/beforeFlow", BeforeFlow);
|
|
60
|
-
|
|
61
|
-
// DEBUG 用
|
|
62
|
-
if (app.config.debug) {
|
|
63
|
-
app.registerAction("STAITC_DEBUG", PageFlowSystemPages.Debug);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// 全局 LOADING
|
|
67
|
-
if (app.config.globalLoading) {
|
|
68
|
-
app.registerAction("GLOBAL_LOADING", PageFlowSystemPages.Loading);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { PageFlowSystemPages } from '@cniot/op-components';
|
|
3
|
-
|
|
4
|
-
import "@cniot/op-components/es/style.css";
|
|
5
|
-
// 注册系统默认界面,不同设备可能需要不同的组件库
|
|
6
|
-
export default function registerSystemPages(app){
|
|
7
|
-
// system
|
|
8
|
-
app.registerPage("/system/alert", PageFlowSystemPages.Alert);
|
|
9
|
-
app.registerPage("/system/toast", PageFlowSystemPages.Toast);
|
|
10
|
-
app.registerPage("/system/confirm", PageFlowSystemPages.Confirm);
|
|
11
|
-
app.registerPage("/system/end", PageFlowSystemPages.Start);
|
|
12
|
-
app.registerPage("/system/prompt", PageFlowSystemPages.Prompt);
|
|
13
|
-
|
|
14
|
-
// DEBUG 用
|
|
15
|
-
if (app.config.debug) {
|
|
16
|
-
app.registerAction("STAITC_DEBUG", PageFlowSystemPages.Debug);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// 全局 LOADING
|
|
20
|
-
if (app.config.globalLoading) {
|
|
21
|
-
app.registerAction("GLOBAL_LOADING", PageFlowSystemPages.Loading);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
package/test/vite.config.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import autoRegisterPages from './_vite_plugins/autoRegisterPages';
|
|
3
|
-
import inserMeta2html from './_vite_plugins/insertMeta2html';
|
|
4
|
-
|
|
5
|
-
const webRootDir = path.join(__dirname,"./src/web");
|
|
6
|
-
const webPagesDir = path.join(__dirname,"./src/web/pages");
|
|
7
|
-
const webBuildDir = path.join(__dirname,"./build");
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
resolve: {
|
|
11
|
-
// 兼容 next 组件 ~@alifd/xxx.scss 的写法
|
|
12
|
-
alias: [{ find: /^~/, replacement: "" }],
|
|
13
|
-
},
|
|
14
|
-
root: webRootDir,
|
|
15
|
-
// 配置选项
|
|
16
|
-
base: "./",
|
|
17
|
-
build: {
|
|
18
|
-
outDir: webBuildDir,
|
|
19
|
-
rollupOptions: {},
|
|
20
|
-
},
|
|
21
|
-
plugins: [autoRegisterPages(webPagesDir), inserMeta2html()],
|
|
22
|
-
server: {
|
|
23
|
-
host: '0.0.0.0',
|
|
24
|
-
port: 11020,
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|