wl-design-mobile 0.7.6 → 0.7.8-beat.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 CHANGED
@@ -1,6 +1,6 @@
1
- # wl-design-mobile
2
-
3
- ## Setup
4
- ```
5
- npm i wl-design-mobile
6
- ```
1
+ # wl-design-mobile
2
+
3
+ ## Setup
4
+ ```
5
+ npm i wl-design-mobile
6
+ ```
@@ -1,3 +1,3 @@
1
- .img-upload-container {
2
- padding: 0px 14px 12px 14px;
3
- }
1
+ .img-upload-container {
2
+ padding: 0px 14px 12px 14px;
3
+ }
@@ -1,39 +1,39 @@
1
- .coll-div {
2
- margin-bottom: 8px;
3
- }
4
-
5
- .indicator-title {
6
- display: flex;
7
- align-items: center;
8
- color: var(--scl-blue);
9
- font-size: 14px;
10
- font-family: 微软雅黑, serif Regular;
11
- }
12
-
13
- .indicator-title .color-line {
14
- width: 3px;
15
- height: 14px;
16
- margin-right: 8px;
17
- }
18
-
19
- .coll-title-icon {
20
- justify-content: center;
21
- align-items: center;
22
- align-content: center;
23
- }
24
-
25
- /* 覆盖折叠面板的标题的padding */
26
- /deep/ .van-cell {
27
- padding: 12px 10px;
28
- }
29
-
30
- /* 覆盖去掉折叠面板的标题下面的线 */
31
- /deep/ .van-cell::after {
32
- border: none;
33
- }
34
-
35
- /* 覆盖折叠面板的内容的padding */
36
- /deep/ .van-collapse-item__content {
37
- padding: 0px 0px 0px 0px;
38
- }
39
-
1
+ .coll-div {
2
+ margin-bottom: 8px;
3
+ }
4
+
5
+ .indicator-title {
6
+ display: flex;
7
+ align-items: center;
8
+ color: var(--scl-blue);
9
+ font-size: 14px;
10
+ font-family: 微软雅黑, serif Regular;
11
+ }
12
+
13
+ .indicator-title .color-line {
14
+ width: 3px;
15
+ height: 14px;
16
+ margin-right: 8px;
17
+ }
18
+
19
+ .coll-title-icon {
20
+ justify-content: center;
21
+ align-items: center;
22
+ align-content: center;
23
+ }
24
+
25
+ /* 覆盖折叠面板的标题的padding */
26
+ /deep/ .van-cell {
27
+ padding: 12px 10px;
28
+ }
29
+
30
+ /* 覆盖去掉折叠面板的标题下面的线 */
31
+ /deep/ .van-cell::after {
32
+ border: none;
33
+ }
34
+
35
+ /* 覆盖折叠面板的内容的padding */
36
+ /deep/ .van-collapse-item__content {
37
+ padding: 0px 0px 0px 0px;
38
+ }
39
+
@@ -27,9 +27,11 @@
27
27
  <div class="cell-group-div">
28
28
  <van-cell-group>
29
29
  <van-search v-model="searchField" placeholder="请输入筛选名称" clearable @input="search"/>
30
- <van-cell v-for="(c, index) in searchData" :key="index" :title="`${c.V}`" clickable @click="radioClick(c)">
30
+ <van-cell v-for="(c, index) in searchData" :key="index" :title="`${c.V}`" clickable @click.stop="radioClick(c)">
31
31
  <template #right-icon>
32
- <van-radio :name="c.K" checked-color="#0070D2"/>
32
+ <div style="pointer-events: none;">
33
+ <van-radio :name="c.K" checked-color="#0070D2"/>
34
+ </div>
33
35
  </template>
34
36
  </van-cell>
35
37
  </van-cell-group>
@@ -123,12 +125,12 @@ export default {
123
125
  this.showBottom = false
124
126
  },
