guhongwei %!s(int64=4) %!d(string=hai) anos
pai
achega
4811a7f66c

+ 5 - 0
src/components/common/Sidebar.vue

@@ -91,6 +91,11 @@ export default {
           index: 'links',
           title: '友情链接',
         },
+        {
+          icon: 'el-icon-video-camera',
+          index: 'videomeet',
+          title: '视频会议',
+        },
       ],
     };
   },

+ 120 - 0
src/components/frame/uploaddock.vue

@@ -0,0 +1,120 @@
+<template>
+  <div id="upload">
+    <el-upload
+      v-if="url"
+      ref="upload"
+      :action="url"
+      :list-type="listType"
+      :file-list="fileList"
+      :limit="limit"
+      :on-exceed="outLimit"
+      :on-preview="handlePictureCardPreview"
+      :before-remove="handleRemove"
+      :on-success="onSuccess"
+      :before-upload="beforeUpload"
+      :show-file-list="showList"
+      :accept="accept"
+    >
+      <el-button size="small" type="primary" v-if="isBtn">点击上传</el-button>
+      <template v-else-if="uploadBtn">
+        <el-button type="danger">选择文件</el-button>
+      </template>
+      <template v-else>
+        <el-button type="primary" size="mini">选择文件</el-button>
+      </template>
+      <template #tip v-if="tip">
+        {{ tip }}
+      </template>
+    </el-upload>
+    <el-dialog :visible.sync="dialogVisible">
+      <img width="100%" :src="dialogImageUrl" alt="" />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import _ from 'lodash';
+export default {
+  name: 'upload',
+  props: {
+    url: { type: null },
+    limit: { type: Number },
+    data: { type: null },
+    type: { type: String },
+    isBtn: { type: Boolean, default: false },
+    uploadBtn: { type: Boolean, default: false },
+    showList: { type: Boolean, default: true },
+    accept: { type: String, default: '' },
+    tip: { type: String, default: undefined },
+    listType: { type: String, default: 'picture-card' },
+  },
+  components: {},
+  data: () => ({
+    dialogVisible: false,
+    dialogImageUrl: '',
+    fileList: [],
+  }),
+  created() {
+    if (this.data) {
+      this.defalutProcess(this.data);
+    }
+  },
+  watch: {
+    data: {
+      handler(val) {
+        this.defalutProcess(val);
+      },
+    },
+  },
+  computed: {},
+  methods: {
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = false;
+    },
+    handleRemove(file, fileList) {
+      console.log(file.url, fileList);
+      // let index = fileList.findIndex(f => _.isEqual(f, file));
+      this.$emit('delete', file.url);
+      // return true;
+    },
+    outLimit() {
+      this.$message.error(`只允许上传${this.limit}个文件`);
+    },
+    onSuccess(response, file, fileList) {
+      //将文件整理好传回父组件
+      this.$emit('upload', { type: this.type, data: { ...response, name: file.name } });
+    },
+    beforeUpload(file) {
+      const sizeLimit = file.size / 1024 / 1024 < 10;
+      if (sizeLimit) return true;
+      else {
+        this.$message.error('文件超出10M!');
+        return false;
+      }
+    },
+    defalutProcess(val) {
+      if (_.isArray(val)) {
+        let newArr = val.map(item => {
+          let object = {};
+          object.name = item.name;
+          object.url = item.url;
+          return object;
+        });
+        this.$set(this, `fileList`, newArr);
+      } else if (_.isObject(val)) {
+        let object = {};
+        if (_.get(val, `url`)) {
+          object.name = val.name;
+          object.url = val.url;
+          this.$set(this, `fileList`, [object]);
+        }
+      } else if (typeof val === 'string') {
+        this.$set(this, `fileList`, [{ name: '附件', url: val }]);
+      }
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 5 - 0
src/router/index.js

@@ -50,6 +50,11 @@ export default new Router({
           component: () => import('../views/links/index.vue'),
           meta: { title: '友情链接' },
         },
+        {
+          path: '/videomeet',
+          component: () => import('../views/videomeet/index.vue'),
+          meta: { title: '视频会议' },
+        },
       ],
     },
     {

+ 2 - 0
src/store/index.js

@@ -9,6 +9,7 @@ import connews from './connews';
 import concolumn from './concolumn';
 import trainnews from './trainnews';
 import traincolumn from './traincolumn';
+import videomeet from './videomeet';
 
 Vue.use(Vuex);
 
@@ -24,5 +25,6 @@ export default new Vuex.Store({
     concolumn,
     trainnews,
     traincolumn,
+    videomeet,
   },
 });

+ 54 - 0
src/store/videomeet.js

@@ -0,0 +1,54 @@
+//第一步
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  //接口地址
+  repair: `/api/servicealtai/videomeet`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  //查询列表 skip:第一页,limit:第一页显示的数据,info:其余查询参数
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    //连接接口。。。。
+    const res = await this.$axios.$get(`${api.repair}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    //把数据集合res返回
+    return res;
+  },
+  //创建数据  payload是添加form表单中的数据集合  创建数据的时候需要拿到form表单里面的数据
+  async create({ commit }, payload) {
+    //通过$axios提交post请求????
+    const res = await this.$axios.$post(`${api.repair}`, payload);
+    return res;
+  },
+  //查询详情,payload:参数位,一般传当前数据id
+  async fetch({ commit }, payload) {
+    //有/一般都是路径
+    const res = await this.$axios.$get(`${api.repair}/${payload}`);
+    return res;
+  },
+  //修改:id: 当前数据id, data: 当前修改数据的新form表单
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.repair}/update/${id}`, data);
+    return res;
+  },
+  //删除:payload:参数位,一般传当前数据id
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.repair}/${payload}`);
+    return res;
+  },
+};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 185 - 0
src/views/videomeet/index.vue

@@ -0,0 +1,185 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main">
+        <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
+        <el-col :span="24" class="container info">
+          <el-col :span="24" class="top">
+            <el-button type="primary" size="mini" @click="dialog = true">添加</el-button>
+          </el-col>
+          <el-col :span="24" class="list">
+            <data-table :fields="fields" :opera="opera" :data="list" :total="total" @edit="toEdit" @delete="toDelete" @query="search"></data-table>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+    <el-dialog :visible.sync="dialog" title="增加" @close="toClose" :destroy-on-close="true" width="50%">
+      <data-form :data="form" :fields="formFields" :rules="rules" @save="turnSave" v-if="!loading">
+        <template #custom="{item,form}">
+          <template v-if="item.model == 'picture'">
+            <upload
+              :limit="1"
+              :data="form.picture"
+              type="picture"
+              listType=""
+              :url="'/files/picture/upload'"
+              @upload="uploadSuccess"
+              @delete="uploadDelete"
+            ></upload>
+          </template>
+        </template>
+      </data-form>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import breadcrumb from '@c/common/breadcrumb.vue';
+import dataTable from '@/components/frame/filter-page-table.vue';
+import dataForm from '@/components/frame/form.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+import upload from '@/components/frame/uploaddock.vue';
+const { mapActions: videomeet } = createNamespacedHelpers('videomeet');
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'index',
+  props: {},
+  components: {
+    breadcrumb,
+    dataTable,
+    dataForm,
+    upload,
+  },
+  data: function() {
+    return {
+      opera: [
+        {
+          label: '修改',
+          method: 'edit',
+        },
+        {
+          label: '删除',
+          method: 'delete',
+        },
+      ],
+      fields: [
+        { label: '名称', prop: 'title', filter: 'input', showTip: true },
+        { label: '来源', prop: 'orgin', showTip: true },
+        { label: '简介', prop: 'brief', showTip: true },
+        { label: '发布时间', prop: 'create_time', showTip: true },
+      ],
+      list: [],
+      total: 0,
+      // 增加
+      dialog: false,
+      formFields: [
+        { label: '名称', required: true, model: 'title' },
+        { label: '来源', required: false, model: 'orgin' },
+        { label: '发布时间', required: false, model: 'create_time', type: 'date' },
+        { label: '视频', required: false, model: 'picture', custom: true },
+        { label: '简介', required: false, model: 'brief', type: 'textarea' },
+        { label: '内容', required: false, model: 'content', type: 'editor' },
+      ],
+      form: {},
+      rules: {
+        title: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+      },
+      loading: false,
+    };
+  },
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...videomeet(['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);
+      }
+    },
+    // 修改
+    async toEdit({ data }) {
+      let res = await this.fetch(data.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+        this.loading = false;
+        this.dialog = true;
+      }
+    },
+    // 删除
+    async toDelete({ data }) {
+      this.$confirm('您确定要删除此信息吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(async () => {
+          const res = await this.delete(data.id);
+          if (this.$checkRes(res)) {
+            this.$message({
+              message: '删除数据成功',
+              type: 'success',
+            });
+            this.search();
+          }
+        })
+        .catch(() => {});
+    },
+    // 增加
+    // 保存
+    async turnSave({ data }) {
+      if (data.id) {
+        let res = await this.update(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '修改数据成功',
+            type: 'success',
+          });
+          this.dialog = false;
+          location.reload();
+        }
+      } else {
+        let res = await this.create(data);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '添加数据成功',
+            type: 'success',
+          });
+          this.dialog = false;
+          location.reload();
+        }
+      }
+    },
+    // 取消增加
+    toClose() {
+      this.form = {};
+      this.dialog = false;
+    },
+    uploadSuccess({ type, data }) {
+      this.$set(this.form, `${type}`, data.uri);
+    },
+    uploadDelete(index) {
+      this.$set(this.form, `picture`, null);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .info {
+    .top {
+      text-align: right;
+      margin: 15px 0;
+    }
+  }
+}
+</style>