Compare commits

..

No commits in common. "dbb0f44b1cea2cc7b5491bb8a88acf0e97d8ade0" and "3b2fee67311fa0338871ef9cc0dc1c130ded02d1" have entirely different histories.

10 changed files with 20 additions and 810 deletions

View File

@ -36,18 +36,3 @@ export class toLink {
// 删除链接-缓存 // 删除链接-缓存
static delLink = key => ApiService.publicHttp(`/smarttalk/toLink/${key}`, null, 'delete') static delLink = key => ApiService.publicHttp(`/smarttalk/toLink/${key}`, null, 'delete')
} }
// v2.5加入 认证学校
export class school {
// 学校加入 认证
static schoolJoin = data => ApiService.publicHttp(`/smarttalk/register/schoolJoin`,data, 'post')
// 获取学校列表
static deptTree = data => ApiService.publicHttp(`/smarttalk/register/deptTree`)
// 获取当前用户审核详情
static registerinfo = data => ApiService.publicHttp(`/smarttalk/register/info`)
// 获取学校管理列表
static auditlist = data => ApiService.publicHttp(`/smarttalk/audit/list`,data)
// 获取学校管理审核
static checkSchool = data => ApiService.publicHttp(`/smarttalk/audit/checkSchool`,data,'post')
}

View File

@ -105,14 +105,6 @@ export function deptTree(data) {
params:data params:data
}) })
} }
//获取学校
export function getdeptTree(data) {
return request({
url: '/system/user/deptTree',
method: 'get',
params:data
})
}
// 查询部门详细 // 查询部门详细
export function getDept(query) { export function getDept(query) {
return request({ return request({
@ -137,21 +129,4 @@ export function listEvaluation(query) {
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 发送验证码
export function sendcode(data) {
return request({
url: '/code/send',
method: 'post',
data
})
}
// 教师注册
export function instructorregister(data) {
return request({
url: '/instructor/register',
method: 'post',
data
})
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -10,16 +10,14 @@
</div> </div>
</template> </template>
<div class="head-aside"> <div class="head-aside">
<ul > <ul>
<li :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" > <li class="auth-li">
<i class="iconfont icon-renzheng-"></i> <i class="iconfont icon-renzheng-"></i>
<span class="mlr-5" v-if="computedregistertype!=4">学校认证</span> <span class="mlr-5">学校认证</span>
<span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span> <span class="gray">未认证</span>
<span class="gray" v-if="computedregistertype!=4">未认证</span>
</li> </li>
<li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li> <li>加入学校</li>
<li @click="onUserTo('/profile')">个人中心</li> <li @click="onUserTo('/profile')">个人中心</li>
<li @click="onUserTo('/schoolManagement')">学校管理</li>
<li @click="onUserTo('/class')">班级中心</li> <li @click="onUserTo('/class')">班级中心</li>
<li @click="logout">退出登录</li> <li @click="logout">退出登录</li>
</ul> </ul>
@ -53,14 +51,13 @@
</template> </template>
<script setup> <script setup>
import { ref, watch , reactive, onMounted,computed} from 'vue' import { ref, watch } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import pkc from "../../../../../package.json" import pkc from "../../../../../package.json"
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
const dev_api = ref(import.meta.env.VITE_APP_BASE_API) const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const userStore = useUserStore() const userStore = useUserStore()
@ -69,7 +66,6 @@ const currentRoute = ref('')
const activeId = ref('/home') const activeId = ref('/home')
const version = ref(pkc.version) const version = ref(pkc.version)
const popoverRef = ref('') const popoverRef = ref('')
@ -110,31 +106,7 @@ const sideBottomMenu = [
}, },
] ]
const computedregistertype = computed(() => {
const type =userStore.DeptInfo?.register?.type ??0
console.log(userStore.DeptInfo?.register)
if(type==0 || userStore.DeptInfo?.register?.auditStatus!=0 && userStore.DeptInfo?.register?.auditStatus!=1){
return 1
}
//
if(type==3 && userStore.DeptInfo.register.auditStatus==1){
console.log(1111)
return 4
}
if(type==4 && userStore.DeptInfo.register.auditStatus==1){
return 4
}
//
if(type==3 && userStore.DeptInfo.register.auditStatus==0){
return 2
}
//
if(type==4 && userStore.DeptInfo.register.auditStatus==0){
return 3
}
})
const clickMenu = ({ id, disabled, path }) => { const clickMenu = ({ id, disabled, path }) => {
if (disabled) return if (disabled) return
activeId.value = id activeId.value = id
@ -157,7 +129,6 @@ watch(
) )
const logout = () => { const logout = () => {
const hasClass = sessionStore.has('activeClass.id') const hasClass = sessionStore.has('activeClass.id')
const hasTool = sessionStore.get('isToolWin') const hasTool = sessionStore.get('isToolWin')
@ -182,13 +153,10 @@ const logout = () => {
}) })
}).catch(()=>{}) }).catch(()=>{})
} }
onMounted(() => {
userStore.getDeptInfo()
// getregisterinfo()
})
</script> </script>
<style lang="scss"> <style>
.el-popover.popoverStyle{ .el-popover.popoverStyle{
min-width:120px; min-width:120px;
padding: 0; padding: 0;
@ -307,7 +275,4 @@ onMounted(() => {
font-size: 12px; font-size: 12px;
margin-top: 5px; margin-top: 5px;
} }
.pointer-events{
pointer-events: none;
}
</style> </style>

View File

@ -160,25 +160,7 @@ export const constantRoutes = [
component: () => import('@/views/setting/index.vue'), component: () => import('@/views/setting/index.vue'),
name: 'setting', name: 'setting',
meta: { title: '设置' } meta: { title: '设置' }
}, }
{
path: '/joinSchool',
component: () => import('@/views/joinSchool/index.vue'),
name: 'joinSchool',
meta: {title: '加入学校'}
},
{
path: '/schoolCertification',
component: () => import('@/views/schoolCertification/index.vue'),
name: 'schoolCertification',
meta: {title: '学校认证'}
},
{
path: '/schoolManagement',
component: () => import('@/views/schoolManagement/index.vue'),
name: 'schoolManagement',
meta: {title: '学校管理'}
},
] ]
}, },
...toolRouters ...toolRouters

