资源模块修改
This commit is contained in:
parent
38c1cf1236
commit
5b67c4baaa
|
@ -38,3 +38,12 @@ export function getUserProfile() {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改用户,这个不涉及到用户的权限、角色更新
|
||||
export function updateUserInfo(data) {
|
||||
return request({
|
||||
url: '/system/user/updateUserInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
|
@ -305,6 +305,7 @@ onMounted(() => {
|
|||
border-bottom: solid #f4f5f7 1px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
border-radius: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
.book-list {
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
<template>
|
||||
<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"
|
||||
style="border-radius: 5px;padding-top: 0;">
|
||||
<div class="dialog-title flex">
|
||||
<span>选择你的年级、学科</span>
|
||||
</div>
|
||||
<div class="dialog-content">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="年级">
|
||||
<el-select v-model="gradeVal" style="width: 120px;" @change="changeGrade">
|
||||
<el-option v-for="item in gradeList" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学科">
|
||||
<el-select v-model="subjectVal" style="width: 130px;">
|
||||
<el-option v-for="item in subjectList" :key="item.id" :label="item.itemtitle" :value="item.itemtitle" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="editUserInfo">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch, defineProps, defineEmits } from 'vue'
|
||||
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 props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
})
|
||||
|
||||
// 定义要发送的emit事件
|
||||
const emit = defineEmits(['update:modelValue', 'onSuccess'])
|
||||
|
||||
const gradeList = ref([
|
||||
{
|
||||
label: '高中',
|
||||
value: '高中'
|
||||
},
|
||||
{
|
||||
label: '初中',
|
||||
value: '初中'
|
||||
},
|
||||
{
|
||||
label: '小学',
|
||||
value: '小学'
|
||||
},
|
||||
{
|
||||
label: '幼儿园',
|
||||
value: '幼儿园'
|
||||
},
|
||||
]
|
||||
)
|
||||
const subjectVal = ref('')
|
||||
const gradeVal = ref('')
|
||||
// 默认第一项
|
||||
gradeVal.value = gradeList.value[0].value
|
||||
//学科列表数据
|
||||
const subjectList = ref([])
|
||||
const allSubject = ref([])
|
||||
const dialogVisible = ref(false)
|
||||
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
dialogVisible.value = newVal
|
||||
})
|
||||
|
||||
//切换年级
|
||||
const changeGrade = ()=>{
|
||||
// 切换年级 过滤出对应学科数据
|
||||
subjectList.value = allSubject.value.filter( item => item.edustage == gradeVal.value)
|
||||
if(!subjectList.value.length){
|
||||
subjectVal.value = ''
|
||||
return
|
||||
}
|
||||
// 默认选中第一个学科
|
||||
subjectVal.value = subjectList.value[0].itemtitle
|
||||
}
|
||||
// 获取学科数据
|
||||
|
||||
const getSubject = async ()=>{
|
||||
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
|
||||
// 所有学科
|
||||
allSubject.value = rows;
|
||||
// 根据默认第一个年级(gradeVal) 拿到学科数据
|
||||
subjectList.value = rows.filter( item => item.edustage == gradeVal.value)
|
||||
if(!subjectList.value.length) return
|
||||
// 默认选中第一个学科
|
||||
subjectVal.value = subjectList.value[0].itemtitle
|
||||
}
|
||||
|
||||
// 修改用户年级 学科
|
||||
const editUserInfo = async () =>{
|
||||
const data = {
|
||||
userId,
|
||||
userName,
|
||||
edustage: subjectVal.value,
|
||||
edusubject: gradeVal.value
|
||||
}
|
||||
await updateUserInfo(data)
|
||||
await userStore.getInfo()
|
||||
emit('onSuccess')
|
||||
}
|
||||
|
||||
|
||||
onMounted(getSubject)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dialog-title {
|
||||
justify-content: space-between;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
|
||||
.icon-close {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
padding: 30px 20px 10px 30px;
|
||||
}
|
||||
|
||||
.dialog-footer{
|
||||
text-align: center;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
|
@ -33,6 +33,8 @@
|
|||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<!--选择学科-->
|
||||
<SelectSubject v-model="isSubject" v-if="isSubject" class="select-subject" @onSuccess="successEditSubject" />
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
|
@ -42,6 +44,7 @@ import Cookies from 'js-cookie'
|
|||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import leftBg2 from '@/assets/images/login/left-bg2.png'
|
||||
import SelectSubject from '@/components/select-subject/index.vue'
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const formRef = ref()
|
||||
|
@ -49,6 +52,7 @@ const userStore = useUserStore()
|
|||
const router = useRouter()
|
||||
const isMaxSize = ref(false)
|
||||
const btnLoading = ref(false)
|
||||
const isSubject = ref(false)
|
||||
//表单
|
||||
const loginForm = reactive({
|
||||
username: '',
|
||||
|
@ -83,8 +87,14 @@ const submitForm = async (formEl) => {
|
|||
try{
|
||||
await userStore.login(loginForm)
|
||||
await userStore.getInfo()
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/resource')
|
||||
if(userStore.user.edustage || userStore.user.edusubject){
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/resource')
|
||||
}
|
||||
else{
|
||||
isSubject.value = true
|
||||
}
|
||||
|
||||
|
||||
}finally{
|
||||
btnLoading.value = false
|
||||
|
@ -93,6 +103,12 @@ const submitForm = async (formEl) => {
|
|||
})
|
||||
}
|
||||
|
||||
const successEditSubject = ()=>{
|
||||
isSubject.value = false
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/resource')
|
||||
}
|
||||
|
||||
const getCookie = () => {
|
||||
const username = Cookies.get('username')
|
||||
const password = Cookies.get('password')
|
||||
|
@ -207,4 +223,7 @@ const closeWindow = () => {
|
|||
.el-form-item {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.select-subject{
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -69,14 +69,22 @@ import useResoureStore from '../store'
|
|||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const sourceStore = useResoureStore()
|
||||
const handleSizeChange = () => { }
|
||||
const handleCurrentChange = () => { }
|
||||
|
||||
// 分页change
|
||||
const handleSizeChange = (limit) => {
|
||||
sourceStore.query.pageSize = limit
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
const handleCurrentChange = (page) => {
|
||||
sourceStore.query.pageNum = page
|
||||
sourceStore.handleQuery()
|
||||
}
|
||||
|
||||
// 下载文件
|
||||
const downloadFile = (item) => {
|
||||
ipcRenderer.send('save-as', item.fileFullPath, item.fileShowName)
|
||||
}
|
||||
|
||||
// 编辑行
|
||||
const editRow = (item) => {
|
||||
console.log(item.fileShowName.substring(0, item.fileShowName.lastIndexOf('.')))
|
||||
ElMessageBox.prompt('请输入新的名称', '重命名', {
|
||||
|
@ -134,14 +142,6 @@ const addLesson = ({ id }) => {
|
|||
finally {
|
||||
sourceStore.loading = false
|
||||
}
|
||||
|
||||
// ElMessageBox.confirm('是否将文件加入备课?', '提示', {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning'
|
||||
// }).then(() => {
|
||||
// ElMessage.success('操作成功')
|
||||
// }).catch(() => { })
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,11 +27,10 @@ import ResoureList from './container/resoure-list.vue'
|
|||
import uploadDialog from '@/components/upload-dialog/index.vue'
|
||||
import uploaderState from '@/store/modules/uploader'
|
||||
|
||||
|
||||
const sourceStore = useResoureStore()
|
||||
const isDialogOpen = ref(false)
|
||||
|
||||
|
||||
|
||||
const openDialog = () => {
|
||||
isDialogOpen.value = true
|
||||
}
|
||||
|
@ -46,7 +45,7 @@ const changeBook = (data) => {
|
|||
}
|
||||
// 节点点击
|
||||
const nodeClick = (data) => {
|
||||
// getData(data)
|
||||
getData(data)
|
||||
}
|
||||
|
||||
// 查询
|
||||
|
|
Loading…
Reference in New Issue