zhaoxiaohai 2 년 전
부모
커밋
dc25d0380e

+ 31 - 7
pages/login/modules/agreement.js

@@ -12,13 +12,6 @@ Component({
         }
     },
 
-    /**
-     * 组件的初始数据
-     */
-    data: {
-
-    },
-
     /**
      * 组件的方法列表
      */
@@ -30,6 +23,37 @@ Component({
                 isAgree
             })
             this.triggerEvent("callBack", isAgree)
+        },
+        checkTheAgreement() {
+            wx.showLoading({
+                title: '加载中...',
+            })
+            wx.downloadFile({
+                url: 'https://mdyossys.obs.cn-east-3.myhuaweicloud.com/resources/%E7%BE%8E%E5%A4%A7CRM%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%9A%90%E7%A7%81%E4%BF%9D%E6%8A%A4%E6%8C%87%E5%BC%95.docx',
+                success: (res) => {
+                    wx.openDocument({
+                        filePath: res.tempFilePath,
+                        success:(s)=>{
+                            wx.hideLoading();
+
+                        },
+                        fail: (err) => {
+                            wx.hideLoading();
+                            wx.showToast({
+                                title: '读取失败,请稍后再试',
+                                icon: "none"
+                            })
+                        }
+                    })
+                },
+                fail: (err) => {
+                    wx.hideLoading();
+                    wx.showToast({
+                        title: '读取失败,请稍后再试',
+                        icon: "none"
+                    })
+                }
+            })
         }
     }
 })

+ 1 - 2
pages/login/modules/agreement.scss

@@ -10,8 +10,7 @@
         font-size: 24rpx !important;
         font-family: PingFang SC-Regular, PingFang SC;
         color: #666666 !important;
