diff --git a/src/api/index.js b/src/api/index.js index 055e3b4..b12d5f3 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -14,6 +14,8 @@ export default { heartbeatDetection: `nakadai/message/heartbeatDetection`, encrypt: `nakadai/data/encrypt`, logout: `users/users/user/logout`, + checkUserNameOrWorkNumber: `users/users/batchProcessing/checkUserNameOrWorkNumber`, + updateUserNameOrWorkNumber: `users/users/batchProcessing/updateUserNameOrWorkNumber`, getPlayAuth: `nakadai/nakadai/oss/getPlayAuth`, // 获取播放凭证 diff --git a/src/layouts/home/index.vue b/src/layouts/home/index.vue index f925f9c..8c8be42 100644 --- a/src/layouts/home/index.vue +++ b/src/layouts/home/index.vue @@ -38,6 +38,21 @@ + + + + + + + + + + + + 确 定 + + @@ -71,7 +86,18 @@ export default { name: '优化', icon: 'optimize' } - ] + ], + + realNameVisible: false, + realNameForm: { + userName: '', + workNumber: '', + }, + realNameRules: { + userName: [ + { required: true, message: '请输入真实姓名', trigger: 'blur' } + ], + }, }; }, components: { @@ -87,6 +113,7 @@ export default { mounted () { this.autoLogout() this.logView || this.getLogStatus() // logView为false才需要查询接口 + this.handleRealName() }, methods: { ...mapMutations("user", [ @@ -95,6 +122,14 @@ export default { ...mapActions("user", [ "logout" ]), + // 提示填写姓名(登录后调用一次) + async handleRealName () { + const res = await this.$post(this.api.checkUserNameOrWorkNumber) + // 如果没有真实姓名,则弹框提示填写 + if (!res.hasName) { + this.realNameVisible = true + } + }, // 获取日志列表 getLog () { this.$get(`${this.api.platformLogList}?platformId=${Setting.platformId}&port=1&versionName=`).then(({ logList }) => { @@ -118,6 +153,18 @@ export default { } }).catch(res => { }) }, + // 真实姓名提交 + realNameSubmit () { + this.$refs.realNameForm.validate(async (valid) => { + if (valid) { + const form = this.realNameForm + await this.$post(`${this.api.updateUserNameOrWorkNumber}?userName=${form.userName}&workNumber=${form.workNumber}`) + this.realNameVisible = false + } else { + return false + } + }) + }, // 长时间未操作,自动退出登录 autoLogout () { let lastTime = new Date().getTime(); diff --git a/src/pages/student/list/index.vue b/src/pages/student/list/index.vue index 6b7073b..e7e6758 100644 --- a/src/pages/student/list/index.vue +++ b/src/pages/student/list/index.vue @@ -188,7 +188,8 @@ - + @@ -205,8 +206,8 @@