yinchengnuo 4 жил өмнө
parent
commit
1ffb4e8d37

+ 1 - 1
package.json

@@ -85,7 +85,7 @@
     "chalk": "2.4.2",
     "chokidar": "2.1.5",
     "connect": "3.6.6",
-    "element-ui": "^2.12.0",
+    "element-ui": "^2.13.1",
     "eslint": "5.15.3",
     "eslint-plugin-vue": "5.2.2",
     "html-webpack-plugin": "3.2.0",

+ 0 - 2
public/index.html

@@ -31,8 +31,6 @@
   </head>
 
   <body>
-    <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
-    <script src="https://yinchengnuo.com/static/china.js"></script>
     <div id="app"></div>
   </body>
 </html>

+ 2 - 0
src/api/cl.js

@@ -8,3 +8,5 @@ export const api_getShortList = params => request({ url: '/show?page=1', method:
 export const api_addShort = params => request({ url: '/created', method: 'get', params })
 export const api_updateShort = params => request({ url: '/created', method: 'get', params })
 export const api_delShort = params => request({ url: '/deleted', method: 'get', params })
+
+export const api_mark = params => request({ url: '/sign', method: 'get', params })

+ 4 - 1
src/main.js

@@ -30,7 +30,10 @@ Vue.prototype.$request = function(api, fun, conf) {
   } else {
     api.then(({ code, message, data }) => { // 发送网络请求
       code === 200 ? fun(data) : this.$message.error(message)
-    }).catch(() => this.$message.error((conf && conf.errorMsg) || '操作失败')).finally(() => (conf && conf.endStillLoading) || this._loading.close())
+    }).catch(() => {
+      this.$message.error((conf && conf.errorMsg) || '操作失败')
+      this._loading.close()
+    }).finally(() => (conf && conf.endStillLoading) || this._loading.close())
   }
 }
 

+ 73 - 24
src/views/PageIndex/index.vue

@@ -23,6 +23,13 @@
           <el-table-column prop="imgList" align="center" label="详情">
             <template slot-scope="scope">
               <el-button type="primary" @click.stop="detail(scope.row)">详情</el-button>
+              <el-button v-if="+scope.row.important === 0" type="success" @click.stop="handlerImportant(scope.$index, scope.row)">标记重要</el-button>
+              <el-button v-else type="info" @click.stop="handlerCancelImportant(scope.$index, scope.row)">取消标记</el-button>
+            </template>
+          </el-table-column>
+          <el-table-column prop="imgList" align="center" label="标记" width="65">
+            <template slot-scope="scope">
+              <i v-if="+scope.row.important === 1" class="el-icon-star-on" style="color: red; font-size: 40px;" />
             </template>
           </el-table-column>
         </el-table>
@@ -48,6 +55,39 @@
           <el-table-column prop="imgList" align="center" label="详情">
             <template slot-scope="scope">
               <el-button type="primary" @click.stop="detail(scope.row)">详情</el-button>
+              <el-button v-if="+scope.row.important === 0" type="success" @click.stop="handlerImportant(scope.$index, scope.row)">标记重要</el-button>
+              <el-button v-else type="info" @click.stop="handlerCancelImportant(scope.$index, scope.row)">取消标记</el-button>
+            </template>
+          </el-table-column>
+          <el-table-column prop="imgList" align="center" label="标记" width="65">
+            <template slot-scope="scope">
+              <i v-if="+scope.row.important === 1" class="el-icon-star-on" style="color: red; font-size: 40px;" />
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
+      <el-tab-pane label="已标记">
+        <el-table ref="table3" :data="list" border stripe style="width: 100%">
+          <el-table-column prop="time" align="center" label="反馈时间" />
+          <el-table-column v-if="!phone" prop="channel" align="center" label="反馈渠道" />
+          <el-table-column prop="avatar" align="center" label="微信头像">
+            <template slot-scope="scope">
+              <img class="avatar" :src="scope.row.avatar" :alt="scope.row.nickname">
+            </template>
+          </el-table-column>
+          <el-table-column prop="nickname" align="center" label="微信昵称" />
+          <el-table-column v-if="!phone" prop="nickname" align="center" label="性别">
+            <template slot-scope="scope">
+              <span v-if="scope.row.sex === '1'">男</span>
+              <span v-else-if="scope.row.sex === '0'">女</span>
+              <span v-else>-</span>
+            </template>
+          </el-table-column>
+          <el-table-column v-if="!phone" prop="address" align="center" label="所在地区" />
+          <el-table-column prop="imgList" align="center" label="详情">
+            <template slot-scope="scope">
+              <el-button type="primary" @click.stop="detail(scope.row)">详情</el-button>
+              <el-button type="info" @click.stop="handlerCancelImportant(scope.$index, scope.row)">取消标记</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -62,8 +102,9 @@
           <el-image v-for="(url, index) in detailItem.imgList" :key="index" style="width: 120px; height: 200px; margin-right: 8px;" :src="url" :preview-src-list="detailItem.imgList" @click="preview(index)" />
         </div>
         <div v-else style="text-align: center; margin: 24px;">无</div>
