system-phone 3.1.10 → 3.1.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "system-phone",
3
- "version": "3.1.10",
3
+ "version": "3.1.13",
4
4
  "description": "手机模块 前端组件",
5
5
  "author": "何宁社 <524395609@qq.com>",
6
6
  "license": "ISC",
@@ -505,6 +505,7 @@
505
505
  }
506
506
  .imgs{
507
507
  width: 35px;
508
+ height: 35px;
508
509
  margin-top: 15px;
509
510
  }
510
511
  .pages-bgcolor{
@@ -152,21 +152,24 @@ export default {
152
152
  this.password = val
153
153
  },
154
154
  // 对资源菜单进行排序
155
- sortFunctions(val) {
156
- if (val && val.length > 0) {
157
- for (var i = 0; i < val.length - 1; i++) {
158
- for (var j = 0; j < val.length - 1 - i; j++) {
159
- if (val[j].position > val[j + 1].position) {
160
- var temp = val[j + 1]
161
- val[j + 1] = val[j]
162
- val[j] = temp;
163
- }
164
- }
155
+ sortFunctions (val) {
156
+ this.sortArr(val)
157
+ val.forEach((item)=>{
158
+ if(item.children && Array.isArray(item.children)){
159
+ this.sortArr(item.children)
165
160
  }
166
- return val
167
- }
161
+ })
168
162
  return val
169
163
  },
164
+ sortArr(val){
165
+ val.sort((itemA, itemB)=>{
166
+ if(itemA.position !== itemB.position){
167
+ return itemA.position - itemB.position
168
+ }else{
169
+ return itemA.id - itemB.id
170
+ }
171
+ })
172
+ },
170
173
  // 记住密码选中/未选中
171
174
  showoff() {
172
175
  this.showsave = false
@@ -118,21 +118,24 @@
118
118
  },
119
119
  methods: {
120
120
  // 对资源菜单进行排序
121
- sortFunctions(val){
122
- if(val && val.length > 0){
123
- for(var i = 0;i<val.length-1;i++){
124
- for(var j = 0;j<val.length-1-i;j++){
125
- if(val[j].position > val[j+1].position){
126
- var temp = val[j+1]
127
- val[j+1] = val[j]
128
- val[j] = temp;
129
- }
130
- }
121
+ sortFunctions (val) {
122
+ this.sortArr(val)
123
+ val.forEach((item)=>{
124
+ if(item.children && Array.isArray(item.children)){
125
+ this.sortArr(item.children)
131
126
  }
132
- return val
133
- }
127
+ })
134
128
  return val
135
- },
129
+ },
130
+ sortArr(val){
131
+ val.sort((itemA, itemB)=>{
132
+ if(itemA.position !== itemB.position){
133
+ return itemA.position - itemB.position
134
+ }else{
135
+ return itemA.id - itemB.id
136
+ }
137
+ })
138
+ },
136
139
  // 记住密码选中/未选中
137
140
  showoff(){
138
141
  this.showsave = false
@@ -39,7 +39,7 @@
39
39
  <header slot="modal-header" class="modal-header">
40
40
  </header>
41
41
  <article slot="modal-body" class="modal-body">
42
- <modify-pass-word :sourse="login" :weak-password="weakPassword" v-if="modifyPassword"
42
+ <modify-pass-word :sourse="login" version="v4" :weak-password="weakPassword" v-if="modifyPassword"
43
43
  v-on:success="success"></modify-pass-word>
44
44
  </article>
45
45
  <footer slot="modal-footer" class="modal-footer">
@@ -70,9 +70,24 @@ let asyncReady = async function (self, url) {
70
70
  await self.$appdata.load()
71
71
  console.log('获取营收配置文件和参数【结束】,开始获取vue配置文件【开始】')
72
72
  let that = self
73
- let res = await Vue.resetget(`${url}/phone/rs/vue`, {data: {}}, {resolveMsg: null, rejectMsg: null})
74
- that.$set('config', res.data)
75
- Vue.config2 = res.data
73
+ const vueConfig={}
74
+ const res = await Vue.resetget(`${url}/api/af-safecheck/vue`, {data: {}}, {resolveMsg: null, rejectMsg: null})
75
+ self.delConfigKey(res.data)
76
+ vueConfig.safecheck = res.data
77
+ const dir_module = res.data.global.dir_module
78
+ for(let mod in dir_module) {
79
+ if (dir_module[mod].name !== 'af-safecheck') {
80
+ let mod_url = `${url}/api/${dir_module[mod].name}/vue`
81
+ if (!dir_module[mod].name.startsWith('af-')) {
82
+ mod_url = `${url}/${dir_module[mod].name}/rs/vue`
83
+ }
84
+ const config = await Vue.resetget(mod_url, {data: {}}, {resolveMsg: null, rejectMsg: null})
85
+ self.delConfigKey(config.data)
86
+ vueConfig[dir_module[mod].name] = config.data;
87
+ }
88
+ }
89
+ that.$set('config', vueConfig)
90
+ Vue.config2 = vueConfig
76
91
  // 判断是否需要弱密码校验
77
92
  if (self.config && self.config.telephone && self.config.telephone.LoginApp && 'undefined' != typeof self.config.telephone.LoginApp.weakPassword) {
78
93
  self.weakPassword = self.config.telephone.LoginApp.weakPassword
@@ -153,20 +168,23 @@ export default {
153
168
  },
154
169
  // 对资源菜单进行排序
155
170
  sortFunctions (val) {
156
- if (val && val.length > 0) {
157
- for (var i = 0; i < val.length - 1; i++) {
158
- for (var j = 0; j < val.length - 1 - i; j++) {
159
- if (val[j].position > val[j + 1].position) {
160
- var temp = val[j + 1]
161
- val[j + 1] = val[j]
162
- val[j] = temp
163
- }
164
- }
171
+ this.sortArr(val)
172
+ val.forEach((item)=>{
173
+ if(item.children && Array.isArray(item.children)){
174
+ this.sortArr(item.children)
165
175
  }
166
- return val
167
- }
176
+ })
168
177
  return val
169
178
  },
179
+ sortArr(val){
180
+ val.sort((itemA, itemB)=>{
181
+ if(itemA.position !== itemB.position){
182
+ return itemA.position - itemB.position
183
+ }else{
184
+ return itemA.id - itemB.id
185
+ }
186
+ })
187
+ },
170
188
  // 记住密码选中/未选中
171
189
  showoff () {
172
190
  this.showsave = false
@@ -191,7 +209,7 @@ export default {
191
209
  async confirm () {
192
210
  this.loaderShow = true
193
211
  // 判断用户状态
194
- let users = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {
212
+ let users = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/af-telephone/rs/sql/tel_singleTable_OrderBy`, {
195
213
  data: {
196
214
  items: '*',
197
215
  tablename: 't_user',
@@ -207,43 +225,44 @@ export default {
207
225
  console.log('Vue.android:' + Vue.android)
208
226
  Vue.dataUrl = this.$androidUtil.getProxyUrl() + '/'
209
227
  let loginData = {}
228
+ try {
229
+ let ret = {}
210
230
  try {
211
- let ret = {}
212
- try {
213
- ret = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/api/af-auth/login`, {
214
- username: this.ename, password: this.password,
215
- resourceName: '手机服务'
216
- }, {
217
- resolveMsg: null,
218
- rejectMsg: null,
219
- headerConfig: {'Content-type': 'application/json'}
220
- })
221
- console.log(ret, '==')
222
- if (ret.data) {
223
- if (ret.data.resources.data && ret.data.resources.data.id) {
224
- loginData = ret.data.resources.data
225
- } else {
226
- loginData = ret.data.resources
227
- }
228
- this.$androidUtil.setPreference('siteId', loginData.f_extend1 || '')
229
- this.$androidUtil.setPreference('flatId', loginData.f_extend2 || '')
230
- this.$androidUtil.setPreference('name', loginData.name || '')
231
- this.$androidUtil.setPreference('ename', loginData.ename || '')
231
+ ret = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/api/af-auth/login`, {
232
+ username: this.ename, password: this.password,
233
+ resourceName: '手机服务'
234
+ }, {
235
+ resolveMsg: null,
236
+ rejectMsg: null,
237
+ headerConfig: {'Content-type': 'application/json'}
238
+ })
239
+ console.log(ret, '==')
240
+ if (ret.data) {
241
+ if (ret.data.resources.data && ret.data.resources.data.id) {
242
+ loginData = ret.data.resources.data
232
243
  } else {
233
- throw {status: ret.data.code, message: ret.data.msg}
234
- }
235
- } catch (e) {
236
- if (Vue.android) {
237
- this.loaderShow = false
238
- this.$showMessage(e.message ? e.message : '登录失败!用户名或密码错误!')
244
+ loginData = ret.data.resources
239
245
  }
240
- return
246
+ this.$androidUtil.setPreference('siteId', loginData.f_extend1 || '')
247
+ this.$androidUtil.setPreference('flatId', loginData.f_extend2 || '')
248
+ this.$androidUtil.setPreference('name', loginData.name || '')
249
+ this.$androidUtil.setPreference('ename', loginData.ename || '')
250
+ } else {
251
+ throw {status: ret.data.code, message: ret.data.msg}
252
+ }
253
+ } catch (e) {
254
+ if (Vue.android) {
255
+ this.loaderShow = false
256
+ this.$showMessage(e.message ? e.message : '登录失败!用户名或密码错误!')
241
257
  }
258
+ return
259
+ }
242
260
 
243
- // 设置登录人
244
- Vue.user = Util.f = loginData
261
+ // 设置登录人
262
+ Vue.user = Util.f = loginData
245
263
 
246
- // 对资源菜单进行排序
264
+ // 对资源菜单进行排序
265
+ try{
247
266
  let viewDetails = await Vue.resetpost(`${this.$androidUtil.getProxyUrl()}/rs/search`, {
248
267
  source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
249
268
  userid: Vue.user.id
@@ -251,79 +270,83 @@ export default {
251
270
  const rithtList = viewDetails.data
252
271
  Vue.user.r = []
253
272
  rithtList.forEach(x => Vue.user.r.push(x.name))
254
- // 功能排序
255
- Vue.functions = this.sortFunctions(loginData.functions)
256
- let userStr
257
- if (Vue.android) {
258
- console.log(`Device_IEMI:${this.$androidUtil.getPreference('Device_IEMI')}`)
259
- // 判断是否需要验证 设备码
260
- if (this.$androidUtil.getPreference('Device_IEMI')) {
261
- console.log(`手机设备码:${this.deviceIemi}`)
262
- let result = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {
263
- data: {
264
- items: '*',
265
- tablename: 't_equipment',
266
- orderitem: 'id desc',
267
- condition: `f_terminal_number = '${this.deviceIemi}' and f_state = '正常'`
268
- }
269
- }, {resolveMsg: null, rejectMsg: null})
270
- console.log(`检测设备码存在是否:${result.data.length}`)
271
- if (result.data.length == 0) {
272
- HostApp.alert('设备码未绑定,请联系管理员!')
273
- return
273
+ }catch (e) {
274
+ console.log('资源排序失败!暂时先不影响登录')
275
+ }
276
+ // 功能排序
277
+ Vue.functions = this.sortFunctions(loginData.functions)
278
+ let userStr
279
+ if (Vue.android) {
280
+ console.log(`Device_IEMI:${this.$androidUtil.getPreference('Device_IEMI')}`)
281
+ // 判断是否需要验证 设备码
282
+ if (this.$androidUtil.getPreference('Device_IEMI')) {
283
+ console.log(`手机设备码:${this.deviceIemi}`)
284
+ let result = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {
285
+ data: {
286
+ items: '*',
287
+ tablename: 't_equipment',
288
+ orderitem: 'id desc',
289
+ condition: `f_terminal_number = '${this.deviceIemi}' and f_state = '正常'`
274
290
  }
291
+ }, {resolveMsg: null, rejectMsg: null})
292
+ console.log(`检测设备码存在是否:${result.data.length}`)
293
+ if (result.data.length == 0) {
294
+ HostApp.alert('设备码未绑定,请联系管理员!')
295
+ return
275
296
  }
276
- if (this.showsave) {
277
- userStr = `{'username':'${this.ename}','password':'${this.password}'}`
278
- } else {
279
- userStr = `{'username':'${this.ename}','password':''}`
280
- }
281
- console.log(this.showauto)
282
- this.$androidUtil.setPreference('login_user_cache', userStr)
283
- this.$androidUtil.setPreference('f_repairman_id', Util.f.id)
284
- this.$androidUtil.setPreference('f_repairman_name', Util.f.name)
285
- this.$androidUtil.setPreference('f_orgid', Util.f.orgid)
286
- this.$androidUtil.setPreference('f_role_name', Util.f.f_role_name || '')
287
- console.log('自动登陆标识' + Util.f.f_role_name)
288
- console.log(this.showauto)
289
- this.$androidUtil.setPreference('auto_login', this.showauto)
290
297
  }
291
- Vue.$login = Vue.prototype.$login = {
292
- jwt: loginData.id,
293
- jwtNew: ret.data.access_token,
294
- toStandardDateString () {
295
- let dt = new Date()
296
- let month = dt.getMonth() + 1
297
- let date = dt.getDate()
298
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
299
- }, toStandardTimeString () {
300
- let dt = new Date()
301
- let month = dt.getMonth() + 1
302
- let date = dt.getDate()
303
- let hour = dt.getHours()
304
- let min = dt.getMinutes()
305
- let sec = dt.getSeconds()
306
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
307
- + ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
308
- }
298
+ if (this.showsave) {
299
+ userStr = `{'username':'${this.ename}','password':'${this.password}'}`
300
+ } else {
301
+ userStr = `{'username':'${this.ename}','password':''}`
309
302
  }
310
- // 获取参数
311
- console.log('获取参数system以及安检参数')
312
- const flag = await asyncReady(this, this.$androidUtil.getProxyUrl())
313
- if (!flag) {
314
- this.loaderShow = false
315
- console.log('获取参数异常')
316
- return
303
+ console.log(this.showauto)
304
+ this.$androidUtil.setPreference('login_user_cache', userStr)
305
+ this.$androidUtil.setPreference('f_repairman_id', Util.f.id)
306
+ this.$androidUtil.setPreference('f_repairman_name', Util.f.name)
307
+ this.$androidUtil.setPreference('f_orgid', Util.f.orgid)
308
+ this.$androidUtil.setPreference('f_role_name', Util.f.f_role_name || '')
309
+ this.$androidUtil.setPreference('access_token', ret.data.access_token)
310
+ console.log('自动登陆标识' + Util.f.f_role_name)
311
+ console.log(this.showauto)
312
+ this.$androidUtil.setPreference('auto_login', this.showauto)
313
+ }
314
+ Vue.$login = Vue.prototype.$login = {
315
+ jwt: loginData.id,
316
+ jwtNew: ret.data.access_token,
317
+ toStandardDateString () {
318
+ let dt = new Date()
319
+ let month = dt.getMonth() + 1
320
+ let date = dt.getDate()
321
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
322
+ }, toStandardTimeString () {
323
+ let dt = new Date()
324
+ let month = dt.getMonth() + 1
325
+ let date = dt.getDate()
326
+ let hour = dt.getHours()
327
+ let min = dt.getMinutes()
328
+ let sec = dt.getSeconds()
329
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
330
+ + ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
317
331
  }
318
- console.log('获取参数结束')
332
+ }
333
+ // 获取参数
334
+ console.log('获取参数system以及安检参数')
335
+ const flag = await asyncReady(this, this.$androidUtil.getProxyUrl())
336
+ if (!flag) {
319
337
  this.loaderShow = false
320
- // 弱口令验证
321
- if (this.weakPassword && !(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?!.*(123|321|abc|cba))[a-zA-Z\d!@#$%^&*()_+-=<>?]{8,16}$/.test(this.password))) {
322
- await this.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm'])
323
- this.modifyPassword = true
324
- return
338
+ console.log('获取参数异常')
339
+ return
325
340
  }
326
- this.$goto('nav-bottom')
341
+ console.log('获取参数结束')
342
+ this.loaderShow = false
343
+ // 弱口令验证
344
+ if (this.weakPassword && !(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?!.*(123|321|abc|cba))[a-zA-Z\d!@#$%^&*()_+-=<>?]{8,16}$/.test(this.password))) {
345
+ await this.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm'])
346
+ this.modifyPassword = true
347
+ return
348
+ }
349
+ this.$goto('nav-bottom')
327
350
  } catch (e) {
328
351
  if (Vue.android) {
329
352
  this.loaderShow = false
@@ -331,6 +354,18 @@ export default {
331
354
  console.error('登录异常,LoginApp的confirm函数错误', e)
332
355
  this.$showMessage('登陆失败!,')
333
356
  }
357
+ },
358
+ delConfigKey(obj){
359
+ // 从琉璃中获取的配置中会包含 $开头的一些额外描述新的key。为了兼容v3的代码逻辑在此函数中去掉
360
+ Object.keys(obj).forEach(key =>{
361
+ Object.keys(obj[key]).forEach(col => {
362
+ // 检查键是否以$开头
363
+ if (col.startsWith('$')) {
364
+ // 使用delete操作符删除键
365
+ delete obj[key][col];
366
+ }
367
+ })
368
+ })
334
369
  }
335
370
  },
336
371
  watch: {
@@ -66,7 +66,7 @@ let asyncCheck = async function (self, url) {
66
66
  affirmpassword: that.model.newpassword,
67
67
  password: that.model.oldpassword
68
68
  }
69
- let res = await Vue.resetpost(`${url}/rs/user/modifypwd`, {data: user}, {resolveMsg: null, rejectMsg: null})
69
+ let res = await Vue.resetpost(`${url}/${version === 'v4'?'api/af-system':'rs'}/user/modifypwd`, {data: user}, {resolveMsg: null, rejectMsg: null})
70
70
  console.log("手机端验证登陆原始密码")
71
71
  console.log(res.data)
72
72
  if ((JSON.stringify(res.data).startsWith("{") || JSON.stringify(res.data).startsWith("[")) && res.data.code && res.data.msg) {
@@ -122,7 +122,8 @@ export default {
122
122
  },
123
123
  props: {
124
124
  sourse: '',
125
- weakPassword: false
125
+ weakPassword: false,
126
+ version: ''
126
127
  },
127
128
  ready() {
128
129