Forráskód Böngészése

登陆页面尝试

Rorschach 6 éve
szülő
commit
7e948b9fa3

+ 7 - 0
app.js

@@ -7,6 +7,13 @@ App({
   onLaunch: function (options) {
     // 判断设备是否为 iPhone X
     this.checkIsIPhoneX()
+    console.log(options);
+    if(!wx.getStorageSync('user')){
+      wx.setStorageSync('options',options)
+      wx.navigateTo({
+        url: './pages/loginPage/loginPage'
+      })
+    }
   },
   globalData: {
     isIPX: false, // 当前设备是否为 iPhone X

+ 1 - 0
app.json

@@ -1,6 +1,7 @@
 {
   "pages": [
     "pages/index/index",
+    "pages/loginPage/loginPage",
     "pages/social/works/works",
     "pages/social/insideMessage/insideMessage",
     "pages/social/replyDetail/replyDetail",

+ 0 - 2
component/hot/hot.js

@@ -182,11 +182,9 @@ export const hotInit = (that) => {
   // 获取全部课本
   // that.getBookList();
   that.swiperChange = (e) => {
-    console.log(e)
     const str = 'hotData.swiperCurrent'
     that.setData({
       [str]: e.detail.current
     });
-    console.log(that.data.hotData)
   }
 }

+ 17 - 17
pages/index/index.js

@@ -135,29 +135,29 @@ Page({
       title: '小学课文朗读配音'
     })
     // this.init();
-    getOpenidSessionKey((res) => {}, (error) => {
-      // console.log(error)
-      this.setData({
-        hide: !this.data.hide
-      })
-    });
+    // getOpenidSessionKey((res) => {}, (error) => {
+    //   // console.log(error)
+    //   wx.navigateTo({
+    //     url: '../../pages/loginPage/loginPage'
+    //   })
+    // });
     if (this.data.myIndex === 3) {
       this.getUserWorksInfo();
     }
   },
   //初始化数据
-  init: function () {
-    httputil.getOpenidSessionKey((res) => {
-      console.log('微信的用户信息', res)
+  // init: function () {
+  //   httputil.getOpenidSessionKey((res) => {
+  //     console.log('微信的用户信息', res)
       
-    }, (error) => {
-      console.log(error);
-      this.jurisdiction()
-      // this.setData({
-      //   jurisdictionFlag: false
-      // })
-    });
-  },
+  //   }, (error) => {
+  //     console.log(1111111111111111)
+  //     // this.jurisdiction()
+  //     wx.navigateTo({
+  //       url: '../../loginPage/loginPage'
+  //     })
+  //   });
+  // },
   // 获取用户信息
   getUserWorksInfo: function () {
     console.log(wx.getStorageSync('user'));

+ 73 - 0
pages/loginPage/loginPage.js

@@ -0,0 +1,73 @@
+import httpRequestApi from '../../utils/APIClient';
+import httpUtil from '../../utils/httpUtil'
+Page({
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    collection_data: []
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (option) {
+    console.log(option.title);
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+  getUser:function(e){
+    console.log(e)
+    const options = wx.getStorageSync('options');
+    httpUtil.getOpenidSessionKey(res => {
+      wx.redirectTo({
+        url: `../../${options.path}`
+      })
+  });
+  },
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
pages/loginPage/loginPage.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 3 - 0
pages/loginPage/loginPage.wxml

@@ -0,0 +1,3 @@
+<view class="login-wrapper">
+    <button class="btn"  open-type="getUserInfo" bindgetuserinfo="getUser">登录</button>
+</view>

+ 17 - 0
pages/loginPage/loginPage.wxss

@@ -0,0 +1,17 @@
+.login-wrapper{
+    width: 100%;
+    height: 100%;
+    overflow: hidden;
+}
+.btn {
+    margin: 0;
+    padding: 0;
+    font-size: 36rpx;
+    color: #16B016;
+    background: #fff;
+    width: 100%;
+}
+
+.btn::after {
+    border: none;
+}

+ 8 - 1
project.config.json

@@ -36,7 +36,7 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": 2,
+			"current": 3,
 			"list": [
 				{
 					"id": -1,
@@ -56,6 +56,13 @@
 					"name": "自己发团",
 					"pathName": "pages/groupPage/collage-details/collage-details",
 					"query": "orderId=1547518873633105"
+				},
+				{
+					"id": 3,
+					"name": "123",
+					"pathName": "pages/loginPage/loginPage",
+					"query": "",
+					"scene": "1012"
 				}
 			]
 		}