guhongwei 4 vuotta sitten
vanhempi
commit
b1876d2034

+ 22 - 0
src/router/index.js

@@ -126,6 +126,28 @@ export default new Router({
           component: () => import('../views/roadshow/detail.vue'),
           meta: { title: '项目路演信息管理' },
         },
+        // 嘉宾访谈
+        {
+          path: '/interview',
+          component: () => import('../views/interview/index.vue'),
+          meta: { title: '嘉宾访谈' },
+        },
+        {
+          path: '/interview/detail',
+          component: () => import('../views/interview/detail.vue'),
+          meta: { title: '嘉宾访谈信息管理' },
+        },
+        // 通知管理
+        {
+          path: '/notice',
+          component: () => import('../views/notice/index.vue'),
+          meta: { title: '通知管理' },
+        },
+        {
+          path: '/notice/detail',
+          component: () => import('../views/notice/detail.vue'),
+          meta: { title: '通知信息管理' },
+        },
       ],
     },
     {

+ 6 - 0
src/store/index.js

@@ -23,6 +23,10 @@ import column from '@common/src/store/column';
 import news from '@common/src/store/news';
 // 项目路演
 import roadShow from '@common/src/store/roadShow';
+// 嘉宾访谈
+import interview from '@common/src/store/interview';
+// 通知管理
+import notice from '@common/src/store/notice';
 // 字典表
 import category from '@common/src/store/category';
 import code from '@common/src/store/code';
@@ -45,6 +49,8 @@ export default new Vuex.Store({
     column,
     news,
     roadShow,
+    interview,
+    notice,
     category,
     code,
     place,

+ 132 - 0
src/views/interview/detail.vue

@@ -0,0 +1,132 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="back">
+          <el-button type="primary" size="mini" @click="back">返回</el-button>
+        </el-col>
+        <el-col :span="24" class="detail">
+          <data-form :data="form" :fields="formFields" :rules="rules" @save="toSave">
+            <template #custom="{item,form}">
+              <template v-if="item.model == 'picture'">
+                <upload :limit="1" :data="form.picture" type="picture" :url="'/files/picture/upload'" @upload="uploadSuccess" @delete="uploadDelete"></upload>
+              </template>
+              <template v-else-if="item.model == 'filepath'">
+                <upload
+                  :limit="1"
+                  :data="form.filepath"
+                  listType=""
+                  type="filepath"
+                  :url="'/files/filepath/upload'"
+                  @upload="uploadSuccess"
+                  @delete="uploadDelete"
+                ></upload>
+              </template>
+            </template>
+          </data-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import dataForm from '@common/src/components/frame/form.vue';
+import upload from '@common/src/components/frame/upload.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: interview } = createNamespacedHelpers('interview');
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'detail',
+  props: {},
+  components: {
+    dataForm,
+    upload,
+  },
+  data: function() {
+    return {
+      formFields: [
+        { label: '信息标题', model: 'title' },
+        { label: '信息来源', model: 'origin' },
+        { label: '发布时间', model: 'publish_time', type: 'date' },
+        { label: '信息简介', model: 'brief', type: 'textarea' },
+        { label: '图片文件', model: 'picture', custom: true },
+        { label: '视频文件', model: 'filepath', custom: true },
+        { label: '信息内容', model: 'content', type: 'editor' },
+      ],
+      form: {},
+      rules: {
+        title: [{ required: true, message: '请输入信息标题' }],
+        origin: [{ required: true, message: '请输入信息来源' }],
+        publish_time: [{ required: true, message: '请输入发布时间' }],
+      },
+    };
+  },
+  async created() {
+    if (this.id) await this.search();
+  },
+  methods: {
+    ...interview(['fetch', 'create', 'update']),
+    // 查询详情
+    async search() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    // 提交
+    async toSave({ data }) {
+      data.user_id = this.user.id;
+      if (data.id) {
+        let res = await this.update(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '信息修改成功',
+            type: 'success',
+          });
+          this.back();
+        }
+      } else {
+        let res = await this.create(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '信息创建成功',
+            type: 'success',
+          });
+          this.back();
+        }
+      }
+    },
+    // 返回
+    back() {
+      this.$router.push({ path: '/interview' });
+    },
+    // 图片上传
+    uploadSuccess({ type, data }) {
+      this.$set(this.form, `${type}`, data.uri);
+    },
+    // 删除图片
+    uploadDelete(data) {
+      this.$set(this.form, `${data.type}`, null);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .back {
+    text-align: right;
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 94 - 0
src/views/interview/index.vue

@@ -0,0 +1,94 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="top">
+          <el-button type="primary" size="mini" @click="add">添加</el-button>
+        </el-col>
+        <el-col :span="24" class="down">
+          <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit" @delete="toDelete"></data-table>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import dataTable from '@common/src/components/frame/filter-page-table.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: interview } = createNamespacedHelpers('interview');
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'index',
+  props: {},
+  components: { dataTable },
+  data: function() {
+    return {
+      opera: [
+        {
+          label: '编辑',
+          method: 'edit',
+        },
+        {
+          label: '删除',
+          method: 'delete',
+        },
+      ],
+      fields: [
+        { label: '信息标题', prop: 'title', filter: 'input' },
+        { label: '信息来源', prop: 'origin' },
+        { label: '发布时间', prop: 'publish_time' },
+      ],
+      list: [],
+      total: 0,
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...interview(['query', 'fetch', 'create', 'update', 'delete']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 修改
+    toEdit({ data }) {
+      this.$router.push({ path: '/interview/detail', query: { id: data.id } });
+    },
+    // 删除
+    async toDelete({ data }) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息删除成功',
+          type: 'success',
+        });
+        this.search();
+      }
+    },
+    // 添加数据
+    add() {
+      this.$router.push({ path: '/interview/detail' });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .top {
+    text-align: right;
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 1 - 0
src/views/live/detail.vue

@@ -103,6 +103,7 @@ export default {
         let res = await this.fetch(this.id);
         if (this.$checkRes(res)) {
           this.$set(this, `form`, res.data);
+          this.changeshenge(res.data.province);
         }
       }
     },

+ 100 - 0
src/views/notice/detail.vue

@@ -0,0 +1,100 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="back">
+          <el-button type="primary" size="mini" @click="back">返回</el-button>
+        </el-col>
+        <el-col :span="24" class="detail">
+          <data-form :data="form" :fields="formFields" :rules="rules" @save="toSave"> </data-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import dataForm from '@common/src/components/frame/form.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: notice } = createNamespacedHelpers('notice');
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'detail',
+  props: {},
+  components: {
+    dataForm,
+  },
+  data: function() {
+    return {
+      formFields: [
+        { label: '信息标题', model: 'title' },
+        { label: '信息来源', model: 'source' },
+        { label: '信息内容', model: 'content', type: 'editor' },
+      ],
+      form: {},
+      rules: {
+        title: [{ required: true, message: '请输入信息标题' }],
+        source: [{ required: true, message: '请输入信息来源' }],
+      },
+    };
+  },
+  async created() {
+    if (this.id) await this.search();
+  },
+  methods: {
+    ...notice(['fetch', 'create', 'update']),
+    // 查询详情
+    async search() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    // 提交
+    async toSave({ data }) {
+      data.user_id = this.user.id;
+      if (data.id) {
+        let res = await this.update(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '信息修改成功',
+            type: 'success',
+          });
+          this.back();
+        }
+      } else {
+        let res = await this.create(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '信息创建成功',
+            type: 'success',
+          });
+          this.back();
+        }
+      }
+    },
+    // 返回
+    back() {
+      this.$router.push({ path: '/notice' });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .back {
+    text-align: right;
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 189 - 0
src/views/notice/index.vue

@@ -0,0 +1,189 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="top">
+          <el-button type="primary" size="mini" @click="add">添加</el-button>
+        </el-col>
+        <el-col :span="24" class="down">
+          <data-table
+            :fields="fields"
+            :opera="opera"
+            :data="list"
+            :total="total"
+            @query="search"
+            @check="toCheck"
+            @edit="toEdit"
+            @delete="toDelete"
+          ></data-table>
+        </el-col>
+      </el-col>
+    </el-row>
+    <el-dialog title="通知信息启用设置" width="40%" :visible.sync="dialog" @closed="handleClose" :destroy-on-close="true">
+      <div class="form">
+        <p>
+          <el-radio-group v-model="form.isenable">
+            <el-radio label="1">启用</el-radio>
+            <el-radio label="2">禁用</el-radio>
+          </el-radio-group>
+          <el-button type="primary" size="mini" @click="toSave">保存</el-button>
+        </p>
+        <p>{{ form.title }}</p>
+        <p>
+          <span>来源:{{ form.source }}</span>
+          <span>发布时间:{{ form.create_time }}</span>
+        </p>
+        <p v-html="form.content"></p>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import dataTable from '@common/src/components/frame/filter-page-table.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: notice } = createNamespacedHelpers('notice');
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'index',
+  props: {},
+  components: { dataTable },
+  data: function() {
+    return {
+      opera: [
+        {
+          label: '启用&禁用',
+          method: 'check',
+        },
+        {
+          label: '编辑',
+          method: 'edit',
+        },
+        {
+          label: '删除',
+          method: 'delete',
+        },
+      ],
+      fields: [
+        { label: '信息标题', prop: 'title', filter: 'input' },
+        { label: '信息来源', prop: 'source' },
+        { label: '发布时间', prop: 'create_time' },
+        {
+          label: '是否启用',
+          prop: 'isenable',
+          format: item => {
+            return item === '0' ? '未启用' : item === '1' ? '启用' : '禁用';
+          },
+        },
+      ],
+      list: [],
+      total: 0,
+      // 启用禁用信息
+      dialog: false,
+      form: {},
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...notice(['query', 'fetch', 'create', 'update', 'delete']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 修改
+    toEdit({ data }) {
+      this.$router.push({ path: '/notice/detail', query: { id: data.id } });
+    },
+    // 删除
+    async toDelete({ data }) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '信息删除成功',
+          type: 'success',
+        });
+        this.search();
+      }
+    },
+    // 添加数据
+    add() {
+      this.$router.push({ path: '/notice/detail' });
+    },
+    // 启动&禁用,
+    toCheck({ data }) {
+      this.$set(this, `form`, data);
+      this.dialog = true;
+    },
+    // 取消
+    handleClose() {
+      this.form = {};
+      this.dialog = false;
+      this.search();
+    },
+    // 保存
+    async toSave() {
+      let data = this.form;
+      let arr = await this.query();
+      let notice = arr.data.filter(i => i.isenable == '1');
+      if (notice.length > 0 && data.isenable == '1') {
+        alert('已有信息启用');
+      } else {
+        let res = await this.update(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '启用&禁用信息成功',
+            type: 'success',
+          });
+          this.handleClose();
+        }
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .top {
+    text-align: right;
+    margin: 0 0 10px 0;
+  }
+}
+.form {
+  p:first-child {
+    text-align: center;
+    padding: 20px 0;
+    /deep/.el-radio__inner {
+      width: 25px;
+      height: 25px;
+      top: -4px;
+    }
+    /deep/.el-radio__label {
+      font-size: 25px;
+    }
+    .el-button {
+      margin: 0 0 0 15px;
+    }
+  }
+  p:nth-child(2) {
+    text-align: center;
+    font-size: 30px;
+  }
+  p:nth-child(3) {
+    text-align: center;
+    font-size: 20px;
+    padding: 20px 0;
+  }
+}
+</style>