Jelajahi Sumber

添加群聊

lex 1 tahun lalu
induk
melakukan
9f3a08aa34

+ 5 - 3
src/components/singe-file-upload/index.vue

@@ -144,9 +144,11 @@ export default {
           ];
           this.$emit("update:value", url);
           this.$emit("input", url);
-          this.$emit("inputFile", file);
-          this.$emit("success");
-          // val.data.name
+          this.$emit("inputFile", info.file);
+          this.$emit("success", {
+            fileName: this.dataObj.name,
+            fileSize: info.file.size
+          });
 
           let res = {
             data: {

+ 7 - 0
src/layout/components/AppMain.vue

@@ -415,6 +415,13 @@ export default {
       if (!val) {
         this.activeName = "first";
       }
+    },
+    chatVisible(val) {
+      if (!val) {
+        document
+          .querySelector("#body")
+          .classList.remove("el-popup-parent--hidden");
+      }
     }
   }
 };

+ 75 - 22
src/views/groupChatManager/component/chatList.vue

@@ -1,19 +1,40 @@
 <!--  -->
 <template>
   <div class="m-container">
-    <save-form :inline="true" :model="searchForm" @submit="search" @reset="onReSet" ref="searchForm">
+    <save-form
+      :inline="true"
+      :model="searchForm"
+      @submit="search"
+      @reset="onReSet"
+      ref="searchForm"
+    >
       <el-form-item>
-        <el-input v-model.trim="searchForm.search" clearable @keyup.enter.native="e => {
-            e.target.blur();
-            $refs.searchForm.save();
-            search();
-          }
-          " placeholder="群聊名称"></el-input>
+        <el-input
+          v-model.trim="searchForm.search"
+          clearable
+          @keyup.enter.native="
+            e => {
+              e.target.blur();
+              $refs.searchForm.save();
+              search();
+            }
+          "
+          placeholder="群聊名称"
+        ></el-input>
       </el-form-item>
       <el-form-item prop="groupType">
-        <el-select v-model.trim="searchForm.groupType" clearable filterable placeholder="群聊类型">
-          <el-option v-for="(item, index) in catgGoupTypeList" :key="index" :value="item.value"
-            :label="item.label"></el-option>
+        <el-select
+          v-model.trim="searchForm.groupType"
+          clearable
+          filterable
+          placeholder="群聊类型"
+        >
+          <el-option
+            v-for="(item, index) in catgGoupTypeList"
+            :key="index"
+            :value="item.value"
+            :label="item.label"
+          ></el-option>
         </el-select>
       </el-form-item>
       <el-form-item>
@@ -35,12 +56,30 @@
     </div>
 
     <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
+        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="memo" label="群备注"></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="memo"
+          label="群备注"
+        ></el-table-column>
         <el-table-column align="center" prop="groupType" label="群聊类型">
           <template slot-scope="scope">
             <div>
@@ -55,22 +94,36 @@
             </div>
           </template>
         </el-table-column>
-        <el-table-column align="center" prop="memberNum" label="人数"></el-table-column>
+        <el-table-column
+          align="center"
+          prop="memberNum"
+          label="人数"
+        ></el-table-column>
         <el-table-column align="center" prop="memberNum" label="操作">
           <template slot-scope="scope">
             <div>
               <auth auths="/chatDetail">
-                <el-button type="text" @click="gotoCatDetail(scope.row)">详情</el-button>
+                <el-button type="text" @click="gotoCatDetail(scope.row)"
+                  >详情</el-button
+                >
               </auth>
               <auth auths="imGroup/updateImGroup">
-                <el-button type="text" @click="cancelCat(scope.row)">解散</el-button>
+                <el-button type="text" @click="cancelCat(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" />
+      <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" />
     <eidtCatInfo ref="eidtCatInfo" @getList="getList" />
