w-ui-v1 1.0.66 → 1.0.68

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/index.ts CHANGED
@@ -18,6 +18,7 @@ import WFormControlVue from './w-form-control/w-form-control.vue'
18
18
  import {menu} from './utils/apis/menu'
19
19
  import request from './utils/http'
20
20
  import nfc from './utils/nfc'
21
+ import iData from './utils/idata-scan'
21
22
  const coms: any[] = [
22
23
  wTest,
23
24
  wLogin,
@@ -45,6 +46,7 @@ function install(Vue: App) {
45
46
  export const api={
46
47
  request,
47
48
  menu,
48
- nfc
49
+ nfc,
50
+ iData
49
51
  }
50
52
  export default install // 这个方法以后再使用的时候可以被vue.use调用
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -0,0 +1,69 @@
1
+ //注意:需要在插件市场 安装 安卓原生插件“iData条码扫描插件”
2
+ interface callback {
3
+ (scanData:any): void;
4
+ }
5
+ let barcodeModel=null
6
+ let globalEvent=null
7
+
8
+ //初始化手持机扫码模块
9
+ const initBarcode = (callback:callback) => {
10
+ // #ifdef APP-PLUS
11
+ console.log("initBarcode")
12
+
13
+ //获取手持机扫描module
14
+ barcodeModel = uni.requireNativePlugin("iData-BarcodePlugin-BarcodeModule")
15
+
16
+ if(!barcodeModel){
17
+ return uni.showToast({
18
+ icon:"none",
19
+ title:"请在插件市场安装安卓原生插件“iData条码扫描插件”"
20
+ })
21
+ }
22
+ //初始化
23
+ barcodeModel.initScan((ret) => {
24
+
25
+ });
26
+
27
+ //页面监听event事件,建议在页面onLoad方法里调用
28
+ globalEvent = uni.requireNativePlugin('globalEvent');
29
+
30
+ globalEvent.addEventListener('iDataBarcodeEvent', function(e:any) {
31
+ console.log("收到条码:" + e.barcode)
32
+ //判断是否登录
33
+ let token=uni.getStorageSync('token')
34
+ if (!token) {
35
+
36
+ return uni.showModal({
37
+ title: '提示',
38
+ content: '请登录,才可使用扫码功能',
39
+ success: function (res) {
40
+ if (res.confirm) {
41
+ console.log('用户点击确定');
42
+ uni.reLaunch({
43
+ url: '/pages/login/login'
44
+ })
45
+ } else if (res.cancel) {
46
+ console.log('用户点击取消');
47
+ }
48
+ }
49
+ });
50
+
51
+ }
52
+ callback(e)
53
+ });
54
+ // #endif
55
+ }
56
+ const closeBarcode=()=>{
57
+ // #ifdef APP-PLUS
58
+ //建议在页面onExit方法里调用
59
+ //接口closeScan(UniJSCallback callback)
60
+ //结束扫描
61
+ barcodeModel.closeScan((ret:any) => {
62
+ console.log(ret)
63
+ });
64
+ // #endif
65
+ }
66
+ export default {
67
+ initBarcode,
68
+ closeBarcode
69
+ }
@@ -139,7 +139,7 @@ function add() {
139
139
  align-items: center;
140
140
  justify-content: space-between;
141
141
  background-color: #fff;
142
- margin-bottom: 10px;
142
+ // margin-bottom: 10px;
143
143
  }
144
144
  .card-list{
145
145
  padding: 12px 0 1px 0;