浏览代码

直播间推广

1
mo 3 年之前
父节点
当前提交
ff27000b47

+ 1 - 0
src/components/singe-file-upload/index.vue

@@ -98,6 +98,7 @@ export default {
         this.$emit('update:value', res.data.url)
         this.$emit('input', res.data.url)
         this.$emit('inputFile', file)
+        this.$emit('getName',res)
       } else {
         this.remove()
         this.$message.error(res.msg || '上传失败')

+ 2 - 0
src/router/index.js

@@ -554,6 +554,8 @@ export const asyncRoutes = {
   agentList:()=>import('@/views/agentManager/agentList'),
   // 团练宝分润
   memberShareList:()=>import('@/views/agentManager/memberShareList'),
+  // 群组管理
+  groupChatManager:()=>import('@/views/groupChatManager')
 }
 
 export default router

+ 2 - 1
src/router/notKeepAliveList.js

@@ -121,5 +121,6 @@ export default [
   '/platformAdminManger', // 平台员工管理
   '/studentManager/smallStudentManager',
   '/memberShareList',
-  '/agentList'
+  '/agentList',
+  '/groupChatManager', // 群组管理
 ]

+ 40 - 0
src/views/groupChatManager/api.js

@@ -0,0 +1,40 @@
+
+import request from '@/utils/request2'
+import qs from 'qs'
+let api = '/api-web'
+
+
+
+// 获取群组列表 1 3层
+export function getGroupList(data) {
+  return request({
+    url: api + '/imSendGroupMessage/queryGroupPage',
+    method: 'POST',
+    // params: data,
+    requestType: 'form',
+    data
+  })
+}
+
+// 发送群聊消息
+export function sendGroupMsg(data) {
+  return request({
+    url: api + '/imSendGroupMessage/send',
+    method: 'POST',
+    // params: data,
+    // requestType: 'form',
+    data
+  })
+}
+
+
+// 获取群消息列表
+export function getGroupMessageList(data) {
+  return request({
+    url: api + '/imSendGroupMessage/queryPage',
+    method: 'POST',
+    // params: data,
+    requestType: 'form',
+    data
+  })
+}

+ 204 - 0
src/views/groupChatManager/component/chatList.vue

@@ -0,0 +1,204 @@
+<!--  -->
+<template>
+  <div class="m-container">
+    <save-form
+      :inline="true"
+      :model="searchForm"
+      @submit="search"
+      @reset="onReSet"
+    >
+      <el-form-item>
+        <el-input
+          v-model.trim="searchForm.search"
+          clearable
+          @keyup.enter.native="search"
+          placeholder="群组名称"
+        ></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button native-type="submit" type="primary">搜索</el-button>
+        <el-button native-type="reset" type="danger">重置</el-button>
+      </el-form-item>
+    </save-form>
+    <auth auths="news/add">
+      <el-button @click="postMsg" type="primary" style="margin-bottom: 20px">
+        消息群发
+      </el-button>
+    </auth>
+    <div class="tableWrap">
+      <el-table
+        style="width: 100%"
+        :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+        :data="tableList"
+        @selection-change="handleSelectionChange"
+        @select="onTableSelect"
+        ref="multipleSelection"
+      >
+        <el-table-column type="selection" width="55"> </el-table-column>
+        <el-table-column
+          align="center"
+          prop="id"
+          label="群组"
+        ></el-table-column>
+        <el-table-column
+          align="center"
+          prop="name"
+          label="群组名称"
+        ></el-table-column>
+        <el-table-column
+          align="center"
+          prop="memberNum"
+          label="人数"
+        ></el-table-column>
+      </el-table>
+      <pagination
+        sync
+        :total.sync="rules.total"
+        :page.sync="rules.page"
+        :limit.sync="rules.limit"
+        :page-sizes="rules.page_size"
+        @pagination="getList"
+      />
+    </div>
+    <eidtPostMsg ref='eidtPostMsg' @clear="clearCom"/>
+  </div>
+</template>
+<script>
+import axios from "axios";
+import { getToken } from "@/utils/auth";
+import pagination from "@/components/Pagination/index";
+import load from "@/utils/loading";
+import { getTimes } from "@/utils";
+import { getGroupList } from "../api";
+import eidtPostMsg from '../model/eidtPostMsg'
+export default {
+  components: { pagination,eidtPostMsg },
+  data() {
+    return {
+      searchForm: {
+        search: null,
+      },
+
+      tableList: [],
+      organList: [],
+      rules: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+      addMuiscVisible: false,
+      multipleSelection: [],
+      chioseIdList: [],
+      isNewPage: false,
+    };
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+    // 获取分部
+
+    this.init();
+  },
+  methods: {
+    init() {
+      this.getList();
+    },
+    async getList() {
+      // let { timer, ...rest } = this.searchForm;
+      // let params = {
+      //   ...rest,
+      //   page: this.rules.page,
+      //   rows: this.rules.limit,
+      //   ...getTimes(timer, ["startTime", "endTime"]),
+      // };
+      try {
+        const res = await getGroupList({
+          ...this.searchForm,
+          page: this.rules.page,
+          rows: this.rules.limit,
+        });
+        this.tableList = res.data.rows;
+        this.rules.total = res.data.total;
+        let idList = this.chioseIdList.map((group) => {
+          return group.id;
+        });
+        this.isNewPage = true;
+        this.$nextTick(() => {
+          this.tableList.forEach((course) => {
+            if (idList.indexOf(course.id) != -1) {
+            this.$refs.multipleSelection.toggleRowSelection(course, true);
+            }
+          });
+          this.isNewPage = false;
+        });
+      } catch (e) {
+        console.log(e);
+      }
+    },
+    search() {
+      this.rules.page = 1;
+      this.getList();
+    },
+    onReSet() {
+      this.searchForm.search =
+      this.clearCom()
+    },
+    postMsg() {
+      if (!this.chioseIdList || this.chioseIdList.length <= 0) {
+        this.$message.error("请至少选择一个群组");
+        return;
+      }
+      this.$refs.eidtPostMsg.openDioag(this.chioseIdList)
+    },
+    handleSelectionChange(val) {
+      if (val.length > 0) {
+        this.chioseIdList = this.chioseIdList.concat(val);
+        this.chioseIdList = this.$helpers.lodash.uniqBy(this.chioseIdList, "id");
+      } else {
+        if (this.isNewPage) return;
+        let idList = this.chioseIdList.map((group) => {
+          return group.id;
+        });
+        this.$nextTick(() => {
+          let tableIdList = [];
+          this.tableList.forEach((group) => {
+            tableIdList.push(group.id);
+            if (idList.indexOf(group.id) != -1) {
+              this.$refs.multipleSelection.toggleRowSelection(group, false);
+            }
+          });
+          this.chioseIdList = this.$helpers.lodash.remove(
+            this.chioseIdList,
+            function (item) {
+              return tableIdList.indexOf(item.id) == -1;
+            }
+          );
+          if (this.chioseIdList.length <= 0) {
+            this.clearCom();
+          }
+        });
+      }
+    },
+    clearCom() {
+      this.chioseIdList = [];
+      this.$refs.multipleSelection.clearSelection();
+    },
+    onTableSelect(rows, row) {
+      let idList = this.chioseIdList.map((group) => {
+        return group.id;
+      });
+      if (idList.indexOf(row.id) != -1) {
+        this.chioseIdList.splice(idList.indexOf(row.id), 1);
+        if (this.chioseIdList.length <= 0) {
+          this.clearCom();
+        }
+      }
+    },
+  },
+};
+</script>
+<style lang='scss' scoped>
+</style>

+ 169 - 0
src/views/groupChatManager/component/timingMsgList.vue

@@ -0,0 +1,169 @@
+<!--  -->
+<template>
+  <div class="m-container">
+    <save-form
+      :inline="true"
+      :model="searchForm"
+      @submit="search"
+      @reset="onReSet"
+    >
+      <el-form-item>
+        <el-select
+          v-model.trim="searchForm.sendFlag"
+          placeholder="状态"
+        >
+          <el-option label="已发送" :value="true"></el-option>
+          <el-option label="未发送" :value="false"> </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button native-type="submit" type="primary">搜索</el-button>
+        <el-button native-type="reset" type="danger">重置</el-button>
+      </el-form-item>
+    </save-form>
+    <div class="tableWrap">
+      <el-table
+        style="width: 100%"
+        :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+        :data="tableList"
+      >
+        <el-table-column
+          align="sendTime"
+          prop="id"
+          label="发送时间"
+        ></el-table-column>
+        <el-table-column
+          align="center"
+          prop="name"
+          label="创建人"
+        ></el-table-column>
+        <el-table-column
+          align="center"
+          prop="messageContent"
+          label="发送内容"
+        ></el-table-column>
+        <el-table-column
+          align="center"
+          prop="fileName"
+          label="附件名称"
+        ></el-table-column>
+        <el-table-column align="center" prop="sendFlag" label="状态">
+          <template slot-scope="scope">
+            <div>
+              {{ scope.row.sendFlag ? "已发送" : "未发送" }}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" prop="id" label="操作">
+          <template slot-scope="scope">
+            <div>
+              <auth auths="musicGroupQuestionnaire/get">
+                <el-button type="text" @click="lookGroup(scope.row)"
+                  >查看群主</el-button
+                >
+              </auth>
+              <auth
+                :auths="[
+                  'musicGroupQuestionnaire/get',
+                  'musicGroupQuestionnaire/update',
+                ]"
+                mulit
+              >
+                <el-button type="text" @click="resetGroup(scope.row)"
+                  >修改</el-button
+                >
+              </auth>
+              <auth auths="musicGroupQuestionnaire/del">
+                <el-button type="text" @click="deleteGroup(scope.row)"
+                  >删除</el-button
+                >
+              </auth>
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        sync
+        :total.sync="rules.total"
+        :page.sync="rules.page"
+        :limit.sync="rules.limit"
+        :page-sizes="rules.page_size"
+        @pagination="getList"
+      />
+    </div>
+  </div>
+</template>
+<script>
+import axios from "axios";
+import { getToken } from "@/utils/auth";
+import pagination from "@/components/Pagination/index";
+import load from "@/utils/loading";
+import { getTimes } from "@/utils";
+import { getGroupMessageList } from "../api";
+export default {
+  components: { pagination },
+  data() {
+    return {
+      searchForm: {
+        sendFlag: null,
+      },
+
+      tableList: [],
+      organList: [],
+      rules: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+    };
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+    // 获取分部
+
+    this.init();
+  },
+  methods: {
+    init() {
+      this.getList();
+    },
+    async getList() {
+      // let { timer, ...rest } = this.searchForm;
+      // let params = {
+      //   ...rest,
+      //   page: this.rules.page,
+      //   rows: this.rules.limit,
+      //   ...getTimes(timer, ["startTime", "endTime"]),
+      // };
+      try {
+        const res = await getGroupMessageList({
+          ...this.searchForm,
+          page: this.rules.page,
+          rows: this.rules.limit,
+        });
+        this.tableList = res.data.rows;
+        this.rules.total = res.data.total;
+      } catch (e) {
+        console.log(e);
+      }
+    },
+    search() {
+      this.rules.page = 1;
+      this.getList();
+    },
+    onReSet() {
+      this.searchForm.sendFlag = null;
+      this.search()
+    },
+    lookGroup(row) {},
+    resetGroup(row) {},
+    deleteGroup(row) {},
+  },
+};
+</script>
+<style lang='scss' scoped>
+</style>

