Browse Source

解决冲突

Limengbo 6 years ago
parent
commit
5907d8a19f

+ 3 - 1
app.js

@@ -1,5 +1,6 @@
 //app.js
 import {GetQueryString} from 'utils/util'
+const Towxml = require('/towxml/main'); 
 App({
   onLaunch: function (options) {
    // 判断设备是否为 iPhone X
@@ -18,5 +19,6 @@ App({
         }
       }
     })
-  }
+  },
+  towxml: new Towxml()
 })

+ 0 - 5
component/my/my.js

@@ -9,13 +9,8 @@ export const myInit = (that) => {
       keep: '我的收藏',
       collage: '我的拼团',
       wallet: '我的钱包',
-      address: ['北京海淀', '中关村', '三小'],
       schoolCity: '',
       schoolName: '',
-      playNum: 31549,
-      attentionCount: 10254,
-      point: 6317,
-      flowerNum: 56245,
       user: {}
     }
   });

+ 43 - 11
component/my/my.wxml

@@ -1,24 +1,56 @@
+<wxs module="wxs">
+  function formatDate(time) {
+    var t = getDate(time); 
+    var tf = function(i){return (i < 10 ? '0' : '') + i};
+    var year = t.getFullYear();
+    var month = tf(t.getMonth() + 1);
+    var day = tf(t.getDate());
+    var hour = tf(t.getHours());
+    var minute = tf(t.getMinutes());
+    return month + '-' + day + ' ' + hour + ':' + minute;
+  }
+  function getBirthday(birthday){
+    var t = getDate(birthday); 
+    var tf = function(i){return (i < 10 ? '0' : '') + i};
+    var year = t.getFullYear();
+    var month = tf(t.getMonth() + 1);
+    var day = tf(t.getDate());
+    return year + '年' + month + '月' + day + '日';
+  }
+  module.exports.formatDate = formatDate;
+  module.exports.getBirthday = getBirthday;
+</wxs>
 <template name="my">
   <view class='mine-container'>
-    <view class='mine-center'>
-      <view class='mine-info'>
-        <view class='mine-bg'>
-          <view class='mine-avatar'>
+    <view class='follow-details'>
+      <view class='follow-info'>
+        <view class='avatar-bg'>
+          <view class='avatar-box'>
             <image class='avatar-image' src='{{ myData.user.user.avatar }}'></image>
           </view>
+          <view class='occupation-title'>{{ myData.user.user.profession }}</view>
+        </view>
+        <view class='avatar-msg'>
+          <view class='avatar-nickname'>
+            <text>{{ myData.user.user.wechatName }}</text>
+            <view class='flowers-box' wx:if='{{ myData.user.user.gender === 2 }}'>
+              <image src='../../static/image/flowers.png'></image>
+            </view>
+            <view class='flowers-box' wx:elif='{{ myData.user.user.gender === 1 }}'>
+              <image src='../../static/image/boy.png'></image>
+            </view>
+            <view wx:else class='gender-size'>未知</view>
+          </view>
+          <view class='avatar-birthday'>{{ wxs.getBirthday(myData.user.user.birthday) }}</view>
+          <view class='avatar-address'>{{ myData.user.user.schoolName }}</view>
         </view>
         <view class='mine-edit' bindtap='toMyEdit' data-title='{{ myData.title }}'>
           <view class='edit-image'>
-            <image class='edit-img' src='../../static/image/_edit.png'></image>
+            <image class='edit-img' src='../../static/image/reset.png'></image>
           </view>
-          <view class='edit-text'>修改个人资料</view>
+          <view class='edit-text'>修改</view>
         </view>
       </view>
-      <view class='mine-detail'>
-        <text class='mine-title'>{{ myData.user.user.wechatName }}</text>
-        <view class='mine-address'>{{ myData.user.user.schoolName }}</view>
-        <view class='mine-line'></view>
-      </view>
       <view class='mine-category'>
         <view class='play-count'>
           <view>{{ myData.user.playAmount || 0 }}</view>

+ 102 - 62
component/my/my.wxss

@@ -1,6 +1,5 @@
 .mine-container{
   width: 750rpx;
-  height: 1116rpx;
   background: #F0F1F5;
   position: relative;
   display: flex;
@@ -10,37 +9,40 @@
   box-sizing: border-box;
 }
 
