孙志雷 il y a 6 ans
Parent
commit
c1064ae411
4 fichiers modifiés avec 341 ajouts et 341 suppressions
  1. 1 1
      pages/user/myWallet/myWallet.js
  2. 24 36
      pages/user/walletDetails/walletDetails.wxml
  3. 9 2
      project.config.json
  4. 307 302
      utils/APIClient.js

+ 1 - 1
pages/user/myWallet/myWallet.js

@@ -5,7 +5,7 @@ Page({
    */
   data: {
     title: '',
-    totalMoney: 3000,
+    totalMoney: 0,
     textDoc: '收到的赏金',
     textPrompt: '收到的奖励自动转入微信钱包',
     walletDetail: '资金明细',

+ 24 - 36
pages/user/walletDetails/walletDetails.wxml

@@ -1,46 +1,34 @@
-<wxs module="m1">
-    function formatDate(time, flag) {
-	const t = new Date(time); 
-	const tf = function(i){return (i < 10 ? '0' : '') + i};
-	const year = t.getFullYear();
-	const month = tf(t.getMonth() + 1);
-	const day = tf(t.getDate());
-	const hour = tf(t.getHours());
-	const minute = tf(t.getMinutes());
-	//console.log( month + '月' + day + '日' + hour + ':' + minute);
-	if(flag == 1) {
-		return  month + '月' + day + '日' + ' ' + hour + ':' + minute;
-	}else if(flag == 2) {
-		return year + '-' + month + '-' + day
-	}else if(flag == 3){
-		return month + '-' + day + ' ' + hour + ':' + minute;
-	}
-}
-    module.exports.formatDate = formatDate;
+<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='walletDetails'>
   <view class="walletDetails-center">
     <view class='walletDetails-info' wx:for="{{ walletDatails }}" wx:key="{{ index }}">
-        <view class="walletDetails-left">
-            <view class='avatar-box'>
-                <image src="../../../static/image/walletdetails.png" />
-            </view>
-            <view class="avatar-info">
-                <text class="avatar-doc">{{ item.description }}</text>
+      <view class="walletDetails-left">
+        <view class='avatar-box'>
+          <image src="../../../static/image/walletdetails.png" />
+        </view>
+        <view class="avatar-info">
+          <text class="avatar-doc">{{ item.description }}</text>
 
-                <text class="avatar-time"></text>
-            </view>
+          <text class="avatar-time">{{wxs.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>{{ item.price / 100 }}</text>
         </view>
-        <view class="walletDetails-right">
-            <view class="avatar-value-pos" wx:if="{{ item.type === 'INCOME' }}">
-                <text class="avatar-symbol">+</text>
-                <text>{{ item.price }}</text>
-            </view>
-            <view class="avatar-value-neg" wx:else>
-                <text class="avatar-symbol">-</text>
-                <text>{{ item.price }}</text>
-            </view>
+        <view class="avatar-value-neg" wx:else>
+          <text class="avatar-symbol">-</text>
+          <text>{{ item.price / 100 }}</text>
         </view>
+      </view>
     </view>
   </view>
 </view>

+ 9 - 2
project.config.json

@@ -36,7 +36,7 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": 19,
+			"current": 20,
 			"list": [
 				{
 					"id": 0,
@@ -156,7 +156,14 @@
 				{
 					"id": -1,
 					"name": "course",
-					"pathName": "pages/user/mycourse/mycourse"
+					"pathName": "pages/user/mycourse/mycourse",
+					"query": ""
+				},
+				{
+					"id": -1,
+					"name": "我的",
+					"pathName": "pages/index/index",
+					"query": ""
 				}
 			]
 		}

+ 307 - 302
utils/APIClient.js

@@ -5,311 +5,316 @@ let request = require('WXHttpRequest.js');
 const httputil = require('httpUtil.js');
 
 function getProductUrl(action) {
-	return HOST_PRODUCT + action;
+  return HOST_PRODUCT + action;
 }
 
 function getBaseUrl(action) {
-	return HOST_BASE + action;
+  return HOST_BASE + action;
 }
 module.exports = {
-    //获取推荐首页信息
-    getIndex(uid) {
-        let url = getProductUrl('wx/index');
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 获取首页人气推荐
-    getHotRecommend(uid, pageNo, pageSize) {
-        let url = getBaseUrl('wx/userRead/recommend');
-        return request.getInstance().header({
-            uid
-        }).data({
-            pageNo,
-            pageSize,
-        }).url(url).send();
-    },
-    // 获取用户朗读详细信息
-    getWorksDetail(uid, readId) {
-        let url = getBaseUrl(`wx/userRead/info/${readId}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 获取全部课本
-    getAllBooks(pageNo, pageSize) {
-        let url = getProductUrl('wx/product');
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data({
-            pageNo,
-            pageSize
-        }).send();
-    },
-    // 获取课本详情
-    getBookDetail(uid, id) {
-        let url = getProductUrl(`wx/product/${id}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 获取单课详情
-    getClassDetail(uid, id) {
-        let url = getProductUrl(`wx/lesson/${id}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 检查是否收藏过课程
-    classIsLike(uid, data) {
-        let url = getProductUrl(`wx/favorites/isLike`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).send();
-    },
-    getClassDetail(uid, id) {
-        let url = getProductUrl(`wx/lesson/${id}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 获取单课朗读信息
-    getClassRead(uid, data) {
-        let url = getBaseUrl(`wx/userRead`);
-        return request.getInstance().header({
-            uid
-        }).data(data).url(url).send();
-    },
-    // 作品播放了+1
-    playWorks(uid, readId) {
-        let url = getBaseUrl(`wx/userRead/play/${readId}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 发布作品
-    postWork(uid, data) {
-        console.log(data);
-        let url = getBaseUrl(`wx/userRead`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    // 点赞作品
-    likeWorks(uid, readId) {
-        let url = getBaseUrl(`wx/userRead/like/${readId}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 关注用户
-    followUser(uid, followUid) {
-        let url = getBaseUrl(`wx/fans`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            "uid": followUid
-        }).method('POST').send();
-    },
-    //获取关注的用户列表
-    getFollowUsers(uid, pageNo, pageSize) {
-        let url = getBaseUrl(`wx/fans`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            pageNo: pageNo,
-            pageSize: pageSize
-        }).send();
-    },
-    // 获取关注用户的作品列表
-    getFollowWorks(uid, pageNo, pageSize) {
-        let url = getBaseUrl(`wx/fans/interest`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            pageNo: pageNo,
-            pageSize: pageSize
-        }).send();
-    },
-    // 搜索
-    getSearchResult(uid, key, pageNo, pageSize) {
-        let url = getProductUrl(`wx/lesson`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            title: key,
-            productId: '',
-            pageNo: pageNo,
-            pageSize: pageSize
-        }).send();
-    },
-    // 获取回复信息
-    getReply(uid, columnId, pageNo, pageSize) {
-        let url = getBaseUrl(`wx/posts/reply`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data({
-            columnId: columnId,
-            pageNo: pageNo,
-            pageSize: pageSize
-        }).send();
-    },
-    // 获取回复(楼中楼)
-    getReplyComment(uid, postId) {
-        let url = getBaseUrl(`wx/posts/one/${postId}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).send();
-    },
-    // 发布回复(楼中楼)
-    postReplyComment(uid, data) {
-        let url = getBaseUrl(`wx/reply`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    // 点赞评论
-    likeCommend(uid, likeUid) {
-        let url = getBaseUrl(`wx/posts/attribute/${likeUid}`);
-        return request.getInstance().header({
-            uid
-        }).url(url).method('GET').send();
-    },
-    // 发布讨论
-    postReply(uid, data) {
-        let url = getBaseUrl(`wx/posts`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    // 获取推荐团购信息
-    getGroupList() {
-        let url = getBaseUrl(`wx/groupPurchaseInfo/recommend`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).send();
-    },
-    // 获取课程团购信息
-    getGroupPurchaseInfo(productId) {
-        let url = getBaseUrl(`wx/groupPurchaseInfo/info/${productId}`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).send();
-    },
-    // 发起团购
-    SendGroupPurchas(data) {
-        let url = getBaseUrl(`wx/groupPurchase/create`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data(data).method('POST').send();
-    },
-    // 参加团购
-    JoinGroupPurchas(orderId) {
-        let url = getBaseUrl(`wx/groupPurchase/join`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data({
-            orderId
-        }).method('POST').send();
-    },
-    // 收藏课程
-    collectClass(uid, data) {
-        let url = getProductUrl(`wx/favorites`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    //我的团
-    getMygroup() {
-        let url = getBaseUrl(`wx/groupPurchase/my`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data({
-            pageNo: 1,
-            pageSize: 100
-        }).send();
-    },
-    //获取团购详情
-    getMygroupInfo(orderId) {
-        let url = getBaseUrl(`wx/groupPurchase/info/${orderId}`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).send();
-    },
-    //团购是否成功
-    groupSuccess(orderId) {
-        let url = getBaseUrl(`wx/groupPurchase/joinStatus`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).url(url).data({
-            orderId
-        }).send();
-    },
-    // 发起奖励
-    rewardMoney(uid, data) {
-        let url = getBaseUrl(`wx/wallet/award`);
-        return request.getInstance().header({
-            uid
-        }).url(url).data(data).method('POST').send();
-    },
-    // 修改资料
-    settingUserInfo(wechatName, mobile, gender, schoolProvince, schoolCity, schoolName, profession, birthday) {
-        let url = getBaseUrl(`wx/user`);
-        return request.getInstance().header({
-            uid:wx.getStorageSync('uid')
-        }).data({
-            wechatName: wechatName,
-            mobile: mobile,
-            gender: gender,
-            schoolProvince: schoolProvince,
-            schoolCity: schoolCity,
-            schoolName: schoolName,
-            profession: profession,
-            birthday: birthday
-        }).url(url).method('PUT').send();
-    },
-    //获取个人信息
-    getUserInfo() {
-        let url = getBaseUrl(`wx/user`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).data({
-            uid: wx.getStorageSync('uid')
-        }).url(url).send();
-    },
-    // 生成二维码
-    createQRCode(data) {
-        let url = getBaseUrl(`wx/qrCode`);
-        return request.getInstance().header({
-            uid: wx.getStorageSync('uid')
-        }).data(data).url(url).send();
-    },
-//	我的奖金
-    myWallet() {
-      let url = getBaseUrl('wx/wallet/bonus');
-      return request.getInstance().header({
-          uid: wx.getStorageSync('uid')
-      }).url(url).send();
-    },
-    // 資金明細
-    myWalletDetails() {
-      let url = getBaseUrl('wx/wallet/record');
-      return request.getInstance().header({
-        uid: wx.getStorageSync('uid')
-      }).url(url).send();
-    },
-    // 我的課程
-    myCourse() {
-      let url = getBaseUrl('wx/groupPurchase/myCourse');
-      return request.getInstance().header({
-        uid: wx.getStorageSync('uid')
-      }).url(url).send();
-    },
-    // 我的朗读
-    myRead() {
-      let url = getBaseUrl('wx/userRead/my');
-      return request.getInstance().header({
-        uid: wx.getStorageSync('uid')
-      }).url(url).send();
-    },
+  //获取推荐首页信息
+  getIndex(uid) {
+    let url = getProductUrl('wx/index');
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 获取首页人气推荐
+  getHotRecommend(uid, pageNo, pageSize) {
+    let url = getBaseUrl('wx/userRead/recommend');
+    return request.getInstance().header({
+      uid
+    }).data({
+      pageNo,
+      pageSize,
+    }).url(url).send();
+  },
+  // 获取用户朗读详细信息
+  getWorksDetail(uid, readId) {
+    let url = getBaseUrl(`wx/userRead/info/${readId}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 获取全部课本
+  getAllBooks(pageNo, pageSize) {
+    let url = getProductUrl('wx/product');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data({
+      pageNo,
+      pageSize
+    }).send();
+  },
+  // 获取课本详情
+  getBookDetail(uid, id) {
+    let url = getProductUrl(`wx/product/${id}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 获取单课详情
+  getClassDetail(uid, id) {
+    let url = getProductUrl(`wx/lesson/${id}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 检查是否收藏过课程
+  classIsLike(uid, data) {
+    let url = getProductUrl(`wx/favorites/isLike`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).send();
+  },
+  getClassDetail(uid, id) {
+    let url = getProductUrl(`wx/lesson/${id}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 获取单课朗读信息
+  getClassRead(uid, data) {
+    let url = getBaseUrl(`wx/userRead`);
+    return request.getInstance().header({
+      uid
+    }).data(data).url(url).send();
+  },
+  // 作品播放了+1
+  playWorks(uid, readId) {
+    let url = getBaseUrl(`wx/userRead/play/${readId}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 发布作品
+  postWork(uid, data) {
+    console.log(data);
+    let url = getBaseUrl(`wx/userRead`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  // 点赞作品
+  likeWorks(uid, readId) {
+    let url = getBaseUrl(`wx/userRead/like/${readId}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 关注用户
+  followUser(uid, followUid) {
+    let url = getBaseUrl(`wx/fans`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      "uid": followUid
+    }).method('POST').send();
+  },
+  //获取关注的用户列表
+  getFollowUsers(uid, pageNo, pageSize) {
+    let url = getBaseUrl(`wx/fans`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).send();
+  },
+  // 获取关注用户的作品列表
+  getFollowWorks(uid, pageNo, pageSize) {
+    let url = getBaseUrl(`wx/fans/interest`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).send();
+  },
+  // 搜索
+  getSearchResult(uid, key, pageNo, pageSize) {
+    let url = getProductUrl(`wx/lesson`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      title: key,
+      productId: '',
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).send();
+  },
+  // 获取回复信息
+  getReply(uid, columnId, pageNo, pageSize) {
+    let url = getBaseUrl(`wx/posts/reply`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data({
+      columnId: columnId,
+      pageNo: pageNo,
+      pageSize: pageSize
+    }).send();
+  },
+  // 获取回复(楼中楼)
+  getReplyComment(uid, postId) {
+    let url = getBaseUrl(`wx/posts/one/${postId}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).send();
+  },
+  // 发布回复(楼中楼)
+  postReplyComment(uid, data) {
+    let url = getBaseUrl(`wx/reply`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  // 点赞评论
+  likeCommend(uid, likeUid) {
+    let url = getBaseUrl(`wx/posts/attribute/${likeUid}`);
+    return request.getInstance().header({
+      uid
+    }).url(url).method('GET').send();
+  },
+  // 发布讨论
+  postReply(uid, data) {
+    let url = getBaseUrl(`wx/posts`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  // 获取推荐团购信息
+  getGroupList() {
+    let url = getBaseUrl(`wx/groupPurchaseInfo/recommend`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 获取课程团购信息
+  getGroupPurchaseInfo(productId) {
+    let url = getBaseUrl(`wx/groupPurchaseInfo/info/${productId}`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 发起团购
+  SendGroupPurchas(data) {
+    let url = getBaseUrl(`wx/groupPurchase/create`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data(data).method('POST').send();
+  },
+  // 参加团购
+  JoinGroupPurchas(orderId) {
+    let url = getBaseUrl(`wx/groupPurchase/join`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data({
+      orderId
+    }).method('POST').send();
+  },
+  // 收藏课程
+  collectClass(uid, data) {
+    let url = getProductUrl(`wx/favorites`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  //我的团
+  getMygroup() {
+    let url = getBaseUrl(`wx/groupPurchase/my`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data({
+      pageNo: 1,
+      pageSize: 100
+    }).send();
+  },
+  //获取团购详情
+  getMygroupInfo(orderId) {
+    let url = getBaseUrl(`wx/groupPurchase/info/${orderId}`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  //团购是否成功
+  groupSuccess(orderId) {
+    let url = getBaseUrl(`wx/groupPurchase/joinStatus`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).data({
+      orderId
+    }).send();
+  },
+  // 发起奖励
+  rewardMoney(uid, data) {
+    let url = getBaseUrl(`wx/wallet/award`);
+    return request.getInstance().header({
+      uid
+    }).url(url).data(data).method('POST').send();
+  },
+  // 修改资料
+  settingUserInfo(wechatName, mobile, gender, schoolProvince, schoolCity, schoolName, profession, birthday) {
+    let url = getBaseUrl(`wx/user`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data({
+      wechatName: wechatName,
+      mobile: mobile,
+      gender: gender,
+      schoolProvince: schoolProvince,
+      schoolCity: schoolCity,
+      schoolName: schoolName,
+      profession: profession,
+      birthday: birthday
+    }).url(url).method('PUT').send();
+  },
+  //获取个人信息
+  getUserInfo() {
+    let url = getBaseUrl(`wx/user`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 生成二维码
+  createQRCode(data) {
+    let url = getBaseUrl(`wx/qrCode`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data(data).url(url).send();
+  },
+  //个人中心
+  getMyInfo() {
+    let url = getBaseUrl(`wx/user/my`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  //我的奖金
+  myWallet() {
+    let url = getBaseUrl('wx/wallet/bonus');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 資金明細
+  myWalletDetails() {
+    let url = getBaseUrl('wx/wallet/record');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 我的課程
+  myCourse() {
+    let url = getBaseUrl('wx/groupPurchase/myCourse');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
+  // 我的朗读
+  myRead() {
+    let url = getBaseUrl('wx/userRead/my');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).url(url).send();
+  },
 }