xiaxiaofeng 8 gadi atpakaļ
vecāks
revīzija
eea218740a

+ 1 - 1
pages/channel/image/add/add.js

@@ -176,7 +176,7 @@ Page({
     }else{
       data.type=2
     }
-    data.expire_in=1440;
+    // data.expire_in=1440;
     self.setData({
         'busy1':true
     })

+ 62 - 22
pages/channel/index/index.js

@@ -64,6 +64,8 @@ var showMsg = (title, content) => {
         showCancel: false
     });
 };
+
+
 var busy=false;
 //获取应用实例
 var app = getApp()
@@ -336,28 +338,6 @@ Page({
             hash_key:e.hash_key
         })
         var self=this;
-        qcloud.request({
-            // 要请求的地址
-            url: config.service.apiUrl+'messages/'+self.data.hash_key,
-            success(result) {
-              console.log(result);
-              if(result.data.success==true){
-                  if(result.data.is_mine==false){
-                      var ncikname=result.data.message_data.user.nickname;
-                      showMsg("提示信息","您成功关注了"+ncikname+'的密频');
-                  }
-              }
-                  
-            },
-
-            fail(error) {
-                console.log('request fail', error);
-            },
-
-            complete() {
-                console.log('request complete');
-            }
-      });
       }else{
           console.log('123')
       }
@@ -380,10 +360,70 @@ Page({
     busy=true;
     var self=this;
     app.getUserInfo(function(userInfo){
+      self.setData({
+          userInfo:userInfo
+      });
       self.post_list();
       self.user_list();
+      if(self.data.hash_key==undefined||!self.data.hash_key){
+          return false;
+      }
+      qcloud.request({
+            // 要请求的地址
+            url: config.service.apiUrl+'messages/'+self.data.hash_key,
+            success(result) {
+              console.log(result);
+              if(result.data.success==true){
+                  if(result.data.is_mine==false){
+                      var ncikname=result.data.message_data.user.nickname;
+                      showMsg("提示信息","您成功关注了"+ncikname+'的密频');
+                  }
+              }
+                  
+            },
+
+            fail(error) {
+                console.log('request fail', error);
+            },
+
+            complete() {
+                console.log('request complete');
+            }
+      });
     });
   },
+  formSubmit1: function(e) {
+      var self=this;
+      var url=e.detail.target.dataset.url;
+      var data={};
+      if(e.detail.formId!='the formId is a mock one'){
+        data.form_id=e.detail.formId;
+      }else{
+          wx.navigateTo({
+                url: url
+           });
+           return;
+      }
+      data.openid=self.data.userInfo.openId;
+      qcloud.request({
+        // 要请求的地址
+        url: config.service.apiUrl+'form_ids',
+        method:"POST",
+        data: data,
+        success(result) {
+            console.log(result);
+            
+        },
+        fail(error) {
+            console.log('request fail', error);
+        },
+        complete() {
+            wx.navigateTo({
+                url: url
+            })
+        }
+      });
+  },
   onHide:function(){
     // 页面隐藏
   },

+ 4 - 2
pages/channel/index/index.wxml

@@ -29,15 +29,17 @@
             <view class="weui-loading"></view>
             <text class="weui-loadmore__tips">正在加载</text>
         </view>
+        <form bindsubmit="formSubmit1" report-submit="{{true}}">
         <view style="width:100%;display:inline-block;padding:50px 40px;box-sizing:border-box;padding-top:10px;padding-bottom:0px;">
             <view class="item" wx:for="{{posts}}" wx:key="id">
-                <navigator url="/pages/channel/view/view?hash_key={{item.hash_key}}" open-type="navigate" >
+                <button data-url="/pages/channel/view/view?hash_key={{item.hash_key}}" url="/pages/channel/view/view?hash_key={{item.hash_key}}" formType="submit" style="clear:both;display:inline-block;padding:0;width:100%;line-height:0;border-radius:0;"  >
                     <image src="{{item.user.headimgurl ? item.user.headimgurl : '/pages/images/default.png'}}" mode="widthFix"></image>
-                </navigator>
+                </button>
                 <view class="u_name" style="color:#fff;text-align:center;font-size:12px;margin-top:5px;">{{item.user.nickname}}</view>
                 <view class="date_time" style="color:#fff;text-align:center;font-size:12px;margin-top:5px;">{{item.created_at}}</view>
             </view>
         </view>
+        </form>
         <view class="weui-loadmore weui-loadmore_line" wx:if="{{!next_data&&!loading&&posts.length!==0}}">
             <text class="weui-loadmore__tips">数据已经全部加载完了</text>
         </view>

+ 8 - 1
pages/channel/index/index.wxss

@@ -186,4 +186,11 @@ margin-bottom:10rpx;
     padding: 0 .55em;
     background-color: #000;
     color: #999999;
-}
+}
+image {
+width:0px;
+height:0px;
+display:inline-block;
+overflow:hidden;
+
+}

