Quellcode durchsuchen

添加了下拉刷新的功能

yerong vor 4 Jahren
Ursprung
Commit
dc7c7956a9

+ 1 - 1
dist/wx

@@ -1 +1 @@
-Subproject commit 5938a205f72e2d0db5d313ee0b8088fb8f454df0
+Subproject commit 0de22cf11675ba564d8959a2f6cfe7257ad37b93

+ 3 - 3
src/components/device/toy/connecting.vue

@@ -244,9 +244,9 @@ export default {
     },
     // 前往正在玩的波动时间界面
     to_playing() {
-      // mpvue.navigateTo({
-      //   url: "/pages/start/main"
-      // })
+      mpvue.navigateTo({
+        url: "/pages/start/main"
+      })
     },
     //修改连接状态
     change_toy_connect_status($status) {

+ 11 - 5
src/components/index/personal.vue

@@ -93,6 +93,12 @@
       </van-row>
     </div>
 
+    <view class="text-center font-sm" v-if="userinfo.level >= 3 && userinfo.level <= 7">
+      <text class="text-gray">今日专注力免费训练时长还有:
+        <text class="text-yellow">{{ userinfo.free_time }}</text>
+      </text>
+    </view>
+
     <!--    领券弹窗-->
     <van-popup
       :show="first"
@@ -216,7 +222,7 @@ export default {
         url: "/pages/coupons/main"
       })
     },
-    change_login_status(){
+    change_login_status() {
       $this.$emit('change_login_status')
     }
   },
@@ -224,9 +230,6 @@ export default {
     $this.first = wx.getStorageSync('is_first')
     $this.invite_code = wx.getStorageSync('code')
     reload_userinfo($this)
-    // else if ($this.userinfo.play_time == 0) {
-    //   $this.pop_show = true
-    // }
   }
   ,
   onShow() {
@@ -235,7 +238,10 @@ export default {
   ,
   created() {
     $this = this
-  }
+  },
+  onPullDownRefresh() {
+    reload_userinfo($this)
+  },
 }
 </script>
 

+ 2 - 0
src/pages/index/index.vue

@@ -20,6 +20,7 @@
     <!--    登陆后 的个人首页-->
     <div class="personal_card" v-if="is_login">
       <personal_container @change_login_status="change_login_status"></personal_container>
+
       <device_container></device_container>
     </div>
     <div class="service" :class="{'service_login_page':is_login==false}">
@@ -63,6 +64,7 @@ import device_container from "@/components/device/device";
 import Toast from '../../../static/vant/toast/toast';
 import {userDetail} from "../../requests/user";
 import user_store from "../../store/index"
+import {reload_userinfo} from "../../utils/user";
 
 
 var $this

+ 1 - 0
src/pages/index/main.json

@@ -1,4 +1,5 @@
 {
+  "enablePullDownRefresh":true,
   "usingComponents": {
     "van-row": "../../../static/vant/row/index",
     "van-col": "../../../static/vant/col/index",

+ 9 - 9
src/utils/user.js

@@ -1,35 +1,35 @@
 import {userDetail} from "../requests/user";
-import {formatBirthday, formatTime} from "./index";
+import {formatBirthday, formatSeconds, formatTime} from "./index";
 import utils from "./index";
 import user_store from '../store/index'
 
 
 //刷新用户信息
 export function reload_userinfo($this) {
+  wx.showLoading({
+    title: '加载中',
+    mask:true
+  })
   let $errcode = [
     1001, 1002, 1011, 1012, 1021, 1031
   ]
   userDetail().then((res) => {
     let $data = res.data;
-    console.log('返回码:', $data.code)
-    console.log("错误码", $errcode)
-    console.log('判断状态', $errcode.indexOf($data.code))
     if ($errcode.indexOf($data.code) != -1) {
       do_logout($this)
     }
-    // try {
     $this.userinfo = $data.data;
     $this.userinfo.birthday = formatBirthday($this.userinfo.birthday)
     $this.userinfo['validity_time'] = formatTime($this.userinfo['validity_time'])
     $this.userinfo['level_name'] = utils.get_level_name($this.userinfo['level'])
+    $this.userinfo['free_time'] = formatSeconds($this.userinfo['free_time'])
     //设置邀请码
     user_store.setters.set_invite_code($this.userinfo['invite_id'])
     $this.invite_code = wx.getStorageSync('code') ? wx.getStorageSync('code') : $this.userinfo['invite_id']
     user_store.setters.set_userinfo($this.userinfo)
-
-    // } catch (e) {
-    //   do_logout($this)
-    // }
+    //停止下拉刷新
+    wx.stopPullDownRefresh()
+    wx.hideLoading()
   })
 }