Jelajahi Sumber

半小时内自动登录

Z1hgq 7 tahun lalu
induk
melakukan
5bf825be50
2 mengubah file dengan 37 tambahan dan 35 penghapusan
  1. 28 25
      Gkzs/index/index.js
  2. 9 10
      Gkzs/index/result/result.wxss

+ 28 - 25
Gkzs/index/index.js

xqd
@@ -19,31 +19,34 @@ Page({
     // this.userLogin()
     this.getInfo()
     var that = this
-    wx.getStorage({
-      key: 'logDate',
-      success: function (res) {
-        console.log('prelogDate:' + res.data)
-        var nowDate = new Date()
-        if (nowDate - res.data < 30 * 60 * 1000) {
-          console.log(nowDate - res.data)
-          wx.getStorage({
-            key: 'userid',
-            success: function (res) {
-              wx.showLoading({
-                title: '正在自动登录',
-              })
-              var app = getApp()
-              app.userinfo.userid = res.data
-              console.log(getApp().userinfo.userid)
-              wx.navigateTo({
-                url: "info/info",
-              })
-            },
-          })
-        }
-      },
-    })
-    
+    try{
+      wx.getStorage({
+        key: 'logDate',
+        success: function (res) {
+          console.log('prelogDate:' + res.data)
+          var nowDate = new Date()
+          if (nowDate - res.data < 30 * 60 * 1000) {
+            console.log(nowDate - res.data)
+            wx.getStorage({
+              key: 'userid',
+              success: function (res) {
+                wx.showLoading({
+                  title: '正在自动登录',
+                })
+                var app = getApp()
+                app.userinfo.userid = res.data
+                console.log(getApp().userinfo.userid)
+                wx.navigateTo({
+                  url: "info/info",
+                })
+              },
+            })
+          }
+        },
+      })
+    }catch(e){
+
+    }
   },
 
   /**

+ 9 - 10
Gkzs/index/result/result.wxss

xqd xqd
@@ -7,14 +7,14 @@
 }
 
 .baseInfo{
-  border-radius: 15rpx;
-  margin: 20rpx;
-  background-color: #3CB371
+  border-radius: 5rpx;
+  margin: 5rpx;
+  background-color: #E6E6FA
 }
 .major{
-  border-radius: 15rpx;
-  margin: 20rpx;
-  background-color: #3CB371;
+  border-radius: 5rpx;
+  margin: 5rpx;
+  background-color: #E6E6FA;
   text-align: center
 }
 .college{
@@ -26,8 +26,7 @@
   height: auto
 }
 .majorInfo{
-  border-bottom-left-radius: 30rpx;
-  border-bottom-right-radius:30rpx;
-  margin: 20rpx;
-  background-color: #E6E6FA;
+  border-bottom:4rpx solid gray;
+  margin: 5rpx;
+  background-color: #fff;
 }