jinx hace 1 año
padre
commit
9e96abedf5

+ 78 - 21
packages/admin/src/views/tab5/index.vue

@@ -106,6 +106,7 @@
         </el-dialog>
 
         <el-dialog
+          @close="cancelLevel1ModalForm"
           :visible.sync="level1ModalFormVisible"
           destroy-on-close
           width="30%"
@@ -133,7 +134,7 @@
             </el-form-item>
           </el-form>
           <span slot="footer" class="dialog-footer">
-            <el-button @click="level1ModalFormVisible = false">取 消</el-button>
+            <el-button @click="cancelLevel1ModalForm()">取 消</el-button>
             <el-button type="primary" @click="handleLevel1Submit"
               >确 定</el-button
             >
@@ -144,6 +145,7 @@
         <el-dialog
           destroy-on-close
           :visible.sync="level2ModalFormVisible"
+          @close="cancelLevel2ModalForm()"
           width="30%"
           center
         >
@@ -169,6 +171,7 @@
                 action=""
                 :limit="1"
                 :http-request="handleFileUpload"
+                :before-upload="beforeFileUpload"
                 list-type="picture-card"
                 accept=".jpeg,.jpg,.png,.png"
                 :file-list="level2ModalForm.filelist"
@@ -189,7 +192,7 @@
             </el-form-item>
           </el-form>
           <span slot="footer" class="dialog-footer">
-            <el-button @click="level2ModalFormVisible = false">取 消</el-button>
+            <el-button @click="cancelLevel2ModalForm()">取 消</el-button>
             <el-button type="primary" @click="handleLevel2Submit"
               >确 定</el-button
             >
@@ -231,10 +234,10 @@
               <template #default="{ row }">
                 <!-- <el-button type="text" @click="handleVillageSettings(row.id)"
                   >村落设置</el-button
-                >
-                <el-button type="text" @click="handleLevel2Edit(row.id)"
-                  >编辑</el-button
                 > -->
+                <el-button type="text" @click="handleVillageEdit(row.id)"
+                  >编辑</el-button
+                >
                 <el-popconfirm
                   title="确定删除吗?"
                   @confirm="handleVillageDelete(row.id)"
@@ -249,14 +252,14 @@
         </div>
 
         <el-dialog
-          v-if="showVillageForm"
           :visible.sync="showVillageForm"
           destroy-on-close
           width="30%"
+          @close="cancelVillage"
           center
         >
           <div slot="title" class="lv1-modal-header">
-            <span>新增</span>
+            <span>{{ villageForm?.id ? "新增" : "新增" }}</span>
           </div>
           <el-form
             ref="villageForm"
@@ -273,8 +276,9 @@
                 action=""
                 :limit="1"
                 :http-request="handleVillageFileUpload"
+                :before-upload="beforeFileUpload"
                 list-type="picture-card"
-                accept=".jpeg,.jpg,.png,.png"
+                accept=".jpeg,.jpg,.png"
                 :file-list="villageForm.filelist"
                 :on-remove="handleVillageFileRemove"
               >
@@ -299,7 +303,7 @@
             </el-form-item>
           </el-form>
           <span slot="footer" class="dialog-footer">
-            <el-button @click="showVillageForm = false">取 消</el-button>
+            <el-button @click="cancelVillage">取 消</el-button>
             <el-button type="primary" @click="handleVillageSubmit"
               >确 定</el-button
             >
@@ -319,7 +323,6 @@ import {
   getEntity,
   fileUpload
 } from '@/apis/tab5'
