15 changed files with 985 additions and 102 deletions
@ -0,0 +1,210 @@ |
|||||
|
<template> |
||||
|
<div class="d-flex flex-wrap pb-3"> |
||||
|
<!-- 添加 --> |
||||
|
<a-modal |
||||
|
:maskClosable="false" |
||||
|
@cancel="$emit('closeModal')" |
||||
|
destroyOnClose |
||||
|
footer |
||||
|
title="添加页面" |
||||
|
v-model="visible" |
||||
|
width="700px" |
||||
|
> |
||||
|
<a-form :form="form" @submit="handleSubmit"> |
||||
|
<!-- 公司 --> |
||||
|
<a-form-item |
||||
|
:label-col="formItemLayout.labelCol" |
||||
|
:wrapper-col="formItemLayout.wrapperCol" |
||||
|
label="公司" |
||||
|
> |
||||
|
<a-input |
||||
|
v-decorator="['company', { rules: [{ required: true, message: '请输入公司' }] }]" |
||||
|
/> |
||||
|
</a-form-item> |
||||
|
<!-- 职责 --> |
||||
|
<a-form-item |
||||
|
:label-col="formItemLayout.labelCol" |
||||
|
:wrapper-col="formItemLayout.wrapperCol" |
||||
|
label="职责" |
||||
|
> |
||||
|
<a-input |
||||
|
v-decorator="['duties', { rules: [{ required: true, message: '请输入职责' }] }]" |
||||
|
/> |
||||
|
|
||||
|
</a-form-item> |
||||
|
<!-- 名称 --> |
||||
|
<a-form-item |
||||
|
:label-col="formItemLayout.labelCol" |
||||
|
:wrapper-col="formItemLayout.wrapperCol" |
||||
|
label="名称" |
||||
|
> |
||||
|
<a-input |
||||
|
v-decorator="['name', { rules: [{ required: true, message: '请输入名称' }] }]" |
||||
|
/> |
||||
|
|
||||
|
</a-form-item> |
||||
|
|
||||
|
|
||||
|
<!-- 排序 --> |
||||
|
<a-form-item |
||||
|
:label-col="formItemLayout.labelCol" |
||||
|
:wrapper-col="formItemLayout.wrapperCol" |
||||
|
label="排序" |
||||
|
> |
||||
|
<a-input |
||||
|
placeholder="请输入正整数的排序" |
||||
|
v-decorator="['orders', { rules: [{ pattern: new RegExp(/^[+]{0,1}(\d+)$/),required: true, message: '请输入排序(仅限制正整数,包含0)' }] }]" |
||||
|
/> |
||||
|
|
||||
|
</a-form-item> |
||||
|
|
||||
|
<!-- services --> |
||||
|
<a-form-item |
||||
|
:label-col="formItemLayout.labelCol" |
||||
|
:wrapper-col="formItemLayout.wrapperCol" |
||||
|
label="导师分类id" |
||||
|
> |
||||
|
<!-- <div>{{ services }}</div> --> |
||||
|
<a-select |
||||
|
mode="multiple" |
||||
|
placeholder="请输入导师分类id" |
||||
|
:default-value="[ 1,2]" |
||||
|
style="width: 100%" |
||||
|
@change="handleChange" |
||||
|
> |
||||
|
<a-select-option v-for="(item) in services" :key="item.id"> |
||||
|
{{ item.categoryName }} |
||||
|
</a-select-option> |
||||
|
</a-select> |
||||
|
<!-- <a-input |
||||
|
v-model="services" |
||||
|
placeholder="" |
||||
|
/> --> |
||||
|
|
||||
|
</a-form-item> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<a-form-item class="d-flex flex-row-reverse"> |
||||
|
<a-button @click="$emit('closeModal')" class="mr-3">取消</a-button> |
||||
|
<a-button class="white--text" html-type="submit" type="primary">保存</a-button> |
||||
|
</a-form-item> |
||||
|
</a-form> |
||||
|
</a-modal> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { mapState } from 'vuex'; |
||||
|
import { addTeacher ,selTutorH} from 'config/api'; |
||||
|
import { quillEditor } from 'vue-quill-editor'; |
||||
|
|
||||
|
const formItemLayout = { |
||||
|
labelCol: { span: 6 }, |
||||
|
wrapperCol: { span: 16 }, |
||||
|
}; |
||||
|
const tailItemLayout = { wrapperCol: { span: 16, offset: 6 } }; |
||||
|
export default { |
||||
|
name: 'TeacherAdd', |
||||
|
props: { visible: { type: Boolean, default: false } }, |
||||
|
components: { |
||||
|
quillEditor, // 富文本编辑器 |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
formItemLayout, |
||||
|
tailItemLayout, |
||||
|
form: this.$form.createForm(this, { name: 'page-add' }), |
||||
|
content: '', |
||||
|
services: [], |
||||
|
servicesForm: [1], |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
this.getTeacherType(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
computed: mapState(['titles']), |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
handleChange(value) { |
||||
|
// console.log() |
||||
|
console.log(`Selected: ${value}`); |
||||
|
this.servicesForm = value; |
||||
|
console.log(this.servicesForm) |
||||
|
}, |
||||
|
// 查询导师分类 |
||||
|
async getTeacherType() { |
||||
|
try { |
||||
|
const params = { |
||||
|
param: { |
||||
|
recStatus: 0, |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
const res = await selTutorH(params); |
||||
|
const { code, msg, data } = res.data; |
||||
|
if (code === 200) { |
||||
|
console.log("getTeacherType方法已经走到") |
||||
|
console.log(data) |
||||
|
this.services = data; |
||||
|
// const paper = { ...this.pagination }; |
||||
|
// paper.current = data.pageNum; |
||||
|
// paper.total = +data.total; |
||||
|
// paper.pageSize = data.pageSize; |
||||
|
// this.pagination = paper; |
||||
|
} else { |
||||
|
throw msg || '获取失败'; |
||||
|
} |
||||
|
} catch (error) { |
||||
|
this.$message.error(error); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
// 提交表单 |
||||
|
handleSubmit(e) { |
||||
|
|
||||
|
e.preventDefault(); |
||||
|
this.form.validateFieldsAndScroll(async (err, values) => { |
||||
|
if (!err) { |
||||
|
try { |
||||
|
console.log("是否走到了这个逻辑") |
||||
|
console.log('Received values of form: ', values); |
||||
|
// if (values.titleCode.length > 1) { |
||||
|
// values.titleCode = `${values.titleCode[0]}-${values.titleCode[1]}`; |
||||
|
// } else { |
||||
|
// values.titleCode = `${values.titleCode[0]}`; |
||||
|
// } |
||||
|
const param = values; |
||||
|
|
||||
|
param.services = this.servicesForm |
||||
|
const params = { param }; |
||||
|
|
||||
|
|
||||
|
console.log('params: ', params); |
||||
|
const res = await addTeacher(params); |
||||
|
const { data, msg, code } = res.data; |
||||
|
if (code === 200) { |
||||
|
this.$message.success('添加成功'); |
||||
|
this.$emit('closeModal'); |
||||
|
} else { |
||||
|
throw msg; |
||||
|
} |
||||
|
} catch (error) { |
||||
|
this.$message.error(error || '添加失败'); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="stylus"></style> |
@ -0,0 +1,227 @@ |
|||||
|
<template> |
||||
|
<div class="main flex-1"> |
||||
|
<a-spin :spinning="showEdit"> |
||||
|
<!-- <div>{{ lists }}</div> --> |
||||
|
<div style="width: 100%" v-if="lists && lists.length > 0"> |
||||
|
<a-table |
||||
|
:columns="columns" |
||||
|
:data-source="lists" |
||||
|
:loading="loading" |
||||
|
:pagination="pagination" |
||||
|
:row-key="record => record.id" |
||||
|
:scroll="{ y: height }" |
||||
|
@change="handleTableChange" |
||||
|
bordered |
||||
|
class="white" |
||||
|
> |
||||
|
<template slot="id" slot-scope="text, record, index"> |
||||
|
<span>{{ index + 1 }}</span> |
||||
|
</template> |
||||
|
|
||||
|
<template slot="categoryName" slot-scope="text, record"> |
||||
|
<span>{{ record.categoryName }}</span> |
||||
|
</template> |
||||
|
|
||||
|
<!-- <template slot="edit" slot-scope="text, record"> |
||||
|
<a-icon @click="showEditModal(record)" class="pointer" theme="twoTone" type="edit" /> |
||||
|
<a-popconfirm @confirm="() => onDelete(record.id)" title="确定要删除这一条?" v-if="lists.length"> |
||||
|
<a-icon class="ml-4 pointer" theme="twoTone" two-tone-color="#ff0000" type="delete" /> |
||||
|
</a-popconfirm> |
||||
|
</template> --> |
||||
|
<!-- <div class="d-flex flex-nowrap justify-space-between" slot="expandedRowRender" slot-scope="record" style="margin: 0"> |
||||
|
<div> |
||||
|
|
||||
|
<div v-for="(item,index) in record.services" :key="index"> |
||||
|
<div class="d-flex"> |
||||
|
<div class="ml-5">姓名:{{item.name}}</div> |
||||
|
<div class="ml-3"> 性别:{{item.sex}} </div> |
||||
|
<div class="ml-3"> 所在公司:{{item.company}}</div> |
||||
|
<div class="ml-3"> 职责:{{item.duties}}</div> |
||||
|
<div class="ml-3"> 排序:{{item.order}}</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> --> |
||||
|
|
||||
|
|
||||
|
</a-table> |
||||
|
</div> |
||||
|
<a-empty v-else /> |
||||
|
|
||||
|
<!-- 编辑 --> |
||||
|
<!-- <page-edit :editItem="editItem" :editVisible="editVisible" @closeModal="closeModal" @getPageList="getPageList" /> --> |
||||
|
</a-spin> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
// import PageEdit from 'components/Page/PageEdit.vue'; |
||||
|
import { deletePage, getPage } from 'config/api'; |
||||
|
|
||||
|
const columns = [ |
||||
|
{ |
||||
|
title: '序号', |
||||
|
align: 'center', |
||||
|
dataIndex: 'id', |
||||
|
key: 'id', |
||||
|
width: 80, |
||||
|
scopedSlots: { customRender: 'id' }, |
||||
|
}, |
||||
|
{ |
||||
|
title: '公司', |
||||
|
align: 'center', |
||||
|
dataIndex: 'company', |
||||
|
key: 'company', |
||||
|
scopedSlots: { customRender: 'company' }, |
||||
|
}, |
||||
|
{ |
||||
|
title: '职责', |
||||
|
align: 'center', |
||||
|
dataIndex: 'duties', |
||||
|
key: 'duties', |
||||
|
scopedSlots: { customRender: 'duties' }, |
||||
|
}, |
||||
|
{ |
||||
|
title: '序号', |
||||
|
align: 'center', |
||||
|
dataIndex: 'orders', |
||||
|
key: 'orders', |
||||
|
scopedSlots: { customRender: 'orders' }, |
||||
|
}, |
||||
|
{ |
||||
|
title: '名字', |
||||
|
align: 'center', |
||||
|
dataIndex: 'name', |
||||
|
key: 'name', |
||||
|
scopedSlots: { customRender: 'name' }, |
||||
|
}, |
||||
|
{ |
||||
|
title: '性别', |
||||
|
align: 'center', |
||||
|
dataIndex: 'sex', |
||||
|
key: 'sex', |
||||
|
scopedSlots: { customRender: 'sex' }, |
||||
|
}, |
||||
|
// { |
||||
|
// title: '简历', |
||||
|
// align: 'center', |
||||
|
// dataIndex: 'resume', |
||||
|
// key: 'resume', |
||||
|
// scopedSlots: { customRender: 'resume' }, |
||||
|
// }, |
||||
|
{ |
||||
|
title: '职工照片id', |
||||
|
align: 'center', |
||||
|
dataIndex: 'teacherPhoto', |
||||
|
key: 'teacherPhoto', |
||||
|
scopedSlots: { customRender: 'teacherPhoto' }, |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
]; |
||||
|
|
||||
|
export default { |
||||
|
name: 'TeacherDate', |
||||
|
components: { |
||||
|
|
||||
|
}, |
||||
|
props: { lists: { type: Array, default: () => [] }, pagination: { type: Object, default: () => {} } }, |
||||
|
data() { |
||||
|
return { |
||||
|
columns, |
||||
|
loading: false, |
||||
|
height: '', |
||||
|
editVisible: false, |
||||
|
editItem: {}, // 修改的那条 |
||||
|
spinning: false, |
||||
|
showEdit: false, |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
let th = 250; |
||||
|
let wh = window.innerHeight; |
||||
|
this.height = wh - th; |
||||
|
window.onresize = () => { |
||||
|
return (() => { |
||||
|
wh = window.innerHeight; |
||||
|
this.height = wh - th; |
||||
|
})(); |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
async showEditModal(record) { |
||||
|
this.showEdit = true; |
||||
|
await this.getDetail(true, record); |
||||
|
this.showEdit = false; |
||||
|
this.editItem = record; |
||||
|
this.editVisible = true; |
||||
|
}, |
||||
|
|
||||
|
closeModal() { |
||||
|
this.editVisible = false; |
||||
|
}, |
||||
|
|
||||
|
async getPageList() { |
||||
|
await this.$emit('getPageList'); |
||||
|
}, |
||||
|
|
||||
|
handleTableChange(pagination) { |
||||
|
const { current, pageSize } = pagination; |
||||
|
const condition = { current, pageSize }; |
||||
|
this.$emit('getPageList', condition); |
||||
|
}, |
||||
|
|
||||
|
// 删除 |
||||
|
async onDelete(id) { |
||||
|
try { |
||||
|
const params = { param: { id } }; |
||||
|
const res = await deletePage(params); |
||||
|
const { data, msg, code } = res.data; |
||||
|
if (code === 200) { |
||||
|
this.$message.success('删除成功'); |
||||
|
await this.$emit('getPageList'); |
||||
|
} else { |
||||
|
throw msg; |
||||
|
} |
||||
|
} catch (error) { |
||||
|
this.$message.error('删除失败'); |
||||
|
// this.$message.error(error || '删除失败'); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 详情查询 |
||||
|
async getDetail(expanded, record) { |
||||
|
if (!expanded) return; |
||||
|
try { |
||||
|
this.spinning = true; |
||||
|
const params = { param: { id: record.id } }; |
||||
|
const res = await getPage(params); |
||||
|
const { data, msg, code } = res.data; |
||||
|
this.spinning = false; |
||||
|
if (code === 200) { |
||||
|
const item = this.lists.find(item => item.id === record.id); |
||||
|
item.content = data.content; |
||||
|
} else { |
||||
|
throw msg; |
||||
|
} |
||||
|
} catch (error) { |
||||
|
this.$message.error(error || '查询失败'); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 打开报名 |
||||
|
openSignUp() { |
||||
|
const { query } = this.$route; |
||||
|
this.$router.push({ path: '/sign-up', query }); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="stylus"></style> |
@ -0,0 +1,51 @@ |
|||||
|
|
||||
|
|
||||
|
<template> |
||||
|
<div class="d-flex flex-wrap pb-3"> |
||||
|
<div class="d-flex flex-row"> |
||||
|
<!-- 模块 --> |
||||
|
<a-input placeholder="标题code" v-model="titleCode" /> |
||||
|
<a-button @click="handleTableChange" class="mx-2" type="primary">搜索</a-button> |
||||
|
</div> |
||||
|
|
||||
|
<div class="flex-1"></div> |
||||
|
|
||||
|
<a-button @click="showModal" class="editable-add-btn" type="primary">增加</a-button> |
||||
|
|
||||
|
<!-- 添加 --> |
||||
|
<teacher-add :visible="visible" @closeModal="closeModal" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import TeacherAdd from 'components/Teacher/TeacherAdd.vue'; |
||||
|
export default { |
||||
|
name: 'TeacherSearch', |
||||
|
components: { |
||||
|
TeacherAdd |
||||
|
|
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
visible: false, |
||||
|
titleCode: '', |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
showModal() { |
||||
|
this.visible = true; |
||||
|
}, |
||||
|
|
||||
|
closeModal() { |
||||
|
this.visible = false; |
||||
|
}, |
||||
|
|
||||
|
handleTableChange() { |
||||
|
const condition = { titleCode: this.titleCode }; |
||||
|
this.$emit('getPageList', condition); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="stylus"></style> |
@ -0,0 +1,259 @@ |
|||||
|
<template> |
||||
|
<div class="d-flex flex-wrap pb-3"> |
||||
|
<!-- 添加 --> |
||||
|
<a-modal |
||||
|
:mask-closable="false" |
||||
|
@cancel="$emit('closeModal')" |
||||
|
destroy-on-close |
||||
|
footer |
||||
|
title="创业学院修改" |
||||
|
v-model="editVisible" |
||||
|
width="700px" |
||||
|
> |
||||
|
<a-form :form="form" @submit="handleSubmit"> |
||||
|
<!-- 标题 --> |
||||
|
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="标题"> |
||||
|
<a-input |
||||
|
class="ml-3" |
||||
|
placeholder="标题" |
||||
|
v-decorator="[ |
||||
|
'title', |
||||
|
{ |
||||
|
rules: [ |
||||
|
{ required: true, message: '标题不能为空' }, |
||||
|
{ whitespace: true, message: '标题不能为空' }, |
||||
|
{ max: 140, massage: '标题最多140个字符' }, |
||||
|
], |
||||
|
initialValue: title, |
||||
|
}, |
||||
|
]" |
||||
|
/> |
||||
|
</a-form-item> |
||||
|
<!-- 内容链接 --> |
||||
|
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="内容链接"> |
||||
|
<a-input |
||||
|
class="ml-3" |
||||
|
placeholder="内容链接" |
||||
|
v-decorator="[ |
||||
|
'contentUrl', |
||||
|
{ |
||||
|
rules: [ |
||||
|
{ required: true, message: '内容链接不能为空' }, |
||||
|
{ whitespace: true, message: '内容链接不能为空' }, |
||||
|
{ max: 300, massage: '内容链接最多30个字符' }, |
||||
|
], |
||||
|
initialValue:contentUrl, |
||||
|
}, |
||||
|
]" |
||||
|
/> |
||||
|
</a-form-item> |
||||
|
<!-- 简介 --> |
||||
|
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="简介"> |
||||
|
<a-textarea |
||||
|
class="ml-3" |
||||
|
style="height:80px" |
||||
|
placeholder="简介" |
||||
|
v-decorator="[ |
||||
|
'intro', |
||||
|
{ |
||||
|
rules: [ |
||||
|
{ required: true, message: '简介不能为空' }, |
||||
|
{ whitespace: true, message: '简介不能为空' }, |
||||
|
{ max: 140, massage: '简介最多140个字符' }, |
||||
|
], |
||||
|
initialValue:intro, |
||||
|
}, |
||||
|
]" |
||||
|
/> |
||||
|
</a-form-item> |
||||
|
<!-- 封面图片 --> |
||||
|
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="封面图片"> |
||||
|
<div v-if="editData.picUrl" class="d-flex align-end ml-4"> |
||||
|
<img :src="editData.picUrl" style="height:100px;" alt=""> |
||||
|
<div> |
||||
|
<a-icon @click="deleteFileList" class="ml-5" type="close-circle" /> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<a-upload :action="upload" :before-upload="beforeUpload" @change="handleChange" class="ml-3" list-type="picture" name="files"> |
||||
|
<a-button v-show="fileList.length - 0 === 0"> <a-icon type="upload" />选择封面图片 </a-button> |
||||
|
</a-upload> |
||||
|
</a-form-item> |
||||
|
<!-- 时间 --> |
||||
|
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="时间"> |
||||
|
<a-date-picker :default-value="editData.times" class="ml-3" @change="changeBirthday" show-time /> |
||||
|
</a-form-item> |
||||
|
<!-- 类型 --> |
||||
|
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="类型"> |
||||
|
<a-select |
||||
|
v-decorator="[ 'type', { initialValue:type }, ]" |
||||
|
class="ml-3" default-value="视频" style="width: 100%" |
||||
|
> |
||||
|
<a-select-option :key="index" :value="index + 1" v-for="(item, index) in recStatusList">{{ item }}</a-select-option> |
||||
|
</a-select> |
||||
|
</a-form-item> |
||||
|
<!-- 是否在首页展示 --> |
||||
|
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="是否在首页展示"> |
||||
|
<a-radio-group class="ml-3" |
||||
|
v-decorator="[ 'whetherShow', { initialValue:whetherShow, }, ]" |
||||
|
> |
||||
|
<a-radio :value="0"> 否 </a-radio> |
||||
|
<a-radio :value="1"> 是 </a-radio> |
||||
|
</a-radio-group> |
||||
|
</a-form-item> |
||||
|
<!-- 栏目 --> |
||||
|
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="栏目"> |
||||
|
<a-checkbox-group class="ml-3" @change="onChangeBan"> |
||||
|
<a-checkbox class="my-2" v-for="(item, index) in bannersList" :key="index" :value="item.moldId">{{ item.moldName }}</a-checkbox> |
||||
|
</a-checkbox-group> |
||||
|
</a-form-item> |
||||
|
<a-form-item class="d-flex flex-row-reverse"> |
||||
|
<a-button @click="$emit('closeModal')" class="mr-3">取消</a-button> |
||||
|
<a-button class="white--text" html-type="submit" type="primary">保存</a-button> |
||||
|
</a-form-item> |
||||
|
</a-form> |
||||
|
|
||||
|
</a-modal> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { upload, academyUpdate, queryMold } from 'config/api'; |
||||
|
|
||||
|
const formItemLayout = { |
||||
|
labelCol: { span: 6 }, |
||||
|
wrapperCol: { span: 16 }, |
||||
|
}; |
||||
|
|
||||
|
const tailItemLayout = { wrapperCol: { span: 16, offset: 6 } }; |
||||
|
|
||||
|
export default { |
||||
|
name: 'CollegeEdit', |
||||
|
props: { |
||||
|
editVisible: { type: Boolean, default: false }, |
||||
|
editData: { type: Object, default: () => {} }, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
formItemLayout, |
||||
|
tailItemLayout, |
||||
|
form: this.$form.createForm(this, { name: 'college-edit' }), |
||||
|
upload: upload, |
||||
|
fileList: [], |
||||
|
//限制文件上传的格式和大小 |
||||
|
beforeUpload: file => { |
||||
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; |
||||
|
if (!isJpgOrPng) { |
||||
|
this.$message.error('仅支持 JPG/PNG 格式的图片!'); |
||||
|
} |
||||
|
return isJpgOrPng; |
||||
|
}, |
||||
|
recStatusList: ['视频', '音频', 'PPT'], |
||||
|
bannersList: [], |
||||
|
banner: [], |
||||
|
title: '', |
||||
|
contentUrl: '', |
||||
|
intro: '', |
||||
|
times: '', |
||||
|
type: 1, |
||||
|
whetherShow: 0, |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
|
||||
|
this.getQueryMold(); |
||||
|
// this.from = this.editData |
||||
|
this.title = this.editData.title, |
||||
|
this.contentUrl = this.editData.contentUrl |
||||
|
this.intro = this.editData.intro |
||||
|
this.times = this.editData.times |
||||
|
this.type = this.editData.type |
||||
|
this.whetherShow = this.editData.whetherShow |
||||
|
this.fileList.push(this.editData.coverPicture) |
||||
|
console.log("======>collegeEdit",this.data) |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
// 删除fileList |
||||
|
deleteFileList(){ |
||||
|
console.log("进入事件") |
||||
|
this.fileList = [] |
||||
|
this.editData.picUrl = '' |
||||
|
}, |
||||
|
changeBirthday(date, dateString) { |
||||
|
// console.log(this.$moment(date._e).format('YYYY-MM-DD HH:mm:ss')); |
||||
|
this.times = this.$moment(date._e).format('YYYY-MM-DD HH:mm:ss'); |
||||
|
}, |
||||
|
onChangeBan(e) { |
||||
|
this.banner = e; |
||||
|
console.log(this.banner) |
||||
|
}, |
||||
|
// 上传图片事件 |
||||
|
handleChange(info) { |
||||
|
// this.fileList = fileList; |
||||
|
console.log(info); |
||||
|
if (info.file.status === 'done') { |
||||
|
this.fileList.push(info.file.response.data[0].id); |
||||
|
} else if (info.file.status === 'removed') { |
||||
|
this.fileList = info.fileList; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
async getQueryMold() { |
||||
|
try { |
||||
|
const res = await queryMold(); |
||||
|
const { code, msg, data } = res.data; |
||||
|
if (code === 200) { |
||||
|
this.bannersList = data; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
} catch (error) { |
||||
|
this.$message.error(error); |
||||
|
} |
||||
|
}, |
||||
|
// 提交表单 |
||||
|
handleSubmit(e) { |
||||
|
e.preventDefault(); |
||||
|
this.form.validateFieldsAndScroll(async (err, values) => { |
||||
|
if (!err) { |
||||
|
if (this.fileList.length > 0 || this.editData.picUrl) { |
||||
|
try { |
||||
|
console.log("handleSubmit",values) |
||||
|
this.picId = this.fileList[0]; |
||||
|
const params = { |
||||
|
param: { |
||||
|
academyId: this.editData.academyId, |
||||
|
banners: this.banner, |
||||
|
contentUrl: values.contentUrl, |
||||
|
coverPicture: this.fileList[0] || this.editData.coverPicture, |
||||
|
intro: values.intro, |
||||
|
times: this.times, |
||||
|
title: values.title, |
||||
|
type: values.type, |
||||
|
whetherShow: values.whetherShow, |
||||
|
}, |
||||
|
}; |
||||
|
const res = await academyUpdate(params); |
||||
|
const { data, msg, code } = res.data; |
||||
|
if (code === 200) { |
||||
|
this.$emit('getData'); |
||||
|
this.$emit('closeModal'); |
||||
|
this.$message.success('保存成功'); |
||||
|
} else { |
||||
|
throw msg; |
||||
|
} |
||||
|
} catch (error) { |
||||
|
this.$message.error(error || '添加失败'); |
||||
|
} |
||||
|
} else { |
||||
|
this.$message.error('请上传图片'); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="stylus"></style> |
@ -0,0 +1,70 @@ |
|||||
|
<template> |
||||
|
<div class="pa-3 white fill-height d-flex flex-column"> |
||||
|
<teacher-search @getPageList="getPageList" /> |
||||
|
|
||||
|
<teacher-date :lists="lists" :pagination="pagination" @getPageList="getPageList" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
// import PageSearch from 'components/Page/PageSearch.vue'; |
||||
|
import TeacherDate from 'components/Teacher/TeacherDate.vue'; |
||||
|
import TeacherSearch from 'components/Teacher/TeacherSearch.vue'; |
||||
|
|
||||
|
import { selTeacher,findTeachH } from 'config/api'; |
||||
|
|
||||
|
export default { |
||||
|
name: 'Teacher', |
||||
|
components: { |
||||
|
TeacherSearch, |
||||
|
TeacherDate |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
lists: [], |
||||
|
pagination: { current: 1, pageSize: 10 }, |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
created() { |
||||
|
this.getPageList(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
/** |
||||
|
* 页面列表查询 |
||||
|
* @param { String } pageNum 页码 |
||||
|
* @param { String } pageSize 每页多少条 |
||||
|
* @param { String } titleCode 模块 |
||||
|
*/ |
||||
|
async getPageList(condition) { |
||||
|
try { |
||||
|
const params = { |
||||
|
param: { |
||||
|
pageNum: (condition && condition.current) || 1, |
||||
|
pageSize: (condition && condition.pageSize) || 10, |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
const res = await findTeachH(params); |
||||
|
const { code, msg, data } = res.data; |
||||
|
if (code === 200) { |
||||
|
console.log("selTeacher方法已经走到") |
||||
|
this.lists = data.list; |
||||
|
const paper = { ...this.pagination }; |
||||
|
paper.current = data.pageNum; |
||||
|
paper.total = +data.total; |
||||
|
paper.pageSize = data.pageSize; |
||||
|
this.pagination = paper; |
||||
|
} else { |
||||
|
throw msg || '获取失败'; |
||||
|
} |
||||
|
} catch (error) { |
||||
|
this.$message.error(error); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
}; |
||||
|
</script> |
Loading…
Reference in new issue