Merge pull request 'lyc-dev' (#136) from lyc-dev into main
This commit is contained in:
commit
f632bab6b3
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="500"
|
<el-dialog v-model="model" append-to-body :show-close="false" width="500"
|
||||||
top="25vh"
|
top="25vh"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
|
@ -34,12 +34,14 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
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'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const { userId, userName } = userStore.user
|
const { userId, userName } = userStore.user
|
||||||
|
const { ipcRenderer } = window.electron || {}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
loginData: {
|
loginData: {
|
||||||
|
@ -48,17 +50,11 @@ const props = defineProps({
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modelValue: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const model = defineModel();
|
||||||
const subjectLoading = ref(false)
|
const subjectLoading = ref(false)
|
||||||
|
// 默认学段 前端写死 参照web AIx
|
||||||
// 定义要发送的emit事件
|
|
||||||
const emit = defineEmits(['update:modelValue', 'onSuccess'])
|
|
||||||
|
|
||||||
const gradeList = ref([
|
const gradeList = ref([
|
||||||
{
|
{
|
||||||
label: '高中',
|
label: '高中',
|
||||||
|
@ -85,7 +81,6 @@ gradeVal.value = gradeList.value[0].value
|
||||||
//学科列表数据
|
//学科列表数据
|
||||||
const subjectList = ref([])
|
const subjectList = ref([])
|
||||||
const allSubject = ref([])
|
const allSubject = ref([])
|
||||||
const dialogVisible = ref(false)
|
|
||||||
|
|
||||||
//切换年级
|
//切换年级
|
||||||
const changeGrade = ()=>{
|
const changeGrade = ()=>{
|
||||||
|
@ -98,8 +93,8 @@ const changeGrade = ()=>{
|
||||||
// 默认选中第一个学科
|
// 默认选中第一个学科
|
||||||
subjectVal.value = subjectList.value[0].itemtitle
|
subjectVal.value = subjectList.value[0].itemtitle
|
||||||
}
|
}
|
||||||
// 获取学科数据
|
|
||||||
|
|
||||||
|
// 获取学科数据
|
||||||
const getSubject = async ()=>{
|
const getSubject = async ()=>{
|
||||||
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
|
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
|
||||||
// 所有学科
|
// 所有学科
|
||||||
|
@ -119,7 +114,6 @@ const editUserInfo = async () =>{
|
||||||
edustage: gradeVal.value,
|
edustage: gradeVal.value,
|
||||||
edusubject: subjectVal.value
|
edusubject: subjectVal.value
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改之后需要重新登录 查询用户信息,否则不登录 查询的用户信息是未修改之前的
|
// 修改之后需要重新登录 查询用户信息,否则不登录 查询的用户信息是未修改之前的
|
||||||
// 接口如此,我也不知道为啥要这样
|
// 接口如此,我也不知道为啥要这样
|
||||||
subjectLoading.value = true
|
subjectLoading.value = true
|
||||||
|
@ -128,14 +122,15 @@ const editUserInfo = async () =>{
|
||||||
await updateUserInfo(data)
|
await updateUserInfo(data)
|
||||||
await userStore.login(props.loginData)
|
await userStore.login(props.loginData)
|
||||||
await userStore.getInfo()
|
await userStore.getInfo()
|
||||||
|
ElMessage.success('登录成功')
|
||||||
|
model.value = false
|
||||||
|
ipcRenderer && ipcRenderer.send('openMainWindow')
|
||||||
} finally {
|
} finally {
|
||||||
subjectLoading.value = false
|
subjectLoading.value = false
|
||||||
}
|
}
|
||||||
emit('onSuccess')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => props.modelValue, (newVal) => {
|
watch(() => model.value, (newVal) => {
|
||||||
dialogVisible.value = newVal
|
|
||||||
if(newVal){
|
if(newVal){
|
||||||
getSubject()
|
getSubject()
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
/>
|
/>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!--选择学科-->
|
<!--选择学科-->
|
||||||
<SelectSubject v-model="isSubject" :login-data="loginForm" @on-success="successEditSubject" />
|
<SelectSubject v-model="isSubject" :login-data="loginForm" />
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
|
@ -121,12 +121,6 @@ const submitForm = async (formEl) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const successEditSubject = () => {
|
|
||||||
isSubject.value = false
|
|
||||||
ElMessage.success('登录成功')
|
|
||||||
ipcRenderer && ipcRenderer.send('openMainWindow')
|
|
||||||
}
|
|
||||||
|
|
||||||
const getCookie = async () => {
|
const getCookie = async () => {
|
||||||
const username = (await getCookieDetail('username'))[0]
|
const username = (await getCookieDetail('username'))[0]
|
||||||
const password = (await getCookieDetail('password'))[0]
|
const password = (await getCookieDetail('password'))[0]
|
||||||
|
|
Loading…
Reference in New Issue