yc-ui2 0.2.2-beta2 → 0.2.2-beta4

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.
Files changed (47) hide show
  1. package/package.json +1 -1
  2. package/.env +0 -7
  3. package/babel.config.js +0 -5
  4. package/jsconfig.json +0 -19
  5. package/public/favicon.ico +0 -0
  6. package/public/index.html +0 -20
  7. package/src/App.vue +0 -70
  8. package/src/api/customerService.js +0 -56
  9. package/src/assets/ca/ca-bg.png +0 -0
  10. package/src/assets/ca/caBg.png +0 -0
  11. package/src/assets/customerService/admin.jpg +0 -0
  12. package/src/assets/customerService/chatTop.png +0 -0
  13. package/src/assets/customerService/ellipticalWenh.png +0 -0
  14. package/src/assets/customerService/enlarge.png +0 -0
  15. package/src/assets/customerService/personal.jpg +0 -0
  16. package/src/assets/customerService/personal1.jpg +0 -0
  17. package/src/assets/customerService/personal2.jpg +0 -0
  18. package/src/assets/slideVerify/1.jpg +0 -0
  19. package/src/assets/slideVerify/2.jpg +0 -0
  20. package/src/assets/slideVerify/3.jpg +0 -0
  21. package/src/assets/slideVerify/4.jpg +0 -0
  22. package/src/assets/slideVerify/5.jpg +0 -0
  23. package/src/assets/slideVerify/6.jpg +0 -0
  24. package/src/assets/slideVerify/7.jpg +0 -0
  25. package/src/assets/slideVerify/8.jpg +0 -0
  26. package/src/components/YcCA/index.vue +0 -536
  27. package/src/components/YcCustomerService/chat.vue +0 -337
  28. package/src/components/YcCustomerService/chatMixin.js +0 -128
  29. package/src/components/YcCustomerService/index.vue +0 -272
  30. package/src/components/YcQuestion/index.vue +0 -535
  31. package/src/components/YcSlideVerify/index.vue +0 -104
  32. package/src/main.js +0 -19
  33. package/src/packages/index.js +0 -29
  34. package/src/router/index.js +0 -20
  35. package/src/utils/auth.js +0 -6
  36. package/src/utils/mTokenPlugin/base64.js +0 -148
  37. package/src/utils/mTokenPlugin/base64_backups.js +0 -146
  38. package/src/utils/mTokenPlugin/hunca_mToken_core.js +0 -1447
  39. package/src/utils/mTokenPlugin/hunca_mToken_core2.js +0 -1455
  40. package/src/utils/mTokenPlugin/hunca_mToken_core_backups.js +0 -1425
  41. package/src/utils/mTokenPlugin/mToken.js +0 -3211
  42. package/src/utils/mTokenPlugin/mToken_backups.js +0 -3202
  43. package/src/utils/mTokenPluginBeijin/formateTime.js +0 -10
  44. package/src/utils/mTokenPluginBeijin/xtxasyn.js +0 -1156
  45. package/src/utils/request.js +0 -50
  46. package/src/views/question.vue +0 -32
  47. package/vue.config.js +0 -41
