Forráskód Böngészése

feature:首页增加消息回复提醒、完成回复之后返回首页

liuzhenlin 1 éve
szülő
commit
512768daf5
6 módosított fájl, 241 hozzáadás és 8 törlés
  1. 16 0
      api/follow/index.js
  2. 7 0
      pages.json
  3. 12 1
      pages/home/index.vue
  4. 197 0
      pages/home/reply.vue
  5. BIN
      static/images/user_avatar.png
  6. 9 7
      store/index.js

+ 16 - 0
api/follow/index.js

@@ -23,4 +23,20 @@ export default {
   getListByDay(query) {
     return micro_request.postRequest(basePath, 'FollowUp', 'GetListByDay', query)
   },
+  // 跟进记录详情
+  getListByDay(query) {
+    return micro_request.postRequest(basePath, 'FollowUp', 'GetListByDay', query)
+  },
+  // 获取待回复信息
+  getNeedReplyComments(query) {
+    return micro_request.postRequest(basePath, 'FollowUpComment', 'GetNeedReplyComments', query)
+  },
+  // 回复信息
+  onReply(query) {
+    return micro_request.postRequest(basePath, 'FollowUpComment', 'Reply', query)
+  },
+  // 检测是否需要回复
+  getIsNeedReply(query) {
+    return micro_request.postRequest(basePath, 'FollowUpComment', 'GetNeedReplyCount', query)
+  },
 }

+ 7 - 0
pages.json

@@ -233,6 +233,13 @@
         "navigationStyle": "custom"
       },
       "tit": "合作伙伴详情"
