Z1hgq 7 rokov pred
rodič
commit
840df64cb6

BIN
Gkzs/.DS_Store


+ 0 - 1
Gkzs/app.json

@@ -1,6 +1,5 @@
 {
 {
   "pages":[
   "pages":[
-    "login/login",
     "index/index",
     "index/index",
     "index/info/info",
     "index/info/info",
     "index/terms/terms",
     "index/terms/terms",

+ 49 - 8
Gkzs/index/index.js

@@ -17,10 +17,6 @@ Page({
    */
    */
   onLoad: function (options) {
   onLoad: function (options) {
    // this.userLogin()
    // this.userLogin()
-   wx.hideLoading()
-   this.setData({
-     userid: getApp().userinfo.userid
-   })
     this.getInfo()
     this.getInfo()
   },
   },
 
 
@@ -75,6 +71,7 @@ Page({
   showTopTips: function () {
   showTopTips: function () {
     var that = this;
     var that = this;
     if (!that.data.isAgree) {
     if (!that.data.isAgree) {
+      wx.hideLoading()
       this.setData({
       this.setData({
         showTopTips: true
         showTopTips: true
       });
       });
@@ -109,9 +106,6 @@ Page({
     });
     });
   },
   },
   getInfo:function(){
   getInfo:function(){
-    wx.showLoading({
-      title: '加载中',
-    })
     var that = this
     var that = this
     var WxParse = require('../wxParse/wxParse.js');
     var WxParse = require('../wxParse/wxParse.js');
     wx.request({
     wx.request({
@@ -131,5 +125,52 @@ Page({
         //callback(tet)
         //callback(tet)
       }
       }
     });
     });
-  }
+  },
+  userLogin: function () {
+    wx.showLoading({
+      title: '登录中',
+    })
+    var that = this
+    try {
+      wx.login({
+        success: function (res) {
+          let code = res.code
+          console.log(code)
+          var c = getApp()
+          c.userinfo.usercode = res.code
+          wx.getUserInfo({
+            success: function (res) {
+              //let encrypted_data = res.encryptedData
+              let tx = res.userInfo.avatarUrl
+              let nn = res.userInfo.nickName
+              wx.request({
+                url: 'https://t10.9026.com/api/home/login',
+                method: 'POST',
+                data: {
+                  code: code,
+                  avatar: tx,
+                  nickName: nn,
+                },
+                success: function (res) {
+                  that.setData({
+                    userid: res.data.data.userinfo.id
+                  })
+                  var app = getApp()
+                  app.userinfo.userid = that.data.userid
+                  console.log(getApp().userinfo.userid)
+                  if (res.data.data.userinfo.has_agreed == 1) {
+                    wx.navigateTo({
+                      url: 'info/info'
+                    })
+                  } else {
+                    that.showTopTips()
+                  }
+                }
+              })
+            }
+          })
+        }
+      })
+    } catch (e) { }
+  },
 })
 })

+ 2 - 2
Gkzs/index/index.wxml

@@ -8,7 +8,7 @@
     </view>
     </view>
   </view>
   </view>
   <view class='page__bd'>
   <view class='page__bd'>
-  <view class="weui-toptips weui-toptips_warn" wx:if="{{showTopTips}}">错误提示</view>
+  <view class="weui-toptips weui-toptips_warn" wx:if="{{showTopTips}}">未同意使用协议</view>
     <checkbox-group bindchange="bindAgreeChange">
     <checkbox-group bindchange="bindAgreeChange">
       <label class="weui-agree" for="weuiAgree">
       <label class="weui-agree" for="weuiAgree">
         <view class="weui-agree__text">
         <view class="weui-agree__text">
@@ -21,7 +21,7 @@
       </label>
       </label>
     </checkbox-group>
     </checkbox-group>
     <view class="weui-btn-area">
     <view class="weui-btn-area">
-            <button class="weui-btn" type="primary" bindtap="showTopTips">进入高考志愿助手</button>
+            <button open-type='getUserInfo' class="weui-btn" type="primary" bindtap="userLogin">进入高考志愿助手</button>
     </view>
     </view>
   </view>
   </view>
 </view>
 </view>

+ 0 - 1
Gkzs/index/terms/terms.js

@@ -28,7 +28,6 @@ Page({
         })
         })
         var article = tet.data.list[1].content
         var article = tet.data.list[1].content
         WxParse.wxParse('article', 'html', article, that, 5)
         WxParse.wxParse('article', 'html', article, that, 5)
-        wx.hideLoading()
         //callback(tet)
         //callback(tet)
       }
       }
     });
     });

+ 0 - 115
Gkzs/login/login.js

@@ -1,115 +0,0 @@
-// login/login.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    userid: 0,
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  },
-  userLogin: function () {
-    wx.showLoading({
-      title: '登录中',
-    })
-    var that = this
-    try {
-      wx.login({
-        success: function (res) {
-          let code = res.code
-          console.log(code)
-          var c = getApp()
-          c.userinfo.usercode = res.code
-          wx.getUserInfo({
-            success: function (res) {
-              //let encrypted_data = res.encryptedData
-              let tx = res.userInfo.avatarUrl
-              let nn = res.userInfo.nickName
-              wx.request({
-                url: 'https://t10.9026.com/api/home/login',
-                method: 'POST',
-                data: {
-                  code: code,
-                  avatar: tx,
-                  nickName: nn,
-                },
-                success: function (res) {
-                  that.setData({
-                    userid: res.data.data.userinfo.id
-                  })
-                  var app = getApp()
-                  app.userinfo.userid = that.data.userid
-                  console.log(getApp().userinfo.userid)
-                  if (res.data.data.userinfo.has_agreed == 1) {
-                    wx.navigateTo({
-                      url: '../index/info/info'
-                    })
-                  }else{
-                    wx.navigateTo({
-                      url: '../index/index'
-                    })
-                  }
-                }
-              })
-            }
-          })
-        }
-      })
-    } catch (e) { }
-  },
-})

+ 0 - 1
Gkzs/login/login.json

@@ -1 +0,0 @@
-{}

+ 0 - 19
Gkzs/login/login.wxml

@@ -1,19 +0,0 @@
-<!--login/login.wxml-->
-<view class='page'>
-  <view class="page__hd">
-  <image src='../images/logo.png' mode='aspectFit'></image>
-    <view class="weui-flex">
-      <view class="weui-flex__item">
-        <view class="left">申请获取以下权限</view>
-      </view>
-    </view>
-    <view class="weui-flex">
-      <view class="weui-flex__item">
-        <view class="left-text">获得你的公开信息(昵称、头像等)</view>
-      </view>
-    </view>
-    <view class="weui-btn-area">
-      <button open-type='getUserInfo' class="weui-btn" type="primary" bindtap="userLogin">授权登录</button>
-    </view>
-  </view>
-</view>

+ 0 - 12
Gkzs/login/login.wxss

@@ -1,12 +0,0 @@
-/* login/login.wxss */
-.left{
-  text-align: left;
-  float: 40rpx;
-  margin-top: 40rpx;
-}
-.left-text{
-  text-align: left;
-  float: 40rpx;
-  margin-top: 40rpx;
-  color:#C0C0C0
-}