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

Merge branch 'master' of ssh://gogs.zfire.top:2222/zfire-front/recycle-mobile

* 'master' of ssh://gogs.zfire.top:2222/zfire-front/recycle-mobile:
  feat: 区分环境
  feat: 添加防骗指南跳转
  feat: 发送消息判空
  feat: 修改消息交互
Moss 1 éve
szülő
commit
b5c8162157

+ 12 - 1
src/common/utils/navPag.js

@@ -15,7 +15,7 @@ export const navToPage = (function() {
     // #ifdef H5
     if (isWeixin()) {
       wx.miniProgram.getEnv(res => {
-        if (res.miniprogram) {
+        if (res.miniprogram && uni.getStorageSync('miniProgram') == "jsm_env") {
           var i = 0;
           (function goTo() {
             if (gopageid) {
@@ -65,6 +65,7 @@ export function webViewHref(url, pam = {}) {
   var pamstr = Object.entries(pam).map(item => {
     return item.join("=")
   }).join("&");
+  // #ifdef H5
   if (!!~url.indexOf("?")) {
     return process.env.VUE_APP_HREF + url +
       `${pamstr?"&"+pamstr:""}&x-token=${store.state.user.token||''}&openId=${store.state.user.openId||''}&userId=${store.state.user.userId}&username=${store.state.user.name||''}&useravatar=${store.state.user.avatar||''}`
@@ -72,4 +73,14 @@ export function webViewHref(url, pam = {}) {
     return process.env.VUE_APP_HREF + url +
       `?${pamstr?pamstr+"&":""}x-token=${store.state.user.token||''}&openId=${store.state.user.openId||''}&userId=${store.state.user.userId}&username=${store.state.user.name||''}&useravatar=${store.state.user.avatar||''}`
   }
+  // #endif
+  // #ifndef H5
+  if (!!~url.indexOf("?")) {
+    return process.env.VUE_APP_HREF + url +
+      `${pamstr?"&"+pamstr:""}&x-token=${store.state.user.token||''}&openId=${store.state.user.openId||''}&userId=${store.state.user.userId}&username=${store.state.user.name||''}&useravatar=${store.state.user.avatar||''}&miniProgram=jsm_env`
+  } else {
+    return process.env.VUE_APP_HREF + url +
+      `?${pamstr?pamstr+"&":""}x-token=${store.state.user.token||''}&openId=${store.state.user.openId||''}&userId=${store.state.user.userId}&username=${store.state.user.name||''}&useravatar=${store.state.user.avatar||''}&miniProgram=jsm_env`
+  }
+  // #endif
 }

+ 8 - 2
src/pages/message/index.vue

@@ -2,7 +2,7 @@
   <!-- #ifdef H5 -->
   <view class="message_view_page">
     <!-- 横幅 -->
-    <view class="gonggao">
+    <view class="gonggao" @click="goFpzn">
       <view>防骗手册,为您保驾护航</view>
       <text class="iconfont icon-jinru"></text>
     </view>
@@ -32,6 +32,7 @@
             </view>
           </view>
         </view>
+        <Loading v-if="!list.length" :loadStatus="2" :dataList="list" />
       </scroll-view>
     </view>
   </view>
@@ -86,7 +87,12 @@
         this.$navToPage({
           url: '/pages/message/msgView?goodsId=' + item.goodsId || '' + "&groupId=" + item.groupId || ''
         })
-      }
+      },
+      goFpzn(item) {
+        this.$navToPage({
+          url: '/pages/mine/parse?type=1'
+        })
+      },
     },
     // #endif
     // #ifndef H5

+ 40 - 16
src/pages/message/msgView.vue

@@ -2,7 +2,7 @@
   <!-- #ifdef H5 -->
   <view class="message_view_page">
     <!-- 横幅 -->
-    <view class="gonggao">
+    <view class="gonggao" @click="goFpzn">
       <view>防骗手册,为您保驾护航</view>
       <text class="iconfont icon-jinru"></text>
     </view>
@@ -77,7 +77,7 @@
           </view> -->
           <!-- 发送消息 -->
           <view class="text_input_mount" @click="send">
-            <image style="width: 60%; height: 60%;" mode="aspectFill" src="/static/tabBar/icon_issue01.png"></image>
+            <image style="width: 50%; height: 53%;" mode="aspectFill" src="/static/tabBar/icon_issue01.png"></image>
           </view>
         </view>
       </view>
@@ -127,7 +127,16 @@
     onShow() {
       // #ifdef H5
       this.getGoods()
-      this.getNewList()
+      this.getMsgList(2, () => {
+        this.getNewList()
+        this.$nextTick(() => {
+          uni.createSelectorQuery().select('.message_view_scroll').boundingClientRect(data => {
+            uni.createSelectorQuery().select('.scrollviewDiv').boundingClientRect(data2 => {
+              this.scrollTop = data2.height - data.height
+            }).exec()
+          }).exec()
+        })
+      })
       // #endif
     },
     onHide() {
@@ -137,6 +146,13 @@
       }
       // #endif
     },
+    destroyed() {
+      // #ifdef H5
+      if (this.timeId) {
+        clearTimeout(this.timeId)
+      }
+      // #endif
+    },
     methods: {
       // #ifdef H5
       getGoods() {
@@ -145,25 +161,28 @@
         }
         api.postJson('/goods/detail', {
           id: this.pam.goodsId,
-        }).then(res => {
+        }, false).then(res => {
           this.goodsDetail = res.data
-          console.log(res)
         })
       },
       getNewList() {
         if (this.timeId) {
           clearTimeout(this.timeId)
         }
-        this.getMsgList(0, () => {
-          this.timeId = setTimeout(this.getNewList, 3000)
-          uni.createSelectorQuery().select('.message_view_scroll').boundingClientRect(data => {
-            uni.createSelectorQuery().select('.scrollviewDiv').boundingClientRect(data2 => {
-              if ((this.scrollTop + data.height + 10) >= data2.height) {
-                this.scrollTop = data2.height
-              }
-            }).exec()
-          }).exec()
-        })
+        uni.createSelectorQuery().select('.scrollviewDiv').boundingClientRect(data1 => {
+          this.getMsgList(0, () => {
+            this.timeId = setTimeout(this.getNewList, 3000)
+            this.$nextTick(() => {
+              uni.createSelectorQuery().select('.message_view_scroll').boundingClientRect(data => {
+                uni.createSelectorQuery().select('.scrollviewDiv').boundingClientRect(data2 => {
+                  if (data1.height - data.height - this.scrollTop < 10) {
+                    this.scrollTop = data2.height - data.height
+                  }
+                }).exec()
+              }).exec()
+            })
+          })
+        }).exec()
       },
       getMsgList(flag, cb) {
         api.postJson('/user/talk/list', {
@@ -222,7 +241,7 @@
         this.scrollTop = e.detail.scrollTop
       },
       send() {
-        if (this.pam.goodsId && this.$store.state.user.userId) {
+        if (this.pam.goodsId && this.$store.state.user.userId && this.message) {
           api.postJson('/user/talk/send', {
             message: this.message,
             userId: this.$store.state.user.userId,
@@ -241,6 +260,11 @@
           })
         }
       },
+      goFpzn(item) {
+        this.$navToPage({
+          url: '/pages/mine/parse?type=1'
+        })
+      },
       // #endif
       // #ifndef H5
 

+ 4 - 0
src/store/modules/user/index.js

@@ -39,6 +39,10 @@ var userId = getQueryVariable("userId")
 if (userId) {
   uni.setStorageSync('recycle_mobile_userId', userId)
 }
+var miniProgram = getQueryVariable("miniProgram")
+if (miniProgram) {
+  uni.setStorageSync('miniProgram', miniProgram)
+}
 // #endif
 
 const state = {