@@ -113,7 +166,7 @@ export default {
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() { },
+  created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     // 获取分部
@@ -195,7 +248,7 @@ export default {
           });
           this.chioseIdList = this.$helpers.lodash.remove(
             this.chioseIdList,
-            function (item) {
+            function(item) {
               return tableIdList.indexOf(item.id) == -1;
             }
           );

+ 21 - 22
src/views/groupChatManager/component/sysChatList.vue

@@ -12,13 +12,13 @@
         <el-input
           v-model.trim="searchForm.search"
           clearable
-           @keyup.enter.native="
-              (e) => {
-                e.target.blur();
-                $refs.searchForm.save();
-                search();
-              }
-            "
+          @keyup.enter.native="
+            e => {
+              e.target.blur();
+              $refs.searchForm.save();
+              search();
+            }
+          "
           placeholder="群聊名称"
         ></el-input>
       </el-form-item>
@@ -147,7 +147,7 @@ export default {
     return {
       searchForm: {
         search: null,
-        groupType: "",
+        groupType: ""
       },
       catgGoupTypeList,
       tableList: [],
@@ -157,12 +157,12 @@ export default {
         limit: 10, // 限制显示条数
         page: 1, // 当前页
         total: 0, // 总条数
-        page_size: [10, 20, 40, 50], // 选择限制显示条数
+        page_size: [10, 20, 40, 50] // 选择限制显示条数
       },
       addMuiscVisible: false,
       multipleSelection: [],
       chioseIdList: [],
-      isNewPage: false,
+      isNewPage: false
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -189,16 +189,16 @@ export default {
         const res = await getSysGroupList({
           ...this.searchForm,
           page: this.rules.page,
-          rows: this.rules.limit,
+          rows: this.rules.limit
         });
         this.tableList = res.data.rows;
         this.rules.total = res.data.total;
-        let idList = this.chioseIdList.map((group) => {
+        let idList = this.chioseIdList.map(group => {
           return group.id;
         });
         this.isNewPage = true;
         this.$nextTick(() => {
-          this.tableList.forEach((course) => {
+          this.tableList.forEach(course => {
             if (idList.indexOf(course.id) != -1) {
               this.$refs.multipleSelection.toggleRowSelection(course, true);
             }
@@ -235,12 +235,12 @@ export default {
         );
       } else {
         if (this.isNewPage) return;
-        let idList = this.chioseIdList.map((group) => {
+        let idList = this.chioseIdList.map(group => {
           return group.id;
         });
         this.$nextTick(() => {
           let tableIdList = [];
-          this.tableList.forEach((group) => {
+          this.tableList.forEach(group => {
             tableIdList.push(group.id);
             if (idList.indexOf(group.id) != -1) {
               this.$refs.multipleSelection.toggleRowSelection(group, false);
@@ -248,7 +248,7 @@ export default {
           });
           this.chioseIdList = this.$helpers.lodash.remove(
             this.chioseIdList,
-            function (item) {
+            function(item) {
               return tableIdList.indexOf(item.id) == -1;
             }
           );
@@ -263,7 +263,7 @@ export default {
       this.$refs.multipleSelection.clearSelection();
     },
     onTableSelect(rows, row) {
-      let idList = this.chioseIdList.map((group) => {
+      let idList = this.chioseIdList.map(group => {
         return group.id;
       });
       if (idList.indexOf(row.id) != -1) {
@@ -279,15 +279,14 @@ export default {
     gotoCatDetail(row) {
       this.$router.push({
         path: "/operateManager/chatDetail",
-        query: { imGroupId: row.id, name: row.name },
+        query: { imGroupId: row.id, name: row.name }
       });
       console.log(row);
     },
     addChat() {
       this.$refs.addChatForm.openDioag();
-    },
-  },
+    }
+  }
 };
 </script>
-<style lang='scss' scoped>
-</style>
+<style lang="scss" scoped></style>

+ 14 - 6
src/views/groupChatManager/model/eidtPostMsg.vue

@@ -59,6 +59,7 @@
               () => {
                 formes.fileUrl = '';
                 formes.fileName = '';
+                formes.fileSize = 0;
               }
             "
           >
@@ -76,7 +77,7 @@
             tips="仅支持上传 PNG/JPG"
             accept=".png, .jpg"
             v-model="formes.fileUrl"
-            @getName="getName"
+            @success="onFileSuccess"
           />
         </el-form-item>
         <el-form-item
@@ -89,7 +90,7 @@
             tips="仅支持上传PDF文件"
             accept=".pdf"
             v-model="formes.fileUrl"
-            @getName="getName"
+            @success="onFileSuccess"
           />
         </el-form-item>
       </el-form>
@@ -112,7 +113,8 @@ export default {
         sendTime: "",
         messageContent: "",
         messageType: "TXT",
-        fileName: ""
+        fileName: "",
+        fileSize: 0
       },
       lookVisible: false,
       chioseIdList: null,
@@ -149,7 +151,8 @@ export default {
         sendTime: "",
         messageContent: "",
         messageType: "",
-        fileName: ""
+        fileName: "",
+        fileSize: 0
       };
       this.$refs["eidtPostMsg"].resetFields();
       this.lookVisible = false;
@@ -189,8 +192,13 @@ export default {
         }
       });
     },
-    getName(val) {
-      this.formes.fileName = val.data.name;
+    // getName(val) {
+    //   this.formes.fileName = val.data.name;
+    //   console.log(val, "fileName");
+    // },
+    onFileSuccess(val) {
+      this.formes.fileName = val.fileName;
+      this.formes.fileSize = val.fileSize;
     },
     payDate() {
       let self = this;