wl-design-mobile 0.4.3 → 0.4.5
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/edit/select/lambo-edit-search-single-select.vue +178 -0
- package/package.json +1 -1
- package/util/jssdk.js +36 -14
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="edit-box" @click="changeColor">
|
|
4
|
+
<div class="edit-left-box">
|
|
5
|
+
<div class="edit-left-top">
|
|
6
|
+
<div v-if="required" class="edit-red-icon">
|
|
7
|
+
<lambo-required-red-star :required="required"></lambo-required-red-star>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="edit-title">{{ title }}</div>
|
|
10
|
+
</div>
|
|
11
|
+
<van-field v-model="valName" :placeholder="placeholder" :readonly="true"
|
|
12
|
+
class="edit-lambo-input" clear-trigger="focus"></van-field>
|
|
13
|
+
</div>
|
|
14
|
+
<div v-if="icon" class="edit-right-icon">
|
|
15
|
+
<lambo-vector-icon :icon="icon" @click="onOpen"></lambo-vector-icon>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div>
|
|
19
|
+
<van-popup v-model:show="showBottom" :style="{ height: '33%' }" position="bottom">
|
|
20
|
+
<van-radio-group v-model="selectItem.K">
|
|
21
|
+
<div class="bottom-div">
|
|
22
|
+
<div class="edit-top-div">
|
|
23
|
+
<van-button class="edit-cancel-btn" size="normal" @click="cancel">取消</van-button>
|
|
24
|
+
<span class="edit-select-title">请选择</span>
|
|
25
|
+
<van-button class="edit-confirm-btn" size="normal" @click="onConfirm">确认</van-button>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="cell-group-div">
|
|
28
|
+
<van-cell-group>
|
|
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)">
|
|
31
|
+
<template #right-icon>
|
|
32
|
+
<van-radio :name="c.K" checked-color="#0070D2"/>
|
|
33
|
+
</template>
|
|
34
|
+
</van-cell>
|
|
35
|
+
</van-cell-group>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</van-radio-group>
|
|
39
|
+
</van-popup>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
<script>
|
|
44
|
+
import requiredIcon from '../../assets/icon/required.png'
|
|
45
|
+
import LamboVectorIcon from '../../icon/lambo-vector-icon.vue'
|
|
46
|
+
import LamboRequiredRedStar from '../../icon/lambo-required-red-star.vue'
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
name: 'LamboEditEmployeeSingleSelect',
|
|
50
|
+
components: {LamboRequiredRedStar, LamboVectorIcon},
|
|
51
|
+
props: {
|
|
52
|
+
title: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: '',
|
|
55
|
+
},
|
|
56
|
+
placeholder: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: '请选择',
|
|
59
|
+
},
|
|
60
|
+
required: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
icon: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'arrow-right-big.png',
|
|
67
|
+
},
|
|
68
|
+
data: {
|
|
69
|
+
type: Array,
|
|
70
|
+
default: () => ([]),
|
|
71
|
+
},
|
|
72
|
+
defaultItem: {
|
|
73
|
+
type: Object,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
data() {
|
|
77
|
+
return {
|
|
78
|
+
iconSrc: requiredIcon,
|
|
79
|
+
showBottom: false,
|
|
80
|
+
val: '',
|
|
81
|
+
valName: '',
|
|
82
|
+
selectItem: {
|
|
83
|
+
K: '',
|
|
84
|
+
V: '',
|
|
85
|
+
},
|
|
86
|
+
firstLoad: true,
|
|
87
|
+
searchField:'',
|
|
88
|
+
searchData:this.data
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
watch: {
|
|
92
|
+
defaultItem: {
|
|
93
|
+
handler: function (val, oldVal) {
|
|
94
|
+
console.log('lambo-select -- defaultItem -- val,oldVal,firstLoad:', {
|
|
95
|
+
val,
|
|
96
|
+
oldVal,
|
|
97
|
+
'firstLoad': this.firstLoad,
|
|
98
|
+
})
|
|
99
|
+
if (this.defaultItem && ((this.defaultItem.K && this.firstLoad === true) || !this.firstLoad) ) {
|
|
100
|
+
this.val = this.defaultItem.K || ''
|
|
101
|
+
this.valName = this.defaultItem.V || ''
|
|
102
|
+
this.$set(this.selectItem, 'K', this.defaultItem.K)
|
|
103
|
+
this.$set(this.selectItem, 'V', this.defaultItem.V)
|
|
104
|
+
this.firstLoad = false
|
|
105
|
+
this.$emit('on-ok', this.defaultItem)
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
deep: true,
|
|
109
|
+
immediate: true,
|
|
110
|
+
},
|
|
111
|
+
data:{
|
|
112
|
+
handler: function (val) {
|
|
113
|
+
this.searchData = val
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
methods: {
|
|
118
|
+
onOpen() {
|
|
119
|
+
console.log('this.data:', this.data)
|
|
120
|
+
this.showBottom = true
|
|
121
|
+
},
|
|
122
|
+
cancel() {
|
|
123
|
+
this.showBottom = false
|
|
124
|
+
},
|
|
125
|
+
onConfirm() {
|
|
126
|
+
if (this.selectItem && this.selectItem.K) {
|
|
127
|
+
this.val = this.selectItem.K
|
|
128
|
+
this.valName = this.selectItem.V
|
|
129
|
+
this.$emit('on-ok', this.selectItem)
|
|
130
|
+
} else {
|
|
131
|
+
console.error('lambo-select -- 条件选择失败,this.selectItem:', this.selectItem)
|
|
132
|
+
this.val = ''
|
|
133
|
+
this.valName = ''
|
|
134
|
+
this.$emit('on-ok', {K: '', V: ''})
|
|
135
|
+
}
|
|
136
|
+
this.showBottom = false
|
|
137
|
+
},
|
|
138
|
+
radioClick(data) {
|
|
139
|
+
if (data && data.K) {
|
|
140
|
+
this.selectItem.K = data.K
|
|
141
|
+
this.selectItem.V = data.V
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
changeColor() {
|
|
145
|
+
let searchRows = document.querySelectorAll('.edit-box')
|
|
146
|
+
Array.from(searchRows).forEach(function (row, index) {
|
|
147
|
+
row.addEventListener('click', function () {
|
|
148
|
+
Array.from(searchRows).forEach(function (row) {
|
|
149
|
+
row.style.borderBottom = '1px solid var(--scl-white-2)'
|
|
150
|
+
})
|
|
151
|
+
row.style.borderBottom = '1px solid var(--scl-blue)'
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
},
|
|
155
|
+
search(){
|
|
156
|
+
let arr = []
|
|
157
|
+
let searchData = this.data
|
|
158
|
+
for (let i = 0; i < searchData.length; i++) {
|
|
159
|
+
if(searchData[i].V.indexOf(this.searchField)>=0){
|
|
160
|
+
arr.push(searchData[i]);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
this.searchData = arr
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
created() {
|
|
167
|
+
|
|
168
|
+
},
|
|
169
|
+
}
|
|
170
|
+
</script>
|
|
171
|
+
<style scoped>
|
|
172
|
+
@import "../../styles/index.less";
|
|
173
|
+
@import "./styles/css/index.css";
|
|
174
|
+
|
|
175
|
+
/deep/ .edit-left-box .van-cell {
|
|
176
|
+
padding: 0px 0px;
|
|
177
|
+
}
|
|
178
|
+
</style>
|
package/package.json
CHANGED
package/util/jssdk.js
CHANGED
|
@@ -11,6 +11,22 @@ function init({appId:a,agentId:b,corpId:c,appKey:d}){
|
|
|
11
11
|
agentId = b
|
|
12
12
|
corpId = c
|
|
13
13
|
appKey = d
|
|
14
|
+
|
|
15
|
+
if(appId){
|
|
16
|
+
sessionStorage.setItem('JsSdk_appId',appId)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if(agentId){
|
|
20
|
+
sessionStorage.setItem('JsSdk_agentId',agentId)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if(corpId){
|
|
24
|
+
sessionStorage.setItem('JsSdk_corpId',corpId)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if(appKey){
|
|
28
|
+
sessionStorage.setItem('JsSdk_appKey',appKey)
|
|
29
|
+
}
|
|
14
30
|
}
|
|
15
31
|
|
|
16
32
|
|
|
@@ -41,10 +57,10 @@ function getJsConfig(){
|
|
|
41
57
|
return new Promise((resolve, reject)=>{
|
|
42
58
|
axios.post(config.platformServerContext + '/api/weixin/getJsConfig', {
|
|
43
59
|
appType: getAppType(),
|
|
44
|
-
appId:
|
|
45
|
-
agentId:
|
|
46
|
-
corpId:
|
|
47
|
-
appKey:
|
|
60
|
+
appId: sessionStorage.getItem('JsSdk_appId'),
|
|
61
|
+
agentId: sessionStorage.getItem('JsSdk_agentId'),
|
|
62
|
+
corpId: sessionStorage.getItem('JsSdk_corpId'),
|
|
63
|
+
appKey: sessionStorage.getItem('JsSdk_appKey'),
|
|
48
64
|
url: url
|
|
49
65
|
}).then((resp) => {
|
|
50
66
|
resolve(resp.data)
|
|
@@ -59,7 +75,7 @@ function configWx(){
|
|
|
59
75
|
getJsConfig().then((resp)=>{
|
|
60
76
|
wx.config({
|
|
61
77
|
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
62
|
-
appId:
|
|
78
|
+
appId: sessionStorage.getItem('JsSdk_appId'), // 必填,公众号的唯一标识
|
|
63
79
|
timestamp: resp.timestamp, // 必填,生成签名的时间戳
|
|
64
80
|
nonceStr: resp.noncestr, // 必填,生成签名的随机串
|
|
65
81
|
signature: resp.signature, // 必填,签名
|
|
@@ -86,10 +102,10 @@ function getConfigSignature(url) {
|
|
|
86
102
|
return new Promise((resolve,reject)=>{
|
|
87
103
|
axios.post(config.platformServerContext + '/api/weixin/getJsConfig', {
|
|
88
104
|
appType: getAppType(),
|
|
89
|
-
appId:
|
|
90
|
-
agentId:
|
|
91
|
-
corpId:
|
|
92
|
-
appKey:
|
|
105
|
+
appId: sessionStorage.getItem('JsSdk_appId'),
|
|
106
|
+
agentId: sessionStorage.getItem('JsSdk_agentId'),
|
|
107
|
+
corpId: sessionStorage.getItem('JsSdk_corpId'),
|
|
108
|
+
appKey: sessionStorage.getItem('JsSdk_appKey'),
|
|
93
109
|
url: url.split('#')[0]
|
|
94
110
|
}).then(resp=>{
|
|
95
111
|
console.log('getConfigSignature',resp)
|
|
@@ -107,7 +123,7 @@ function getConfigSignature(url) {
|
|
|
107
123
|
function configWw(){
|
|
108
124
|
return new Promise((resolve, reject) =>{
|
|
109
125
|
ww.register({
|
|
110
|
-
corpId:
|
|
126
|
+
corpId: sessionStorage.getItem('JsSdk_appId'), // 必填,当前用户企业所属企业ID
|
|
111
127
|
jsApiList: ['chooseImage', 'uploadImage', 'downloadImage', 'getLocalImgData', 'openLocation', 'getLocation', 'scanQRCode', 'chooseWXPay', 'onHistoryBack','invoke','onLocationChange','previewFile'], // 必填,需要使用的JSAPI列表
|
|
112
128
|
getConfigSignature, // 必填,根据url生成企业签名的回调函数
|
|
113
129
|
onConfigSuccess:(res) => {
|
|
@@ -130,8 +146,8 @@ function configDd(){
|
|
|
130
146
|
//钉钉js-api配置
|
|
131
147
|
console.log("当前页面:"+location.href);
|
|
132
148
|
dd.config({
|
|
133
|
-
agentId:
|
|
134
|
-
corpId:
|
|
149
|
+
agentId:sessionStorage.getItem('JsSdk_agentId'),
|
|
150
|
+
corpId: sessionStorage.getItem('JsSdk_corpId'), // 必填,公众号的唯一标识
|
|
135
151
|
timeStamp: resp.timestamp, // 必填,生成签名的时间戳
|
|
136
152
|
nonceStr: resp.noncestr, // 必填,生成签名的随机串
|
|
137
153
|
signature: resp.signature, // 必填,签名
|
|
@@ -218,7 +234,10 @@ let JsSDK = (function () {
|
|
|
218
234
|
isShowProgressTips: 0, // 默认为1,显示进度提示
|
|
219
235
|
success: function (res) {
|
|
220
236
|
let serverId = res.serverId; // 返回图片的服务器端ID
|
|
221
|
-
resolve(
|
|
237
|
+
resolve({
|
|
238
|
+
appId:sessionStorage.getItem('JsSdk_appId'),
|
|
239
|
+
agentId:sessionStorage.getItem('JsSdk_agentId'),
|
|
240
|
+
serverId:serverId})
|
|
222
241
|
}
|
|
223
242
|
})
|
|
224
243
|
}, 200);
|
|
@@ -252,7 +271,10 @@ let JsSDK = (function () {
|
|
|
252
271
|
isShowProgressTips: 0, // 默认为1,显示进度提示
|
|
253
272
|
success: function (res) {
|
|
254
273
|
let serverId = res.serverId; // 返回图片的服务器端ID
|
|
255
|
-
resolve(
|
|
274
|
+
resolve({
|
|
275
|
+
appId:sessionStorage.getItem('JsSdk_appId'),
|
|
276
|
+
agentId:sessionStorage.getItem('JsSdk_agentId'),
|
|
277
|
+
serverId:serverId})
|
|
256
278
|
}
|
|
257
279
|
})
|
|
258
280
|
}, 200);
|