+ 58 - 0
src/views/groupChatManager/index.vue

@@ -0,0 +1,58 @@
+
+<!--  -->
+<template>
+  <div class="m-container">
+    <h2>
+      <div class="squrt"></div>
+      群组管理
+    </h2>
+
+    <div class="m-core">
+      <tab-router
+        v-model.trim="activeIndex"
+        type="card"
+        @tab-click="handleClick"
+      >
+        <el-tab-pane label="群聊管理" lazy name="1">
+          <chatList v-if="activeIndex === '1'" />
+          <!-- <dayList v-if="activeIndex === '1'&& permission('/childrensDay')" /> -->
+        </el-tab-pane>
+        <el-tab-pane label="定时消息" lazy name="2">
+          <timingMsgList v-if="activeIndex === '2'"/>
+          <!-- <resetDays v-if="activeIndex === '2'&& permission('/resetDays')" /> -->
+        </el-tab-pane>
+      </tab-router>
+    </div>
+  </div>
+</template>
+
+<script>
+import chatList from './component/chatList'
+import timingMsgList from './component/timingMsgList'
+import { permission } from "@/utils/directivePage";
+export default {
+  components:{
+    chatList,
+    timingMsgList
+  },
+  data() {
+    return {
+      activeIndex: "1",
+    };
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+    // 获取分部
+  },
+  methods: {
+    permission,
+    handleClick(evt) {
+      // this.changeHash(evt.name);
+    },
+  },
+};
+</script>
+<style lang='scss' scoped>
+</style>

