n20-common-lib 2.1.0 → 2.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
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
@@ -229,7 +229,8 @@ export default {
229
229
  { label: $lc('账户密码登录'), value: 'account' },
230
230
  { label: $lc('手机验证码登录'), value: 'pthon' },
231
231
  { label: $lc('二维码扫码登录'), value: 'qrcode' },
232
- { label: $lc('账户密码验证码登录'), value: 'accountPthon' }
232
+ { label: $lc('账户密码验证码登录'), value: 'accountPthon' },
233
+ { label: $lc('账号密码图形验证码登录'), value: 'accountImage' }
233
234
  ],
234
235
  systemItem: undefined
235
236
  }
@@ -8,7 +8,7 @@
8
8
  <path d="M0,0L52,0L52,52Z" @click="cutQrcode" />
9
9
  </svg>
10
10
  <!-- 账号/密码登录 -->
11
- <div v-if="theType === 'account'" class="flex-item">
11
+ <div v-if="theType === 'account' || theType === 'accountImage'" class="flex-item">
12
12
  <el-form
13
13
  ref="login-form"
14
14
  :model="form"
@@ -43,6 +43,15 @@
43
43
  </el-input>
44
44
  不自动填充密码End -->
45
45
  </el-form-item>
46
+ <el-form-item v-if="theType === 'accountImage'" 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: 28px" />
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>
@@ -183,7 +192,8 @@ export default {
183
192
  account: $lc('账号密码登录'),
184
193
  pthon: $lc('手机验证码登录'),
185
194
  qrcode: $lc('二维码扫码登录'),
186
- accountPthon: $lc('账户密码验证码登录')
195
+ accountPthon: $lc('账户密码验证码登录'),
196
+ accountImage: $lc('账号密码图形验证码登录')
187
197
  },
188
198
  theType: this.loginTypes[0],
189
199
  userNo: undefined,
@@ -197,6 +207,7 @@ export default {
197
207
  username: [{ required: true, message: '请输入账号!', trigger: 'blur' }],
198
208
  password: [{ required: true, message: '请输入密码!', trigger: 'blur' }],
199
209
  code: [{ required: true, message: '请输入验证码!', trigger: 'blur' }],
210
+ imageCode: [{ required: true, message: '请输入图形验证码!', trigger: 'blur' }],
200
211
  phone: [
201
212
  { required: true, message: '请输入手机号!', trigger: 'blur' },
202
213
  {
@@ -207,14 +218,19 @@ export default {
207
218
  ]
208
219
  },
209
220
  codeNum: $lc('验证码'),
210
- getAzCount: 0
221
+ getAzCount: 0,
222
+ imageUrl: undefined
211
223
  }
212
224
  },
213
225
  watch: {
214
226
  loginTypes() {
215
227
  this.theType = this.loginTypes[0]
228
+ this.getImgCode()
216
229
  }
217
230
  },
231
+ mounted() {
232
+ this.getImgCode()
233
+ },
218
234
  methods: {
219
235
  // 忘记密码
220
236
  forgetPw() {
@@ -232,6 +248,12 @@ export default {
232
248
  this.theType = this.loginTypes[0]
233
249
  }
234
250
  },
251
+ getImgCode() {
252
+ if (this.theType === 'accountImage') {
253
+ // axios.get('/bems/prod_1.0/uas/api/authorization/captcha/image', null, { responseType: 'blob' })
254
+ this.imageUrl = require('./imgcode.png')
255
+ }
256
+ },
235
257
  // 发送短信
236
258
  outTime(num) {
237
259
  clearTimeout(this.setTimeNum)
@@ -294,11 +316,13 @@ export default {
294
316
  this.theType === 'account' && this.passwordLogin()
295
317
  this.theType === 'pthon' && this.phoneLogin()
296
318
  this.theType === 'accountPthon' && this.accountPthonLogin()
319
+ this.theType === 'accountImage' && this.passwordLogin()
297
320
  })
298
321
  } else {
299
322
  this.theType === 'account' && this.passwordLogin()
300
323
  this.theType === 'pthon' && this.phoneLogin()
301
324
  this.theType === 'accountPthon' && this.accountPthonLogin()
325
+ this.theType === 'accountImage' && this.passwordLogin()
302
326
  }
303
327
  })
304
328
  },
@@ -338,13 +362,19 @@ export default {
338
362
  },
339
363
  // 账号/密码登录
340
364
  async passwordLogin() {
341
- let { username, password, code } = this.form
365
+ let { username, password, code, imageCode } = this.form
342
366
  await this.authorizationCode(username, password, code)
343
367
  // 请求该账号要不要强制验证码登录
344
368
  this.loadingAdd()
345
369
  let cL = await axios.post(
346
370
  '/bems/prod_1.0/uas/api/authorization/checkLogin',
347
- { grantType: 'password', username, password: this.pwd, code },
371
+ {
372
+ grantType: 'password',
373
+ username,
374
+ password: this.pwd,
375
+ code,
376
+ imageCode: this.theType === 'accountImage' ? imageCode : undefined
377
+ },
348
378
  {
349
379
  loading: this.loadingSub
350
380
  }
@@ -405,7 +435,8 @@ export default {
405
435
  password: this.pwd,
406
436
  code,
407
437
  sign,
408
- certDn
438
+ certDn,
439
+ imageCode: this.theType === 'accountImage' ? imageCode : undefined
409
440
  },
410
441
  {
411
442
  loading: this.loadingSub
@@ -424,7 +455,13 @@ export default {
424
455
  axios
425
456
  .post(
426
457
  '/bems/prod_1.0/uas/api/authorization/login',
427
- { grantType: 'password', username, password: this.pwd, code },
458
+ {
459
+ grantType: 'password',
460
+ username,
461
+ password: this.pwd,
462
+ code,
463
+ imageCode: this.theType === 'accountImage' ? imageCode : undefined
464
+ },
428
465
  { loading: this.loadingSub }
429
466
  )
430
467
  .then((res) => {
@@ -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