Browse Source

update:讲师

pull/1/head
Wangwei-王伟 2 years ago
parent
commit
200be85bc8
  1. 4
      src/api/teacher.js
  2. 4
      src/components/Header.vue
  3. 37
      src/components/TeacherApply/TeacherApplyModal.vue
  4. 8
      workspace.code-workspace

4
src/api/teacher.js

@ -19,3 +19,7 @@ export function addTeacher(params) {
export function editTeacher(id, params) {
return requestPut(`/api/lecturer/${id}`,params);
}
export function judgeIsTeacher(uid) {
return requestGet(`/api/lecturer/check/${uid}`);
}

4
src/components/Header.vue

@ -123,7 +123,7 @@
</el-dropdown-item>
<el-divider></el-divider>
<el-dropdown>
<teacherApplyModal />
<teacherApplyModal :uid="uid"/>
</el-dropdown>
<el-divider></el-divider>
<el-dropdown-item v-for="(item, i) in avatarMenu.adminMenu" :key="i" :icon="item.icon">
@ -236,7 +236,7 @@
</el-dropdown-item>
<el-divider></el-divider>
<el-dropdown>
<teacherApplyModal />
<teacherApplyModal :uid="uid"/>
</el-dropdown>
<el-divider></el-divider>
<el-dropdown-item v-for="(item, i) in avatarMenu.adminMenu" :key="i" :icon="item.icon">

37
src/components/TeacherApply/TeacherApplyModal.vue

@ -1,5 +1,5 @@
<template>
<a :href="com_edu_url + '/v2'" class="til f16 fw600" v-if="form.status === 1" target="_blank">
<a :href="com_edu_url + '/v2'" class="til f16 fw600" v-if="isTeacher" target="_blank">
<div class="item-nav apply_trigger_btn">
<i class="iconfont icon-icon_icon-37" />
讲师工作台
@ -68,13 +68,17 @@
import {defineComponent, reactive, ref} from 'vue'
import teacherApplyUpload from './Upload/TeacherApplyUpload';
import { ElMessage } from 'element-plus'
import { addTeacher, getTeacherInfo, editTeacher, getUserInfo } from "../../api/teacher"
import { addTeacher, getTeacherInfo, editTeacher, judgeIsTeacher } from "../../api/teacher"
export default defineComponent({
name: 'TeacherApplyModal',
props:{
uid:undefined
},
components:{
teacherApplyUpload
},
setup() {
setup(props) {
const isTeacher = ref(false);
const dialogVisible = ref(false);
const qrDialogVisible = ref(false);
const submitLoading = ref(false);
@ -87,29 +91,31 @@ export default defineComponent({
introduction: '',
avatar:'',
})
const showModal = () => {
dialogVisible.value = true
const judgeIfTeacher = async () => {
const judgeRes = await judgeIsTeacher(props.uid)
if (judgeRes.code === 200){
isTeacher.value = judgeRes.data;
}
}
//
judgeIfTeacher();
const getInfo = async () => {
const userInfoRes = await getUserInfo();
console.log('获取用户资料');
const res = await getTeacherInfo();
if (userInfoRes.code === 200 && userInfoRes.data){
const {mobile} = userInfoRes.data;
form.phone = mobile;
}
if (res.code === 200 && res.data){
const {name = '', avatar = '',introduction = '', id= ''} = res.data;
const {name = '', avatar = '',introduction = '', id= '', phone=''} = res.data;
form.phone = phone;
form.name = name;
form.avatar = avatar;
form.introduction = introduction;
form.teacherId = id;
form.status=res.data.approvalState;
}
console.log('讲师资料是');
console.log(res);
}
getInfo();
const showModal = () => {
getInfo();
dialogVisible.value = true
}
//
const rules = reactive({
name: [
{ required: true, message: '请输入讲师姓名', trigger: 'blur' },
@ -168,6 +174,7 @@ export default defineComponent({
})
}
return {
isTeacher,
dialogVisible,
form,
ruleFormRef,

8
workspace.code-workspace

@ -1,8 +0,0 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
Loading…
Cancel
Save