+    },
+    {
+      "path": "pages/home/reply",
+      "style": {
+        "navigationStyle": "custom"
+      },
+      "tit": "评论回复"
     }
   ],
   "tabBar": {

+ 12 - 1
pages/home/index.vue

@@ -178,6 +178,7 @@
 <script>
   import indexApi from '@/api/system/index.js'
   import homeApi from '@/api/home'
+  import followApi from '@/api/follow/index'
   import to from 'await-to-js'
   export default {
     name: 'omsIndex',
@@ -234,17 +235,27 @@
       this.getHomeConfig()
     },
     onShow() {
+      this.getIsNeedReply()
       this.getReport('week')
     },
 
     methods: {
+      async getIsNeedReply() {
+        const [err, res] = await to(followApi.getIsNeedReply())
+        if (err) return
+        if (res && res.data.total > 0) {
+          uni.redirectTo({
+            url: '/pages/home/reply',
+          })
+        }
+      },
       // 获取首页新增数据
       async getReport(type) {
         this.tabDate = type
         let params = { viewInterval: this.tabDate }
         const [err, res] = await to(homeApi.getReportData(params))
         if (err) return
-        if (res.code == 200) {
+        if (res && res.code == 200) {
           this.newCustomer = res.data.newCustomer
           this.newBusiness = res.data.newBusiness
           this.newTask = res.data.newTask

+ 197 - 0
pages/home/reply.vue

@@ -0,0 +1,197 @@
+<!--
+ * @Author: liuzhenlin 461480418@qq.ocm
+ * @Date: 2023-01-12 11:57:48
+ * @LastEditors: liuzhenlin
+ * @LastEditTime: 2023-05-22 15:31:58
+ * @Description: file content
+ * @FilePath: \oms\pages\distributor\index.vue
+-->
+<template>
+  <view class="home">
+    <view class="nav">
+      <view :style="{ paddingTop }">
+        <view class="title" :style="[{ height }, { lineHeight: height }]">
+          <text>评论回复</text>
+        </view>
+      </view>
+    </view>
+    <view class="main">
+      <view class="flex top-tips">
+        <u-text type="error" text="*请先回复完以下评论"></u-text>
+        <u-text type="primary" :text="'待回复信息' + replyIndex + '/' + commentList.length"></u-text>
+      </view>
+      <transition-group name="fade" tag="view">
+        <view class="comment-wrap" v-show="replyIndex - 1 == i" v-for="(v, i) in commentList" :key="i">
+          <view class="header flex">
+            <u-image
+              :src="require('../../static/images/user_avatar.png')"
+              width="40px"
+              height="40px"
+              shape="circle"></u-image>
+            <view class="name">{{ v.createdName }}</view>
+          </view>
+          <view class="content-wrap">
+            <view class="content">
+              <u-text :text="v.content"></u-text>
+            </view>
+            <view class="flex">
+              <text>{{ parseTime(v.createdTime, '{y}-{m}-{d} {h}:{i}') }}</text>
+            </view>
+            <view class="replyText">
+              <u-textarea v-model="replyContent" height="100" placeholder="回复内容:"></u-textarea>
+              <view style="float: right; margin: 20px 0 0">
+                <u-button :loading="loading" customStyle="width:60px" type="primary" @click="handleReply(v)">
+                  回复
+                </u-button>
+              </view>
+            </view>
+          </view>
+        </view>
+      </transition-group>
+    </view>
+  </view>
+</template>
+<script>
+  import followApi from '@/api/follow/index'
+  import to from 'await-to-js'
+  export default {
+    name: 'omsIndex',
+    components: {},
+    data() {
+      return {
+        height: '',
+        paddingTop: '',
+        commentList: [],
+        replyIndex: 1,
+        replyContent: '',
+        loading: false,
+      }
+    },
+    created() {
+      const navData = uni.getMenuButtonBoundingClientRect()
+      this.height = navData.height + 'px'
+      this.paddingTop = navData.top + 'px'
+    },
+    onShow() {
+      this.getCommentList()
+    },
+    methods: {
+      async getCommentList() {
+        const [err, res] = await to(followApi.getNeedReplyComments())
+        if (err) return
+        if (res && res.code == 200) {
+          this.commentList = res.data.list
+        }
+      },
+      async handleReply(row) {
+        if (!this.replyContent) {
+          return this.$u.toast('请输入回复内容')
+        }
+        const params = {
+          followId: '' + row.followId,
+          content: this.replyContent,
+          pid: row.id,
+        }
+        this.loading = true
+        const [err, res] = await to(followApi.onReply(params))
+        this.loading = false
+        if (err) return
+        if (res && res.code == 200) {
+          this.replyContent = ''
+          if (this.replyIndex < this.commentList.length) {
+            this.replyIndex++
+            return this.$u.toast('回复成功,请继续回复下一条')
+          }
+          this.$u.toast('已全部回复,即将返回首页')
+          setTimeout(() => {
+            uni.switchTab({ url: '/pages/home/index' })
+          }, 2000)
+        }
+      },
+    },
+  }
+</script>
+<style>
+  page {
+    background: #f2f3f5;
+  }
+</style>
+<style lang="scss" scoped>
+  .home {
+    padding-top: 188rpx;
+    .nav {
+      position: absolute;
+      left: 0;
+      top: 0;
+      width: 100%;
+      height: 284rpx;
+      background: #3e7ef8;
+      .title {
+        position: relative;
+        text-align: center;
+        font-size: 32rpx;
+        font-weight: bold;
+        color: #ffffff;
+        .back {
+          position: absolute;
+          top: 0;
+          bottom: 0;
+          margin: auto;
+          left: 70rpx;
+          display: flex;
+        }
+      }
+    }
+    .main {
+      position: absolute;
+      width: 100%;
+      height: calc(100vh - 188rpx);
+      background: #f5f5f5;
+      box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
+      border-radius: 31rpx 31rpx 0 0;
+      padding: 0 32rpx;
+      padding-bottom: 64rpx;
+      .top-tips {
+        padding: 10px 10px 20px;
+      }
+      .comment-wrap {
+        border: 1px solid #d7e8f4;
+        background: #f7fbfe;
+        border-radius: 8px;
+        padding: 10px;
+        overflow: hidden;
+        .header {
+          align-items: center;
+          .name {
+            margin-left: 20rpx;
+            font-weight: bold;
+            color: #333;
+            margin-left: 10px;
+          }
+        }
+        .content-wrap {
+          padding-left: 50px;
+          .content {
+            padding: 10px 0;
+          }
+        }
+        .replyText {
+          margin: 20px 0;
+        }
+      }
+    }
+  }
+  .fade-enter-active,
+  .fade-leave-active {
+    transition: opacity 0.5s;
+  }
+
+  .fade-enter-from,
+  .fade-leave-to {
+    opacity: 0;
+  }
+
+  .is-hidden {
+    display: none;
+  }
+</style>

BIN
static/images/user_avatar.png


+ 9 - 7
store/index.js

@@ -134,13 +134,15 @@ const store = new Vuex.Store({
     async getUserInfo({ commit }) {
       const [err, res] = await to(userApi.getUserInfo())
       if (err) return
-      const { id, userName, nickName, avatar, postName, phone } = res.data.entity
-      if (id) commit('setUserId', id)
-      if (userName) commit('setUsername', userName)
-      if (nickName) commit('setNickName', nickName)
-      if (postName) commit('setPostName', nickName)
-      if (avatar) commit('setAvatar', avatar)
-      if (phone) commit('setPhone', phone)
+      if (res && res.data) {
+        const { id, userName, nickName, avatar, postName, phone } = res.data.entity
+        if (id) commit('setUserId', id)
+        if (userName) commit('setUsername', userName)
+        if (nickName) commit('setNickName', nickName)
+        if (postName) commit('setPostName', nickName)
+        if (avatar) commit('setAvatar', avatar)
+        if (phone) commit('setPhone', phone)
+      }
     },
     /**
      * @description 退出登录