姜永辉 2 yıl önce
ebeveyn
işleme
315d10f074

+ 1 - 1
app.json

@@ -1,5 +1,5 @@
 {
-    "pages": [
+    "pages": [ 
         "pages/login/login",
         "pages/index/index",
         "pages/home-page/home-page",

+ 33 - 4
pages/login/login.js

@@ -18,14 +18,14 @@ Page({
    * 页面的初始数据
    */
   data: {
-    backgroud: '/static/img/background.png'
+    backgroud: '/static/img/login.png'
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-   // this.wx_login()
+  //  this.wx_login()
   },
 
   /**
@@ -74,13 +74,12 @@ Page({
    */
   getopenid(param) {
     let _this = this
-    api.request(Constants.SYS_OPENID_API + 'login_wechat', 'POST', param).then(login_res => {
+    api.request(Constants.SYS_OPENID_API + 'oauth/wx/login_wechat', 'POST', param).then(login_res => {
       if (login_res.data.code === 200) {
         app.globalData.openid = login_res.data.data.openid
         app.globalData.unionid = login_res.data.data.unionid
         app.globalData.sessionkey = login_res.data.data.session_key
         _this.gettoken()
-
       }
     })
   },
@@ -145,5 +144,35 @@ Page({
       }
     })
   },
+ 
+  /**
+  * 处理加密电话
+  * @e {*} e 
+  */
+  handleGetPhoneNumber(e) { 
+    console.log("handleGetPhoneNumber",e);
+    this.getWechatMobileDecrypt(e.detail.encryptedData, e.detail.iv, app.globalData.session_key);
+  },
+
+   /**
+    * 手机号解密
+    * @param {*} encryptedData 
+    * @param {*} iv 
+    * @param {*} sessionKey 
+    */
+   getWechatMobileDecrypt(encryptedData, iv, sessionKey) {  
+    let param = {
+      encryptedData: encryptedData,
+      iv: iv,
+      sessionKey: sessionKey,
+    }
+    api.request(Constants.SYS_OPENID_API + 'oauth/wx/decrypt', 'POST', param).then(res => {
+      console.log("decrypt", res);
+      if (res.data.code === 200) {
+        app.globalData.phoneNumber = res.data.phoneNumber        
+      }
+    }) 
+ 
+  }, 
 
 })

+ 1 - 2
pages/login/login.json

@@ -2,6 +2,5 @@
   "usingComponents": {},
   "navigationStyle":"custom",
   "navigationBarTextStyle": "white",
-  "navigationBarBackgroundColor": "#1B365D",
-  "navigationBarTitleText":"登录"
+  "navigationBarBackgroundColor": "#1B365D"
 }

+ 19 - 2
pages/login/login.wxml

@@ -1,5 +1,22 @@
 <!-- 新引导页 -->
-<view style="height: 100vh;width:100%; ">
-  <image style="width: 100%;height: 100%;" mode="aspectFit" src="{{backgroud}}" catch:tap="login" />
+<view style="height: 100vh;width:100%;">
+  <image style=" height: 100%;width:100%;" mode="aspectFit" src="../../static/img/background.png" />
+  <view class="base-absolute">
+    <view>
+      标准版
+    </view>
+    <view>
+      专业版
+    </view>
+    <view>
+      泛家居建陶行业云服务
+    </view>
+    <view>
 
+    </view>
+
+    <view>
+      <button class="pf-btn-auth" 	open-type="getPhoneNumber" bindgetphonenumber="handleGetPhoneNumber" bindtap="closegetPhoneNumber">授权登陆</button>
+    </view>
+  </view>
 </view>

+ 27 - 0
pages/login/login.wxss

@@ -1,6 +1,25 @@
 page {
 	overflow: hidden;
   }
+
+  .button-login{
+	width: 100%;
+	position: absolute;
+	left: 0rpx;
+	bottom: 210rpx; 
+  }
+
+  .pf-btn-auth,
+.pf-btn-save {
+	opacity: 1;
+	border-radius: 4px;
+	width: 500rpx;
+	color: rgb(94, 62, 235);
+	text-align: center;
+	font-size: 14px;
+	height: 30px;
+	line-height: 30px;
+}
   
   .out-view {
 	background-color: #fff;
@@ -47,4 +66,12 @@ page {
   
   .logo-image-active{
 	margin-top: 30%;opacity: 1;
+  }
+
+  .base-absolute{
+	width: 100%; 
+	position: absolute;
+	left: 60rpx;
+	top: 200rpx;
+	color: #17319c;
   }

BIN
static/img/login.png