Compare commits

..

No commits in common. "f632bab6b3945422412aafc67f368070365132b7" and "cf3129ed66cd04a193937e4343125c7c61d8193f" have entirely different histories.

2 changed files with 22 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<template>
<el-dialog v-model="model" append-to-body :show-close="false" width="500"
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="500"
top="25vh"
:close-on-click-modal="false"
:close-on-press-escape="false"
@ -34,14 +34,12 @@
<script setup>
import { ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { listEvaluation } from '@/api/subject'
import { updateUserInfo } from '@/api/system/user'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const { userId, userName } = userStore.user
const { ipcRenderer } = window.electron || {}
const props = defineProps({
loginData: {
@ -50,11 +48,17 @@ const props = defineProps({
return {}
}
},
modelValue: {
type: Boolean,
default: false
},
})
const model = defineModel();
const subjectLoading = ref(false)
// web AIx
// emit
const emit = defineEmits(['update:modelValue', 'onSuccess'])
const gradeList = ref([
{
label: '高中',
@ -81,6 +85,7 @@ gradeVal.value = gradeList.value[0].value
//
const subjectList = ref([])
const allSubject = ref([])
const dialogVisible = ref(false)
//
const changeGrade = ()=>{
@ -93,8 +98,8 @@ const changeGrade = ()=>{
//
subjectVal.value = subjectList.value[0].itemtitle
}
//
const getSubject = async ()=>{
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
//
@ -114,6 +119,7 @@ const editUserInfo = async () =>{
edustage: gradeVal.value,
edusubject: subjectVal.value
}
//
//
subjectLoading.value = true
@ -122,15 +128,14 @@ const editUserInfo = async () =>{
await updateUserInfo(data)
await userStore.login(props.loginData)
await userStore.getInfo()
ElMessage.success('登录成功')
model.value = false
ipcRenderer && ipcRenderer.send('openMainWindow')
} finally {
subjectLoading.value = false
}
emit('onSuccess')
}
watch(() => model.value, (newVal) => {
watch(() => props.modelValue, (newVal) => {
dialogVisible.value = newVal
if(newVal){
getSubject()
}

View File

@ -47,7 +47,7 @@
/>
</el-dialog>
<!--选择学科-->
<SelectSubject v-model="isSubject" :login-data="loginForm" />
<SelectSubject v-model="isSubject" :login-data="loginForm" @on-success="successEditSubject" />
</template>
<script setup>
import { onMounted, reactive, ref } from 'vue'
@ -121,6 +121,12 @@ const submitForm = async (formEl) => {
})
}
const successEditSubject = () => {
isSubject.value = false
ElMessage.success('登录成功')
ipcRenderer && ipcRenderer.send('openMainWindow')
}
const getCookie = async () => {
const username = (await getCookieDetail('username'))[0]
const password = (await getCookieDetail('password'))[0]