Selaa lähdekoodia

解决测试问题

Limengbo 6 vuotta sitten
vanhempi
commit
39f1c6fb4e

+ 1 - 1
compontents/chat/chat.wxml

@@ -4,7 +4,7 @@
         <image src="../../pages/image/xing.png" class="xing"></image>
         <text class="">{{title}}</text>
         <image src="../../pages/image/xing.png" class="xing"></image>
-        <text class="uploading" bindtap="uploadImage" wx:if="{{productionData.list}}">{{query}}</text>
+        <text class="uploading" bindtap="uploadImage" wx:if="{{productionData.list && query}}">{{query}}</text>
     </view>
     <view wx:if="{{productionData.list}}">
         <view class="share-con" wx:for="{{productionData.list}}" wx:key="{{index}}">

+ 2 - 2
compontents/preview/preview.wxml

@@ -12,8 +12,8 @@
 
     <view class="material-con" animation="{{animationData}}" style="height: {{height}}rpx">
         <view class="art-img" wx:for="{{materialData}}" wx:key="{{index}}">
-            <text>{{item.title}}</text>
-            <text wx:if="{{ item.warePath && item.title}}" data-warePath="{{item.warePath}}" bindtap="preview">点击预览</text>
+            <text>{{item.fileName == '' ? item.title : item.fileName}}</text>
+            <text wx:if="{{ item.warePath && item.fileName}}" data-warePath="{{item.warePath}}" bindtap="preview">点击预览</text>
             <text wx:else>暂无资料</text>
         </view>
     </view>

+ 1 - 1
compontents/ranking/ranking.wxml

@@ -22,7 +22,7 @@
         <view class="rank-friend" wx:for="{{friendsData}}" wx:key="{{index}}">
             <view class="rank-head">
                 <text class="rank-text">{{item.rank}}</text>
-                <image src="{{item.users.headImgUrl}}" class="head-img"></image>
+                <image src="{{item.users.headImgUrl ? item.users.headImgUrl : (item.users.gender == 1 ? '../../pages/image/boy.png' : '../../pages/image/girl.png' )}}" class="head-img"></image>
                 <text style="width: 120px; overflow: hidden;">{{item.users.wechatName}}</text>
             </view>
             <text wx:if="{{myData.exp >= 0}}" class="medal-num">LV{{item.number}}({{item.exp}})</text>

+ 3 - 1
compontents/share/share.js

