登录修改 #102

Merged
lyc merged 1 commits from lyc-dev into main 2024-08-06 15:03:01 +08:00
2 changed files with 25 additions and 6 deletions

View File

@ -23,7 +23,7 @@
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="editUserInfo"> <el-button type="primary" @click="editUserInfo" :loading="subjectLoading">
确定 确定
</el-button> </el-button>
</div> </div>
@ -33,7 +33,7 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted, watch } from 'vue' import { ref, watch } from 'vue'
import { listEvaluation } from '@/api/subject' import { listEvaluation } from '@/api/subject'
import { updateUserInfo } from '@/api/system/user' import { updateUserInfo } from '@/api/system/user'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
@ -42,12 +42,20 @@ const userStore = useUserStore()
const { userId, userName } = userStore.user const { userId, userName } = userStore.user
const props = defineProps({ const props = defineProps({
loginData: {
type: Object,
default(){
return {}
}
},
modelValue: { modelValue: {
type: Boolean, type: Boolean,
default: false default: false
}, },
}) })
const subjectLoading = ref(false)
// emit // emit
const emit = defineEmits(['update:modelValue', 'onSuccess']) const emit = defineEmits(['update:modelValue', 'onSuccess'])
@ -111,8 +119,18 @@ const editUserInfo = async () =>{
edustage: gradeVal.value, edustage: gradeVal.value,
edusubject: subjectVal.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') emit('onSuccess')
} }

View File

@ -24,7 +24,7 @@
</div> </div>
</div> </div>
<!--选择学科--> <!--选择学科-->
<SelectSubject v-model="isSubject" @onSuccess="successEditSubject" /> <SelectSubject v-model="isSubject" :loginData="loginForm" @onSuccess="successEditSubject"/>
</template> </template>
<script setup> <script setup>
import { onMounted, reactive, ref } from 'vue' 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 WindowTools from '@/components/window-tools/index.vue'
import SelectSubject from '@/components/select-subject/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 { ipcRenderer } = window.electron || {}
const formRef = ref() const formRef = ref()
@ -48,6 +48,7 @@ const loginForm = reactive({
password: '', password: '',
rememberMe: false rememberMe: false
}) })
// //
const rules = reactive({ const rules = reactive({
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }], username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],