zdg #184

Merged
zhangxuelin merged 9 commits from zdg into main 2024-09-10 16:16:46 +08:00
5 changed files with 348 additions and 76 deletions
Showing only changes of commit c79e7966ee - Show all commits

View File

@ -24,7 +24,8 @@ export default defineConfig({
server: { server: {
proxy: { proxy: {
'/dev-api': { '/dev-api': {
target: 'http://27.128.240.72:7865', // target: 'http://27.128.240.72:7865',
target: 'http://192.168.2.158:7865',
// target: 'http://192.168.2.52:7863', // target: 'http://192.168.2.52:7863',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') rewrite: (p) => p.replace(/^\/dev-api/, '')

View File

@ -32,12 +32,13 @@
"electron-log": "^5.1.7", "electron-log": "^5.1.7",
"electron-store": "8.0.0", "electron-store": "8.0.0",
"electron-updater": "^6.1.7", "electron-updater": "^6.1.7",
"element-china-area-data": "^6.1.0",
"element-plus": "^2.7.6", "element-plus": "^2.7.6",
"fabric": "^5.3.0", "fabric": "^5.3.0",
"im_electron_sdk": "^8.0.5904",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"jsencrypt": "^3.3.2", "jsencrypt": "^3.3.2",
"jsondiffpatch": "0.6.0", "jsondiffpatch": "0.6.0",
"im_electron_sdk": "^8.0.5904",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"pdfjs-dist": "4.4.168", "pdfjs-dist": "4.4.168",
"pinia": "^2.1.7", "pinia": "^2.1.7",

View File

@ -57,3 +57,67 @@ export function getCodeImg() {
timeout: 20000 timeout: 20000
}) })
} }
// 注册模块-生成人机验证
export function captchaImg(data) {
return request({
url: '/captchaImg',
headers: {
isToken: false
},
method: 'get',
params: data
})
}
//注册模块-发送验证码
export function sendCode(data) {
return request({
url: '/smarttalk/register/authSendCode',
method: 'post',
data:data
})
}
//注册模块-申请注册
export function signIn(data) {
return request({
url: '/smarttalk/register/authSignIn',
method: 'post',
data:data
})
}
//注册模块-获取学校
export function deptTree(data) {
return request({
url: '/smarttalk/register/authDeptTree',
method: 'get',
params:data
})
}
// 查询部门详细
export function getDept(query) {
return request({
url: '/system/dept/detail',
method: 'get',
params: query
})
}
// 查询classmain列表
export function listClassmain(query) {
return request({
url: '/education/classmain/list',
method: 'get',
params: query
})
}
// 查询evaluation列表
export function listEvaluation(query) {
return request({
url: '/smarttalk/register/authEvaluationList',
method: 'get',
params: query
})
}

View File

@ -6,12 +6,12 @@
center center
:before-close="handleClose" :before-close="handleClose"
> >
<el-steps style="max-width: 100%;-webkit-app-region: no-drag;" :active="activeIndex" finish-status="success" simple> <el-steps style="max-width: 100%;-webkit-app-region: no-drag;height:35px" :active="activeIndex" finish-status="success" simple>
<el-step title="1.基本信息" /> <el-step title="1.基本信息" @click="activeIndex=1" />
<el-step title="2.在校信息" /> <el-step title="2.在校信息" />
</el-steps> </el-steps>
<el-form <el-form
style="width: 80%;margin: 0 auto;margin-top: 30px;-webkit-app-region: no-drag;" style="width: 80%;margin: 0 auto;margin-top: 10px;-webkit-app-region: no-drag;"
:model="ruleForm" :model="ruleForm"
:rules="rules" :rules="rules"
label-width="auto" label-width="auto"
@ -28,52 +28,53 @@
<el-input v-model="ruleForm.phoneNumber" /> <el-input v-model="ruleForm.phoneNumber" />
</el-form-item> </el-form-item>
<el-form-item label="验证码" prop="Code" v-if="activeIndex==1"> <el-form-item label="验证码" prop="Code" v-if="activeIndex==1">
<el-input style="width:60%" v-model="ruleForm.Code" /> <el-input style="width:60%" v-model="ruleForm.Code" :disabled="true" />
<el-button type="primary" style="margin-left:10px">发送验证码</el-button> <el-button type="primary" style="margin-left:10px" @click="sendcaptchaImg">发送验证码</el-button>
</el-form-item> </el-form-item>
<el-form-item label="设置密码" prop="password" v-if="activeIndex==1"> <el-form-item label="设置密码" prop="password" v-if="activeIndex==1">
<el-input v-model="ruleForm.password" /> <el-input v-model="ruleForm.password" type="password" />
</el-form-item> </el-form-item>
<el-form-item label="确认密码" prop="confirmPassword" v-if="activeIndex==1"> <el-form-item label="确认密码" prop="confirmPassword" v-if="activeIndex==1">
<el-input v-model="ruleForm.confirmPassword" /> <el-input v-model="ruleForm.confirmPassword" type="password" />
</el-form-item> </el-form-item>
<el-form-item label="所属地区" prop="address" v-if="activeIndex==2"> <el-form-item label="所属地区" prop="address" v-if="activeIndex==2">
<el-cascader <el-cascader
style="width:100%" style="width:100%"
v-model="ruleForm.address" v-model="ruleForm.address"
:options="options" :options="regionData"
@change="handleChange"
/> />
</el-form-item> </el-form-item>
<el-form-item label="学校" prop="school" v-if="activeIndex==2"> <el-form-item label="学校" prop="school" v-if="activeIndex==2">
<el-select <el-cascader :options="optionsSchool" style="width:100%" v-model="ruleForm.school" @change="handleSchoolChange" />
v-model="ruleForm.school"
placeholder="请选择学校"
style="width: 100%"
>
<el-option :value="1">小学</el-option>
<el-option :value="2">中学</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="班级" prop="class" v-if="activeIndex==2"> <el-form-item label="班级" prop="class" v-if="activeIndex==2">
<el-select <el-tree-select
v-model="ruleForm.class" v-model="ruleForm.class"
:data="gradeTree"
multiple multiple
placeholder="请选择班级" :render-after-expand="false"
style="width: 100%" style="width: 100%"
> />
<el-option :value="1">1</el-option>
<el-option :value="2">2</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="学科" prop="discipline" v-if="activeIndex==2"> <el-form-item label="学科" prop="discipline" v-if="activeIndex==2">
<el-checkbox-group v-model="ruleForm.discipline"> <div v-for="item in schoolSubject" style="display: flex;">
<span style="width:50px">{{ item.name }}</span>
<el-checkbox-group style="width:100%" v-model="ruleForm.discipline" >
<el-checkbox style="margin-right:10px" v-for="el in item.children" :key="el.id" :label="el.itemtitle" :value="el.id" />
</el-checkbox-group>
</div>
<!-- <el-checkbox-group v-model="ruleForm.discipline">
<el-checkbox v-for="(item,index) in schoolSubject" :label="item.itemtitle" :key="index" :value="item.itemtitle" />
</el-checkbox-group> -->
<!-- <el-checkbox-group v-model="ruleForm.discipline">
<el-checkbox value="Online activities" name="type"> <el-checkbox value="Online activities" name="type">
语文 语文
</el-checkbox> </el-checkbox>
<el-checkbox value="Promotion activities" name="type"> <el-checkbox value="Promotion activities" name="type">
数学 数学
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group> -->
</el-form-item> </el-form-item>
<el-form-item v-if="activeIndex==1"> <el-form-item v-if="activeIndex==1">
<div class="centerDiv"> <div class="centerDiv">
@ -90,22 +91,82 @@
<div class="dialog-footer" > <div class="dialog-footer" >
<el-button @click="dialogVisible = false">下一步</el-button> <el-button @click="dialogVisible = false">下一步</el-button>
</div> </div>
</template> -->
<el-dialog
v-model="isImg"
title="人机验证"
width="500"
>
<span>根据图片回答相关问题</span>
<div style="display: flex;align-items: center;;margin-top:30px">
<img :src="isPeopleImg" style="width:200px;height:60px;cursor: pointer;" alt="" srcset="" @click="refreshImg">
<el-input v-model="ruleForm.imgCode" style="width: 250px;height:40px;margin-left:20px" placeholder="请根据图片填入答案" />
</div>
<div style="display: flex;justify-content: center;margin-top:30px">
<el-button type="primary" @click="sbmitImg">确定</el-button>
</div>
<!-- <template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="dialogVisible = false">
Confirm
</el-button>
</div>
</template> --> </template> -->
</el-dialog> </el-dialog>
</el-dialog>
</template> </template>
<script setup> <script setup>
import { ref, defineExpose, reactive } from 'vue' import { ref, defineExpose, reactive ,onMounted} from 'vue'
import {captchaImg,sendCode,deptTree,getDept,listClassmain,listEvaluation,signIn} from '@/api/login'
import { ElMessage } from 'element-plus'
import {setToken, removeToken } from '@/utils/auth'
import { regionData, codeToText } from 'element-china-area-data'
import array from 'lodash/array'
const ruleFormRef = ref(null) const ruleFormRef = ref(null)
const activeIndex=ref(1) const activeIndex=ref(1)
const ruleForm = reactive({ const ruleForm = reactive({
name: '', name: '',
idNumber:null, idNumber:'',
phoneNumber: null, phoneNumber: '',
Code:null, Code:'',
password:null, password:'',
confirmPassword:null, confirmPassword:'',
class:[],
discipline:[],
school:[],
}) })
const isImg=ref(false)
const btnName=ref('发送验证码')
const resImg = reactive({ imgData: {} });
const optionsSchool=ref([])
const gradeTree=ref([])
const schoolSubject=ref([])
const allSubjectList = ref([])
const gradeDataList = [
[
{ label: '一年级', agekey: 1, checked: false, current: 1 },
{ label: '二年级', agekey: 2, checked: false, current: 1 },
{ label: '三年级', agekey: 3, checked: false, current: 1 },
{ label: '四年级', agekey: 4, checked: false, current: 1 },
{ label: '五年级', agekey: 5, checked: false, current: 1 },
{ label: '六年级', agekey: 6, checked: false, current: 1 },
],
[
{ label: '初一', agekey: 7, checked: false, current: 2 },
{ label: '初二', agekey: 8, checked: false, current: 2 },
{ label: '初三', agekey: 9, checked: false, current: 2 },
],
[
{ label: '高一', agekey: 10, checked: false, current: 3 },
{ label: '高二', agekey: 11, checked: false, current: 3 },
{ label: '高三', agekey: 12, checked: false, current: 3 },
],
]
//
const isPeopleImg=ref(null)
const rules = reactive({ const rules = reactive({
name: [ name: [
{ required: true, message: '请输入姓名', trigger: 'blur' }, { required: true, message: '请输入姓名', trigger: 'blur' },
@ -147,6 +208,7 @@ const rules = reactive({
trigger: 'change', trigger: 'change',
},], },],
class:[ { class:[ {
type:'array',
required: true, required: true,
message: '请选择班级', message: '请选择班级',
trigger: 'change', trigger: 'change',
@ -159,44 +221,6 @@ const rules = reactive({
},] },]
}) })
const dialogVisible = ref(false) const dialogVisible = ref(false)
const options = [
{
value: 'guide',
label: 'Guide',
children: [
{
value: 'disciplines',
label: 'Disciplines',
children: [
{
value: 'consistency',
label: 'Consistency',
},
{
value: 'feedback',
label: 'Feedback',
},
],
},
{
value: 'navigation',
label: 'Navigation',
children: [
{
value: 'side nav',
label: 'Side Navigation',
},
{
value: 'top nav',
label: 'Top Navigation',
},
],
},
],
},
]
// //
const OpenModel = () =>{ const OpenModel = () =>{
dialogVisible.value=true dialogVisible.value=true
@ -213,25 +237,207 @@ const nextStep = (formEl) => {
formEl.validate((valid) => { formEl.validate((valid) => {
if (valid) { if (valid) {
activeIndex.value=2 activeIndex.value=2
//
deptTree({phone:ruleForm.phoneNumber}).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
})
}
})
}
})
getSubject()
console.log(res)
})
console.log('submit!') console.log('submit!')
} else { } else {
console.log('error submit!') console.log('error submit!')
} }
}) })
} }
//
const getSubject = async ()=>{
const rows= await listEvaluation({ itemkey: "subject", pageSize: 500 })
console.log(rows,'所有学科')
allSubjectList.value = rows.data
}
const submitForm = async (formEl) => { const submitForm = async (formEl) => {
if (!formEl) return if (!formEl) return
await formEl.validate((valid, fields) => { await formEl.validate((valid, fields) => {
if (valid) { if (valid) {
console.log(ruleForm) console.log(ruleForm)
var form={
mobile:ruleForm.phoneNumber,
code:ruleForm.Code,
name:ruleForm.name,
idCard:ruleForm.idNumber,
password:ruleForm.password,
confirmPassword:ruleForm.confirmPassword,
schoolId:ruleForm.school.join(','),
classIds:ruleForm.class.join(','),
subjectIds:ruleForm.discipline.join(','),
area:ruleForm.address.join(','),
}
signIn(form).then(res=>{
if(res.code==200){
ElMessage.success('注册成功')
if (ruleFormRef.value) ruleFormRef.value.resetFields()
ruleForm={
name: '',
idNumber:'',
phoneNumber: '',
Code:'',
password:'',
confirmPassword:'',
class:[],
discipline:[],
school:[],
}
activeIndex.value=1
dialogVisible.value=false
}else{
ElMessage.error(res.msg)
}
})
console.log('submit!') console.log('submit!')
} else { } else {
console.log('error submit!', fields) console.log('error submit!', fields)
} }
}) })
} }
//
const sendcaptchaImg=()=>{
if(ruleForm.phoneNumber){
const pattern = /^1[3-9]\d{9}$/;
if( pattern.test(ruleForm.phoneNumber) ){
captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
ruleForm.imgCode=null
isImg.value=true
isPeopleImg.value='data:image/jpg;base64,'+res.img
if(res.token){
setToken(res.token)
}
resImg.imgData=res
})
}else{
ElMessage.error('请输入正确的手机号码')
}
// captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
// console.log('res->', res)
// })
}else{
ElMessage.error('请输入手机号码')
}
}
//
const refreshImg=()=>{
captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
isPeopleImg.value='data:image/jpg;base64,'+res.img
if(res.token){
setToken(res.token)
}
resImg.imgData=res
})
}
//
const sbmitImg=()=>{
if(ruleForm.imgCode){
sendCode({mobile:ruleForm.phoneNumber,code:ruleForm.imgCode,uuid:resImg.imgData.uuid}).then(res=>{
if(res.code==200){
ruleForm.Code=res.data
isImg.value=false
}
})
}else{
ElMessage.error('请根据图片输入验证码')
}
//
}
const handleChange = (value) => {
console.log('选中的地址值:', value);
};
const handleSchoolChange= async ()=>{
ruleForm.discipline=[];
ruleForm.class=[];
getDept({deptId:ruleForm.school[2]}).then(res =>{
if(res.data.studying && res.data.studying.length){
let studying = res.data.studying.split(',')
let ary = []
studying.forEach(item =>{
let obj = {
name: item,
children: []
}
allSubjectList.value.forEach(el =>{
if(item == el.edustage){
obj.children.push(el)
}
})
ary.push(obj)
})
schoolSubject.value = ary
}
else{
schoolSubject.value = []
}
})
listClassmain( {entpid: ruleForm.school[2], pageSize: 500, status: 'open'}).then(res=>{
gradeTree.value = groupByCondition(res.rows, item => item.agekey);
console.log(gradeTree.value,'班级')
})
}
//
const groupByCondition = (arr, condition)=>{
//
const groups = arr.reduce((groups, item) => {
const groupKey = condition(item);
item.label = item.caption
item.value = item.id
groups[groupKey] = groups[groupKey] || [];
groups[groupKey].push(item);
return groups;
}, {});
//
const formattedGroups = Object.keys(groups).map(key => ({
label: gradeName(key),
value: key,
children: groups[key]
}));
return formattedGroups;
}
//key
const gradeName = (key) =>{
//
const flatGradeDataList = gradeDataList.flat();
const currentIndex = flatGradeDataList.findIndex(item => item.agekey === Number(key));
if(currentIndex !== -1){
return flatGradeDataList[currentIndex].label;
}else{
//
const defaultLabel = '社团';
flatGradeDataList[currentIndex] = { ...flatGradeDataList[currentIndex], label: defaultLabel };
return defaultLabel;
}
}
onMounted(()=>{
})
defineExpose({ defineExpose({
OpenModel, OpenModel,
}) })

View File

@ -23,7 +23,7 @@
</el-form-item> </el-form-item>
<div class="flex mb-5"> <div class="flex mb-5">
<el-checkbox v-model="loginForm.rememberMe" >记住密码</el-checkbox> <el-checkbox v-model="loginForm.rememberMe" >记住密码</el-checkbox>
<el-checkbox >阅读并同意xxx</el-checkbox> <!-- <el-checkbox >阅读并同意xxx</el-checkbox> -->
</div> </div>
<el-form-item> <el-form-item>