-.mine-center{
-  width: 716rpx;
-  margin: 0 auto;
+.follow-details{
+  width: 750rpx;
+  box-sizing: border-box;
+  padding: 0 15rpx;
 }
 
-.mine-info{
-  margin-top: 80rpx;
+.follow-info{
+  /* border: 1rpx solid #3DBEF9; */
+  margin-top: 20rpx;
   width: 100%;
-  height: 344rpx;
-  background: #FFFFFF;
+  height: 362rpx;
   border-radius: 20rpx;
+  background: #FFFFFF;
+  display: flex;
 }
 
-.mine-bg{
-  width: 156rpx;
-  height: 156rpx;
+.avatar-bg{
+  margin-left: 20rpx;
+  margin-top: 50rpx;
+  width: 152rpx;
+  height: 152rpx;
   background: #61CA54;
   border-radius: 50%;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  position: absolute;
-  left: 280rpx;
-  top: 18rpx;
+  position: relative;
 }
 
-.mine-avatar{
+.avatar-box{
   width: 138rpx;
   height: 138rpx;
   border-radius: 50%;
-  background: gray;
+  z-index: 300;
+  position: absolute;
+  top: 7rpx;
+  left: 7rpx;
 }
 
 .avatar-image{
@@ -49,70 +51,73 @@
   border-radius: 50%;
 }
 
-.mine-edit{
-  position: absolute;
-  top: 110rpx;
-  right: 83rpx;
-  width: 224rpx;
-  height: 46rpx;
-  border-radius: 22rpx;
-  background: #3DBEF9;
+.avatar-nickname{
+  width: 500rpx;
   display: flex;
-  align-items: center;
 }
 
-.edit-image{
-  width: 24rpx;
-  height: 36rpx;
-  margin: 0 10rpx 6rpx 20rpx;
+.avatar-address{
+  width: 500rpx;
 }
 
-.edit-img{
-  width: 100%;
-  height: 100%;
+.flowers-box{
+  width: 26rpx;
+  height: 26rpx;
+  margin-left: 10rpx;
 }
 
-.edit-text{
-  width: 144rpx;
-  height: 34rpx;
-  color: #FFFFFF;
-  font-size: 24rpx;
+.flowers-box>image{
+  width: 100%;
+  height: 100%;
 }
 
-.mine-detail{
-  width: 670rpx;
-  text-align: center;
+.occupation-title{
   position: absolute;
-  top: 180rpx;
+  left: 100rpx;
+  top: 46rpx;
+  width: 68rpx;
+  background: #61CA54;
+  border-radius: 180rpx;
+  z-index: 600;
+  line-height: 26rpx;
+  text-align: center;
+  color: #FFFFFF;
+  font-size: 18rpx;
 }
 
-.mine-title{
-  color: #000000;
+.avatar-msg{
+  margin-left: 40rpx;
+  margin-top: 50rpx;
+  width: 500rpx;
+  height: 154rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: flex-start;
+  justify-content: center;
+  color: #444444;
   font-size: 32rpx;
 }
 
-.mine-address{
-  color: #4C4C4C;
+.gender-size{
+  margin-left: 10rpx;
   font-size: 28rpx;
+  align-self: center;
 }
 
-.mine-line{
-  width: 674rpx;
-  height: 4rpx;
-  background: #F0F1F5;
-  margin: 37rpx 20rpx;
-}
 
 .mine-category{
-  width: 716rpx;
-  height: 120rpx;
+  box-sizing: border-box;
+  width: 674rpx;
+  padding-top: 30rpx;
+  padding-bottom: 30rpx;
+  border-top: 4rpx solid #F0F1F5;
   font-size: 28rpx;
-  font-weight: bold;
+  font-weight: 600;
+  z-index: 900;
   display: flex;
-  justify-content: space-around;
-  align-items: center;
   position: absolute;
-  top: 300rpx;
+  top: 246rpx;
+  left: 38rpx;
 }
 
 .border-right{
@@ -130,14 +135,15 @@
 }
 
 .play-count,.point-count,.follow-count,.flower-count{
- width: 25%;
- text-align: center;
+  width: 25%;
+  text-align: center;
 }
 
 .play-img{
   width: 28rpx;
   height: 26rpx;
   margin-right: 6rpx;
+  margin-bottom: 6rpx;
 }
 
 image{
@@ -161,6 +167,40 @@ image{
   color: #EE5750;
 }
 
+
+
+.mine-edit{
+  position: absolute;
+  top: 75rpx;
+  right: 36rpx;
+  width: 138rpx;
+  height: 52rpx;
+  border-radius: 26rpx;
+  background: #FF9209;
+  box-sizing: border-box;
+  padding-top: 3rpx;
+  display: flex;
+}
+
+.edit-image{
+  width: 22rpx;
+  height: 32rpx;
+  margin-left: 24rpx;
+  margin-right: 10rpx;
+}
+
+.edit-img{
+  width: 22rpx;
+  height: 32rpx;
+}
+
+.edit-text{
+  width: 144rpx;
+  height: 34rpx;
+  color: #FFFFFF;
+  font-size: 32rpx;
+}
+
 .wallet-module{
   margin-top: 30rpx;
   width:716rpx;

+ 1 - 1
component/share/share.wxml

@@ -14,7 +14,7 @@
    </view>
    <view class="share-img" wx:if="{{imgUrls}}" id="imgArea" bindtap="nothing">
        <cover-image class="img" src="{{imgUrls}}"></cover-image>
-       <view class="Preservation" style="{{shareType === 'works' ?'background:#ff9209' :'background:#70CA2D'}}">
+       <view class="Preservation" bindtap="PreservationImg" style="{{shareType === 'works' ?'background:#ff9209' :'background:#70CA2D'}}">
            <!-- <image class="PreservationBg" src="../../static/groupImg/Preservation.png"></image> -->
            <!-- <text bindtap="PreservationImg">保存到相册中,快去分享吧</text> -->
            保存到相册中,快去分享吧!

+ 24 - 0
pages/commonWxs/format.wxs

@@ -0,0 +1,24 @@
+function formatDate(time) {
+  var t = getDate(time);
+  var tf = function (i) { return (i < 10 ? '0' : '') + i };
+  var year = t.getFullYear();
+  var month = tf(t.getMonth() + 1);
+  var day = tf(t.getDate());
+  var hour = tf(t.getHours());
+  var minute = tf(t.getMinutes());
+  return month + '-' + day + ' ' + hour + ':' + minute;
+}
+
+function getBirthday(birthday) {
+  var t = getDate(birthday);
+  var tf = function (i) { return (i < 10 ? '0' : '') + i };
+  var year = t.getFullYear();
+  var month = tf(t.getMonth() + 1);
+  var day = tf(t.getDate());
+  return year + '年' + month + '月' + day + '日';
+}
+
+module.exports = {
+  formatDate: formatDate,
+  getBirthday: getBirthday
+}

+ 6 - 6
pages/groupPage/collage-details/collage-details.json

@@ -1,7 +1,7 @@
 {
-    "component": true,
-    "usingComponents": {
-        "shareDialog": "/component/share/share",
-        "popup": "/component/popup/popup"
-    }
-  }
+  "component": true,
+  "usingComponents": {
+      "shareDialog": "/component/share/share",
+      "popup": "/component/popup/popup"
+  }
+}

+ 12 - 1
pages/groupPage/grade-details/grade-details.js

@@ -154,6 +154,7 @@ Page({
         share: options.share
       })
     }
+  
     // wx.setNavigationBarTitle({
     //   title: options.title
     // })
@@ -171,10 +172,20 @@ Page({
       wx.setNavigationBarTitle({
         title: bookInfo.title
       })
+      const data = app.towxml.toJson(
+        bookInfo.description,
+        'markdown',
+        this
+      )
+      // data.theme = 'light';
+      // this.setData({
+      //   article: data
+      // })
       this.setData({
         titleIcon: bookInfo.bgImg,
         title: bookInfo.title,
-        bookInfo: bookInfo.description
+        bookInfo: bookInfo.description,
+        article: data
       })
       const lessonTemp = [];
       lessonList.forEach(item => {

+ 7 - 4
pages/groupPage/grade-details/grade-details.wxml

@@ -5,8 +5,8 @@
             <image src="{{titleIcon}}"></image>
         </view>
         <view class="catalog">
-            <image class="bg2" src="../../../static/groupImg/Rectangle_9.png"></image> 
-            <text class="{{flag ? '' : 'select'}}" bindtap="tabSwitch">您需要知道</text>    
+            <image class="bg2" src="../../../static/groupImg/Rectangle_9.png"></image>
+            <text class="{{flag ? '' : 'select'}}" bindtap="tabSwitch">您需要知道</text>
             <text class="{{flag ? 'select' : ''}}" bindtap="tabSwitch">课文目录</text>
         </view>
         <view class="catalog-list" hidden="{{!flag}}">
@@ -18,8 +18,11 @@
                 </view>
             </view>
         </view>
+        <!-- 你需要知道 -->
         <view class="know" hidden="{{flag}}">
-        </view>       
+            <import src="../../../towxml/entry.wxml" />
+            <template is="entry" data="{{...article}}" />
+        </view>
     </scroll-view>
     <view class="group-btn {{isIPX ? 'bottomx' :''}}" wx:if="{{!share}}">
         <image class="bg1" src="../../../static/groupImg/baise.png"></image>
@@ -39,7 +42,7 @@
                 <view>
                     <text>{{item.headcount}}人团</text>
                 </view>
-            </view> 
+            </view>
         </block>
     </view>
 </view>

+ 11 - 0
pages/groupPage/grade-details/grade-details.wxss

@@ -1,4 +1,15 @@
 /* pages/grade-details/grade-details.wxss */
+/**基础风格样式**/
+@import '../../../towxml/style/main.wxss';
+
+
+/**如果页面有动态主题切换,则需要将使用到的样式全部引入**/
+
+/**主题配色(浅色样式)**/
+@import '../../../towxml/style/theme/light.wxss';
+
+/**主题配色(深色样式)**/
+@import '../../../towxml/style/theme/dark.wxss';
 .group-details {
     height: 100%;
     width: 100%;

+ 2 - 1
pages/index/index.js

@@ -162,10 +162,11 @@ Page({
   // 获取用户信息
   getUserWorksInfo: function () {
     httpRequestApi.getUserWorksInfo().success(res => {
-      console.log(res)
       this.data.myData.user = res.data.data; //直接赋值 给 myData的user对象。
       this.setData({
         myData: this.data.myData,
+      },() => {
+        console.log(this.data.myData);
       });
     }).fail(error => {
       console.log(error)

+ 5 - 4
pages/main/class/class.wxss

@@ -90,10 +90,11 @@ button::after {
 }
 
 .footSection .microphone {
-    display: block;
-    margin: -6rpx auto 0;
-    width: 108rpx;
-    height: 106rpx;
+   display:block;
+margin:-12rpx auto 8rpx;
+width:108rpx;
+height:106rpx;
+
 }
 
 .footSection .readingBtn text {

+ 5 - 4
pages/main/reading/reading.wxss

@@ -90,10 +90,11 @@ audio {
 }
 
 .footSection .microphone {
-    display: block;
-    margin: -6rpx auto 0;
-    width: 108rpx;
-    height: 106rpx;
+   display:block;
+margin:-12rpx auto 8rpx;
+width:108rpx;
+height:106rpx;
+
 }
 
 .footSection .readingBtn text {

+ 13 - 4
pages/social/replyDetail/replyDetail.wxml

@@ -1,6 +1,17 @@
 <view class="commentArea">
   <view class='padding-bottom'>
-    <view class="{{index === 0? class1 : classNormal}}" wx:for="{{comment}}" wx:key="{{index}}">
+    <view class="{{class1}}" wx:key="{{index}}">
+      <image class="avatar" src="{{comment[0].avatar}}" />
+      <view class="commentCore">
+          <text class="nickName">{{comment[0].name}}</text>
+          <text class="time">{{comment[0].time}}</text>
+          <text class="gut">{{comment[0].text}}</text>
+      </view>
+    </view>
+<view class='reply-all'>
+    全部回复({{ count }})
+  </view>
+    <view class="{{classNormal}}" wx:for="{{comment}}" wx:key="{{index}}" wx:if="{{index !== 0}}">
       <image class="avatar" src="{{item.avatar}}" />
       <view class="commentCore">
           <text class="nickName">{{item.name}}</text>
@@ -9,9 +20,7 @@
       </view>
     </view>
   </view>
-  <view class='reply-all'>
-    全部回复({{ count }})
-  </view>
+  
   <view class='reply-msg'>
     <input name='reply' class='reply-input' placeholder='回复@{{ comment[0].name }}' value='{{ replyInfo }}' bindinput='saveValue' confirm-type ="send">
     </input>

+ 4 - 4
pages/social/replyDetail/replyDetail.wxss

@@ -20,7 +20,7 @@
 .commentArea  .commentItemFirst{
   background: #fff;
   border-bottom: none;
-  height: 280rpx;
+  min-height: 280rpx;
 }
 
 .commentItem .commentCore {
@@ -66,13 +66,13 @@
 }
 
 .reply-all{
-  position: absolute;
+  /* position: absolute; */
   box-sizing: border-box;
   padding: 16rpx 23rpx;
   width: 674rpx;
   border-top: 2rpx solid #F0F1F5;
-  left: 40rpx;
-  top: 200rpx;
+  /* left: 40rpx; */
+  /* top: 200rpx; */
   font-size: 28rpx;
   color: #000000;
 }

+ 9 - 3
pages/social/works/works.js

@@ -24,7 +24,7 @@ Page({
         replyModal: false,
         totalRead: 0,
         pageNo: 1,
-        pageSize: 2,
+        pageSize: 3,
         goBackHome: false
         // shareFlag: false
     },
@@ -53,11 +53,15 @@ Page({
         if (this.innerAudioContext) {
             this.innerAudioContext.stop();
         }
+        let videoCtx = wx.createVideoContext('worksVideo',this);
+        videoCtx.stop();
     },
     onUnload: function () {
         if (this.innerAudioContext) {
             this.innerAudioContext.stop();
         }
+        let videoCtx = wx.createVideoContext('worksVideo',this);
+        videoCtx.stop();
     },
     getWorks: function (uid, id) {
         httpRequestApi.getWorksDetail(uid, id).success((res) => {
@@ -141,7 +145,7 @@ Page({
             iconImg: this.data.iconImg,
             title: this.data.title,
             path: `pages/social/works/works`,
-            scene: `this.data.id`
+            scene: this.data.id
             // tip: this.data.tip,
         }
         this.shareDialog.share(data);
@@ -308,7 +312,9 @@ Page({
             httpRequestApi.postReply(this.uid, data).success(res => {
                 console.log(res);
                 this.setData({
-                    inputValue: ''
+                    inputValue: '',
+                  pageNo: 1,
+                  replyList: [],
                 })
                 this.getReply();
             });

+ 4 - 4
pages/social/works/works.wxml

@@ -1,10 +1,10 @@
 <view>
-    <video class="videoSection" src="{{videoSrc}}" bindplay="videoPlay" bindended="videoEnd" bindpause="videoPause" muted="true" controls="false" show-fullscreen-btn="{{fullScreenBtn}}" show-play-btn="{{playBtn}}"></video>
+    <video id="worksVideo" class="videoSection" src="{{videoSrc}}" bindplay="videoPlay" bindended="videoEnd" bindpause="videoPause" muted="true" controls="false" enable-progress-gesture="false" show-fullscreen-btn="{{fullScreenBtn}}" show-play-btn="{{playBtn}}"></video>
     <view class="readAuthorSection">
         <image class="avatar" src="{{authorAvatar}}" />
         <text class="nickName">{{author}}</text>
         <view class="like" bindtap="likeWorks" wx:if="{{authorUid !== myUid}}">
-            <image src="{{isLike? '../../../static/image/red_like_empty.png' : '../../../static/image/red_like.png'}}" />
+            <image src="{{isLike? '../../../static/image/red_like.png' :'../../../static/image/red_like_empty.png'  }}" />
             <text class="likeBtn">{{isLike ? '已' : ''}}点赞</text>
         </view>
         <view class="follow" wx:if="{{authorUid !== myUid}}">
@@ -41,8 +41,8 @@
                 </view>
             </view>
             <view class="btnWrapper">
-                <image class="commentBtn" src="../../../static/image/comment.png" bindtap="setSBId" data-id="{{item.id}}" data-index="{{index}}" />
-                <text class="commentText" bindtap="setSBId" data-id="{{item.id}}" data-index="{{index}}">评论</text>
+                <image class="commentBtn" src="../../../static/image/comment.png" bindtap="goToDetail" data-id="{{item.id}}" data-index="{{index}}" />
+                <text class="commentText" bindtap="goToDetail" data-id="{{item.id}}" data-index="{{index}}">评论</text>
                 <image class="likeBtn" src="../../../static/image/like.png" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" bindtap="likeCommend" />
                 <text class="likeText" data-index="{{index}}" data-likes="{{item.likes}}" data-id="{{item.id}}" bindtap="likeCommend">{{item.likes}}</text>
             </view>

+ 1 - 1
pages/user/myEdit/myEdit.wxml

@@ -45,7 +45,7 @@
         </view>
       </view>
       <view class="submit-btn">
-        <button class='btn' formType="submit">确定</button>
+        <button class='btn' formType="submit">保存</button>
       </view>
     </form>
   </view>

+ 3 - 3
pages/user/myEdit/myEdit.wxss

@@ -180,10 +180,10 @@ radio .wx-radio-input.wx-radio-input-checked{
 .btn{
   font-size: 40rpx;
   color: #FFFFFF;
-  width: 436rpx;
-  line-height: 100rpx;
+  width: 464rpx;
+  line-height: 80rpx;
   border-radius: 80rpx;
-  background: #539BF0;
+  background: #FF9209;
 }
 
 

+ 2 - 15
pages/user/myconcern/myconcern.wxml

@@ -1,17 +1,4 @@
-<wxs module="wxs">
-  function formatDate(time) {
-    console.log(time);
-    var t = getDate(time); 
-    var tf = function(i){return (i < 10 ? '0' : '') + i};
-    var year = t.getFullYear();
-    var month = tf(t.getMonth() + 1);
-    var day = tf(t.getDate());
-    var hour = tf(t.getHours());
-    var minute = tf(t.getMinutes());
-    return month + '-' + day + ' ' + hour + ':' + minute;
-  }
-  module.exports.formatDate = formatDate;
-</wxs>
+<wxs src="../../commonWxs/format.wxs" module="format" />
 <view class='my-concern'>
   <view class="concern-center">
     <view class='concern-info' wx:for="{{ fanList }}" wx:key="{{ index }}" bindtap='toUserDetails' data-uid='{{ item.user.uid }}' data-fanId='{{ item.fans.fanId }}'>
@@ -20,7 +7,7 @@
       </view>
       <view class="avatar-name">
         <text class="nickName">{{ item.user.wechatName }}</text>
-        <text class="time">{{ wxs.formatDate(item.fans.gmtCreated) }}</text>
+        <text class="time">{{ format.formatDate(item.fans.gmtCreated) }}</text>
       </view>
       <view class="avatar-follow" wx:if='{{ item.isEachOther }}'>
         <view class='avatar-img'>

+ 2 - 1
pages/user/mycourse/mycourse.wxss

@@ -1,12 +1,13 @@
 .my-course {
   margin-top: 44rpx;
   display: flex;
-  justify-content: space-around;
+  /* justify-content: space-around; */
   flex-direction: row;
   flex-wrap: wrap;
 }
 
 .book-item{
+  margin-left: 20rpx;
   margin-bottom: 20rpx;
   width: 214rpx;
 }

+ 0 - 8
pages/user/myread/myread.wxml

@@ -1,11 +1,3 @@
-<wxs module="wxs">
-  function formatDate(time) {
-    var timeTemp = getDate(time);
-    var timeString = timeTemp.toLocaleDateString() + timeTemp.toLocaleTimeString();
-    return timeString.replace('/','-').replace('/','-').replace('上午',' ').replace('下午',' ');
-  }
-  module.exports.formatDate = formatDate;
-</wxs>
 <view class='my-read'>
   <view class='read-article' wx:for="{{ wareCards }}" wx:key="{{ index }}" bindtap='toWork' data-lessonId='{{ item.id }}' data-title='{{ item.title }}'>
     <view class='video-preview'>

+ 17 - 4
pages/user/myworks/myworks.js

@@ -7,10 +7,11 @@ Page({
    * 页面的初始数据
    */
   data: {
-    wareCards: [],
+    wareCards: {},
     pageNo: 1,
     totalNo: 0,
-    uid: ''
+    uid: '',
+    worksList: []
   },
   toMyWorks: function(e){
     let id = e.currentTarget.dataset.id;
@@ -24,11 +25,19 @@ Page({
     let pageSize = 3;
     let uid = this.data.uid;
     console.log('用户身份',uid);
+    APIClient.getUserMsg(uid, pageNo, pageSize).success(res => {
+      this.setData({
+        wareCards: res.data.data
+      });
+      wx.hideToast();
+    }).fail(err => {
+      console.log(err);
+    });
     APIClient.userWorks(uid, pageNo, pageSize).success(res => {
-      console.log(res.data.data.list);
       this.setData({
-        wareCards: res.data.data.list
+        worksList: res.data.data.list
       });
+      wx.hideToast();
     }).fail(err => {
       console.log(err);
     });
@@ -42,6 +51,10 @@ Page({
     },() => {
       console.log(options.uid);
     });
+    wx.showToast({
+      title: '加载中...',
+      icon: 'loading'
+    });
     this.getResults();
   },
 

+ 15 - 35
pages/user/myworks/myworks.wxml

@@ -1,52 +1,32 @@
 <!--pages/user/myworks/myworks.wxml-->
-<wxs module="wxs">
-  function formatDate(time) {
-    var t = getDate(time); 
-    var tf = function(i){return (i < 10 ? '0' : '') + i};
-    var year = t.getFullYear();
-    var month = tf(t.getMonth() + 1);
-    var day = tf(t.getDate());
-    var hour = tf(t.getHours());
-    var minute = tf(t.getMinutes());
-    return month + '-' + day + ' ' + hour + ':' + minute;
-  }
-  function getBirthday(birthday){
-    var t = getDate(birthday); 
-    var tf = function(i){return (i < 10 ? '0' : '') + i};
-    var year = t.getFullYear();
-    var month = tf(t.getMonth() + 1);
-    var day = tf(t.getDate());
-    return year + '年' + month + '月' + day + '日';
-  }
-  module.exports.formatDate = formatDate;
-  module.exports.getBirthday = getBirthday;
-</wxs>
+<wxs src="../../commonWxs/format.wxs" module="format" />
 <view class='user-works'>
   <view class='follow-details'>
     <view class='follow-info'>
       <view class='avatar-bg'>
         <view class='avatar-box'>
-          <image class='avatar-image' src='{{ wareCards[0].user.avatar }}'></image>
+          <image class='avatar-image' src='{{ wareCards.user.avatar }}'></image>
         </view>
-        <view class='occupation-title'>{{ wareCards[0].user.profession }}</view>
+        <view class='occupation-title'>{{ wareCards.user.profession }}</view>
       </view>
       <view class='avatar-msg'>
         <view class='avatar-nickname'>
-          <text>{{ wareCards[0].user.wechatName }}</text>
-          <view class='flowers-box' wx:if='{{ true }}'>
+          <text>{{ wareCards.user.wechatName }}</text>
+          <view class='flowers-box' wx:if='{{ wareCards.user.gender === 2 }}'>
             <image src='../../../static/image/flowers.png'></image>
           </view>
-          <view class='flowers-box' wx:else>
+          <view class='flowers-box' wx:elif='{{ wareCards.user.gender === 1 }}'>
             <image src='../../../static/image/boy.png'></image>
           </view>
+          <view wx:else class='gender-size'>未知</view>
         </view>
-        <view class='avatar-birthday'>{{ wxs.getBirthday(wareCards[0].user.birthday) }}</view>
-        <view class='avatar-address'>{{ wareCards[0].user.schoolName }}</view>
+        <view class='avatar-birthday'>{{ format.getBirthday(wareCards.user.birthday) }}</view>
+        <view class='avatar-address'>{{ wareCards.user.schoolName }}</view>
       </view>
     </view>
     <view class='mine-category'>
         <view class='play-count'>
-          <view>{{ wareCards[0].userRead.playAmount }}</view>
+          <view>{{ wareCards.playAmount || 0 }}</view>
           <view class='border-right'>
             <view class='play-img'>
               <image src='../../../static/image/play.png'></image>
@@ -55,7 +35,7 @@
           </view>
         </view>
         <view class='follow-count'>
-          <view class='color'>{{ wareCards[0].userRead.fansAmount || 0 }}</view>
+          <view class='color'>{{ wareCards.fansAmount || 0 }}</view>
           <view class='border-right'>
             <view class='play-img'>
               <image src='../../../static/image/follow.png'></image>
@@ -64,7 +44,7 @@
           </view>
         </view>
         <view class='point-count'>
-          <view class='color'>{{ wareCards[0].userRead.likeAmount || 0 }}</view>
+          <view class='color'>{{ wareCards.likeAmount || 0 }}</view>
           <view class='border-right'>
             <view class='play-img'>
               <image src='../../../static/image/point.png'></image>
@@ -73,7 +53,7 @@
           </view>
         </view>
         <view class='flower-count'>
-          <view class='color'>{{ wareCards[0].userRead.pointAmount || 0 }}</view>
+          <view class='color'>{{ wareCards.pointAmount || 0 }}</view>
           <view class='border-right'>
             <view class='play-img'>
               <image src='../../../static/image/flower.png'></image>
@@ -83,7 +63,7 @@
         </view>
       </view>
   </view>
-  <view class='works-article' wx:for="{{ wareCards }}" wx:key="{{ index }}">
+  <view class='works-article' wx:for="{{ worksList }}" wx:key="{{ index }}">
     <view class='user-info'>
       <view class='user-img'>
         <image src='{{ item.user.avatar }}'></image>
@@ -99,7 +79,7 @@
           </view>
         </view>
         <view class='user-name'>
-          <view class='left-detail'>{{ wxs.formatDate(item.userRead.gmtCreated) || 0 }}</view>
+          <view class='left-detail'>{{ format.formatDate(item.userRead.gmtCreated) || 0 }}</view>
           <view class='right-detail'>
             <view class='point-img'>
               <image src='../../../static/image/like.png'></image>

+ 13 - 6
pages/user/myworks/myworks.wxss

@@ -33,8 +33,8 @@ page{
 .avatar-bg{
   margin-left: 20rpx;
   margin-top: 50rpx;
-  width: 154rpx;
-  height: 154rpx;
+  width: 152rpx;
+  height: 152rpx;
   background: #61CA54;
   border-radius: 50%;
   position: relative;
@@ -46,8 +46,8 @@ page{
   border-radius: 50%;
   z-index: 300;
   position: absolute;
-  top: 8rpx;
-  left: 8rpx;
+  top: 7rpx;
+  left: 7rpx;
 }
 
 .avatar-image{
@@ -103,6 +103,12 @@ page{
   font-size: 32rpx;
 }
 
+.gender-size{
+  margin-left: 10rpx;
+  font-size: 28rpx;
+  align-self: center;
+}
+
 .mine-category{
   box-sizing: border-box;
   width: 674rpx;
@@ -218,6 +224,7 @@ image{
 .right-detail{
   width: 90rpx;
   display: flex;
+  font-size: 22rpx;
 }
 
 .user-time{
@@ -260,14 +267,14 @@ image{
 }
 
 .play-img{
-  margin-bottom: 12rpx;
+  margin-bottom: 10rpx;
   width: 20rpx;
   height: 20rpx;
 }
 
 .point-img{
   margin-right: 6rpx;
-  margin-bottom: 10rpx;
+  margin-top: 2rpx;
   width: 26rpx;
   height: 24rpx;
 }

+ 4 - 15
pages/user/walletDetails/walletDetails.wxml

@@ -1,15 +1,4 @@
-<wxs module="wxs">
-  function formatDate(time) {
-    var timeTemp = getDate(time);
-    var timeString = timeTemp.toLocaleDateString() + timeTemp.toLocaleTimeString();
-    return timeString.replace('/','-').replace('/','-').replace('上午',' ').replace('下午',' ');
-  }
-  function parseDouble(number) {
-    return parseFloat(number).toFixed(2);
-  }
-  module.exports.formatDate = formatDate;
-  module.exports.parseDouble = parseDouble;
-</wxs>
+<wxs src="../../commonWxs/format.wxs" module="format" />
 <view class='walletDetails'>
   <view class="walletDetails-center">
     <view class='walletDetails-info' wx:for="{{ walletDatails }}" wx:key="{{ index }}">
@@ -20,17 +9,17 @@
         <view class="avatar-info">
           <text class="avatar-doc">{{ item.description }}</text>
 
-          <text class="avatar-time">{{wxs.formatDate(item.gmtCreated)}}</text>
+          <text class="avatar-time">{{format.formatDate(item.gmtCreated)}}</text>
         </view>
       </view>
       <view class="walletDetails-right">
         <view class="avatar-value-pos" wx:if="{{ item.type === 'INCOME' }}">
           <text class="avatar-symbol">+</text>
-          <text>{{ wxs.parseDouble(item.price / 100) }}</text>
+          <text>{{ format.parseDouble(item.price / 100) }}</text>
         </view>
         <view class="avatar-value-neg" wx:else>
           <text class="avatar-symbol">-</text>
-          <text>{{ wxs.parseDouble(item.price / 100) }}</text>
+          <text>{{ format.parseDouble(item.price / 100) }}</text>
         </view>
       </view>
     </view>

BIN
static/image/reset.png


+ 1 - 0
towxml

@@ -0,0 +1 @@
+Subproject commit 0bb70d6f7aca65b74d88c01977ceac52f3465f5d

+ 11 - 0
utils/APIClient.js

@@ -356,4 +356,15 @@ module.exports = {
       pageSize: pageSize
     }).url(url).send();
   },
+  //  获取用户信息
+  getUserMsg(followUid, pageNo, pageSize){
+    let url = getBaseUrl('wx/user/info');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data({
+      uid: followUid,
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).url(url).send();
+  },
 }