瀏覽代碼

小程序登陆页面

zwq 2 年之前
父節點
當前提交
8c6e5e909e

+ 39 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/login/login.js

@@ -3,6 +3,10 @@ import{
   baseUrl
 }from '../../utils/util'
 
+import {
+	imgUrl
+} from "../api/request"
+
 
 Page({
 
@@ -10,6 +14,9 @@ Page({
    * 页面的初始数据
    */
   data: {
+    imgUrl: imgUrl,
+    agreementImg: '',
+    agree: false,
     canIUse: wx.canIUse('button.open-type.getUserInfo')
   },
 
@@ -31,7 +38,12 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
-
+    this.setData({
+      agree: false
+    })
+    this.setData({
+      agreementImg: imgUrl + 'login-allow.png'
+    })
   },
 
   /**
@@ -41,7 +53,33 @@ Page({
 
   },
 
+  agreementSuccess(e) {
+    if (this.data.agree === true) {
+      this.setData({
+        agree: false
+      })
+      this.setData({
+        agreementImg: imgUrl + 'login-allow.png'
+      })
+    } else {
+      this.setData({
+        agree: true
+      })
+      this.setData({
+        agreementImg: imgUrl + 'login-select-allow.png'
+      })
+    }
+  },
+
   getUserProfile() {
+    if (this.data.agree === false) {
+      wx.showToast({
+        title: '请同意服务协议',
+        icon: 'error',
+        duration: 1500//持续的时间
+      })
+      return
+    }
     wx.setStorageSync('nickname', "");
     wx.setStorageSync('avatarUrl', "");
     wx.getUserProfile({

+ 23 - 8
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/login/login.wxml

@@ -1,14 +1,29 @@
 <!--pages/login/login.wxml-->
-<view style="height: 100vh; background-image: url('https://hui.yrslm.com:8089/file/bg1.jpg');background-size: 100% 100%;">
-  <view class="head">
-    <view class="logo">
-      <image class="bg" style="width: 90px; height: 90px; border-radius: 90px;" src="https://wx.qlogo.cn/mmhead/Q3auHgzwzM6oEStzJXU5EgPwXloSC6qSD1xIJUbrpSr3pakmodv23A/0"></image>
+<view style="height: 100vh;background-color: #F5F6F8">
+
+  <view style="height: 280rpx;width: 100%;display:flex;align-items:center;justify-content:center;padding-top:130rpx">
+    <view>
+      <image src="{{imgUrl}}login-top-icon.png" style="height: 175rpx;width: 370rpx"></image>
     </view>
   </view>
-  <view class="btn">
-    <button type="primary" bindtap="getUserProfile" style="width: 80%;">
-      <image style="width: 30rpx; height: 30rpx; margin-left: 45rpx;float: left;margin-top: 7rpx;" src="wx.png"></image>
-      <text style="float: left; margin-left: 50rpx;">微信用户一键登陆</text>
+
+  <view style="margin-top:50rpx;height: 100rpx;width: 100%;display:flex;align-items:center;justify-content:center">
+    <view style="width: 80%;display:flex;align-items:center;justify-content:center">
+      <view style="height: 66rpx">
+        <image src="{{agreementImg}}" bindtap="agreementSuccess" style="height: 40rpx;width: 40rpx"></image>
+      </view>
+      <view style="height: 66rpx;font-size:24rpx;color: #333333;display:flex;align-items:center;justify-content:center">
+        阅读并同意《服务协议及个人信息处理规则》和《xxx 个人信息处理规则》
+      </view>
+    </view>
+  </view>
+
+  <view style="margin-top: 10rpx">
+    <button type="primary" bindtap="getUserProfile"
+      style="width: 80%;display: flex;align-items:center;justify-content: center">
+      <image style="height: 33rpx;width: 41rpx" src="{{imgUrl}}wx-login.png"></image>
+      <text style="padding-left: 15rpx;font-size:27rpx">微信用户一键登陆</text>
     </button>
   </view>
+
 </view>

+ 0 - 26
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/login/login.wxss

@@ -1,27 +1 @@
 /* pages/login/login.wxss */
-page {
-  box-sizing: border-box;
-  /* padding-bottom: calc(env(safe-area-inset-bottom) + 96rpx); */
-}
-
-
-.head {
-  width: 100%;
-  margin-top: 120rpx;
-  height: 200rpx;
-  line-height: 400rpx;
-  margin-bottom: 60rpx;
-  float: left;
-}
-
-.logo {
-  /* margin-top: 100px; */
-  width: 180rpx;
-  height: 180rpx;
-  border-radius: 180rpx;
-  margin: auto;
-}
-
-.btn {
-  width: 100%;
-}