@@ -51,6 +51,7 @@ Component({
         wx.downloadFile({
           url: res.data.data,
           success: (res) => {
+            //'https:' +
             this.setData({
               codeImage: res.tempFilePath
             })
@@ -75,6 +76,7 @@ Component({
           success: (res) => {
             console.log(res.tempFilePath);
             const codeImage = this.data.codeImage;
+            console.log('二维码' + codeImage)
             //canvas绘制文字和图片
             const ctx = wx.createCanvasContext('myCanvas');
             var imgPath = res.tempFilePath;
@@ -87,7 +89,7 @@ Component({
             ctx.setFillStyle('black')
             ctx.fillText(title, 25, imgHeight + 90)
             ctx.setFontSize(12)
-            ctx.fillText('在勋章战士上学会了这些,分享给大家', 25, imgHeight + 60)
+            ctx.fillText('在小学王者班上学会了这些,分享给大家', 25, imgHeight + 60)
             ctx.setFontSize(22)
             ctx.fillText(featureMap.wechatName, 25, imgHeight + 35);
             //横线

+ 1 - 1
compontents/share/share.wxml

@@ -7,7 +7,7 @@
                 <image src="../../pages/image/download.png"></image>
                 <text>生成海报分享</text>
             </view>
-            <button class='transmit' open-type="share" id="transmit" data-userId="{{userId}}" data-postId="{{postId}}">
+            <button class='transmit' open-type="share" id="transmit" data-userId="{{userId}}" data-postId="{{postId}}" data-imageUrl="{{imgUrl}}">
                 <image src="../../pages/image/transmit.png"></image>
                 <text>转发给好友</text>
             </button>      

+ 5 - 5
compontents/tarbar/tarbar.js

@@ -79,14 +79,14 @@ Component({
   },
   ready() {
     let options = util.getUrl();
-    //console.log(options)
-    if(options.ind) {
-      this.setData({ navBtnSelectIdx: options.ind});
+    const ind = options.ind || util.convertObject(unescape(options.scene)).ind;
+    if(ind) {
+      this.setData({ navBtnSelectIdx: ind});
     }
-    if (options.ind <= 2) {
+    if (ind <= 2) {
       this.setData({ left: 0 });
     }
-    if(options.ind > 2){
+    if(ind > 2){
       this.setData({left: 200 });
     }
   }

+ 3 - 2
pages/art/art.js

@@ -127,7 +127,7 @@ Page({
     const position = e.currentTarget.dataset.id;
     console.log(position)
     this.setData({
-      position: position
+      position
     })
   },
 
@@ -227,11 +227,12 @@ Page({
       // 来自页面内转发按钮
       console.log(ops.target)
     }
-    debugger;
     const postId = ops.target.dataset.postid;
+    const imageUrl= ops.target.dataset.imageurl[0];
     return {
       title: '小学王者班',
       path: `pages/transmit/transmit?ind=7&postId=${postId}`,
+      imageUrl,
       success: function (res) {
         // 转发成功
         console.log("转发成功:" + JSON.stringify(res));

+ 8 - 8
pages/art/art.wxml

@@ -4,7 +4,7 @@
   <tarbar id="tarbar"/>
   <!-- 内容 -->
   <view class="content">
-      <scroll-view scroll-y="true"  scroll-with-animation="true" scroll-with-animation="true" enable-back-to-top="true" scroll-into-view="{{position}}">
+      <scroll-view scroll-y="true"  scroll-with-animation="true" enable-back-to-top="true" scroll-into-view="{{position}}">
           <!-- 科学艺术 -->
           <view class="art">
             <target wxObjectives="{{wxObjectives}}"/>
@@ -40,19 +40,19 @@
                 data-type="1"
                 more="{{questionsMore}}"/>
 
-            <view class="questions-one" data-id="questions" bindtap="location">
-                <image src="../image/q_discuss.png" ></image>
-                <text class="row" wx:if="{{questionsdian > 0}}"></text>
-            </view>
-
             <view class="upload-one" data-id="upload" bindtap="location">
                 <image src="../image/works.png" ></image>
             </view>  
-            <view class="canvas-box">
-                <canvas canvas-id="myCanvas" style="width:100%; height: {{canvasHeight}}px;"></canvas>
+
+            <view class="questions-one" data-id="questions" bindtap="location">
+                <image src="../image/q_discuss.png" ></image>
+                <text class="row" wx:if="{{questionsdian > 0}}"></text>
             </view>
           </view>
       </scroll-view>
   </view>
+  <view class="canvas-box">
+    <canvas canvas-id="myCanvas" style="width:100%; height: {{canvasHeight}}px;"></canvas>
+  </view>
 </view>
 

+ 2 - 1
pages/index/index.js

@@ -238,11 +238,12 @@ Page({
       // 来自页面内转发按钮
       console.log(ops.target)
     }
-    debugger;
     const postId = ops.target.dataset.postid;
+    const imageUrl= ops.target.dataset.imageurl[0];
     return {
       title: '小学王者班',
       path: `pages/transmit/transmit?ind=7&postId=${postId}`,
+      imageUrl,
       success: function (res) {
         // 转发成功
         console.log("转发成功:" + JSON.stringify(res));

+ 3 - 4
pages/index/index.wxml

@@ -108,7 +108,6 @@
               id="chat"
               productionData="{{productionData}}" 
               title="我的作品"
-              query="上传作品"
               type="2"
               columnType="6"
               bind:getHeight="onGetHeight"
@@ -119,11 +118,11 @@
              id="set-grade"
              grade="{{grade}}"/>
           </view>
-          <view class="canvas-box">
-            <canvas canvas-id="myCanvas" style="width:100%; height: {{canvasHeight}}px;"></canvas>
-          </view>
       </scroll-view>
   </view>
+  <view class="canvas-box">
+    <canvas canvas-id="myCanvas" style="width:100%; height: {{canvasHeight}}px;"></canvas>
+  </view>  
   <view hidden="{{flag}}">
     <dialog bindmyevent="jurisdiction"/>
   </view>

+ 1 - 1
pages/index/index.wxss

@@ -230,7 +230,7 @@
 }
 
 .canvas-box {
-    position: absolute;
+    position: fixed;
     left: 999px;
     top: 0;
     width: 100%;

+ 8 - 1
pages/particulars/particulars.js

@@ -15,7 +15,8 @@ Page({
     messageLength: '',
     type: '',
     favors: '',
-    like: false
+    like: false,
+    hike: false
   },
   /* 获取输入内容 */
   bindKeyInput (e) {
@@ -23,6 +24,12 @@ Page({
       text: e.detail.value
     })
   },
+  /*拉起键盘*/
+  discuss() {
+    this.setData({
+      hike: true
+    })
+  },
   /* 发送评论 */
   sendText (e) {
     let text = this.data.text.trim();

+ 2 - 2
pages/particulars/particulars.wxml

@@ -28,7 +28,7 @@
                         <image src="../../pages/image/weatch.png" class="weatch"></image>
                         <text>{{productionData.postsAttributeInfo ? productionData.postsAttributeInfo.views : '0'}}</text>
                     </view>
-                    <view>
+                    <view bindtap="discuss">
                         <image src="../../pages/image/discuss.png" class="discuss"></image>
                         <text>{{messageLength}}</text>
                     </view>
@@ -46,7 +46,7 @@
 <view class="text">
     <image src="../../pages/image/input.png" class="input-img"></image>
     <view class="input-text">
-        <input placeholder="请输入评论内容" value="{{text}}" bindinput="bindKeyInput" type="text" />
+        <input placeholder="请输入评论内容" value="{{text}}" bindinput="bindKeyInput" type="text" focus="{{hike}}"/>
         <view bindtap="sendText" data-id="{{productionData.id}}"></view>
     </view>
 </view>

+ 2 - 0
pages/science/science.js

@@ -208,9 +208,11 @@ Page({
       console.log(ops.target)
     }
     const postId = ops.target.dataset.postid;
+    const imageUrl= ops.target.dataset.imageurl[0];
     return {
       title: '小学王者班',
       path: `pages/transmit/transmit?ind=6&postId=${postId}`,
+      imageUrl,
       success: function (res) {
         // 转发成功
         console.log("转发成功:" + JSON.stringify(res));

+ 3 - 4
pages/science/science.wxml

@@ -48,12 +48,11 @@
             <view class="upload-one" data-id="upload" bindtap="location">
                 <image src="../image/works.png" ></image>
             </view>
-
-            <view class="canvas-box">
-                <canvas canvas-id="myCanvas" style="width:100%; height: {{canvasHeight}}px;"></canvas>
-            </view> 
           </view>
       </scroll-view>
   </view>
+  <view class="canvas-box">
+    <canvas canvas-id="myCanvas" style="width:100%; height: {{canvasHeight}}px;"></canvas>
+  </view>   
 </view>
 

+ 2 - 2
pages/transmit/transmit.js

@@ -90,8 +90,8 @@ Page({
     //   }
     // })
     const postsId = options.postId || '';
-    const shareKey = options.shareKey || '';
-    console.log('shareKey' + JSON.stringify(options));
+    const shareKey = util.convertObject(unescape(options.scene)).shareKey || '';
+    console.log('shareKey:' + util.convertObject(unescape(options.scene)).shareKey);
     //判断分享过来的参数是否有postId查询单挑显示 
     if(postsId || shareKey) {
       login.getOpenidSessionKey(res => {

+ 2 - 2
utils/const.js

@@ -6,7 +6,7 @@ module.exports = {
 	// apiUrl: 'https://weixin.ai160.com/',
 	// host: 'wss://weixin.ai160.com/wx/websocket'
 	// ----测试环境-----
-  apiUrl: 'https://weixin.efunbox.cn/',
-  // apiUrl: 'https://schedule.api.ai160.com/'
+  //apiUrl: 'https://weixin.efunbox.cn/',
+   apiUrl: 'https://schedule.api.ai160.com/'
 
 }

+ 16 - 4
utils/util.js

@@ -35,12 +35,12 @@ const day = msd => {
     if (min > 60) {
       min = Math.floor(msd / 60) % 60;
       let hour = Math.floor(msd / 3600);
-      time = hour + "时" + min + "分";
+      time = hour + "时";
       // time = hour + "时";  
       if (hour > 24) {
         hour = Math.floor(msd / 3600) % 24;
         let day = Math.floor(msd / 3600 / 24);
-        time = day + "天" + hour + "时";
+        time = day + "天";
         // time = day + "天";  
       }
     }
@@ -122,7 +122,6 @@ function getUrl() {
   var url = currentPage.route    //当前页面url
   
   var options = currentPage.options    //如果要获取url中所带的参数可以查看options
-
   return options
 }
 
@@ -211,6 +210,18 @@ function replyNo (arr) {
   return num
 }
 
+//url地址转成对象
+function convertObject (str) {
+  const arr = str.split('&');
+  let obj = {};
+  for (let item of arr) {
+  let key = item.split('=')[0];
+  let val = item.split('=')[1];
+    obj[key] = val;
+  }
+  return obj;
+}
+
 module.exports = {
   formatTime: formatTime,
   studyTime,
@@ -223,5 +234,6 @@ module.exports = {
   column,
   url,
   topThree,
-  replyNo
+  replyNo,
+  convertObject
 }