system-phone 3.1.11 → 3.1.14

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.
@@ -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" :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,62 +225,44 @@ export default {
207
225
  console.log('Vue.android:' + Vue.android)
208
226
  Vue.dataUrl = this.$androidUtil.getProxyUrl() + '/'
209
227
  let loginData = {}
210
- let jwtNew= ''
228
+ try {
229
+ let ret = {}
211
230
  try {
212
- let ret = {}
213
- try {
214
- ret = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/api/af-auth/login`, {
215
- username: this.ename, password: this.password,
216
- resourceName: '手机服务'
217
- }, {
218
- resolveMsg: null,
219
- rejectMsg: null,
220
- headerConfig: {'Content-type': 'application/json'}
221
- })
222
- console.log(ret, '==')
223
- if (ret.data) {
224
- if (ret.data.resources.data && ret.data.resources.data.id) {
225
- loginData = ret.data.resources.data
226
- } else {
227
- loginData = ret.data.resources
228
- }
229
- jwtNew = ret.data.access_token
230
- this.$androidUtil.setPreference('siteId', loginData.f_extend1 || '')
231
- this.$androidUtil.setPreference('flatId', loginData.f_extend2 || '')
232
- this.$androidUtil.setPreference('name', loginData.name || '')
233
- 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
234
243
  } else {
235
- throw {status: ret.data.code, message: ret.data.msg}
244
+ loginData = ret.data.resources
236
245
  }
237
- } catch (e) {
238
- if (Vue.android) {
239
- this.loaderShow = false
240
- this.$showMessage(e.message ? e.message : '登录失败!用户名或密码错误!')
241
- }
242
- 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}
243
252
  }
244
- // 设置登录人
245
- Vue.user = Util.f = loginData
246
- Vue.$login = Vue.prototype.$login = {
247
- jwt: loginData.id,
248
- jwtNew: jwtNew,
249
- toStandardDateString () {
250
- let dt = new Date()
251
- let month = dt.getMonth() + 1
252
- let date = dt.getDate()
253
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
254
- }, toStandardTimeString () {
255
- let dt = new Date()
256
- let month = dt.getMonth() + 1
257
- let date = dt.getDate()
258
- let hour = dt.getHours()
259
- let min = dt.getMinutes()
260
- let sec = dt.getSeconds()
261
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
262
- + ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
263
- }
253
+ } catch (e) {
254
+ if (Vue.android) {
255
+ this.loaderShow = false
256
+ this.$showMessage(e.message ? e.message : '登录失败!用户名或密码错误!')
264
257
  }
265
- // 对资源菜单进行排序
258
+ return
259
+ }
260
+
261
+ // 设置登录人
262
+ Vue.user = Util.f = loginData
263
+
264
+ // 对资源菜单进行排序
265
+ try{
266
266
  let viewDetails = await Vue.resetpost(`${this.$androidUtil.getProxyUrl()}/rs/search`, {
267
267
  source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
268
268
  userid: Vue.user.id
@@ -270,60 +270,83 @@ export default {
270
270
  const rithtList = viewDetails.data
271
271
  Vue.user.r = []
272
272
  rithtList.forEach(x => Vue.user.r.push(x.name))
273
- // 功能排序
274
- Vue.functions = this.sortFunctions(loginData.functions)
275
- let userStr
276
- if (Vue.android) {
277
- console.log(`Device_IEMI:${this.$androidUtil.getPreference('Device_IEMI')}`)
278
- // 判断是否需要验证 设备码
279
- if (this.$androidUtil.getPreference('Device_IEMI')) {
280
- console.log(`手机设备码:${this.deviceIemi}`)
281
- let result = await this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/tel_singleTable_OrderBy`, {
282
- data: {
283
- items: '*',
284
- tablename: 't_equipment',
285
- orderitem: 'id desc',
286
- condition: `f_terminal_number = '${this.deviceIemi}' and f_state = '正常'`
287
- }
288
- }, {resolveMsg: null, rejectMsg: null})
289
- console.log(`检测设备码存在是否:${result.data.length}`)
290
- if (result.data.length == 0) {
291
- HostApp.alert('设备码未绑定,请联系管理员!')
292
- 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 = '正常'`
293
290
  }
291
+ }, {resolveMsg: null, rejectMsg: null})
292
+ console.log(`检测设备码存在是否:${result.data.length}`)
293
+ if (result.data.length == 0) {
294
+ HostApp.alert('设备码未绑定,请联系管理员!')
295
+ return
294
296
  }
295
- if (this.showsave) {
296
- userStr = `{'username':'${this.ename}','password':'${this.password}'}`
297
- } else {
298
- userStr = `{'username':'${this.ename}','password':''}`
299
- }
300
- console.log(this.showauto)
301
- this.$androidUtil.setPreference('login_user_cache', userStr)
302
- this.$androidUtil.setPreference('f_repairman_id', Util.f.id)
303
- this.$androidUtil.setPreference('f_repairman_name', Util.f.name)
304
- this.$androidUtil.setPreference('f_orgid', Util.f.orgid)
305
- this.$androidUtil.setPreference('f_role_name', Util.f.f_role_name || '')
306
- console.log('自动登陆标识' + Util.f.f_role_name)
307
- console.log(this.showauto)
308
- this.$androidUtil.setPreference('auto_login', this.showauto)
309
297
  }
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
298
+ if (this.showsave) {
299
+ userStr = `{'username':'${this.ename}','password':'${this.password}'}`
300
+ } else {
301
+ userStr = `{'username':'${this.ename}','password':''}`
302
+ }
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: {