Kaynağa Gözat

feat: add onShareAppMessage function & judge index login or-not

wangyuan 2 yıl önce
ebeveyn
işleme
28f85fe9ed
1 değiştirilmiş dosya ile 14 ekleme ve 2 silme
  1. 14 2
      pages/index/index.js

+ 14 - 2
pages/index/index.js

@@ -2,7 +2,7 @@
 import { homePage } from '../../api/index'
 import { userEntityRecharge } from '../../api/charge'
 import { createQRcode } from "../../api/document";
-
+const app = getApp()
 Page({
 
   /**
@@ -24,7 +24,13 @@ Page({
   },
   
   onShow () {
-    this.initIndexData()
+    if (app.globalData.userInfo.login) {
+      this.initIndexData()
+    } else {
+      wx.reLaunch({
+        url: '/pages/my/my'
+      })
+    }
   },
   onPullDownRefresh () {
     wx.vibrateShort({
@@ -32,6 +38,12 @@ Page({
     })
     this.initIndexData(true)
   },
+  onShareAppMessage () {
+    return {
+      title: 'ITTHealth',
+      path: '/page/index/index'
+    }
+  },
   // 获取首页信息
   initIndexData (pullDownRefresh = false) {
     wx.showLoading({