Commit cb18af7b by 张立顺 Committed by chenwq

用户协议 功能开发

1 parent 0327907c
...@@ -30,12 +30,19 @@ Component({ ...@@ -30,12 +30,19 @@ Component({
// password: 'bb123456' // password: 'bb123456'
}, },
phoneReady: false, phoneReady: false,
countDown: null countDown: null,
agree: false
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
authChoose(e) {
let { detail: agree } = e
this.setData({
agree
})
},
/**隐藏验证码错误 */ /**隐藏验证码错误 */
hideError(name) { hideError(name) {
if (name == 'code') if (name == 'code')
...@@ -129,8 +136,19 @@ Component({ ...@@ -129,8 +136,19 @@ Component({
showPwd: !this.data.showPwd showPwd: !this.data.showPwd
}) })
}, },
checkAgree() {
let { agree } = this.data
console.log('agree', agree)
if (!agree) {
wx.$api.showToast('请同意用户协议')
return true
}
return false
},
/**手机号&帐号密码登录 */ /**手机号&帐号密码登录 */
login() { login() {
const checkAgree = this.checkAgree()
if (checkAgree) return false
const { formData, loginType } = this.data, const { formData, loginType } = this.data,
target = { target = {
1: 'phoneSmsLogin', 1: 'phoneSmsLogin',
......
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"input-icon":"../InputIcon/InputIcon" "input-icon": "../InputIcon/InputIcon",
"auth-setting": "../authSetting/authSetting"
} }
} }
...@@ -15,15 +15,34 @@ ...@@ -15,15 +15,34 @@
<view class="title">{{loginType == 1?'手机号':'账号'}}登录</view> <view class="title">{{loginType == 1?'手机号':'账号'}}登录</view>
<block wx:if="{{loginType == 1}}"> <block wx:if="{{loginType == 1}}">
<view class="input"> <view class="input">
<input type="number" placeholder="填写手机号" placeholder-class="placeholder" bindinput="input" data-name="phone" value="{{formData.phone}}" maxlength="11" /> <input
type="number"
placeholder="填写手机号"
placeholder-class="placeholder"
bindinput="input"
data-name="phone"
value="{{formData.phone}}"
maxlength="11" />
<input-icon show="{{formData.phone}}" bindtap="clear" data-name="phone" /> <input-icon show="{{formData.phone}}" bindtap="clear" data-name="phone" />
</view> </view>
<view class="input"> <view class="input">
<input type="number" placeholder="填写验证码" placeholder-class="placeholder" bindinput="input" data-name="code" value="{{formData.code}}" maxlength="4" /> <input
type="number"
placeholder="填写验证码"
placeholder-class="placeholder"
bindinput="input"
data-name="code"
value="{{formData.code}}"
maxlength="4" />
<input-icon show="{{formData.code}}" bindtap="clear" data-name="code" /> <input-icon show="{{formData.code}}" bindtap="clear" data-name="code" />
<button class="sms text-center " bindtap="getSmsCode" disabled="{{count || !phoneReady}}" loading="{{smsLoading}}">{{ <button
class="sms text-center "
bindtap="getSmsCode"
disabled="{{count || !phoneReady}}"
loading="{{smsLoading}}">{{
count? count + 's':'获取验证码' count? count + 's':'获取验证码'
}}</button> }}
</button>
<block wx:if="{{smsError}}"> <block wx:if="{{smsError}}">
<view class="error">验证码错误</view> <view class="error">验证码错误</view>
</block> </block>
...@@ -31,11 +50,26 @@ ...@@ -31,11 +50,26 @@
</block> </block>
<block wx:else> <block wx:else>
<view class="input"> <view class="input">
<input type="text" placeholder="填写账号" placeholder-class="placeholder" bindinput="input" data-name="account" value="{{formData.account}}" maxlength="15" /> <input
type="text"
placeholder="填写账号"
placeholder-class="placeholder"
bindinput="input"
data-name="account"
value="{{formData.account}}"
maxlength="15" />
<input-icon show="{{formData.account}}" bindtap="clear" data-name="account" /> <input-icon show="{{formData.account}}" bindtap="clear" data-name="account" />
</view> </view>
<view class="input"> <view class="input">
<input type="text" placeholder="填写密码" placeholder-class="placeholder" bindinput="input" data-name="password" value="{{formData.password}}" maxlength="20" password='{{!showPwd}}' /> <input
type="text"
placeholder="填写密码"
placeholder-class="placeholder"
bindinput="input"
data-name="password"
value="{{formData.password}}"
maxlength="20"
password='{{!showPwd}}' />
<input-icon show bindtap="pwdSwitch" type="{{showPwd?'showPwd':'hidePwd'}}" /> <input-icon show bindtap="pwdSwitch" type="{{showPwd?'showPwd':'hidePwd'}}" />
<input-icon show="{{formData.password}}" bindtap="clear" data-name="password" /> <input-icon show="{{formData.password}}" bindtap="clear" data-name="password" />
</view> </view>
...@@ -43,9 +77,24 @@ ...@@ -43,9 +77,24 @@
</view> </view>
</view> </view>
</block> </block>
<block wx:if="{{loginType == 0}}"> <block wx:if="{{loginType == 0 &&agree}}">
<button class="button" disabled="{{disabled}}" hover-class="btn-hover" open-type="getPhoneNumber" bindgetphonenumber="wxLogin" loading="{{loading}}">微信登录</button> <button
class="button"
disabled="{{disabled}}"
hover-class="btn-hover"
open-type="getPhoneNumber"
bindgetphonenumber="wxLogin"
loading="{{loading}}">微信登录
</button>
</block> </block>
<block wx:else> <block wx:else>
<button class="button" disabled="{{disabled}}" hover-class="btn-hover" bindtap="login" loading="{{loading}}">登录</button> <button
class="button"
disabled="{{disabled}}"
hover-class="btn-hover"
bindtap="login"
loading="{{loading}}">登录
</button>
</block> </block>
<auth-setting bind:choose="authChoose" />
// components/authSetting/authSetting.js
// const restapi = require('../../utils/restapi.js')
// var appInstance = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
// auth: {
// type: Boolean,
// value: true,
// observer: function (newVal, oldVal) {
// this.getHeadImage()
// }
// },
// type: {
// type: Boolean,
// value: true
// },
// special: {
// type: Boolean,
// value: false
// },
// index: {
// type: Boolean,
// value: false
// }
},
/**
* 组件的初始数据
*/
data: {
agree: false
// auth: true,
// type: true,
// appLogo: '',
// appName: '',
// merchantName: '',
// gender: 1
},
ready() {
// this.getHeadImage()
},
/**
* 组件的方法列表
*/
methods: {
choose() {
this.setData({
agree: !this.data.agree
})
this.triggerEvent('choose', this.data.agree)
},
jump(e) {
console.log(e)
let { url } = e.currentTarget.dataset
const baseUrl = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/html/'
const path = `${baseUrl}${url}.html`
// private user
wx.navigateTo({
url: `/pages/webView/webView?path=${encodeURIComponent(path)}`
})
// var globalData = appInstance.globalData.extConfig
// restapi.getMerchantBussiness(globalData.merchantId, function (res) {
// console.log(res);
// if (res.returnCode == '0') {
// let path = `https://dj.glsx.com.cn/agreement/djUserPolicy.html?merchantName=${globalData.merchantName}&phone=${res.data.phone}`
// wx.navigateTo({
// url: `/pages/webpage/webpage?path=${encodeURIComponent(path)}`
// })
// }
// }, function (res) {
// console.log(res);
// })
},
noScroll() {}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class='tips'>
<view class='choose-box' bindtap="choose">
<view class='icon'>
<image src="{{agree?'./images/ok.png':'./images/box.png'}}" class='check-img' />
</view>
</view>
阅读并同意以下协议
<!-- <text catchtap="jump" data-url="agree">《服务协议》</text> -->
<text catchtap="jump" data-url="privacy">《隐私协议》</text>
<text catchtap="jump" data-url="agreement">《用户协议》</text>
</view>
/* components/authSetting/authSetting.wxss */
.tips {
position: fixed;
width: 100%;
left: 0;
bottom: 60rpx;
font-size: 24rpx;
color: #999;
letter-spacing: 2rpx;
padding-left: 28rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
}
.tips text {
color: #ff600f;
}
.tips .icon {
position: absolute;
top: 50%;
left: 50%;
width: 24rpx;
height: 24rpx;
border-radius: 2rpx;
box-sizing: border-box;
transform: translate(-50%, -50%);
}
.tips .icon .check-img {
vertical-align: top;
width: 100%;
height: 100%;
}
.tips .choose-box {
width: 80rpx;
height: 80rpx;
position: relative;
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!