-        <div v-if="query.type === '1'" class="feedback-img" style="text-align: center; font-size: 18px; line-height: 2; font-weight: bold; border-top: 1px solid #dfe6ec; border-bottom: 1px solid #dfe6ec;">回复文字</div>
-        <div v-if="query.type === '1'" style="font-size: 16px; text-indent: 2em; line-height: 1.5; margin: 24px;">{{ detailItem.reply }}</div>
+        <div v-if="query.type !== '0'" class="feedback-img" style="text-align: center; font-size: 18px; line-height: 2; font-weight: bold; border-top: 1px solid #dfe6ec; border-bottom: 1px solid #dfe6ec;">回复文字</div>
+        <div v-if="query.type !== '0' && detailItem.reply" style="font-size: 16px; text-indent: 2em; line-height: 1.5; margin: 24px;">{{ detailItem.reply }}</div>
+        <div v-if="!detailItem.reply" style="font-size: 16px; line-height: 1.5; margin: 24px; text-align: center;">未回复</div>
       </div>
       <div slot="footer" class="dialog-footer">
         <el-button @click="dialogDetail = false">关 闭</el-button>
@@ -83,6 +124,7 @@
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
+        <el-checkbox v-model="form.important" :border="true" size="medium" style="margin-right: 24px;">标记为重要</el-checkbox>
         <el-button @click="dialogReply = false">取 消</el-button>
         <el-button type="primary" @click="reply">确 定</el-button>
       </div>
@@ -117,7 +159,7 @@
 </template>
 
 <script>
