xiaohaizhao преди 2 години
родител
ревизия
26ca6125f9
променени са 3 файла, в които са добавени 27 реда и са изтрити 13 реда
  1. 25 2
      pages/login/phone.js
  2. 0 6
      pages/login/phone.scss
  3. 2 5
      pages/login/phone.wxml

+ 25 - 2
pages/login/phone.js

@@ -1,6 +1,7 @@
 import Toast from '@vant/weapp/toast/toast';
 const _Http = getApp().globalData.http,
     loginMsg = require("./modules/login");
+let count = 0;
 Page({
     /**
      * 页面的初始数据
@@ -10,6 +11,22 @@ Page({
         isAgree: false,
         disabled: true, //是否禁用
         loading: false, //登陆中
+        showChange: false
+    },
+    onLoad() {
+        let accountInfo = wx.getAccountInfoSync();
+        const ENV = accountInfo.miniProgram.envVersion
+        if (ENV === 'release') { // 正式版
+            console.log("正式")
+            this.setData({
+                loginFunc: true
+            })
+        } else { // 开发,测试
+            this.setData({
+                showChange: true,
+                loginFunc: false
+            })
+        }
     },
     /* 微信登录 */
     wechatLogin() {
@@ -49,9 +66,9 @@ Page({
         })
         this.selectComponent('#login').handleLogin();
     },
-    changeLoginFun(){
+    changeLoginFun() {
         this.setData({
-            loginFunc:!this.data.loginFunc
+            loginFunc: !this.data.loginFunc
         })
     },
     /* 授权 */
@@ -62,4 +79,10 @@ Page({
             isAgree: detail
         })
     },
+    openChange() {
+        count += 1;
+        if (count == 10) this.setData({
+            showChange: true
+        })
+    },
 })

+ 0 - 6
pages/login/phone.scss

@@ -31,9 +31,3 @@ page {
     font-family: PingFang SC-Regular, PingFang SC;
     color: #FFFFFF;
 }
-
-.change {
-    width: 400rpx;
-    height: 200rpx;
-    background-color: red;
-}

+ 2 - 5
pages/login/phone.wxml

@@ -1,5 +1,5 @@
 <view class="logo">
-    <image src="/static/image/logo.png" />
+    <image src="/static/image/logo.png" bindtap="openChange" />
 </view>
 
 <!-- 手机号登录  -->
@@ -9,18 +9,15 @@
 <view style="width: 100vw; text-align: center;margin-top: 60rpx;margin-bottom: 40rpx;">
     <van-button disabled='{{disabled}}' custom-class='login' bindtap="userLogin" loading='{{loading}}' loading-text="登陆中..." color='linear-gradient(90deg, #3874F6 0%, #095DE0 100%);'>登录</van-button>
 </view>
-
 <!-- 隐私协议 -->
 <Agreement isAgree='{{isAgree}}' bindcallBack='agreementChange' />
-<view wx:if="{{true}}" class="change" bindtap="changeLoginFun">
-    切换登录方式
-</view>
 <!-- 快捷登录 -->
 <block>
     <view style="height: 100rpx;" />
     <van-divider contentPosition="center">其他登录方式</van-divider>
     <view style="width: 100%; text-align: center;">
         <text class="iconfont icon-a-wodebangdingweixin" style="font-size: 100rpx; color:#07C160;" bindtap="wechatLogin" />
+        <text wx:if="{{showChange}}" class="iconfont icon-a-wodeshezhi" style="font-size: 100rpx; color:#1563E6;" bindtap="changeLoginFun" />
     </view>
 </block>