n20-common-lib 2.1.0 → 2.1.2

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": "n20-common-lib",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -150,11 +150,21 @@
150
150
  <i class="el-icon-caret-right m-l-auto m-r-0"></i>
151
151
  </div>
152
152
  </el-dropdown-item>
153
- <el-dropdown-item command="systemSet">
154
- <div class="flex-box flex-v">
155
- <span>{{ '系统设置' | $lc }}</span>
156
- <i class="el-icon-caret-right m-l-auto m-r-0"></i>
157
- </div>
153
+ <el-dropdown-item _command="systemSet">
154
+ <el-dropdown trigger="hover" size="medium" placement="left-start" style="width: 100%" @command="setUserFn">
155
+ <div class="flex-box flex-v">
156
+ <span>{{ '系统设置' | $lc }}</span>
157
+ <i class="el-icon-caret-right m-l-auto m-r-0"></i>
158
+ </div>
159
+ <el-dropdown-menu slot="dropdown">
160
+ <el-dropdown-item v-if="!hideTheme" command="setTheme">
161
+ <span>{{ '主题设置' | $lc }}</span>
162
+ </el-dropdown-item>
163
+ <el-dropdown-item command="setWorkplace">
164
+ <span>{{ '工作台设置' | $lc }}</span>
165
+ </el-dropdown-item>
166
+ </el-dropdown-menu>
167
+ </el-dropdown>
158
168
  </el-dropdown-item>
159
169
  <el-dropdown-item v-if="!inBack" command="toBack">
160
170
  <div class="flex-box flex-v">