-        padding-top: 40rpx;
-        margin-left: -10rpx;
+        margin-left: -20rpx;
 
         text {
             color: #3874F6;

+ 1 - 1
pages/login/modules/agreement.wxml

@@ -1,3 +1,3 @@
 <view class="agreement">
-    <van-checkbox icon-size="28rpx" label-class='con' value="{{ isAgree }}" bind:change="isAgreeChange">登录代表您已同意 <text>用户服务协议</text>、<text>隐私协议</text></van-checkbox>
+    <van-checkbox icon-size="28rpx" label-class='con' value="{{ isAgree }}" bind:change="isAgreeChange">登录代表您已同意<text catchtap="checkTheAgreement">《隐私协议》</text></van-checkbox>
 </view>

+ 0 - 2
pages/login/modules/login.js

@@ -1,6 +1,5 @@
 const _Http = getApp().globalData.http;
 let count = 0; //接口完成数量
-
 function loginMsg(res) {
     wx.setStorageSync('account_list', res.account_list);
     if (res.account_list.length == 1) {
@@ -64,7 +63,6 @@ function query_adspacelist(i = 0) {
         toHome();
     })
 }
-
 function toHome() {
     if (count < 3) return;
     let pages = getCurrentPages();

+ 4 - 71
pages/login/phone.js

@@ -1,34 +1,15 @@
 import Toast from '@vant/weapp/toast/toast';
-const _Http = getApp().globalData.http;
-const md5 = require("../../utils/md5");
-const loginMsg = require("./modules/login");
+const _Http = getApp().globalData.http,
+    loginMsg = require("./modules/login");
 Page({
-
     /**
      * 页面的初始数据
      */
     data: {
         isAgree: true,
-        accountno: "",
-        password: "",
-        inputType: "password", //密码输入框类型
-        focus: false,
-        memory: true, //记忆
         disabled: true, //是否禁用
         loading: false, //登陆中
     },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-        /* 恢复缓存中保存的账号密码 */
-        this.setData({
-            ...wx.getStorageSync('loginMsg')
-        })
-        /* 验证登录条件 */
-        this.allowOrNot()
-    },
     /* 微信登录 */
     wechatLogin() {
         if (!this.data.isAgree) return Toast({
@@ -42,6 +23,7 @@ Page({
                         wechat_code: res.code,
                         "systemclient": "wechatsaletool"
                     }).then(res => {
+                        console.log("微信快捷登录", res)
                         if (res.code == 0) return wx.showToast({
                             title: res.msg,
                             icon: "none"
@@ -64,30 +46,7 @@ Page({
         this.setData({
             loading: true
         })
-        _Http.login({
-            "accountno": this.data.accountno,
-            "password": md5.hexMD5(this.data.password),
-            "systemclient": "wechatsaletool"
-        }).then(res => {
-            this.setData({
-                loading: false
-            })
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
-                icon: "none"
-            })
-            wx.setStorageSync('loginMsg', {
-                accountno: this.data.accountno,
-                password: (this.data.memory) ? this.data.password : ''
-            })
-            loginMsg.loginMsg(res);
-        })
-    },
-    /* 改变密码输入框类型 */
-    changePasswordType() {
-        this.setData({
-            inputType: this.data.inputType == "text" ? 'password' : 'text'
-        })
+        this.selectComponent('#login').handleLogin();
     },
     /* 授权 */
     agreementChange({
@@ -97,30 +56,4 @@ Page({
             isAgree: detail
         })
     },
-    /* 手机号 */
-    inputPhone(e) {
-        this.setData({
-            accountno: e.detail.value.trim()
-        })
-        this.allowOrNot()
-    },
-    /* 密码 */
-    inputPassword(e) {
-        this.setData({
-            password: e.detail.value.trim()
-        })
-        this.allowOrNot()
-    },
-    /* 验证是否允许登录 */
-    allowOrNot() {
-        this.setData({
-            disabled: (this.data.accountno.length > 0 && this.data.password.length > 5) ? false : true
-        })
-    },
-    /* 是否记忆密码 */
-    isMemory() {
-        this.setData({
-            memory: !this.data.memory
-        })
-    },
 })

+ 3 - 2
pages/login/phone.json

@@ -2,7 +2,8 @@
     "navigationBarTitleText": "账户登录",
     "usingComponents": {
         "Agreement": "./modules/agreement",
-        "van-checkbox": "@vant/weapp/checkbox/index",
-        "van-divider": "@vant/weapp/divider/index"
+        "van-divider": "@vant/weapp/divider/index",
+        "account": "./modules/account",
+        "phone": "./modules/phone"
     }
 }

+ 16 - 32
pages/login/phone.scss

@@ -2,41 +2,25 @@ page {
     background: #ffffff;
 }
 
-.iconfont {
-    color: var(--assist);
-}
-
-.input {
-    text-align: left;
-    margin-left: 50rpx;
-}
-
-.image {
-    width: 40rpx !important;
-    height: 40rpx !important;
-}
-
-.box {
+.logo {
+    width: 100vw;
+    height: 340rpx;
     display: flex;
-    justify-content: space-between;
-    width: 690rpx;
-    margin: 40rpx auto 0;
-    font-family: PingFang SC-Regular, PingFang SC;
-
-    .checkbox {
-        font-size: 24rpx;
-        color: #666666;
-        margin-top: -3rpx;
-    }
-
-    .label {
-        margin-left: -10rpx;
+    justify-content: center;
+    align-items: center;
+    margin-bottom: 40rpx;
+
+    image {
+        width: 192rpx !important;
+        height: 192rpx !important;
+        border-radius: 24rpx;
+        border: 2rpx solid #CCC;
+        margin-top: 60rpx;
     }
+}
 
-    .view {
-        font-size: 24rpx;
-        color: #999999;
-    }
+.iconfont {
+    color: var(--assist);
 }
 
 .login {

+ 20 - 26
pages/login/phone.wxml

@@ -1,31 +1,25 @@
-<view style="height: 340rpx;" />
-<van-cell>
-    <text slot='icon' class="iconfont icon-a-biaoqianlanwodexuanzhong" />
-    <input class="input" type="text" value='{{accountno}}' bindinput="inputPhone" placeholder="请输入账户名" />
-</van-cell>
-<van-cell>
-    <text slot='icon' class="iconfont icon-a-wodemima" />
-    <input class="input" wx:if="{{inputType=='text'}}" focus='{{focus}}' bindinput="inputPassword" value="{{password}}" placeholder="请输入密码" />
-    <input class="input" wx:else type="password" focus='{{focus}}' bindinput="inputPassword" value="{{password}}" placeholder="请输入密码" />
-    <view slot='right-icon' style="width: 90rpx;height: 22.4px; display: flex; justify-content: flex-end;" catchtap="changePasswordType">
-        <image class="image" src="{{inputType=='password'?'/static/image/dp-none.svg':'/static/image/dp-show.svg'}}" />
-    </view>
-</van-cell>
-
-<view class="box">
-    <van-checkbox custom-class='checkbox' label-class='label' icon-size="28rpx" value="{{ memory }}" shape="square" bind:change="isMemory">
-        记住密码
-    </van-checkbox>
-    <navigator url="./retrievePassword" class="view">忘记密码?</navigator>
+<view class="logo">
+    <image src="/static/image/logo.png" />
 </view>
-<view style="width: 100vw; text-align: center;margin-top: 60rpx;">
+
+<!-- 手机号登录  -->
+<phone id='login' wx:if="{{false}}" />
+<!-- 账号登录 -->
+<account wx:else id='login' />
+<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' />
-<van-toast id="van-toast" />
 
-<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" />
-</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" />
+    </view>
+</block>
+
+<van-toast id="van-toast" />

+ 1 - 48
pages/login/retrievePassword.js

@@ -148,52 +148,5 @@ Page({
             }, 300)
         })
     },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
+    onShareAppMessage() {}
 })

+ 1 - 43
pages/login/selectSite.js

@@ -19,14 +19,6 @@ Page({
         wx.setStorageSync('userMsg', item);
         login.query_userauth();
     },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
     /**
      * 生命周期函数--监听页面显示
      */
@@ -35,39 +27,5 @@ Page({
             account_list: wx.getStorageSync('account_list')
         })
     },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
+    onShareAppMessage() {}
 })