|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="grid full init-name-view">
|
|
<div class="grid full init-name-view">
|
|
<div class="init-name-modal">
|
|
<div class="init-name-modal">
|
|
- <div class="p-l-large modal-header">首次登录,请填写姓名</div>
|
|
|
|
|
|
+ <div class="p-l-large modal-header">首次登录,请填写姓名{{ needEmployer ? '和单位' : '' }}</div>
|
|
<div class="login-modal-content">
|
|
<div class="login-modal-content">
|
|
<base-form ref="formRef" :rules="rules" :model="model" :items="items" size="large"></base-form>
|
|
<base-form ref="formRef" :rules="rules" :model="model" :items="items" size="large"></base-form>
|
|
<div class="m-t-super-large">
|
|
<div class="m-t-super-large">
|
|
@@ -14,7 +14,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="InitUserName">
|
|
<script setup lang="ts" name="InitUserName">
|
|
-import { reactive } from 'vue'
|
|
|
|
|
|
+import { reactive, ref, computed } from 'vue'
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
import BaseForm from '@/components/element/BaseForm.vue'
|
|
import BaseForm from '@/components/element/BaseForm.vue'
|
|
import ConfirmButton from '@/components/common/ConfirmButton.vue'
|
|
import ConfirmButton from '@/components/common/ConfirmButton.vue'
|
|
@@ -28,33 +28,58 @@ import type { EpFormItem, EpFormRules } from 'global-type'
|
|
const { replace } = useRouter()
|
|
const { replace } = useRouter()
|
|
|
|
|
|
const mainStore = useMainStore()
|
|
const mainStore = useMainStore()
|
|
-
|
|
|
|
-const model = reactive<{ name: string }>({ name: '' })
|
|
|
|
|
|
+const needEmployer = ref(false)
|
|
|
|
+const model = reactive<{ name: string; employer: string }>({ name: '', employer: '' })
|
|
|
|
|
|
const { formRef, elFormRef } = useForm()
|
|
const { formRef, elFormRef } = useForm()
|
|
|
|
|
|
const rules: EpFormRules = {
|
|
const rules: EpFormRules = {
|
|
name: [
|
|
name: [
|
|
- { required: true, message: '请填写用户姓名' },
|
|
|
|
|
|
+ { required: true, message: '请输入你的姓名' },
|
|
{ type: 'string', max: 50, message: '用户姓名限制50字以内' },
|
|
{ type: 'string', max: 50, message: '用户姓名限制50字以内' },
|
|
],
|
|
],
|
|
}
|
|
}
|
|
|
|
|
|
-const items: EpFormItem[] = [
|
|
|
|
- {
|
|
|
|
- prop: 'name',
|
|
|
|
- slotType: 'input',
|
|
|
|
- slot: {
|
|
|
|
- placeholder: '请输入你的姓名',
|
|
|
|
- onKeydown(event: any) {
|
|
|
|
- if (event.keyCode == 13) {
|
|
|
|
- onSubmit()
|
|
|
|
- }
|
|
|
|
|
|
+const items: any = computed(() => {
|
|
|
|
+ let options = [
|
|
|
|
+ {
|
|
|
|
+ prop: 'name',
|
|
|
|
+ slotType: 'input',
|
|
|
|
+ label: '姓名',
|
|
|
|
+ labelWidth: '60px',
|
|
|
|
+ slot: {
|
|
|
|
+ placeholder: '请输入你的姓名',
|
|
|
|
+ onKeydown(event: any) {
|
|
|
|
+ if (event.keyCode == 13) {
|
|
|
|
+ onSubmit()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- },
|
|
|
|
-]
|
|
|
|
|
|
+ ]
|
|
|
|
+ if (needEmployer.value) {
|
|
|
|
+ options.push({
|
|
|
|
+ prop: 'employer',
|
|
|
|
+ slotType: 'input',
|
|
|
|
+ label: '单位',
|
|
|
|
+ labelWidth: '60px',
|
|
|
|
+ slot: {
|
|
|
|
+ placeholder: '请输入你的单位全称',
|
|
|
|
+ onKeydown(event: any) {
|
|
|
|
+ if (event.keyCode == 13) {
|
|
|
|
+ onSubmit()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ return options
|
|
|
|
+})
|
|
|
|
|
|
|
|
+const { fetch: getExamInfo } = useFetch('getExamInfo')
|
|
|
|
+getExamInfo({ id: mainStore.loginInfo?.examId as number }).then((result: any) => {
|
|
|
|
+ needEmployer.value = result.employerCollect
|
|
|
|
+})
|
|
const { loading, fetch } = useFetch('updateUserName')
|
|
const { loading, fetch } = useFetch('updateUserName')
|
|
|
|
|
|
async function onSubmit() {
|
|
async function onSubmit() {
|
|
@@ -63,7 +88,7 @@ async function onSubmit() {
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
await elFormRef.value?.validate()
|
|
await elFormRef.value?.validate()
|
|
- await fetch({ name: model.name })
|
|
|
|
|
|
+ await fetch({ name: model.name, employer: needEmployer.value ? model.employer : undefined })
|
|
mainStore.getMyUserInfo()
|
|
mainStore.getMyUserInfo()
|
|
replace({ name: mainStore.loginInfo?.role === 'MARKER' ? 'MarkingMark' : 'AnalysisMonitoring' })
|
|
replace({ name: mainStore.loginInfo?.role === 'MARKER' ? 'MarkingMark' : 'AnalysisMonitoring' })
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -90,6 +115,7 @@ async function onSubmit() {
|
|
}
|
|
}
|
|
.login-modal-content {
|
|
.login-modal-content {
|
|
padding: 52px 80px;
|
|
padding: 52px 80px;
|
|
|
|
+ padding-left: 50px;
|
|
}
|
|
}
|
|
:deep(button.el-button) {
|
|
:deep(button.el-button) {
|
|
width: 120px;
|
|
width: 120px;
|