@@ -1,536 +0,0 @@
1
- <template>
2
- <div>
3
- <el-form
4
- ref="loginForm"
5
- :model="loginForm"
6
- :rules="loginRules"
7
- @submit.native.prevent
8
- >
9
- <div
10
- class="ca-bg-box"
11
- :class="loginForm.username ? 'caBg' : 'ca-bg'"
12
- >
13
- <div
14
- class="ca-bg-text"
15
- v-if="loginForm.username"
16
- >
17
- <el-link
18
- type="primary"
19
- :underline="false"
20
- >CA名称:
21
- </el-link>
22
- <span class="caName">{{ loginForm.username }}</span>
23
- </div>
24
- <el-button
25
- class="ca-refresh"
26
- :class="{ start: caLoading }"
27
- @click="caRead"
28
- icon="el-icon-refresh-right"
29
- circle
30
- ></el-button>
31
- </div>
32
- <el-form-item prop="password">
33
- <el-input
34
- prefix-icon="el-icon-lock"
35
- v-model="loginForm.password"
36
- type="password"
37
- auto-complete="off"
38
- placeholder="密码"
39
- show-password
40
- @keyup.enter.native="handleLogin"
41
- >
42
- </el-input>
43
- </el-form-item>
44
- <!-- <el-button
45
- :loading="loading"
46
- size="medium"
47
- type="primary"
48
- class="login-btn"
49
- style="width: 100%"
50
- @click.native.prevent="handleLogin"
51
- >
52
- <span v-if="!loading">登 录</span>
53
- <span v-else>登 录 中...</span>
54
- </el-button> -->
55
- <slot></slot>
56
- </el-form>
57
- <el-dialog
58
- title="提示"
59
- :visible.sync="dialogVisible.showInfo"
60
- width="30%"
61
- center
62
- >
63
- <span style="color: red">{{ caInfo.error_text }}</span>
64
- <span
65
- slot="footer"
66
- class="dialog-footer"
67
- >
68
- <el-button @click="dialogVisible.showInfo = false"
69
- >取 消</el-button
70
- >
71
- <el-button
72
- type="primary"
73
- @click="dialogVisible.showInfo = false"
74
- >确 定</el-button
75
- >
76
- </span>
77
- </el-dialog>
78
- </div>
79
- </template>
80
-
81
- <script>
82
- // import { hunca_mToken_core } from 'utils/mTokenPlugin/hunca_mToken_core2'
83
- // // 北京ca
84
- // // import 'utils/mTokenPluginBeijin/xtxasyn'
85
- // import { formateTime } from 'utils/mTokenPluginBeijin/formateTime'
86
- export default {
87
- name: 'YcCA',
88
- props: {
89
- region: {
90
- /** 1背景CA,0湖南CA */
91
- type: Number,
92
- default: 0,
93
- },
94
- },
95
- data() {
96
- return {
97
- form: {},
98
- caInfo: {
99
- error_text: '',
100
- have_error_info: false,
101
- },
102
- loginForm: {
103
- username: '',
104
- password: '',
105
- uuid: '',
106
- caInfo: '',
107
- },
108
- dialogVisible: {
109
- ca: false,
110
- showInfo: false,
111
- },
112
- loginRules: {
113
- password: [
114
- {
115
- required: true,
116
- trigger: 'blur',
117
- message: '请输入您的密码',
118
- },
119
- ],
120
- },
121
- loading: false,
122
- caLoading: false,
123
- timeId: null,
124
- }
125
- },
126
- computed: {
127
- isBJCA() {
128
- return this.region == 1
129
- },
130
- },
131
- watch: {
132
- region() {
133
- this.caRead()
134
- },
135
- },
136
- async created() {
137
- const { hunca_mToken_core } =
138
- await require('utils/mTokenPlugin/hunca_mToken_core2')
139
- this.hunca_mToken_core = hunca_mToken_core
140
- require('utils/mTokenPluginBeijin/xtxasyn')
141
- const { formateTime } =
142
- await require('utils/mTokenPluginBeijin/formateTime')
143
- this.formateTime = formateTime
144
- this.caRead()
145
- this.init()
146
- },
147
- destroyed() {
148
- window.clearTimeout(this.timeId)
149
- },
150
- methods: {
151
- init() {
152
- if (typeof window.xtxasyn != 'object' || !window.xtxasyn.util)
153
- return
154
- // 监控CA 插拔
155
- const utilConsolelog = window.xtxasyn.util.consolelog
156
- window.xtxasyn.util.consolelog = (...param) => {
157
- // 先执行 xtxasyn 自带的consolelog
158
- utilConsolelog(...param)
159
- // 在刷新 CA 是否连接
160
- window.clearTimeout(this.timeId)
161
- this.timeId = setTimeout(this.caRead, 1000)
162
- }
163
- },
164
- //读取CA
165
- caRead() {
166
- if (this.isBJCA) {
167
- this.caReadBeijin()
168
- } else {
169
- window.mToken = new this.hunca_mToken_core()
170
- let tempName = window.mToken.Hunca_GetUserListGN()
171
- this.loginForm.username = tempName[0]
172
- }
173
- },
174
- async caReadBeijin() {
175
- if (this.caLoading) return
176
- this.caLoading = true
177
- setTimeout(() => {
178
- this.caLoading = false
179
- }, 1000)
180
- let retObj = await new Promise((resolve) => {
181
- window.SOF_GetUserList(function (retObj) {
182
- resolve(retObj)
183
- })
184
- })
185
- this.loginForm.username = retObj.retVal.split('||')[0]
186
- },
187
- // CA登录选择
188
- caLogin(flag) {
189
- switch (flag) {
190
- case 0:
191
- this.HNCALogin()
192
- break
193
- default:
194
- this.$message({
195
- type: 'warning',
196
- message: '请选择CA平台!!!',
197
- })
198
- }
199
- },
200
- // 湖南CA平台登录
201
- HNCALogin() {
202
- window.mToken = new this.hunca_mToken_core()
203
- this.loginForm.username = window.mToken.Hunca_GetUserListGN()
204
- let tempuserName = window.mToken.Hunca_userNameGNToUserName(
205
- this.loginForm.username[0]
206
- ) //将证书G项信息转化为证书名称
207
- let rn = Math.random()
208
- if (
209
- !window.mToken.Hunca_PKCS1(
210
- rn,
211
- tempuserName,
212
- this.loginForm.password
213
- )
214
- ) {
215
- this.caInfo.error_text = window.mToken.Hunca_GetLastError()
216
- this.caInfo.have_error_info = true
217
- this.dialogVisible.showInfo = true
218
- return false
219
- }
220
- this.ca_cert = window.mToken.Hunca_GetSignCert()
221
- this.sign = window.mToken.Hunca_GetSignData()
222
- this.certSn = window.mToken.Hunca_GetSignCertSn() //CA唯一码
223
- this.cert_subject = window.mToken.Hunca_GetSignCertSubject() //CA信息
224
- this.cert_validTime = window.mToken.Hunca_GetValidTime() //过期时间
225
- this.cert_notBeforeTime = window.mToken.HUnca_GetNotBeforeTime() //生效时间
226
- let tempinfo = this.cert_subject.split(',')
227
- let tempinfo1 = {}
228
- tempinfo.forEach((e) => {
229
- tempinfo1[e.split('=')[0]] = e.split('=')[1]
230
- })
231
- this.loginForm = {
232
- cert: this.ca_cert,
233
- sign: this.sign,
234
- rn: rn,
235
- caInfo: this.cert_subject, //CA信息
236
- caAddr: tempinfo1.ST + tempinfo1.OU, //设备归属地
237
- caCode: tempinfo1.TITLE, //证书代码
238
- caName: tempinfo1.GN, //ca名字
239
- caSn: this.certSn, //CA唯一码
240
- caEffectiveDate: this.cert_notBeforeTime, //生效时间
241
- caExpireDate: this.cert_validTime, //过期时间
242
- loginType: '3',
243
- username: tempinfo1.GN,
244
- }
245
- return true
246
- },
247
- handleLogin() {
248
- this.$refs.loginForm.validate((valid) => {
249
- if (valid) {
250
- this.loading = true
251
- if (this.isBJCA) {
252
- this.BJCALogin()
253
- } else {
254
- this.HNCALogin()
255
- if (this.dialogVisible.showInfo == true) {
256
- this.loading = false
257
- } else if (this.loginForm.username) {
258
- this.loading = true
259
- this.$emit('caSuccess', this.loginForm, () => {
260
- this.loading = false
261
- })
262
- } else {
263
- this.msgErr('请插入CA')
264
- }
265
- }
266
- }
267
- })
268
- },
269
- async BJCALogin() {
270
- if (!this.loginForm.username) {
271
- this.msgErr('请插入CA')
272
- return
273
- } else {
274
- let certId = await new Promise((resolve) => {
275
- window.SOF_GetUserList(function (retObj) {
276
- resolve(retObj.retVal.split('&&&')[0].split('||')[1])
277
- })
278
- })
279
- // --------------执行ca登录接口开始
280
- var time_begin = new Date()
281
- let passwd = this.loginForm.password
282
- if (!certId || !passwd) {
283
- return
284
- }
285
- var platform = navigator.platform.toLowerCase()
286
- if (platform.indexOf('win') != -1) {
287
- window.SOF_LoginEx(certId, passwd, 0, this.login_callback, {
288
- begin: time_begin,
289
- certId: certId,
290
- })
291
- } else {
292
- window.SOF_Login(certId, passwd, this.login_callback, {
293
- begin: time_begin,
294
- certId: certId,
295
- })
296
- }
297
- // --------------执行ca登录接口结束
298
- }
299
- },
300
- login_callback(retObj) {
301
- const that = this
302
- var certId = retObj.ctx.certId
303
- if (retObj.retVal) {
304
- // 登录成功对数据进行签名
305
- this.BJSignData()
306
- } else {
307
- //当登录失败时,调用SOF_GetLastError取错误码,errcode为79时表示pin码复杂度不符合
308
- window.SOF_GetLastError(function (retObj) {
309
- var err = retObj.retVal
310
- if (err == 79) {
311
- that.msgErr('请核对pin码复杂度是否符合要求')
312
- }
313
- }, retObj.ctx)
314
- // 实际情况可能仅在登录失败时获取一下重试次数做个提醒
315
- window.SOF_GetPinRetryCount(
316
- certId,
317
- function (retObj) {
318
- var certId = retObj.ctx.certId
319
- that.msgErr(
320
- '证书[' +
321
- certId +
322
- ']重试次数剩余:' +
323
- retObj.retVal +
324
- '次...'
325
- )
326
- },
327
- retObj.ctx
328
- )
329
- }
330
- },
331
- async BJSignData() {
332
- let certId = await new Promise((resolve) => {
333
- window.SOF_GetUserList(function (retObj) {
334
- resolve(retObj.retVal.split('&&&')[0].split('||')[1])
335
- })
336
- })
337
- let rn = Math.random()
338
- this.form['rn'] = rn
339
- window.SOF_SignData(certId, rn, this.signData_callback, {
340
- certId: certId,
341
- })
342
- // --------------登录成功对数据进行签名结束
343
- },
344
- async signData_callback(retObj) {
345
- if (retObj.retVal == '') {
346
- this.caInfo.error_text = '数据签名失败'
347
- this.caInfo.have_error_info = true
348
- this.dialogVisible.showInfo = true
349
- return
350
- }
351
- this.form['sign'] = retObj.retVal
352
- // 签名成功获取其他信息后端登录接口所需信息-------
353
- var certId = retObj.ctx.certId
354
- // 导出用户证书
355
- let userCert = await new Promise((resolve) => {
356
- window.SOF_ExportUserCert(certId, function (retObj) {
357
- resolve(retObj.retVal)
358
- })
359
- })
360
- this.form['username'] = userCert
361
- if (userCert) {
362
- var certInfoTypeArray = {
363
- caAddrProvince: { type: 16, label: '使用者省州名ST' }, //caAddr
364
- caAddrcity: { type: 18, label: '使用者城市名L' }, //caAddr
365
- caEffectiveDate: { type: 11, label: '证书有效开始日期' }, //caEffectiveDate
366
- caExpireDate: { type: 12, label: '证书有效结束日期' }, //caExpireDate
367
- caInfo: { type: 35, label: '使用者DN项第2种格式' }, //caInfo
368
- //caCode
369
- //username
370
- caSn: { type: 2, label: '证书序列号' }, //caSn
371
- caType: { type: 34, label: '颁发者DN项第1种格式' }, //caType
372
- }
373
- // 导出证书成功,解析证书基本项
374
- for (let key in certInfoTypeArray) {
375
- let certInfo = await new Promise((resolve) => {
376
- window.SOF_GetCertInfo(
377
- userCert,
378
- certInfoTypeArray[key].type,
379
- function (retObj) {
380
- resolve(retObj)
381
- },
382
- { key: key }
383
- )
384
- })
385
- this.form[certInfo.ctx.key] = certInfo.retVal
386
- }
387
- let bindParams = {
388
- caSn: this.form['caSn'],
389
- caInfo: this.form['caInfo'],
390
- caAddr:
391
- this.form['caAddrProvince'] + this.form['caAddrcity'],
392
- caCode: this.form['caInfo']
393
- .split(',')
394
- .filter((v) => {
395
- return v.search(/^title=/i) != -1
396
- })[0]
397
- .replace(/title=/i, ''),
398
- username: this.form['caInfo']
399
- .split(',')
400
- .filter((v) => {
401
- return v.search(/^cn=/i) != -1
402
- })[0]
403
- .replace(/cn=/i, ''),
404
- caEffectiveDate: this.formateTime(
405
- this.form['caEffectiveDate']
406
- ),
407
- caExpireDate: this.formateTime(this.form['caExpireDate']),
408
- // region: this.readForm.region,
409
- pass: this.loginForm.password,
410
- caType: '北京ca',
411
- sign: this.form.sign,
412
- rn: this.form.rn,
413
- cert: this.form.username,
414
- }
415
- this.form = bindParams
416
- this.loginForm = {
417
- cert: this.form.cert,
418
- sign: this.form.sign,
419
- rn: this.form.rn,
420
- caInfo: this.form.caInfo, //CA信息
421
- caAddr: this.form.caAddr, //设备归属地
422
- caCode: this.form.caCode, //证书代码
423
- caName: this.form.username, //证书名称
424
- caSn: this.form.caSn, //CA唯一码
425
- caEffectiveDate: this.form.caEffectiveDate, //生效时间
426
- caExpireDate: this.form.caExpireDate, //过期时间
427
- loginType: '3',
428
- username: this.form.username,
429
- }
430
- if (this.dialogVisible.showInfo == true) {
431
- this.loading = false
432
- } else if (this.loginForm.username) {
433
- this.$emit('caSuccess', this.loginForm, () => {
434
- this.loading = false
435
- })
436
- } else {
437
- this.msgErr('请插入CA')
438
- }
439
- }
440
- },
441
- handleClose(done) {
442
- this.$confirm('确认关闭?')
443
- .then(() => {
444
- done()
445
- this.loading = false
446
- })
447
- .catch(() => {})
448
- },
449
- msgErr(msg) {
450
- this.loading = false
451
- this.$message.error(msg)
452
- },
453
- },
454
- }
455
- </script>
456
-
457
- <style lang="scss" scoped>
458
- .ca-bg-box {
459
- height: 101px;
460
- display: flex;
461
- align-items: center;
462
- justify-content: center;
463
- position: relative;
464
- margin-bottom: 1vw;
465
- background-color: rgba(255, 229, 231, 0.28);
466
- -webkit-animation: fadeinout 1s linear forwards;
467
- animation: fadeinout 1s linear forwards;
468
-
469
- &.caBg {
470
- background: url('assets/ca/caBg.png') center no-repeat;
471
- background-size: contain;
472
- }
473
- &.ca-bg {
474
- background: url('assets/ca/ca-bg.png') center no-repeat;
475
- background-size: contain;
476
- }
477
- }
478
- @-webkit-keyframes fadeinout {
479
- 0% {
480
- opacity: 0;
481
- }
482
- 50% {
483
- opacity: 0.5;
484
- }
485
- 100% {
486
- opacity: 1;
487
- }
488
- }
489
-
490
- @keyframes fadeinout {
491
- 0% {
492
- opacity: 0;
493
- }
494
- 50% {
495
- opacity: 0.5;
496
- }
497
- 100% {
498
- opacity: 1;
499
- }
500
- }
501
- .ca-bg-text {
502
- margin-left: 15px;
503
- .el-link {
504
- font-size: 18px;
505
- font-weight: 500;
506
- // color: #53a8ff;
507
- margin-top: -6px;
508
- }
509
- .caName {
510
- margin-left: 10px;
511
- color: #303133;
512
- }
513
- }
514
-
515
- .ca-refresh {
516
- position: absolute;
517
- top: 6px;
518
- right: 8px;
519
- padding: 3px;
520
- font-weight: bold;
521
- // width: 25px;
522
- // height: 25px;
523
- // cursor: pointer;
524
- &.start {
525
- animation: rotate 0.7s linear;
526
- }
527
- @keyframes rotate {
528
- 0% {
529
- transform: rotate(0deg); /* 初始状态 */
530
- }
531
- 100% {
532
- transform: rotate(360deg); /* 结束状态 */
533
- }
534
- }
535
- }
536
- </style>