|
@@ -1,20 +1,149 @@
|
|
<template>
|
|
<template>
|
|
<div id="aRoadShow">
|
|
<div id="aRoadShow">
|
|
- <p>aRoadShow</p>
|
|
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-col :span="24" class="leftTop"> <span>|</span> <span>项目路演</span> </el-col>
|
|
|
|
+ <el-col :span="24" class="info">
|
|
|
|
+ <template v-if="view == 'list'">
|
|
|
|
+ <el-col :span="24" class="add">
|
|
|
|
+ <el-button type="primary" size="mini" @click="view = 'detail'">添加信息</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" class="list">
|
|
|
|
+ <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit" @delete="toDelete"></data-table>
|
|
|
|
+ </el-col>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-col :span="24" class="back">
|
|
|
|
+ <el-button type="primary" size="mini" @click="toBack()">返回</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <data-form :fields="fields" v-model="form" @save="toSave">
|
|
|
|
+ <template #custom="{item, form}">
|
|
|
|
+ <template v-if="item.model === 'picture'">
|
|
|
|
+ <upload
|
|
|
|
+ :limit="1"
|
|
|
|
+ :data="form.picture"
|
|
|
|
+ type="picture"
|
|
|
|
+ :url="'/files/imgpath/upload'"
|
|
|
|
+ @upload="uploadSuccess"
|
|
|
|
+ @delete="uploadDelete"
|
|
|
|
+ ></upload>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="item.model === 'filepath'">
|
|
|
|
+ <upload
|
|
|
|
+ :limit="1"
|
|
|
|
+ :data="form.filepath"
|
|
|
|
+ type="filepath"
|
|
|
|
+ listType=""
|
|
|
|
+ :url="'/files/imgpath/upload'"
|
|
|
|
+ @upload="uploadSuccess"
|
|
|
|
+ @delete="uploadDelete"
|
|
|
|
+ ></upload>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
|
|
+ </data-form>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-col>
|
|
|
|
+ </template>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import dataTable from '@common/src/components/frame/filter-page-table.vue';
|
|
|
|
+import dataForm from '@common/src/components/frame/vform.vue';
|
|
|
|
+import upload from '@common/src/components/frame/upload.vue';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
+const { mapActions: roadShow } = createNamespacedHelpers('roadShow');
|
|
export default {
|
|
export default {
|
|
name: 'aRoadShow',
|
|
name: 'aRoadShow',
|
|
props: {},
|
|
props: {},
|
|
- components: {},
|
|
|
|
|
|
+ components: { dataTable, dataForm, upload },
|
|
data: function() {
|
|
data: function() {
|
|
- return {};
|
|
|
|
|
|
+ return {
|
|
|
|
+ view: 'list',
|
|
|
|
+ opera: [
|
|
|
|
+ {
|
|
|
|
+ label: '编辑',
|
|
|
|
+ method: 'edit',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: '删除',
|
|
|
|
+ type: 'danger',
|
|
|
|
+ method: 'delete',
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ fields: [
|
|
|
|
+ { label: '信息标题', prop: 'title', model: 'title', filter: true },
|
|
|
|
+ { label: '来源', prop: 'origin', model: 'origin' },
|
|
|
|
+ { label: '图片', model: 'picture', custom: true, notable: true },
|
|
|
|
+ { label: '视频', model: 'filepath', custom: true, notable: true },
|
|
|
|
+ { label: '发布时间', prop: 'publish_time', model: 'publish_time', type: 'date' },
|
|
|
|
+ { label: '简介', prop: 'brief', model: 'brief', type: 'textarea' },
|
|
|
|
+ ],
|
|
|
|
+ list: [],
|
|
|
|
+ total: 0,
|
|
|
|
+ form: {},
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.search();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ ...roadShow(['query', 'create', 'update', 'delete']),
|
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
|
+ const res = await this.query({ skip, limit, ...info });
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async toSave() {
|
|
|
|
+ const dup = _.cloneDeep(this.form);
|
|
|
|
+ let res;
|
|
|
|
+ if (dup._id) {
|
|
|
|
+ res = await this.update(dup);
|
|
|
|
+ } else {
|
|
|
|
+ dup.dock_id = this.user.id;
|
|
|
|
+ res = await this.create(dup);
|
|
|
|
+ }
|
|
|
|
+ if (this.$checkRes(res, '嘉宾访谈保存成功', res.errmsg || '嘉宾访谈保存失败')) {
|
|
|
|
+ this.search();
|
|
|
|
+ this.toBack();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ toEdit({ data }) {
|
|
|
|
+ this.view = 'detail';
|
|
|
|
+ this.$set(this, `form`, data);
|
|
|
|
+ },
|
|
|
|
+ toDelete({ data }) {
|
|
|
|
+ this.$confirm('您确定要删除此用户吗?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ .then(async () => {
|
|
|
|
+ const res = await this.delete(data._id);
|
|
|
|
+ if (this.$checkRes(res, '嘉宾访谈删除成功', res.errmsg || '嘉宾访谈删除失败')) {
|
|
|
|
+ this.search();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
|
|
+ },
|
|
|
|
+ toBack() {
|
|
|
|
+ this.view = 'list';
|
|
|
|
+ this.form = {};
|
|
|
|
+ },
|
|
|
|
+ uploadSuccess({ type, data }) {
|
|
|
|
+ this.$set(this.form, `${type}`, data.uri);
|
|
|
|
+ },
|
|
|
|
+ uploadDelete({ type }) {
|
|
|
|
+ this.$set(this.form, type, null);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- created() {},
|
|
|
|
- methods: {},
|
|
|
|
computed: {
|
|
computed: {
|
|
...mapState(['user', 'menuParams']),
|
|
...mapState(['user', 'menuParams']),
|
|
pageTitle() {
|
|
pageTitle() {
|
|
@@ -27,4 +156,28 @@ export default {
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style lang="less" scoped></style>
|
|
|
|
|
|
+<style lang="less" scoped>
|
|
|
|
+.leftTop {
|
|
|
|
+ font-size: 18px;
|
|
|
|
+ width: 96%;
|
|
|
|
+ height: 41px;
|
|
|
|
+ line-height: 35px;
|
|
|
|
+ border-bottom: 1px solid #e5e5e5;
|
|
|
|
+ position: relative;
|
|
|
|
+ bottom: 1px;
|
|
|
|
+ margin: 10px;
|
|
|
|
+ font-weight: 600;
|
|
|
|
+ color: #22529a;
|
|
|
|
+}
|
|
|
|
+.info {
|
|
|
|
+ padding: 0 40px 0 10px;
|
|
|
|
+ .add {
|
|
|
|
+ text-align: right;
|
|
|
|
+ padding: 10px 0;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.back {
|
|
|
|
+ text-align: right;
|
|
|
|
+ padding: 10px 0;
|
|
|
|
+}
|
|
|
|
+</style>
|