讲师管理bug

This commit is contained in:
zhangsir
2024-12-16 11:13:34 +08:00
parent 6a32131c40
commit ca25e381db
13 changed files with 1152 additions and 1118 deletions

View File

@@ -63,156 +63,158 @@
</div>
</div>
<!-- 弹窗组件 -->
<a-drawer v-model:visible="teacherdialog" placement="right" :closable="false" :maskClosable="false"
<a-drawer class="largeDrawerStyle" v-model:visible="teacherdialog" placement="right" :closable="false" :maskClosable="false"
width="700px" :title="false">
<div class="headers" style="margin-top:-24px;width: 110%;margin-left: -24px;">
<div class="headerTitle">{{ teacherdialogtitle }}</div>
<img
style="width: 29px; height: 29px; cursor: pointer;margin-right: 24px;"
src="@/assets/images/basicinfo/close.png"
@click="cancelTeacherDialog"
/>
</div>
<a-form style="padding-left:12px;padding-right: 46px;" :model="formParam" layout="vertical" ref="formRef" >
<!-- 基本信息 -->
<a-row>
<a-col :span="24">
<span class="line"></span><span style="font-weight: 600;">基本信息</span>
</a-col>
<!-- 头像 -->
</a-row>
<a-row :gutter="16">
<a-col :span="24">
<div class="item_inp" style="background-color: #fff;">
<a-upload name="avatar" list-type="picture-card" class="avatar-uploader" :show-upload-list="false"
:headers="headers" :before-upload="beforeUpload">
<img class="i_upload_img" v-if="formParam.photo" :src="formParam.photo" alt="avatar" title="更换头像" />
<img class="i_upload_img" v-else src="../../assets/Avatarman.png" alt="avatar" title="更换头像" />
<!-- <div class="i_upload" v-else>
<div class="addimg">
<div class="heng"></div>
<div class="shu"></div>
</div>
</div> -->
</a-upload>
<div class="i_bottom">
<div class="tip" style="margin-bottom: 10px;">
<span style="color: #999999; margin-left: 8px">支持图片格式为jpg/jpeg/png </span>
<div style="padding:24px">
<div class="headers" style="margin-top:-24px;width: 110%;margin-left: -24px;">
<div class="headerTitle">{{ teacherdialogtitle }}</div>
<img
style="width: 29px; height: 29px; cursor: pointer;margin-right: 24px;"
src="@/assets/images/basicinfo/close.png"
@click="cancelTeacherDialog"
/>
</div>
<a-form style="padding-left:12px;padding-right: 46px;" :model="formParam" layout="vertical" ref="formRef" >
<!-- 基本信息 -->
<a-row>
<a-col :span="24">
<span class="line"></span><span style="font-weight: 600;">基本信息</span>
</a-col>
<!-- 头像 -->
</a-row>
<a-row :gutter="16">
<a-col :span="24">
<div class="item_inp" style="background-color: #fff;">
<a-upload name="avatar" list-type="picture-card" class="avatar-uploader" :show-upload-list="false"
:headers="headers" :before-upload="beforeUpload">
<img class="i_upload_img" v-if="formParam.photo" :src="formParam.photo" alt="avatar" title="更换头像" />
<img class="i_upload_img" v-else src="../../assets/Avatarman.png" alt="avatar" title="更换头像" />
<!-- <div class="i_upload" v-else>
<div class="addimg">
<div class="heng"></div>
<div class="shu"></div>
</div>
</div> -->
</a-upload>
<div class="i_bottom">
<div class="tip" style="margin-bottom: 10px;">
<span style="color: #999999; margin-left: 8px">支持图片格式为jpg/jpeg/png </span>
</div>
</div>
</div>
</div>
</a-col>
</a-row>
<!-- 讲师名称 ,手机号码-->
<a-row :gutter="16">
</a-col>
</a-row>
<!-- 讲师名称 ,手机号码-->
<a-row :gutter="16">
<a-col :span="24">
<a-form-item name="name">
<template v-slot:label>
<img
style="margin-right:4px;width: 7px;height: 7px"
src="@/assets/images/coursewareManage/asterisk.png"
alt=""
/>
讲师姓名
</template>
<a-input v-model:value="formParam.name" class="draitem" :maxlength="20" showCount
@blur="sendName"
placeholder="请输入讲师姓名" allowClear showSearch>
</a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item name="supplier">
<template v-slot:label>
<img
style="margin-right:4px;width: 7px;height: 7px"
src="@/assets/images/coursewareManage/asterisk.png"
alt=""
/>
供应商
</template>
<a-input v-model:value="formParam.supplier" class="draitem" :maxlength="30" showCount
placeholder="请输入供应商" allowClear showSearch>
</a-input>
</a-form-item>
</a-col>
</a-row>
<!-- 供应商 ,邮箱-->
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="手机号码" name="mobile" prop="mobile">
<a-input v-model:value.trim="formParam.mobile" class="draitem"
placeholder="请输入手机号码" allowClear showSearch :maxLength="11" @blur="sendPhone">
</a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="讲师邮箱" name="email" prop="email">
<a-input v-model:value="formParam.email" type="email" class="draitem"
placeholder="请输入讲师邮箱" allowClear showSearch @blur="sendEmail">
</a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item name="name">
<template v-slot:label>
<img
style="margin-right:4px;width: 7px;height: 7px"
src="@/assets/images/coursewareManage/asterisk.png"
alt=""
/>
讲师姓名
</template>
<a-input v-model:value="formParam.name" class="draitem" :maxlength="20" showCount
@blur="sendName"
placeholder="请输入讲师姓名" allowClear showSearch>
</a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item name="supplier">
<template v-slot:label>
<img
style="margin-right:4px;width: 7px;height: 7px"
src="@/assets/images/coursewareManage/asterisk.png"
alt=""
/>
供应商
</template>
<a-input v-model:value="formParam.supplier" class="draitem" :maxlength="30" showCount
placeholder="请输入供应商" allowClear showSearch>
<a-form-item label="初始授课时长" name="teaching">
<a-input v-model:value="formParam.teaching" style="width:100%; height: 40px; border-radius: 8px ; "
placeholder="0" allowClear showSearch suffix="分钟" @blur="clearNonNumber" @focus="focusTeaching">
</a-input>
</a-form-item>
<!-- <span style="margin-left: 5px ;" v-if="formParam.teaching !== null">{{ (formParam.teaching / 60
).toFixed(2) }}小时</span>
<span style="margin-left: 5px ;" v-if="formParam.teaching === null">0.00小时</span> -->
</a-form-item>
</a-col>
</a-row>
<!-- 其他信息 -->
<a-row>
<a-col :span="24" style="margin-bottom: 24px;margin-top: 12px;">
<span class="line"></span><span style="font-weight: 600;">其他信息</span>
</a-col>
</a-row>
<!-- 供应商 ,邮箱-->
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="手机号码" name="mobile" prop="mobile">
<a-input v-model:value.trim="formParam.mobile" class="draitem"
placeholder="请输入手机号码" allowClear showSearch :maxLength="11" @blur="sendPhone">
</a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="讲师邮箱" name="email" prop="email">
<a-input v-model:value="formParam.email" type="email" class="draitem"
placeholder="请输入讲师邮箱" allowClear showSearch @blur="sendEmail">
</a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="初始授课时长" name="teaching">
<a-input v-model:value="formParam.teaching" style="width:100%; height: 40px; border-radius: 8px ; "
placeholder="0" allowClear showSearch suffix="分钟" @blur="clearNonNumber">
</a-input>
<!-- <span style="margin-left: 5px ;" v-if="formParam.teaching !== null">{{ (formParam.teaching / 60
).toFixed(2) }}小时</span>
<span style="margin-left: 5px ;" v-if="formParam.teaching === null">0.00小时</span> -->
</a-form-item>
</a-col>
</a-row>
<!-- 其他信息 -->
<a-row>
<a-col :span="24" style="margin-bottom: 24px;margin-top: 12px;">
<span class="line"></span><span style="font-weight: 600;">其他信息</span>
</a-col>
</a-row>
<!-- 讲师介绍 -->
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="讲师介绍">
<Editor v-model:value="formParam.description "/>
<!-- <a-textarea placeholder="富文本"/> -->
</a-form-item>
</a-col>
</a-row>
<!-- 备注 -->
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="备注" style="margin-bottom: 80px;">
<a-textarea
v-model:value="formParam.remark"
showCount
:maxlength="200"
@blur="sendRemark"
style="width: 100%; height: 100px; border-radius: 8px"
placeholder="请输入"/>
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 交互按钮 -->
<div
:style="{
position: 'absolute',
right: 0,
bottom: 0,
width: '100%',
borderTop: '1px solid #e9e9e9',
padding: '10px 16px',
background: '#fff',
textAlign: 'right',
zIndex: 1,
} "
>
<a-button class="drabtn" @click="cancelTeacherDialog" >取消</a-button>
<a-button style="margin-right: 20px;" class="drabtn" type="primary" @click="createTeacherDialog" :loading="buttonLoading">保存
</a-button>
</div>
</a-row>
<!-- 讲师介绍 -->
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="讲师介绍">
<Editor v-model:value="formParam.description "/>
<!-- <a-textarea placeholder="富文本"/> -->
</a-form-item>
</a-col>
</a-row>
<!-- 备注 -->
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="备注" style="margin-bottom: 80px;">
<a-textarea
v-model:value="formParam.remark"
showCount
:maxlength="200"
@blur="sendRemark"
style="width: 100%; height: 100px; border-radius: 8px"
placeholder="请输入"/>
</a-form-item>
</a-col>
</a-row>
</a-form>
<!-- 交互按钮 -->
<div
:style="{
position: 'absolute',
right: 0,
bottom: 0,
width: '100%',
borderTop: '1px solid #e9e9e9',
padding: '10px 16px',
background: '#fff',
textAlign: 'right',
zIndex: 1,
} "
>
<a-button class="drabtn" @click="cancelTeacherDialog" >取消</a-button>
<a-button style="margin-right: 20px;" class="drabtn" type="primary" @click="createTeacherDialog" :loading="buttonLoading">保存
</a-button>
</div>
</div>
</a-drawer>
<!-- 删除功能弹窗 -->
@@ -346,7 +348,7 @@ export default {
teacherType:'2',
photo:null,
status:1,
teaching:'',
teaching:0,
},
vf:true,
searchParam: {
@@ -667,7 +669,7 @@ export default {
status:1,
teacherType:2,
photo:null,
teaching:null,
teaching:0,
name: null,
mobile: null,
email: null,
@@ -682,20 +684,20 @@ export default {
const rules = {
name: [{ required: true, message: '',log: '讲师不能为空' }],
supplier:[{ required: true, message: '',log:'供应商不能为空' }],
email:[
{
type: "email",
message: '',log: '请输入正确的邮箱地址',
trigger: "blur"
}
],
mobile: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: '',log: "请输入正确的手机号码",
trigger: "blur"
}
]
// email:[
// {
// type: "email",
// message: '',log: '请输入正确的邮箱地址',
// trigger: "blur"
// }
// ],
// mobile: [
// {
// pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
// message: '',log: "请输入正确的手机号码",
// trigger: "blur"
// }
// ]
}
const rule =()=>{
if (state.formParam.name==null){
@@ -755,6 +757,9 @@ export default {
}
const sendEmail=()=>{
const reg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.\w{2,}$/;
if(!state.formParam.email){
return
}
if (!reg.test(state.formParam.email)) {
message.warning( '邮箱格式不正确')
state.formParam.email=''
@@ -762,11 +767,15 @@ export default {
}
}
const clearNonNumber = () => {
state.formParam.teaching = state.formParam.teaching.replace(/\D/g, '');
state.formParam.teaching = state.formParam.teaching.slice(0,8)
state.formParam.teaching = state.formParam.teaching?.replace(/\D/g, '');
state.formParam.teaching = state.formParam.teaching?.slice(0,8)
!state.formParam.teaching && (state.formParam.teaching = 0)
}
const focusTeaching = () => {
state.formParam.teaching == 0 && (state.formParam.teaching = null)
}
const sendRemark=()=>{
state.formParam.remark = state.formParam.remark.replace(/\s/g, '');
state.formParam.remark = state.formParam.remark?.replace(/\s/g, '');
}
const repl = (val) => {
if(val){
@@ -804,6 +813,7 @@ export default {
...toRefs(state),
lecturerAdmin,
clearNonNumber,
focusTeaching,
enterPressHadlerSearch,
validateField,
rules,