-import { api_getClList, api_replyCl, api_getShortList, api_addShort, api_updateShort, api_delShort } from '@/api/cl'
+import { api_getClList, api_replyCl, api_getShortList, api_addShort, api_updateShort, api_delShort, api_mark } from '@/api/cl'
 export default {
   name: 'PageIndex',
   data() {
@@ -139,7 +181,8 @@ export default {
       form: {
         id: '',
         select: [],
-        value: ''
+        value: '',
+        important: false
       },
       e: ['😀', '😃', '😄', '😁', '😆', '😅', '🤣', '😂', '🙂', '🙃', '😉', '😊', '😇', '🥰', '😍', '🤩', '😘', '😗', '😚', '😙', '😋', '😛', '😜', '🤪', '😝', '🤑', '🤗', '🤭', '🤫', '🤔', '🤐', '🤨', '😐', '😑', '😶', '😏', '😒', '🙄', '😬', '🤥', '😌', '😔', '😪', '🤤', '😴', '😷', '🤒', '🤕', '🤢', '🤮', '🤧', '🥵', '🥶', '🥴', '😵', '🤯', '🤠', '🥳', '😎', '🤓', '🧐', '😕', '😟', '🙁', '😮', '😯', '😲', '😳', '🥺', '😦', '😧', '😨', '😰', '😥', '😢', '😭', '😱', '😖', '😣', '😞', '😓', '😩', '😫', '🥱', '😤', '😡', '😠', '🤬', '😈', '👿', '💀', '☠', '💩', '🤡', '👹', '👺', '👻', '👽', '👾', '🤖', '😺', '😸', '😹', '😻', '😼', '😽', '🙀', '😿', '😾', '🙈', '🙉', '🙊', '💋', '💌', '💘', '💝', '💖', '💗', '💓', '💞', '💕', '💟', '❣', '💔', '❤', '🧡', '💛', '💚', '💙', '💜', '🤎', '🖤', '🤍', '💯', '💢', '💥', '💫', '💦', '💨', '🕳', '💣', '💬', '👁️‍🗨️', '🗨', '🗯', '💭', '💤', '👋', '🤚', '🖐', '✋', '🖖', '👌', '🤏', '✌', '🤞', '🤟', '🤘', '🤙', '👈', '👉', '👆', '🖕', '👇', '☝', '👍', '👎', '✊', '👊', '🤛', '🤜', '👏', '🙌']
     }
@@ -158,21 +201,33 @@ export default {
     }
   },
   methods: {
-    onAddInput({ data }) { // 当输入新增短语时
-      console.log(data)
-      this.willAddShort = data
+    handlerImportant(index, { id }) {
+      this.$confirm('此操作将此条反馈标记为重要, 是否继续?', '提示').then(() => {
+        this.$request(api_mark({ id, important: '1' }), () => {
+          this.getData()
+          this.$message.success('标记成功!')
+        }, { endStillLoading: true })
+      }).catch(() => this.$message.info('已取消标记'))
     },
-    addShort() {
+    handlerCancelImportant(index, { id }) {
+      this.$confirm('此操作将此条反馈取消标记重要, 是否继续?', '提示').then(() => {
+        this.$request(api_mark({ id, important: '0' }), () => {
+          this.getData()
+          this.$message.success('取消标记成功!')
+        }, { endStillLoading: true })
+      }).catch(() => this.$message.info('已取消'))
+    },
+    addShort() { // 点击添加短句
       this.willAddShort = ''
       this.dialogAddShortType = 'add'
       this.dialogAddShort = true
     },
-    editShort({ id, body }) {
+    editShort({ id, body }) { // 点击编辑短句
       this.willAddShort = body
       this.dialogAddShortType = id
       this.dialogAddShort = true
     },
-    delShort({ id }) {
+    delShort({ id }) { // 点击删除短句
       this.$confirm('此操作将删除该短语, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -184,7 +239,7 @@ export default {
         }, { endStillLoading: true })
       }).catch(() => this.$message.info('已取消删除'))
     },
-    submitShort() {
+    submitShort() { // 点击提交短句
       if (!this.willAddShort.trim().length) {
         this.$message.error('新增快捷短语不能为空')
         return
@@ -202,40 +257,34 @@ export default {
     manageShorts() { // 点击快捷短语管理
       this.dialogShorts = true
     },
-    onInput({ data }) {
-      this.form.value = data
-    },
-    clearTextarea() {
-      this.$refs.emoji.clear()
-    },
-    getData() {
+    getData() { // 获取数据接口
       this.$request([api_getClList({ type: this.query.type, page: this.page }), api_getShortList()], ([{ total, list }, { list: select }]) => {
         this.total = total
         this.list = list
         this.form.select = select
       })
     },
-    handleReply() {
+    handleReply() { // 点击回复
       this.form.id = this.detailItem.id
       this.form.value = ''
       this.dialogReply = true
     },
-    reply() {
+    reply() { // 提交回复
       if (!this.form.value) {
         this.$message.info('请输入回复内容')
         return
       }
-      this.$request(api_replyCl({ value: this.form.value, id: this.form.id }), () => {
+      this.$request(api_replyCl({ value: this.form.value, id: this.form.id, important: this.form.important ? '1' : '0' }), () => {
         this.getData()
         this.dialogReply = false
         this.dialogDetail = false
       }, { endStillLoading: true })
     },
-    detail(detailItem) {
+    detail(detailItem) { // 点击详情
       this.detailItem = detailItem
       this.dialogDetail = true
     },
-    preview(index) {
+    preview(index) { // 点击图片预览
       this.$nextTick(() => {
         Array(index).fill(0).forEach(() => document.getElementsByClassName('el-image-viewer__next')[0].click())
         document.getElementsByClassName('el-image-viewer__mask')[0].onclick = ({ target }) => {
@@ -243,7 +292,7 @@ export default {
         }
       })
     },
-    pageChange(page) {
+    pageChange(page) { // 换页
       this.page = page
       this.getData()
     }