bayi hai 1 ano
pai
achega
73f39bcc7e
Modificáronse 3 ficheiros con 13 adicións e 4 borrados
  1. 7 1
      pages/chat/index.js
  2. 4 2
      pages/chat/index.wxml
  3. 2 1
      pages/reading/index.js

+ 7 - 1
pages/chat/index.js

@@ -31,7 +31,7 @@ Page({
     })
     })
     this.setData({
     this.setData({
       targetUid: options.uid,
       targetUid: options.uid,
-      uid:wx.getStorageSync('uid')
+      uid: wx.getStorageSync('uid')
     })
     })
     this.storeBindings = createStoreBindings(this, {
     this.storeBindings = createStoreBindings(this, {
       store,
       store,
@@ -99,6 +99,12 @@ Page({
     })
     })
     this.getNewMsgDet()
     this.getNewMsgDet()
   },
   },
+  previewImage(e) {
+    var imageUrl = e.currentTarget.dataset.src;
+    wx.previewImage({
+      urls: [imageUrl]
+    })
+  },
   chooseImage() {
   chooseImage() {
     wx.chooseImage({
     wx.chooseImage({
       count: 1, // 可选择的图片数量
       count: 1, // 可选择的图片数量

+ 4 - 2
pages/chat/index.wxml

@@ -5,11 +5,13 @@
       <view class="base someone" wx:if="{{uid!=item.senderUid}}">
       <view class="base someone" wx:if="{{uid!=item.senderUid}}">
         <image src="{{item.user.avatar}}" class="avatar" bindtap="jumpUserInfo" data-uid='{{item.senderUid}}' />
         <image src="{{item.user.avatar}}" class="avatar" bindtap="jumpUserInfo" data-uid='{{item.senderUid}}' />
         <view class="message" wx:if="{{item.type==1}}">{{item.content}}</view>
         <view class="message" wx:if="{{item.type==1}}">{{item.content}}</view>
-        <image src="{{item.content}}" wx:else class="msgImg" mode="widthFix" />
+        <image src="{{item.content}}" wx:else class="msgImg" mode="widthFix" bindtap="previewImage"
+          data-src="{{item.content}}" />
       </view>
       </view>
       <view class="base self" wx:else>
       <view class="base self" wx:else>
         <view class="message" wx:if="{{item.type==1}}">{{item.content}}</view>
         <view class="message" wx:if="{{item.type==1}}">{{item.content}}</view>
-        <image src="{{item.content}}" wx:else class="msgImg" mode="widthFix" />
+        <image src="{{item.content}}" wx:else class="msgImg" mode="widthFix" bindtap="previewImage"
+          data-src="{{item.content}}" />
         <image src="{{userInfo.avatar}}" class="avatar" bindtap="jumpUserInfo" data-uid='{{item.senderUid}}' />
         <image src="{{userInfo.avatar}}" class="avatar" bindtap="jumpUserInfo" data-uid='{{item.senderUid}}' />
       </view>
       </view>
     </block>
     </block>

+ 2 - 1
pages/reading/index.js

@@ -557,7 +557,6 @@ Page({
   resetReading() {
   resetReading() {
     clearTimeout(this.setTimeoutObj)
     clearTimeout(this.setTimeoutObj)
     clearInterval(this.stl)
     clearInterval(this.stl)
-    wsEngine.reset()
     // 重置视频
     // 重置视频
     if (this.data.videoInfo.userReadExtend.resourcesType == 0) {
     if (this.data.videoInfo.userReadExtend.resourcesType == 0) {
       this.videoContext.stop()
       this.videoContext.stop()
@@ -608,9 +607,11 @@ Page({
     }, 300)
     }, 300)
   },
   },
   onHide() {
   onHide() {
+    wsEngine.reset()
     this.resetReading()
     this.resetReading()
   },
   },
   onUnload() {
   onUnload() {
+    wsEngine.reset()
     this.resetReading()
     this.resetReading()
     this.storeBindings.destroyStoreBindings()
     this.storeBindings.destroyStoreBindings()
   },
   },