-
 export default {
   name: 'tab5',
   components: {},
@@ -335,7 +338,7 @@ export default {
       level1Modal: false,
       level1ModalFormVisible: false,
       level1ModalForm: {},
-      villageForm: null,
+      villageForm: {},
       showVillageForm: false,
       level1ModalFormRules: {
         name: [{ required: true, message: '请输入名称', trigger: 'change' }],
@@ -371,17 +374,38 @@ export default {
   watch: {},
   // 方法集合
   methods: {
+    cancelLevel1ModalForm () {
+      this.level1ModalFormVisible = false
+      this.handleAllReset()
+    },
+    cancelLevel2ModalForm () {
+      this.level2ModalFormVisible = false
+      this.handleAllReset()
+    },
+    cancelVillage () {
+      this.showVillageForm = false
+      this.villageForm = {
+        name: '',
+        thumb: '',
+        remark: '',
+        link: '',
+        fileList: [],
+        sort: 1
+      }
+    },
     editVillage (add = false) {
       if (add) {
-        this.villageForm = {
-          name: '',
-          thumb: '',
-          remark: '',
-          link: ''
-        }
+        // this.villageForm = {
+        //   name: '',
+        //   thumb: '',
+        //   remark: '',
+        //   link: '',
+        //   fileList: [],
+        //   sort: 1
+        // }
         setTimeout(() => {
           this.showVillageForm = true
-        }, 100)
+        }, 0)
       }
     },
     async handleVillageSettings (id) {
@@ -409,8 +433,7 @@ export default {
               message: res.msg,
               type: 'success'
             })
-            this.villageForm = null
-            this.showVillageForm = false
+            this.cancelVillage()
             await this.getVillageList()
           } else {
             this.$message({
@@ -506,6 +529,26 @@ export default {
       }
       await this.getVillageList()
     },
+
+    async handleVillageEdit (id) {
+      this.showVillageForm = true
+      const res = await getEntity(id)
+      const domain =
+        process.env.NODE_ENV === 'development'
+          ? 'http://project.4dage.com:8016'
+          : ''
+      this.villageForm = {
+        id: res.data.id,
+        name: res.data.name,
+        thumb: res.data.thumb,
+        remark: res.data.remark,
+        link: res.data.link,
+        sort: res.data.sort,
+        filelist: [{ name: 'food.jpg', url: domain + res.data.thumb }]
+      }
+
+      console.log('res', res)
+    },
     async handleLevel1Edit (id) {
       this.level1ModalFormVisible = true
       const res = await getEntity(id)
@@ -522,7 +565,6 @@ export default {
         file: file,
         type: 'thumb'
       })
-      console.log('res', res.data.filePath)
       this.level2ModalForm.thumb = res.data.filePath
     },
     handleVillageFileRemove () {
@@ -536,6 +578,21 @@ export default {
       console.log('res', res.data.filePath)
       this.villageForm.thumb = res.data.filePath
     },
+    beforeFileUpload (file) {
+      const isLt2M = file.size / 1024 / 1024 < 5
+      console.error(file.type)
+      const isFormat =
+        file.type === 'image/jpeg' ||
+        file.type === 'image/jpg' ||
+        file.type === 'image/png'
+      if (!isFormat) {
+        this.$message.error('支持png、jpg格式!')
+      }
+      if (!isLt2M) {
+        this.$message.error('大小不能超过 5MB!')
+      }
+      return isLt2M && isFormat
+    },
     handleLevel2Submit () {
       this.$refs.level2Form.validate(async (valid) => {
         if (valid) {

+ 5 - 5
packages/admin/src/views/tab6/index.vue

@@ -163,7 +163,7 @@ export default {
           { required: true, message: '请输入排序值', trigger: 'blur' }
         ],
         dictId: [
-          { required: true, message: '请输入关键词', trigger: 'blur' }
+          { required: true, message: '请选择关键词', trigger: 'blur' }
         ]
       },
       modalForm: {
@@ -282,10 +282,10 @@ export default {
             })
           }
         } else {
-          this.$message({
-            message: '请检查填写!',
-            type: 'warning'
-          })
+          // this.$message({
+          //   message: '请检查填写!',
+          //   type: 'warning'
+          // })
         }
       })
     }

+ 53 - 42
packages/admin/src/views/tab7/index.vue

@@ -6,9 +6,10 @@
       <div class="search">
         <div class="action-group">
           <!--          <el-button @click="keywordListModalVisible=true">关键词设置</el-button>-->
-          <el-button type="primary" @click="handleModelOpen">自动回复设置</el-button>
+          <el-button type="primary" @click="handleModelOpen"
+            >自动回复设置</el-button
+          >
         </div>
-
       </div>
       <div class="table">
         <el-table :data="tableData" style="width: 100%">
@@ -22,26 +23,32 @@
           <el-table-column prop="updateTime" label="留言时间"></el-table-column>
 
           <el-table-column label="操作">
-
             <template #default="{ row }">
-<!--              <el-button-->
-<!--                type="text"-->
-<!--                @click="handleEdit(row)"-->
-<!--              >编辑-->
-<!--              </el-button>-->
+              <!--              <el-button-->
+              <!--                type="text"-->
+              <!--                @click="handleEdit(row)"-->
+              <!--              >编辑-->
+              <!--              </el-button>-->
               <el-popconfirm
                 title="确定删除吗?"
                 @confirm="handleDelete(row.id)"
               >
-                <el-button slot="reference" type="text" style="padding: 0 5px">删除</el-button>
+                <el-button slot="reference" type="text" style="padding: 0 5px"
+                  >删除</el-button
+                >
               </el-popconfirm>
             </template>
           </el-table-column>
         </el-table>
 
-        <div style="text-align:center;margin-top: 30px">
-          <el-pagination background layout="prev, pager, next,total" :total="total"
-                         :page-size="pagesize" @current-change="currentChange"></el-pagination>
+        <div style="text-align: center; margin-top: 30px">
+          <el-pagination
+            background
+            layout="prev, pager, next,total"
+            :total="total"
+            :page-size="pagesize"
+            @current-change="currentChange"
+          ></el-pagination>
         </div>
       </div>
     </div>
@@ -51,33 +58,45 @@
       destroy-on-close
       width="30%"
       @close="handleAutoReplyReset"
-      center>
+      center
+    >
       <div slot="title" class="lv1-modal-header">
         <span>自动回复</span>
       </div>
-      <el-form ref="replyModalForm" label-position="right" label-width="0px" :model="replyModalForm"
-               :rules="rules">
+      <el-form
+        ref="replyModalForm"
+        label-position="right"
+        label-width="0px"
+        :model="replyModalForm"
+        :rules="rules"
+      >
         <el-form-item label="" prop="msg">
-          <el-input type="textarea" controls-position="right" placeholder="请输入"
-                    v-model="replyModalForm.msg">
-
+          <el-input
+            type="textarea"
+            controls-position="right"
+            placeholder="请输入"
+            v-model="replyModalForm.msg"
+          >
           </el-input>
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
-            <el-button @click="autoReplyModalVisible = false">取 消</el-button>
-            <el-button type="primary" @click="handleSubmit">提 交</el-button>
-        </span>
+        <el-button @click="autoReplyModalVisible = false">取 消</el-button>
+        <el-button type="primary" @click="handleSubmit">提 交</el-button>
+      </span>
     </el-dialog>
 
-<!--    -->
-
+    <!--    -->
   </div>
 </template>
 
 <script>
-
-import { getMessageList, deleteMessage, editReplyMessage, getReplyMessage } from '@/apis/tab7'
+import {
+  getMessageList,
+  deleteMessage,
+  editReplyMessage,
+  getReplyMessage
+} from '@/apis/tab7'
 
 export default {
   name: 'tab7',
@@ -92,14 +111,10 @@ export default {
       currentPage: 1, // 当前页码,
       autoReplyModalVisible: false,
       autoReplyModal: {},
-      rules:
-        {
-          msg: [
-            { required: true, message: '请输入内容', trigger: 'blur' }
-          ]
-        },
+      rules: {
+        msg: [{ required: true, message: '请输入内容', trigger: 'blur' }]
+      },
       replyModalForm: {}
-
     }
   },
   // 监听属性 类似于data概念
@@ -108,6 +123,7 @@ export default {
   methods: {
     async currentChange (currentPage) {
       this.currentPage = currentPage
+      this.handleRefreshList()
     },
     async handleRefreshList () {
       const res = await getMessageList({
@@ -116,7 +132,7 @@ export default {
       })
       // debugger
       this.tableData = res.data.records
-      this.total = res.data.pages
+      this.total = res.data.total
       this.currentPage = res.data.current
       this.pagesize = res.data.size
     },
@@ -131,9 +147,7 @@ export default {
       }
     },
 
-    async handleAutoReplyReset () {
-
-    },
+    async handleAutoReplyReset () {},
 
     async getAutoReplyContent () {
       const res = await getReplyMessage()
@@ -150,8 +164,7 @@ export default {
     async handleSubmit () {
       this.$refs.replyModalForm.validate(async (valid) => {
         if (valid) {
-          if (this.replyModalForm.msg.length > 0
-          ) {
+          if (this.replyModalForm.msg.length > 0) {
             editReplyMessage({
               msg: this.replyModalForm.msg
             })
@@ -168,12 +181,10 @@ export default {
     await this.handleRefreshList()
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted () {
-  }
-
+  mounted () {}
 }
 </script>
-<style lang='less' scoped>
+<style lang="less" scoped>
 .tab7 {
   width: 100%;
   height: 100%;

+ 1 - 1
packages/mobile/src/views/qa/index.vue

@@ -470,7 +470,7 @@ export default {
               align-items: flex-start;
               justify-content: flex-start;
               flex-direction: column;
-              max-width: 40%;
+              max-width: 80%;
               .text {
                 font-size: 0.32rem;
                 color: #303030;

+ 0 - 1
packages/mobile/src/views/topic/index.vue

@@ -75,7 +75,6 @@ export default {
     gotoItem(i) {
       this.secondId = i.id;
       this.secondName = i.name;
-      console.error(this.secondName);
     },
     handleClick(id) {
       this.activeName = String(id);