+ 2 - 1
pages/person/image/view/view.js

@@ -65,7 +65,8 @@ Page({
     "share":false,
     "is_qun":false,
     "expire_time":"",
-    "text":""
+    "text":"",
+    "canIUse": wx.canIUse('button.open-type.share')
   },
   onLoad: function (e) {
     console.log('onLoad');

+ 2 - 1
pages/person/image/view/view.wxml

@@ -6,7 +6,8 @@
     <view class="page___title" style="margin-bottom:20px;padding:0 30px;text-align:left;color:#000">{{share_txt}}</view>
   </view>
   <view class="page__bd" style="padding:10px 50px 20px 50px;text-align:center;color:#fff;">
-    <button class="mini-btn" type="primary" bindtap="share" size="mini" hover-class="none" style="width:120px;clear:both;float:none;display:block;font-size:14px;padding-top:1px;padding-bottom:1px;" >发送</button>
+    <button wx:if="{{canIUse}}" class="mini-btn" type="primary" open-type="share" size="mini" hover-class="none" style="width:120px;clear:both;float:none;display:block;font-size:14px;padding-top:1px;padding-bottom:1px;" >发送</button>
+    <button wx:else class="mini-btn" type="primary" bindtap="share" size="mini" hover-class="none" style="width:120px;clear:both;float:none;display:block;font-size:14px;padding-top:1px;padding-bottom:1px;" >发送</button>
     <button class="mini-btn" type="primary" size="mini" hover-class="none" bindtap="edit" style="margin-top:20px;background-color:#ccc;width:120px;clear:both;float:none;display:block;font-size:14px;padding-top:1pxpadding-bottom:1px;">再写一封</button>
   </view>
   <view class="share" hidden="{{!share}}">

+ 2 - 1
pages/person/video/view/view.js

@@ -64,7 +64,8 @@ Page({
     "video_hidden":true,
     "share_txt":"",
     "expire_time":"",
-    "text":""
+    "text":"",
+    "canIUse": wx.canIUse('button.open-type.share')
   },
   onLoad: function (e) {
     console.log('onLoad');

+ 2 - 1
pages/person/video/view/view.wxml

@@ -11,7 +11,8 @@
       <view class="page___title" style="margin-bottom:20px;padding:0 30px;text-align:left;">{{share_txt}}</view>
      </view>
     <view class="page__bd" style="padding:10px 50px 20px 50px;text-align:center;color:#fff;">
-       <button class="mini-btn" bindtap="share" type="primary" size="mini" hover-class="none" style="width:120px;clear:both;float:none;display:block;font-size:14px;padding-top:1px;padding-bottom:1px;">发送</button>
+       <button wx:if="{{canIUse}}" class="mini-btn" open-type="share"  type="primary" size="mini" hover-class="none" style="width:120px;clear:both;float:none;display:block;font-size:14px;padding-top:1px;padding-bottom:1px;">发送</button>
+       <button wx:else class="mini-btn" bindtap="share" type="primary" size="mini" hover-class="none" style="width:120px;clear:both;float:none;display:block;font-size:14px;padding-top:1px;padding-bottom:1px;">发送</button>
     <button class="mini-btn" type="primary" size="mini" hover-class="none" bindtap="edit" style="margin-top:20px;background-color:#ccc;width:120px;clear:both;float:none;display:block;font-size:14px;padding-top:1px;padding-bottom:1px;">再写一封</button>
     </view>
  <view class="share" hidden="{{!share}}">