zdg #105
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="editUserInfo">
|
||||
<el-button type="primary" @click="editUserInfo" :loading="subjectLoading">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
|
@ -33,7 +33,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import { listEvaluation } from '@/api/subject'
|
||||
import { updateUserInfo } from '@/api/system/user'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
@ -42,12 +42,20 @@ const userStore = useUserStore()
|
|||
const { userId, userName } = userStore.user
|
||||
|
||||
const props = defineProps({
|
||||
loginData: {
|
||||
type: Object,
|
||||
default(){
|
||||
return {}
|
||||
}
|
||||
},
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
})
|
||||
|
||||
const subjectLoading = ref(false)
|
||||
|
||||
// 定义要发送的emit事件
|
||||
const emit = defineEmits(['update:modelValue', 'onSuccess'])
|
||||
|
||||
|
@ -111,8 +119,18 @@ const editUserInfo = async () =>{
|
|||
edustage: gradeVal.value,
|
||||
edusubject: subjectVal.value
|
||||
}
|
||||
await updateUserInfo(data)
|
||||
await userStore.getInfo()
|
||||
|
||||
// 修改之后需要重新登录 查询用户信息,否则不登录 查询的用户信息是未修改之前的
|
||||
// 接口如此,我也不知道为啥要这样
|
||||
subjectLoading.value = true
|
||||
try {
|
||||
//修改用户信息
|
||||
await updateUserInfo(data)
|
||||
await userStore.login(props.loginData)
|
||||
await userStore.getInfo()
|
||||
} finally {
|
||||
subjectLoading.value = false
|
||||
}
|
||||
emit('onSuccess')
|
||||
}
|
||||
|
||||
|
@ -148,5 +166,7 @@ watch(() => props.modelValue, (newVal) => {
|
|||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
|
||||
.el-select-dropdown__item{
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
</style>
|
|
@ -24,7 +24,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!--选择学科-->
|
||||
<SelectSubject v-model="isSubject" @onSuccess="successEditSubject" />
|
||||
<SelectSubject v-model="isSubject" :loginData="loginForm" @onSuccess="successEditSubject"/>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
|
@ -35,7 +35,7 @@ import leftBg2 from '@/assets/images/login/left-bg2.png'
|
|||
import WindowTools from '@/components/window-tools/index.vue'
|
||||
import SelectSubject from '@/components/select-subject/index.vue'
|
||||
|
||||
const { BrowserWindow, session } = require('@electron/remote')
|
||||
const { session } = require('@electron/remote')
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const formRef = ref()
|
||||
|
@ -48,6 +48,7 @@ const loginForm = reactive({
|
|||
password: '',
|
||||
rememberMe: false
|
||||
})
|
||||
|
||||
//表单规则
|
||||
const rules = reactive({
|
||||
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
|
||||
|
|
Loading…
Reference in New Issue