View File

@ -1,6 +1,5 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { login, logout, getInfo, getdeptTree } from '@/api/login' import { login, logout, getInfo } from '@/api/login'
import {school} from '@/api/apiService'
import { getToken, setToken, removeToken } from '@/utils/auth' import { getToken, setToken, removeToken } from '@/utils/auth'
import defAva from '@/assets/images/user.png' import defAva from '@/assets/images/user.png'
@ -12,8 +11,7 @@ const useUserStore = defineStore('user', {
avatar: '', avatar: '',
roles: [], roles: [],
permissions: [], permissions: [],
user: {}, user: {}
DeptInfo:{}
}), }),
actions: { actions: {
// 登录 // 登录
@ -82,12 +80,6 @@ const useUserStore = defineStore('user', {
}) })
}) })
}, },
// 注册部门信息
getDeptInfo(){
school.registerinfo().then(res=>{
this.DeptInfo=res.data || {}
})
},
// 退出系统 // 退出系统
logOut() { logOut() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@ -1,195 +0,0 @@
<template>
<div class="joinschool">
<div class="titletext"><span style="font-size:30px;margin-right:30px" class="iconfont icon-tianchongxing-"></span>加入学校</div>
<div v-if="userregister.value">
<div style="border-bottom:1px solid #eee;padding-bottom:10px;margin-bottom:10px" v-if="userregister.value.auditStatus==0">
<img style="margin: 0 auto;height:85px" src="@/assets/images/shenhe.png" alt="">
<p style="color:#F59A23;font-size:22px">申请审核中</p>
<p style="color:#000;font-size:16px;font-weight:600">申请信息已提交请耐心等待审核通过即可完成申请</p>
</div>
<div style="border:1px solid #000;margin-bottom:20px;background:#DFF0D8" v-if="userregister.value.auditStatus==1">
<div style="display: flex;align-items: center;justify-content: center;">
<el-result style="padding: 17px 35px;" icon="success"></el-result>
<p style="font-size:30px;color:#67C23A">审核通过</p>
</div>
<p style="margin-bottom:10px;color:#439FFE; cursor: pointer" @click='chongxin'>重新认证</p>
</div>
<div style="border:1px solid #000;margin-bottom:20px;background:#F2DEDE" v-if="userregister.value.auditStatus==2">
<div style="display: flex;align-items: center;justify-content: center;">
<el-result style="padding: 17px 35px;" icon="error"></el-result>
<p style="font-size:30px;color:#E10A07">申请驳回</p>
</div>
<p style="margin-bottom:10px;font-size:18px;font-weight:600">申请信息已驳回请重新提交申请信息</p>
</div>
</div>
<div class="box-item" >
<el-form ref="ruleFormRef" label-width="auto" :rules="rules" :model="ruleForm" size="large">
<!-- <el-form-item label="所属地区" prop="address">
<el-cascader
style="width:100%"
popper-class="aix-regist-address"
:options="regionData"
v-model="ruleForm.address"
/>
</el-form-item> -->
<el-form-item label="学校名称" prop="school" >
<el-cascader :options="optionsSchool" style="width:100%" v-model="ruleForm.school" :disabled="!isshwoBtn" />
</el-form-item>
<el-form-item label="申请人" >
{{ state.user.nickName }}
</el-form-item>
<el-form-item label="申请人电话" >
{{ state.user.phonenumber }}
</el-form-item>
<el-form-item >
<div style="width:100%;text-align: right;padding-right:100px">
<el-button style="width:150px" type="default" @click="closed">关闭</el-button>
<el-button style="width:150px" type="primary" @click="submitForm(ruleFormRef)" v-if="isshwoBtn">确定</el-button>
</div>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script setup >
import { ref, reactive, onMounted ,watch} from 'vue'
import { regionData, codeToText } from 'element-china-area-data'
import { getUserProfile } from '@/api/system/user'
import {getDept} from '@/api/login'
import {school} from '@/api/apiService'
import { ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user'
import { useRouter } from 'vue-router'
const router = useRouter()
const userStore = useUserStore()
const ruleFormRef = ref(null)
const isshwoBtn = ref(true)
const state = reactive({
user: {},
})
const ruleForm = reactive({
school:[],
// address:[]
})
const optionsSchool=ref([])
const rules = reactive({
address:[ {
required: true,
message: '请选择地址',
trigger: 'change',
},],
school:[{
required: true,
message: '请选择地址',
trigger: 'change',
},],
})
watch (() => userStore.DeptInfo, (newValue, oldValue) => {
getregisterinfo()
})
const userregister = reactive({
value:null
})
const chongxin=()=>{
isshwoBtn.value=true
}
async function getUser() {
getUserProfile().then((response) => {
// response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
Object.assign(state.user,response.data)
})
}
const getSchoolList = () => {
school.deptTree().then(res=>{
optionsSchool.value=res.data
optionsSchool.value.forEach(item=>{
item.value=item.id
if(!item.children){
item.disabled=true
}
if(item.children){
item.children.forEach(child=>{
child.value=child.id
if(!child.children){
child.disabled=true
}
if(child.children){
child.children.forEach(grandson=>{
grandson.value=grandson.id
})
}
})
}
})
})
}
//
const submitForm = async (formEl) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
// const araname = codeToText[ruleForm.address[0]] + '-' + codeToText[ruleForm.address[1]] + '-' + codeToText[ruleForm.address[2]];
const form={
schoolId:ruleForm.school[2],
// areaIds:ruleForm.address.join(','),
// area:araname
}
school.schoolJoin(form).then(async res=>{
if(res.code==200){
ElMessage.success('提交成功')
await userStore.getDeptInfo()
}
})
console.log('submit!')
} else {
console.log('error submit!', fields)
}
})
}
const getregisterinfo=()=>{
if(!(Object.keys(userStore.DeptInfo).length === 0 && userStore.DeptInfo.constructor === Object)){
if(userStore.DeptInfo.register.type==4) return
userregister.value=userStore.DeptInfo.register
getDept({deptId:userStore.DeptInfo.register.schoolId}).then(res1=>{
const arr=(res1?.data?.ancestors || '').split(',')
arr.shift()
arr.push(userStore.DeptInfo.register.schoolId)
ruleForm.school=arr.map(Number)
})
if(userStore.DeptInfo.register.auditStatus==0 || userStore.DeptInfo.register.auditStatus==1){
isshwoBtn.value=false
}
}
}
//
const closed=()=>{
if (ruleFormRef.value) ruleFormRef.value.resetFields()
router.push("/home")
}
onMounted(async () => {
getUser()
getSchoolList()
await userStore.getDeptInfo()
getregisterinfo()
})
</script>
<style scoped lang="scss">
.joinschool{
padding: 20px;
background: #fff;
.titletext{
text-align: left;
display: flex;
align-items: center;
font-size: 30px;
margin-bottom: 30px;
}
}
</style>