125
127
  onConfirm() {
126
- if (this.selectItem && this.selectItem.K) {
128
+ if (this.selectItem && this.selectItem.K && this.selectItem.K !== '') {
127
129
  this.val = this.selectItem.K
128
130
  this.valName = this.selectItem.V
129
131
  this.$emit('on-ok', this.selectItem)
130
132
  } else {
131
- console.error('lambo-select -- 条件选择失败,this.selectItem:', this.selectItem)
133
+ console.log('lambo-select -- 用户取消选择或未选择,清空值')
132
134
  this.val = ''
133
135
  this.valName = ''
134
136
  this.$emit('on-ok', {K: '', V: ''})
@@ -136,7 +138,10 @@ export default {
136
138
  this.showBottom = false
137
139
  },
138
140
  radioClick(data) {
139
- if (data && data.K) {
141
+ if (this.selectItem.K === data.K) {
142
+ this.selectItem.K = ''
143
+ this.selectItem.V = ''
144
+ } else {
140
145
  this.selectItem.K = data.K
141
146
  this.selectItem.V = data.V
142
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wl-design-mobile",
3
- "version": "0.7.6",
3
+ "version": "0.7.8-beat.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -36,7 +36,6 @@
36
36
  <script>
37
37
  import 'ag-grid-community/styles/ag-grid.css'
38
38
  import 'ag-grid-community/styles/ag-theme-balham.css'
39
-
40
39
  /**
41
40
  * 打包时候把这一行放开,下面的一行注释掉
42
41
  *
@@ -46,8 +45,6 @@ import {AgGridVue} from 'ag-grid-vue/lib/main.cjs.js'
46
45
  * 本地运行的时候,把这一行放开,上面的一行注释掉
47
46
  * import {AgGridVue} from 'ag-grid-vue'
48
47
  */
49
-
50
-
51
48
  import {Toast} from "vant"
52
49
  import {axios} from "../util/axios"
53
50
 
package/util/assist.js CHANGED
@@ -1,43 +1,43 @@
1
- // 深拷贝
2
- export function deepCopy(data) {
3
- let i;
4
- const t = typeOf(data);
5
- let o;
6
-
7
- if (t === 'array') {
8
- o = [];
9
- } else if (t === 'object') {
10
- o = {};
11
- } else {
12
- return data;
13
- }
14
-
15
- if (t === 'array') {
16
- for (i = 0; i < data.length; i++) {
17
- o.push(deepCopy(data[i]));
18
- }
19
- } else if (t === 'object') {
20
- for (i in data) {
21
- o[i] = deepCopy(data[i]);
22
- }
23
- }
24
- return o;
25
- }
26
-
27
- // 判断对象类型
28
- export function typeOf(obj) {
29
- const toString = Object.prototype.toString;
30
- const map = {
31
- '[object Boolean]': 'boolean',
32
- '[object Number]': 'number',
33
- '[object String]': 'string',
34
- '[object Function]': 'function',
35
- '[object Array]': 'array',
36
- '[object Date]': 'date',
37
- '[object RegExp]': 'regExp',
38
- '[object Undefined]': 'undefined',
39
- '[object Null]': 'null',
40
- '[object Object]': 'object'
41
- };
42
- return map[toString.call(obj)];
43
- }
1
+ // 深拷贝
2
+ export function deepCopy(data) {
3
+ let i;
4
+ const t = typeOf(data);
5
+ let o;
6
+
7
+ if (t === 'array') {
8
+ o = [];
9
+ } else if (t === 'object') {
10
+ o = {};
11
+ } else {
12
+ return data;
13
+ }
14
+
15
+ if (t === 'array') {
16
+ for (i = 0; i < data.length; i++) {
17
+ o.push(deepCopy(data[i]));
18
+ }
19
+ } else if (t === 'object') {
20
+ for (i in data) {
21
+ o[i] = deepCopy(data[i]);
22
+ }
23
+ }
24
+ return o;
25
+ }
26
+
27
+ // 判断对象类型
28
+ export function typeOf(obj) {
29
+ const toString = Object.prototype.toString;
30
+ const map = {
31
+ '[object Boolean]': 'boolean',
32
+ '[object Number]': 'number',
33
+ '[object String]': 'string',
34
+ '[object Function]': 'function',
35
+ '[object Array]': 'array',
36
+ '[object Date]': 'date',
37
+ '[object RegExp]': 'regExp',
38
+ '[object Undefined]': 'undefined',
39
+ '[object Null]': 'null',
40
+ '[object Object]': 'object'
41
+ };
42
+ return map[toString.call(obj)];
43
+ }
package/util/bus.js CHANGED
@@ -1,4 +1,4 @@
1
- import Vue from 'vue'
2
-
3
- const Bus = new Vue();
4
- export default Bus;
1
+ import Vue from 'vue'
2
+
3
+ const Bus = new Vue();
4
+ export default Bus;
@@ -0,0 +1,157 @@
1
+ import wx from "weixin-js-sdk";
2
+ import config from '../config/config'
3
+ import {axios} from '../util/axios'
4
+
5
+ const SIGNATURE_CACHE_KEY = 'sczy_js_signature_cache'
6
+ const SIGNATURE_CACHE_TTL = 5 * 60 * 1000
7
+ let configPromise = null
8
+
9
+ function getCacheKey(url) {
10
+ return `${SIGNATURE_CACHE_KEY}:${url}`
11
+ }
12
+
13
+ function getCachedSignature(url) {
14
+ try {
15
+ const raw = sessionStorage.getItem(getCacheKey(url))
16
+ if (!raw) {
17
+ return null
18
+ }
19
+ const cached = JSON.parse(raw)
20
+ if (!cached || !cached.data || !cached.expireAt || Date.now() > cached.expireAt) {
21
+ sessionStorage.removeItem(getCacheKey(url))
22
+ return null
23
+ }
24
+ return cached.data
25
+ } catch (e) {
26
+ sessionStorage.removeItem(getCacheKey(url))
27
+ return null
28
+ }
29
+ }
30
+
31
+ function setCachedSignature(url, data) {
32
+ try {
33
+ sessionStorage.setItem(getCacheKey(url), JSON.stringify({
34
+ expireAt: Date.now() + SIGNATURE_CACHE_TTL,
35
+ data,
36
+ }))
37
+ } catch (e) {
38
+ // ignore storage failures
39
+ }
40
+ }
41
+
42
+
43
+ /**
44
+ * 判断ios系统版本号是否大于14
45
+ * @returns {boolean}
46
+ */
47
+ const isIos14AndMore = () => {
48
+ try {
49
+ const str = navigator.userAgent.toLowerCase()
50
+ const ver = str.match(/cpu iphone os (.*?) like mac os/)
51
+ if (!ver) {
52
+ return false
53
+ }
54
+ return Number(ver[1].split('_')[0]) >= 14
55
+ } catch (e) {
56
+ console.log('isIos14AndMore', e)
57
+ return false
58
+ }
59
+ }
60
+
61
+ function getSczyJsConfig() {
62
+ let url = window.location.href.split('#')[0]
63
+ if (isIos14AndMore()) {
64
+ const storedUrl = sessionStorage.getItem('ios14ConfigUrl')
65
+ if (storedUrl) {
66
+ url = storedUrl
67
+ }
68
+ }
69
+
70
+ const cached = getCachedSignature(url)
71
+ if (cached) {
72
+ return Promise.resolve(cached)
73
+ }
74
+
75
+ return axios.get(config.platformServerContext + '/api/weixin/js/signature', {
76
+ params: { url }
77
+ }).then((resp) => {
78
+ const data = resp && resp.data ? resp.data : {}
79
+ if (!data || data.errcode !== 0 || !data.data) {
80
+ throw new Error((data && data.errmsg) ? data.errmsg : '获取签名失败')
81
+ }
82
+ setCachedSignature(url, data.data)
83
+ return data.data
84
+ })
85
+ }
86
+
87
+ function configWx() {
88
+ if (configPromise) {
89
+ return configPromise
90
+ }
91
+
92
+ configPromise = getSczyJsConfig().then((resp) => {
93
+ return new Promise((resolve, reject) => {
94
+ wx.config({
95
+ debug: false,
96
+ appId: resp.appId,
97
+ timestamp: resp.timestamp,
98
+ nonceStr: resp.nonceStr,
99
+ signature: resp.signature,
100
+ jsApiList: ['scanQRCode']
101
+ })
102
+
103
+ wx.ready(() => {
104
+ resolve()
105
+ })
106
+
107
+ wx.error((res) => {
108
+ configPromise = null
109
+ reject('企业微信初始化js-sdk失败' + (res && res.errMsg ? res.errMsg : ''))
110
+ })
111
+ })
112
+ }).catch((error) => {
113
+ configPromise = null
114
+ throw new Error('请求服务端jssdk签名失败:' + error)
115
+ })
116
+
117
+ return configPromise
118
+ }
119
+
120
+ function extractScanText(res) {
121
+ if (!res) {
122
+ return ''
123
+ }
124
+ if (typeof res === 'string') {
125
+ return res
126
+ }
127
+ return res.resultStr || res.result || res.text || res.code || ''
128
+ }
129
+
130
+ function scanQRCode() {
131
+ return new Promise((resolve, reject) => {
132
+ configWx().then(() => {
133
+ wx.scanQRCode({
134
+ desc: 'scanQRCode desc',
135
+ needResult: 1,
136
+ scanType: ['qrCode', 'barCode'],
137
+ success: function (res) {
138
+ resolve(extractScanText(res))
139
+ },
140
+ error: function (res) {
141
+ if (res && res.errMsg && res.errMsg.indexOf('function_not_exist') > -1) {
142
+ reject('版本过低请升级')
143
+ } else {
144
+ reject('企业微信扫码失败,请联系系统管理员!')
145
+ }
146
+ }
147
+ })
148
+ }).catch((error) => {
149
+ configPromise = null
150
+ reject('企业微信扫码失败:' + error)
151
+ })
152
+ })
153
+ }
154
+
155
+ export default {
156
+ scanQRCode,
157
+ }