@@ -402,6 +412,9 @@ export default {
402
412
  case 'switchUser':
403
413
  this.switchUser()
404
414
  break
415
+ case 'setWorkplace':
416
+ this.$router.push('/dashboard/setWorkplace')
417
+ break
405
418
  case 'systemSet':
406
419
  this.systemSet()
407
420
  break
@@ -43,6 +43,15 @@
43
43
  </el-input>
44
44
  不自动填充密码End -->
45
45
  </el-form-item>
46
+ <el-form-item class="m-b" :label="'图形验证码' | $lc" prop="imageCode">
47
+ <br />
48
+ <div class="flex-box">
49
+ <el-input v-model="form.imageCode" class="flex-item m-r-s" :placeholder="'请输入图形验证码' | $lc" />
50
+ <el-button plain class="p-a-0" @click="getImgCode">
51
+ <img v-if="imageUrl" :src="imageUrl" style="width: 80px; height: 30px; margin-bottom: -2px" />
52
+ </el-button>
53
+ </div>
54
+ </el-form-item>
46
55
  <el-button class="m-t" type="primary" native-type="submit" style="width: 100%">{{ '登 录' | $lc }}</el-button>
47
56
  </el-form>
48
57
  </div>
@@ -197,6 +206,7 @@ export default {
197
206
  username: [{ required: true, message: '请输入账号!', trigger: 'blur' }],
198
207
  password: [{ required: true, message: '请输入密码!', trigger: 'blur' }],
199
208
  code: [{ required: true, message: '请输入验证码!', trigger: 'blur' }],
209
+ imageCode: [{ required: true, message: '请输入图形验证码!', trigger: 'blur' }],
200
210
  phone: [
201
211
  { required: true, message: '请输入手机号!', trigger: 'blur' },
202
212
  {
@@ -207,14 +217,22 @@ export default {
207
217
  ]
208
218
  },
209
219
  codeNum: $lc('验证码'),
210
- getAzCount: 0
220
+ getAzCount: 0,
221
+ imageUrl: undefined
211
222
  }
212
223
  },
213
224
  watch: {
214
225
  loginTypes() {
215
226
  this.theType = this.loginTypes[0]
227
+ },
228
+ theType: {
229
+ handler() {
230
+ this.getImgCode()
231
+ },
232
+ immediate: true
216
233
  }
217
234
  },
235
+ mounted() {},
218
236
  methods: {
219
237
  // 忘记密码
220
238
  forgetPw() {
@@ -232,6 +250,14 @@ export default {
232
250
  this.theType = this.loginTypes[0]
233
251
  }
234
252
  },
253
+ getImgCode() {
254
+ if (this.theType === 'account') {
255
+ this.imageUrl && URL.revokeObjectURL(this.imageUrl)
256
+ axios.get('/bems/prod_1.0/uas/api/authorization/captcha/image', null, { responseType: 'blob' }).then((blob) => {
257
+ this.imageUrl = URL.createObjectURL(blob)
258
+ })
259
+ }
260
+ },
235
261
  // 发送短信
236
262
  outTime(num) {
237
263
  clearTimeout(this.setTimeNum)
@@ -338,13 +364,19 @@ export default {
338
364
  },
339
365
  // 账号/密码登录
340
366
  async passwordLogin() {
341
- let { username, password, code } = this.form
367
+ let { username, password, code, imageCode } = this.form
342
368
  await this.authorizationCode(username, password, code)
343
369
  // 请求该账号要不要强制验证码登录
344
370
  this.loadingAdd()
345
371
  let cL = await axios.post(
346
372
  '/bems/prod_1.0/uas/api/authorization/checkLogin',
347
- { grantType: 'password', username, password: this.pwd, code },
373
+ {
374
+ grantType: 'password',
375
+ username,
376
+ password: this.pwd,
377
+ code,
378
+ imageCode: imageCode || undefined
379
+ },
348
380
  {
349
381
  loading: this.loadingSub
350
382
  }
@@ -405,7 +437,8 @@ export default {
405
437
  password: this.pwd,
406
438
  code,
407
439
  sign,
408
- certDn
440
+ certDn,
441
+ imageCode: imageCode || undefined
409
442
  },
410
443
  {
411
444
  loading: this.loadingSub
@@ -424,7 +457,13 @@ export default {
424
457
  axios
425
458
  .post(
426
459
  '/bems/prod_1.0/uas/api/authorization/login',
427
- { grantType: 'password', username, password: this.pwd, code },
460
+ {
461
+ grantType: 'password',
462
+ username,
463
+ password: this.pwd,
464
+ code,
465
+ imageCode: imageCode || undefined
466
+ },
428
467
  { loading: this.loadingSub }
429
468
  )
430
469
  .then((res) => {
@@ -111,7 +111,15 @@ export default {
111
111
  },
112
112
  computed: {
113
113
  loginTypes() {
114
- return this.pageData.LOGIN_MODE?.pmValue?.split(',') || this.jsonData.loginTypes || ['account']
114
+ let LOGIN_MODE = this.pageData.LOGIN_MODE?.pmValue
115
+ if (LOGIN_MODE) {
116
+ try {
117
+ LOGIN_MODE = JSON.parse(LOGIN_MODE)
118
+ } catch (error) {
119
+ LOGIN_MODE = LOGIN_MODE.split(',')
120
+ }
121
+ }
122
+ return LOGIN_MODE || this.jsonData.loginTypes || ['account']
115
123
  },
116
124
  loginBg() {
117
125
  if (this.pageData.BgImage) {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div style="width: 100vw; height: 100vh; overflow: hidden">
2
+ <div v-if="!OL" style="width: 100vw; height: 100vh; overflow: hidden">
3
3
  <div v-if="alV" v-loading="alV" class="login-wrap">
4
4
  <loginForm
5
5
  ref="login-form"
@@ -115,6 +115,7 @@
115
115
  @to-login="inspectionV = false"
116
116
  />
117
117
  </div>
118
+ <OLogin v-else />
118
119
  </template>
119
120
 
120
121
  <script>
@@ -129,9 +130,12 @@ import loginForm from './form.vue'
129
130
  import retrievePw from './retrievePw.vue'
130
131
  import Inspection from './inspection/index.vue'
131
132
  import IconMap from './systemIconMap'
133
+ import OLogin from './index.vue'
134
+
132
135
  export default {
133
136
  name: 'Login',
134
137
  components: {
138
+ OLogin,
135
139
  loginForm,
136
140
  retrievePw,
137
141
  Inspection
@@ -171,7 +175,8 @@ export default {
171
175
  this.realUrl = realUrl
172
176
  return {
173
177
  wrapStyle: '',
174
- logUrl: 'www.baidu.com',
178
+ OL: false, // 切换到旧的登录页
179
+ logUrl: window.location.host,
175
180
  jsonData: {
176
181
  loginTypes: ['account'],
177
182
  loginBg: undefined,
@@ -333,7 +338,15 @@ export default {
333
338
  const { _layoutData = {}, loginSetting } = await getJsonc('/server-config.jsonc')
334
339
  let _loginSetting = loginSetting || _layoutData.loginSetting
335
340
  if (_loginSetting !== 'JSON') {
336
- let res = await this.$axios.post('/bems/portal/portalSysLoginCon/getCuurSysSetting', { logUrl: this.logUrl })
341
+ let por = this.$axios.post(
342
+ '/bems/portal/portalSysLoginCon/getCuurSysSetting',
343
+ { logUrl: this.logUrl },
344
+ { noMsg: true }
345
+ )
346
+ por.catch((err) => {
347
+ this.watchOLogin()
348
+ })
349
+ let res = await por
337
350
  let list = res.data || []
338
351
 
339
352
  for (let k in this.form) {
@@ -436,6 +449,10 @@ export default {
436
449
  },
437
450
  selSystem(item) {
438
451
  this.sltSys = item
452
+ },
453
+ // 切换到旧的登录页
454
+ watchOLogin() {
455
+ this.OL = true
439
456
  }
440
457
  }
441
458
  }
@@ -17,7 +17,8 @@ export function siteTree2menus(siteTree) {
17
17
  pmid: item.pmid,
18
18
  sortnum: item.sortnum ? Number(item.sortnum) : item.menuid,
19
19
  appNo: item.appNo || undefined,
20
- title: item.label
20
+ title: item.label,
21
+ isBackmenu: item.iSbackMenu
21
22
  }
22
23
  if (/^http(s)?:|\/\//.test(item.pageurl)) {
23
24
  menuObj.href = item.pageurl