View File

@ -6,7 +6,7 @@
</div> </div>
<img class="welcome-img" :src="leftBg2" /> <img class="welcome-img" :src="leftBg2" />
</div> </div>
<div class="box-item login" v-if="isRegister"> <div class="box-item login">
<WindowTools :is-has-max="false" /> <WindowTools :is-has-max="false" />
<div class="login-title">账号登录</div> <div class="login-title">账号登录</div>
<el-form ref="formRef" class="login-form" :model="loginForm" :rules="rules" size="large"> <el-form ref="formRef" class="login-form" :model="loginForm" :rules="rules" size="large">
@ -25,30 +25,9 @@
<el-button :loading="btnLoading" class="btn" type="primary" @click="submitForm(formRef)">登录</el-button> <el-button :loading="btnLoading" class="btn" type="primary" @click="submitForm(formRef)">登录</el-button>
</el-form-item> </el-form-item>
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;"> <div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="gotoreRegister">注册账号</a> <a class="hover:text-sky-500" style="margin-right: 10px;" @click="RegisterModel(1)">注册账号</a>
</div> |
</el-form> <a class="hover:text-sky-500" style="margin-left: 10px;" @click="RegisterModel(2)">忘记密码</a>
</div>
<div class="box-item login" v-else>
<WindowTools :is-has-max="false" />
<div class="login-title">账号注册</div>
<el-form ref="ruleFormRef" class="login-form" :model="ruleForm" label-width="auto" :rules="rules" size="large">
<el-form-item label="手机号" prop="username">
<el-input v-model="ruleForm.username" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="验证码" prop="smsCode">
<el-input style="width:185px" v-model="ruleForm.smsCode" placeholder="请输入验证码" /><el-button :disabled="codeName!='发送验证码'" type="primary" @click="sendyzm">{{ codeName }}</el-button>
</el-form-item>
<el-form-item label="密码" prop="password" >
<el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" />
</el-form-item>
<el-form-item>
<el-button class="btn" type="primary" @click="RegisterForm(ruleFormRef)">立即注册</el-button>
</el-form-item>
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="gotoLogin"> 返回登录 </a>
</div> </div>
</el-form> </el-form>
</div> </div>
@ -73,7 +52,6 @@ import WindowTools from '@/components/window-tools/index.vue'
import SelectSubject from '@/components/select-subject/index.vue' import SelectSubject from '@/components/select-subject/index.vue'
import Register from './components/Register.vue' import Register from './components/Register.vue'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import {sendcode,instructorregister} from '@/api/login'
const { session } = require('@electron/remote') const { session } = require('@electron/remote')
const downloadProp = ref(0) const downloadProp = ref(0)
@ -84,25 +62,17 @@ const userStore = useUserStore()
const btnLoading = ref(false) const btnLoading = ref(false)
const isSubject = ref(false) const isSubject = ref(false)
const RegModel = ref(false) const RegModel = ref(false)
const isRegister = ref(true)
const ruleFormRef = ref(null)
const codeName=ref('发送验证码')
const timer=ref(null)
// //
const loginForm = reactive({ const loginForm = reactive({
username: '', username: '',
password: '', password: '',
rememberMe: false rememberMe: false
}) })
//
const ruleForm = reactive({
})
// //
const rules = reactive({ const rules = reactive({
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }], username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }], password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }]
smsCode: [{ required: true, trigger: 'blur', message: '请输入您的验证码' }],
}) })
let curWinUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH let curWinUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
@ -111,43 +81,6 @@ ipcRenderer.on('update-app-progress', (e, prop) => {
downloadProp.value = prop downloadProp.value = prop
showDownLoading.value = prop !== 100 showDownLoading.value = prop !== 100
}) })
const gotoreRegister=()=>{
codeName.value='发送验证码'
if(timer.value){
clearInterval(timer.value);
}
isRegister.value=false
}
//
const sendyzm=()=>{
if(ruleForm.username){
const pattern = /^1[3-9]\d{9}$/;
if( pattern.test(ruleForm.username) ){
sendcode({username:ruleForm.username, source: '4'}).then(res=>{
if(res.code==200){
ElMessage.success('消息发送成功')
codeName.value=60
timer.value=setInterval(()=>{
codeName.value--
if(codeName.value==0){
codeName.value='发送验证码'
clearInterval(timer.value);
}
},1000)
}else{
ElMessage.error(res.msg)
}
})
}else{
ElMessage.error('请输入正确的手机号码')
}
// captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
// console.log('res->', res)
// })
}else{
ElMessage.error('请输入手机号码')
}
}
// //
const RegisterModel = type => { const RegisterModel = type => {
RegModel.value.OpenModel(type) RegModel.value.OpenModel(type)
@ -215,31 +148,7 @@ const setCookie = (name, value) => {
} }
return session.defaultSession.cookies.set(cookie) return session.defaultSession.cookies.set(cookie)
} }
const gotoLogin = () => {
codeName.value='发送验证码'
if (ruleFormRef.value) ruleFormRef.value.resetFields()
isRegister.value = true
}
//
const RegisterForm = async (formEl) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
instructorregister(ruleForm).then(res=>{
if(res.code==200){
ElMessage.success('您已注册成功')
if (ruleFormRef.value) ruleFormRef.value.resetFields()
gotoLogin()
}else{
ElMessage.error(res.msg)
}
})
console.log('submit!')
} else {
console.log('error submit!', fields)
}
})
}
onMounted(() => { onMounted(() => {
localStorage.clear() localStorage.clear()
sessionStore.set('subject', { sessionStore.set('subject', {

View File

@ -1,206 +0,0 @@
<template>
<div class="joinschool">
<div class="titletext"><span style="font-size:30px;margin-right:30px" class="iconfont icon-tianchongxing-"></span>学校认证</div>
<div v-if="userregister.value">
<div style="border-bottom:1px solid #eee;padding-bottom:10px;margin-bottom:10px" v-if="userregister.value.auditStatus==0">
<img style="margin: 0 auto;height:85px" src="@/assets/images/shenhe.png" alt="">
<p style="color:#F59A23;font-size:22px">申请审核中</p>
<p style="color:#000;font-size:16px;font-weight:600">申请信息已提交请耐心等待审核通过即可完成申请</p>
</div>
<div style="border:1px solid #000;margin-bottom:20px;background:#DFF0D8" v-if="userregister.value.auditStatus==1">
<div style="display: flex;align-items: center;justify-content: center;">
<el-result style="padding: 17px 35px;" icon="success"></el-result>
<p style="font-size:30px;color:#67C23A">审核通过</p>
</div>
<p style="margin-bottom:10px;color:#439FFE; cursor: pointer">重新认证</p>
</div>
<div style="border:1px solid #000;margin-bottom:20px;background:#F2DEDE" v-if="userregister.value.auditStatus==2">
<div style="display: flex;align-items: center;justify-content: center;">
<el-result style="padding: 17px 35px;" icon="error"></el-result>
<p style="font-size:30px;color:#E10A07">申请驳回</p>
</div>
<p style="margin-bottom:10px;font-size:18px;font-weight:600">申请信息已驳回请重新提交申请信息</p>
</div>
</div>
<div class="box-item" :style="userregister.value?'':'margin-top:30px'" >
<el-form ref="ruleFormRef" label-width="auto" :rules="rules" :model="ruleForm" size="large" >
<el-form-item label="学校名称" prop="schoolName" >
<el-input v-model="ruleForm.schoolName" placeholder="请输入学校名称" :disabled="!isshwoBtn" />
</el-form-item>
<el-form-item label="所属地区" prop="address">
<el-cascader
:disabled="!isshwoBtn"
style="width:100%"
popper-class="aix-regist-address"
:options="regionData"
v-model="ruleForm.address"
/>
</el-form-item>
<el-form-item label="事业单位法人证书号" prop="certNum" >
<el-input v-model="ruleForm.certNum" placeholder="请输入事业单位法人证书号" :disabled="!isshwoBtn" />
</el-form-item>
<el-form-item label="经办人" >
{{ state.user.nickName }}
</el-form-item>
<el-form-item label="经办人电话" >
{{ state.user.phonenumber }}
</el-form-item>
<el-form-item >
<div style="display:flex;align-items:center;justify-content: space-between;padding-right:100px; width: 100%;">
<div style="display:flex;align-items:center;">
<el-checkbox style="margin: 0px 10px 0px 55px" v-model="ruleForm.istrue" size="large" :disabled="!isshwoBtn" /> 以上信息真实有效勾选后提交
</div>
<div >
<el-button style="width:150px" type="default" @click="closed">关闭</el-button>
<el-button style="width:150px" type="primary" @click="submitForm(ruleFormRef)" v-if="isshwoBtn">确定</el-button>
</div>
</div>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script setup >
import { ref, reactive, onMounted,watch } from 'vue'
import { regionData, codeToText } from 'element-china-area-data'
import { getUserProfile } from '@/api/system/user'
import {getDept} from '@/api/login'
import {school} from '@/api/apiService'
import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const isshwoBtn=ref(true)
const router = useRouter()
const state = reactive({
user: {},
})
const userregister = reactive({
value:null
})
const ruleFormRef=ref(null)
const ruleForm = reactive({
school:[],
address:[],
schoolName:null,
istrue:false
})
const optionsSchool=ref([])
const rules = reactive({
address:[ {
required: true,
message: '请选择地址',
trigger: 'change',
},],
certNum:[{ required: true, message: '请输入证书号', trigger: 'blur' }],
schoolName:[ { required: true, message: '请输入学校名称', trigger: 'blur' },]
})
async function getUser() {
getUserProfile().then((response) => {
// response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
Object.assign(state.user,response.data)
})
}
watch (() => userStore.DeptInfo, (newValue, oldValue) => {
getregisterinfo()
})
const getregisterinfo=()=>{
if(!(Object.keys(userStore.DeptInfo || {}).length === 0 && userStore.DeptInfo.constructor === Object)){
if(userStore.DeptInfo.register.type==3) return
userregister.value=userStore.DeptInfo.register
ruleForm.schoolName=userStore.DeptInfo.register.schoolName
ruleForm.certNum=userStore.DeptInfo.register.certNum
ruleForm.istrue=true
ruleForm.address=userStore.DeptInfo.register.areaIds.split(",")
if(userStore.DeptInfo.register.auditStatus==0 || userStore.DeptInfo.register.auditStatus==1){
isshwoBtn.value=false
}
}
}
const getSchoolList = () => {
school.deptTree().then(res=>{
optionsSchool.value=res.data
optionsSchool.value.forEach(item=>{
item.value=item.id
if(!item.children){
item.disabled=true
}
if(item.children){
item.children.forEach(child=>{
child.value=child.id
if(!child.children){
child.disabled=true
}
if(child.children){
child.children.forEach(grandson=>{
grandson.value=grandson.id
})
}
})
}
})
})
}
//
const submitForm = async (formEl) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
if(!ruleForm.istrue) {
ElMessage.error('请勾选以上信息真实有效的复选框')
return
}
const araname = codeToText[ruleForm.address[0]] + '-' + codeToText[ruleForm.address[1]] + '-' + codeToText[ruleForm.address[2]];
const form={
schoolName:ruleForm.schoolName,
certNum:ruleForm.certNum,
areaIds:ruleForm.address.join(','),
area:araname
}
school.schoolJoin(form).then(async res=>{
if(res.code==200){
ElMessage.success('提交成功')
await userStore.getDeptInfo()
}
})
console.log('submit!')
} else {
console.log('error submit!', fields)
}
})
}
//
const closed=()=>{
if (ruleFormRef.value) ruleFormRef.value.resetFields()
router.push("/home")
}
onMounted(() => {
getUser()
getregisterinfo()
getSchoolList()
})
</script>
<style scoped lang="scss">
.joinschool{
padding: 20px;
background: #fff;
.titletext{
text-align: left;
display: flex;
align-items: center;
font-size: 30px;
}
}
</style>

View File

@ -1,197 +0,0 @@
<template>
<div class="schoolManagement">
<div class="titletext">学校管理</div>
<div class="searchInput">
<div class="mr10">学校名称</div>
<el-input v-model="searchValue.schoolName" class="mr10" style="width: 240px" placeholder="请输入学校名称" />
<div class="mr10">所属区域</div>
<el-cascader
style="width: 240px;margin-right:10px"
:options="regionData"
v-model="address"
:props="{ checkStrictly: true }"
clearable
/>
<div class="mr10">审核状态</div>
<el-radio-group v-model="searchValue.status" class="mr10">
<el-radio :value="-1">全部</el-radio>
<el-radio :value="0">审核中</el-radio>
<el-radio :value="1">已通过</el-radio>
<el-radio :value="2">已驳回</el-radio>
</el-radio-group>
<el-button type="primary" @click="search">搜索</el-button>
</div>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="schoolName" label="学校名称" width="180" />
<el-table-column prop="area" label="所属地区" width="180" />
<el-table-column prop="certNum" label="事业单位法人证件号" />
<el-table-column prop="name" label="联系人" />
<el-table-column prop="mobile" label="联系电话" />
<el-table-column prop="status" label="审核状态">
<template #default="scope">
{{scope.row.status==0?'审核中':scope.row.status==1?'已通过':'已驳回' }}
</template>
</el-table-column>
<el-table-column prop="Operations" label="操作">
<template #default="scope">
<a v-if="scope.row.status==0" style="color:#04A8F0;cursor: pointer;" @click="audit(scope.row)">审核</a>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top:10px;float: right;" background layout="prev, pager, next" @size-change="handleSizeChange"
@current-change="handleCurrentChange" :default-page-size="searchValue.pageSize" v-model:current-page="searchValue.pageNum" :total="total" />
<el-dialog
v-model="dialogVisible"
title="加入学校审核"
width="500"
style="text-align: left;"
:before-close="handleClose"
>
<div style="margin-left:20px" class="formdialog">
审核状态
<el-radio-group v-model="form.status" class="mr10">
<el-radio :value="1">通过</el-radio>
<el-radio :value="2">拒绝</el-radio>
</el-radio-group>
</div>
<div style="margin-left:20px;margin-top:30px" class="formdialog">
审核理由
<el-input
v-model="form.auditMsg"
style="width: 300px"
:rows="3"
type="textarea"
placeholder="请输入理由"
/>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="sbmitform">
确定
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { school } from '@/api/apiService';
import { ref, reactive, onMounted ,computed} from 'vue'
import { regionData, codeToText } from 'element-china-area-data'
import { ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const searchValue = reactive({
status:-1,
schoolName:null,
pageNum:1,
pageSize:10,
type:3
})
const id=ref(null)
const address=ref([])
const total=ref(0)
const tableData = ref([])
const dialogVisible=ref(false)
const form=reactive({
status:'1',
auditMsg:null,
id:null,
ex1:null
})
const sbmitform=()=>{
if(!form.auditMsg){
return ElMessage.error('请输入理由')
}
school.checkSchool(form).then(res=>{
dialogVisible.value=false
form.auditMsg=null
form.status=1
getList()
userStore.getDeptInfo()
})
}
const filterNullProperties=(obj)=> {
const newObj = {};
for (const key in obj) {
if (obj[key] !== null && obj[key] != 'null' && obj[key] !== undefined) {
newObj[key] = obj[key];
}
}
return newObj;
}
const search=()=>{
searchValue.pageNum=1
getList()
}
const handleCurrentChange=()=>{
getList()
}
const handleSizeChange=()=>{
getList()
}
const handleClose=()=>{
form.id=null
form.ex1=null
form.auditMsg=null
form.status=1
dialogVisible.value=false
}
const formattedAddress = () => {
if (typeof address.value === 'undefined' || address.value?.length === 0) {
return null; //
}
return address.value.map(code => codeToText[code]).join('-'); // 使'-'
}
const getList = () =>{
const area=formattedAddress()
searchValue.area=area
let obj= filterNullProperties(searchValue)
school.auditlist(obj).then(res=>{
tableData.value=res.rows
total.value=res.total
})
}
const audit=(row)=>{
form.id=row.id
form.ex1=row.ex1
form.auditMsg=null
form.status=1
dialogVisible.value=true
}
onMounted(()=>{
console.log(searchValue)
getList()
})
</script>
<style scoped scss>
.schoolManagement{
padding: 20px;
background: #fff;
padding-bottom: 50px;
}
.titletext{
text-align: left;
display: flex;
align-items: center;
font-size: 30px;
margin-bottom: 30px;
}
.searchInput{
display: flex;
align-items:center;
margin-bottom: 20px;
}
.mr10{
margin-right: 10px;
}
.formdialog{
display: flex;
align-items: center;
}
</style>