Silent 6 роки тому
батько
коміт
fee9b659d3

+ 31 - 16
wechat/pages/article/article.js

xqd xqd xqd xqd xqd
@@ -12,6 +12,7 @@ Page({
     hide: "hide",
     show: !1,
     animationData: {},
+    show_video: null,
     tabList: [{
       tab: 'video',
       title: '视频'
@@ -21,20 +22,27 @@ Page({
     }],
     selectedTab: 'video',
   },
-  onLoad: function (a) {
+  onLoad: function(a) {
     // app.pageOnLoad(this);
     this.loadMoreGoodsList('both');
   },
-  swiperTab: function (e) {
+  swiperTab: function(e) {
     var that = this;
     // console.log(e);
     that.setData({
       selectedTab: e.detail.currentItemId
     });
   },
-  clickTab: function (e) {
+  clickTab: function(e) {
     var that = this;
     // console.log(e)
+    if (e.target.dataset.current != 'video') {
+      this.setData({
+        show_video: null,
+        show: !0
+      });
+    }
+    
     if (this.data.selectedTab === e.target.dataset.current) {
       return false;
     } else {
@@ -43,14 +51,21 @@ Page({
       })
     }
   },
-  onReady: function () { },
-  onShow: function () {
+  onReady: function() {},
+  onShow: function() {
     // app.pageOnShow(this);
   },
-  onHide: function () { },
-  onUnload: function () { },
-  onPullDownRefresh: function () { },
-  loadMoreGoodsList: function (tab) {
+  onHide: function() {
+    var context = wx.createVideoContext("video_" + this.data.show_video)
+    context.stop()
+    this.setData({
+      show_video: null,
+      show: !0
+    });
+  },
+  onUnload: function() {},
+  onPullDownRefresh: function() {},
+  loadMoreGoodsList: function(tab) {
     var tab = tab || this.data.selectedTab;
     var o = this;
     // if (!is_loading_more) {
@@ -159,18 +174,18 @@ Page({
     // });
     // }
   },
-  play: function (a) {
+  play: function(a) {
     var t = a.currentTarget.dataset.index;
     wx.createVideoContext("video_" + this.data.show_video).pause(), this.setData({
       show_video: t,
       show: !0
     });
   },
-  onReachBottom: function () {
+  onReachBottom: function() {
     this.loadMoreGoodsList();
     // is_no_more || this.loadMoreGoodsList();
   },
-  more: function (a) {
+  more: function(a) {
     var t = this,
       o = a.target.dataset.index,
       i = t.data.video_list,
@@ -180,11 +195,11 @@ Page({
       });
     this.animation = e, -1 != i[o].show ? (e.rotate(0).step(), i[o].show = -1) : (e.rotate(0).step(),
       i[o].show = 0), t.setData({
-        video_list: i,
-        animationData: this.animation.export()
-      });
+      video_list: i,
+      animationData: this.animation.export()
+    });
   },
-  redirectToArticle: function (e) {
+  redirectToArticle: function(e) {
     let id = e.currentTarget.dataset.id;
     wx.navigateTo({
       url: '/pages/article-detail/index?id=' + id

+ 28 - 16
wechat/pages/index/index.js

xqd
@@ -285,22 +285,34 @@ Page({
     //     })
     //   }
     //   }, this)
-    if (!this.data.shareTempFilePath) {
-      wx.showModal({
-        title: '提示',
-        content: '图片绘制中,请稍后重试',
-        showCancel: false
-      })
-    }
-    wx.saveImageToPhotosAlbum({
-      filePath: this.data.shareTempFilePath,
-      success: (res) => {
-        
-      },
-      complete: res => {
-        this.setData({
-          showPopup: false
-        })
+    wx.showModal({
+      title: '确定生成图片吗',
+      content: '生成图片发到朋友圈',
+      success: res => {
+        if(res.confirm) {
+          if (!this.data.shareTempFilePath) {
+            wx.showModal({
+              title: '提示',
+              content: '图片绘制中,请稍后重试',
+              showCancel: false
+            })
+          }
+          wx.saveImageToPhotosAlbum({
+            filePath: this.data.shareTempFilePath,
+            success: (res) => {
+
+            },
+            complete: res => {
+              this.setData({
+                showPopup: false
+              })
+            }
+          })
+        } else if (res.cancel) {
+          this.setData({
+            showPopup: false
+          })
+        }
       }
     })
   },

+ 3 - 1
wechat/pages/index/index.wxss

xqd xqd
@@ -112,6 +112,7 @@ swiper {
   width: 86.88px;
   height: 86.88px
 }
+.close-btn,
 .start-btn {
   position: relative;
   z-index: 1;
@@ -125,7 +126,8 @@ swiper {
   line-height: 86.88px;
   border: none;
 }
+
+.close-btn,
 .share-btn {
-  margin-top: 20px;
   width: 80%;
 }