bayi 2 роки тому
батько
коміт
7df4ea25e3

+ 8 - 0
api/message.js

@@ -0,0 +1,8 @@
+import {
+  request
+} from "../utils/request";
+
+module.exports = {
+  // 获取消息页面状态
+  getAuthorityMsg: data => request('/v3/message', 'get', data),
+}

+ 1 - 1
components/readingTips/index.wxml

@@ -15,7 +15,7 @@
             {{productVip.title}}
           </view>
           <view class="pLcontent vipContent">
-            {{vipTime?filters.formatDate(vipTime)+'过期':'购买VIP会员,即可畅读全部资源'}}
+            购买VIP会员,即可畅读全部资源
           </view>
         </view>
         <view class="payRight vipBtn" bindtap="toBuy" data-type="{{productVip.id}}">

+ 13 - 2
pages/message/index.js

@@ -1,3 +1,6 @@
+import {
+  getAuthorityMsg
+} from '~/api/message'
 const app = getApp()
 Page({
   data: {
@@ -6,7 +9,8 @@ Page({
       show: false,
       top: 0,
       left: 0
-    }
+    },
+    authorityMsg: {}
   },
   onLoad(options) {
 
@@ -17,6 +21,14 @@ Page({
         selected: 3
       })
     }
+    this.getAuthorityMsg()
+  },
+  async getAuthorityMsg() {
+    let authorityMsg = await getAuthorityMsg()
+    console.log(authorityMsg);
+    this.setData({
+      authorityMsg
+    })
   },
   onLongPress(e) {
     console.log(e);
@@ -53,7 +65,6 @@ Page({
   jump({
     currentTarget
   }) {
-    console.log(currentTarget);
     wx.navigateTo({
       url: `/pages/${currentTarget.dataset.url}/index`,
     })

+ 4 - 2
pages/message/index.wxml

@@ -1,3 +1,5 @@
+<wxs src="../../utils/filter.wxs" module="filters" />
+
 <navigationBar></navigationBar>
 <view class="messagePage">
   <view class="searchBox">
@@ -27,8 +29,8 @@
         </view>
       </view>
       <view class="right">
-        <view class="date">2023-3-14</view>
-        <view class="unread">10</view>
+        <view class="date">{{filters.formatDate(authorityMsg.likeDate,5)}}</view>
+        <view class="unread">{{authorityMsg.likeCount}}</view>
       </view>
     </view>
     <view class="base authority" bindtap="jump" data-url='notice'>

+ 2 - 3
utils/filter.wxs

@@ -7,6 +7,7 @@ var formatNumber = function (n) {
  */
 //时间戳转时间
 function formatDate(time, flag) {
+  console.log(time, flag);
   if (!time) {
     return
   }
@@ -29,9 +30,7 @@ function formatDate(time, flag) {
   } else if (flag == 4) {
     return year + '年' + month + '月' + day + '日';
   } else if (flag == 5) {
-    return day.toString().substring(1, 2)
-  } else if (flag == 6) {
-    return month + '.' + day;
+    return year + '-' + month + '-' + day;
   }
 }
 

+ 3 - 3
utils/request.js

@@ -6,13 +6,13 @@ const {
     envVersion
   }
 } = wx.getAccountInfoSync();
-/* if (envVersion == 'develop') {
+if (envVersion == 'develop') {
   baseUrl = 'https://reader-api.efunbox.cn/wx'
   oldUrl = 'https://reader-api.efunbox.cn'
-} else { */
+} else {
   baseUrl = 'https://reader-api.ai160.com/wx'
   oldUrl = 'https://reader-api.ai160.com'
-// }
+}
 
 function request(url, method, data, oldBaseUrl = false) {
   let header = {