+ 171 - 0
src/views/groupChatManager/model/eidtPostMsg.vue

@@ -0,0 +1,171 @@
+<template>
+  <div>
+    <el-dialog
+      width="500px"
+      title="消息发送"
+      :visible.sync="lookVisible"
+      :before-close="onClose"
+    >
+      <el-form :model="formes" label-width="120px" ref="eidtPostMsg">
+        <el-form-item
+          label="发送方式"
+          :rules="[{ required: true, message: '请选择发送方式' }]"
+          prop="postType"
+        >
+          <el-radio-group
+            v-model="formes.postType"
+            @change="
+              () => {
+                formes.sendTime = '';
+              }
+            "
+          >
+            <el-radio label="0">即时发送</el-radio>
+            <el-radio label="1">定时发送</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item
+          label="发送时间"
+          v-if="formes.postType == '1'"
+          :rules="[{ required: true, message: '请选择发送时间' }]"
+          prop="sendTime"
+        >
+          <el-date-picker
+            v-model="formes.sendTime"
+            type="datetime"
+            placeholder="请选择发送时间"
+            format="yyyy-MM-dd HH:mm:ss"
+            value-format="yyyy-MM-dd HH:mm:ss"
+          >
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item
+          label="发送内容"
+          :rules="[{ required: true, message: '请输入发送内容' }]"
+          prop="messageContent"
+        >
+          <el-input
+            class="w100"
+            v-model="formes.messageContent"
+            type="textarea"
+            :rows="3"
+          ></el-input>
+        </el-form-item>
+        <el-form-item
+          label="消息类型"
+          prop="messageType"
+        >
+          <el-radio-group
+            v-model="formes.messageType"
+            @change="
+              () => {
+                formes.fileUrl = '';
+                formes.fileName = ''
+              }
+            "
+          >
+            <el-radio label="IMG">图片消息</el-radio>
+            <el-radio label="FILE">文件消息</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item
+          label="附件(图片)"
+          prop="fileUrl"
+          v-if="formes.messageType === 'IMG'"
+           :rules="[{ required: true, message: '请上传图片' }]"
+        >
+          <singe-file-upload
+            tips="仅支持上传 PNG/JPG"
+            accept=".png, .jpg"
+            v-model="formes.fileUrl"
+            @getName="getName"
+          />
+        </el-form-item>
+        <el-form-item label="附件(PDF)" prop="fileUrl"  v-if="formes.messageType === 'FILE'"  :rules="[{ required: true, message: '请上传文件' }]">
+          <singe-file-upload
+            tips="仅支持上传PDF文件"
+            accept=".pdf"
+            v-model="formes.fileUrl"
+             @getName="getName"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="onClose">取 消</el-button>
+        <el-button type="primary" @click="submitMsg">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { sendGroupMsg  } from '../api'
+export default {
+  name: "eidtPostMsg",
+  data() {
+    return {
+      formes: {
+        id: "",
+        postType: "0",
+        sendTime: "",
+        messageContent: "",
+        messageType: "",
+        fileName:''
+      },
+      lookVisible: false,
+      chioseIdList: null,
+    };
+  },
+
+  mounted() {
+    this.init();
+  },
+  methods: {
+    init() {},
+    openDioag(chioseIdList) {
+      this.chioseIdList = chioseIdList;
+      this.lookVisible = true;
+    },
+    onClose() {
+      this.formes = {
+        id: "",
+        postType: "0",
+        sendTime: "",
+        messageContent: "",
+        messageType: "",
+        fileName:''
+      };
+      this.$refs["eidtPostMsg"].resetFields();
+      this.lookVisible = false;
+    },
+    submitMsg() {
+      this.$refs.eidtPostMsg.validate(async (flag) => {
+        if (flag) {
+          try {
+            let idList = this.chioseIdList
+              .map((group) => {
+                return group.id;
+              })
+              .join(",");
+            let obj = { ...this.formes, targetIds: idList };
+            const res = await sendGroupMsg({ ...obj });
+            this.$message.success('发送成功')
+            this.$emit('clear')
+            this.onClose()
+          } catch (e) {
+            console.log(e);
+          }
+        }
+      });
+    },
+    getName(val){
+
+      this.formes.fileName = val.data.name
+    }
+  },
+};
+</script>
+<style lang="scss" scoped>
+.w100 {
+  width: 100%;
+}
+</style>

+ 1 - 1
src/views/liveClassManager/index.vue

@@ -124,7 +124,7 @@
           <el-table-column align="center" prop="studentId" label="操作">
             <template slot-scope="scope">
               <div>
-                <auth auths="imLiveBroadcastRoom/roomDestroy">
+                <auth auths="imLiveBroadcastRoom/opsPopularize">
                   <el-button type="text" @click="popularizeRoom(scope.row)">{{
                     scope.row.popularize == 1 ? "取消推广" : "首页推广"
                   }}</el-button>