diff --git a/src/renderer/src/api/apiService.js b/src/renderer/src/api/apiService.js index d5d1668..b030354 100644 --- a/src/renderer/src/api/apiService.js +++ b/src/renderer/src/api/apiService.js @@ -36,3 +36,18 @@ export class toLink { // 删除链接-缓存 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') + +} \ No newline at end of file diff --git a/src/renderer/src/api/login.js b/src/renderer/src/api/login.js index 9d9be49..b861345 100644 --- a/src/renderer/src/api/login.js +++ b/src/renderer/src/api/login.js @@ -139,10 +139,19 @@ export function listEvaluation(query) { }) } // 发送验证码 -export function sendcode(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 + }) +} diff --git a/src/renderer/src/layout/components/Aside.vue b/src/renderer/src/layout/components/Aside.vue index 61f9f3b..ba39451 100644 --- a/src/renderer/src/layout/components/Aside.vue +++ b/src/renderer/src/layout/components/Aside.vue @@ -10,14 +10,15 @@
-
@@ -35,20 +35,20 @@
账号注册
- + - - 发送验证码 + + {{ codeName }} - + 立即注册 @@ -73,7 +73,7 @@ import WindowTools from '@/components/window-tools/index.vue' import SelectSubject from '@/components/select-subject/index.vue' import Register from './components/Register.vue' import { sessionStore } from '@/utils/store' -import {sendcode} from '@/api/login' +import {sendcode,instructorregister} from '@/api/login' const { session } = require('@electron/remote') const downloadProp = ref(0) @@ -86,6 +86,8 @@ const isSubject = ref(false) const RegModel = ref(false) const isRegister = ref(true) const ruleFormRef = ref(null) +const codeName=ref('发送验证码') +const timer=ref(null) //表单 const loginForm = reactive({ username: '', @@ -99,7 +101,8 @@ const ruleForm = reactive({ //表单规则 const rules = reactive({ 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 @@ -108,9 +111,42 @@ ipcRenderer.on('update-app-progress', (e, prop) => { downloadProp.value = prop showDownLoading.value = prop !== 100 }) +const gotoreRegister=()=>{ + codeName.value='发送验证码' + if(timer.value){ + clearInterval(timer.value); + } + isRegister.value=false +} // 发送验证码 const sendyzm=()=>{ - // sendcode + 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 => { @@ -179,24 +215,25 @@ const setCookie = (name, value) => { } 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) { - - var form={ - - } - // signIn(form).then(res=>{ - // if(res.code==200){ - // ElMessage.success('您已注册成功,等待学校管理员审核') - // if (ruleFormRef.value) ruleFormRef.value.resetFields() - - // }else{ - // ElMessage.error(res.msg) - // } - // }) + 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) diff --git a/src/renderer/src/views/schoolCertification/index.vue b/src/renderer/src/views/schoolCertification/index.vue index f23d525..530c1e8 100644 --- a/src/renderer/src/views/schoolCertification/index.vue +++ b/src/renderer/src/views/schoolCertification/index.vue @@ -1,39 +1,44 @@ diff --git a/src/renderer/src/views/schoolManagement/index.vue b/src/renderer/src/views/schoolManagement/index.vue new file mode 100644 index 0000000..9dbcdc1 --- /dev/null +++ b/src/renderer/src/views/schoolManagement/index.vue @@ -0,0 +1,197 @@ + + + + + \ No newline at end of file