From 5e649be819c7297c79c21c6dc120b4b6b362db9e Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 03 四月 2024 17:23:39 +0800 Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master --- pages/study/index.js | 37 +++++++++++++++++++++++++++++++++---- 1 files changed, 33 insertions(+), 4 deletions(-) diff --git a/pages/student/index.js b/pages/study/index.js similarity index 85% rename from pages/student/index.js rename to pages/study/index.js index a94d555..1e682d6 100644 --- a/pages/student/index.js +++ b/pages/study/index.js @@ -2,14 +2,18 @@ import { getPublicImage } from "../../assets/js/middleGround/tool.js"; +import { + loginInfo +} from '../../assets/js/login'; +import moment from 'moment' Page({ /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { - learningDuration: 0, - lastLoginTime: '2024-03-25 20:00:09', + learningDuration: "0灏忔椂", + lastLoginTime: '-', active: 0, titleBook: "鍥句功锛�0鏈級", titleCourse: "璇剧▼锛�0闂級", @@ -31,8 +35,9 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad() { - this.getStaticsSum(); - this.getDataList(false); + // 妫�鏌ョ櫥褰曠姸鎬� + + }, /** @@ -51,7 +56,31 @@ active: 2 }) } + const token = wx.getStorageSync(app.config.tokenKey) + if (!token) { + loginInfo(app, (data) => { + if (data) { + this.getUserInfo() + this.getStaticsSum(); + this.getDataList(false); + } + }) + } else { + this.getUserInfo() + this.getStaticsSum(); + this.getDataList(false); + } + + }, + getUserInfo() { + app.MG.identity.getCurrentAppUser().then(res => { + if (res) { + this.setData({ + lastLoginTime: res.lastLoginTime != null ? moment(res.lastLoginTime).format('YYYY-MM-DD HH:mm:ss') : '-' + }) + } + }) }, getStaticsSum() { const data = { -- Gitblit v1.9.1