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"
} }
}
\ No newline at end of file \ No newline at end of file
}
<block wx:if="{{loginType == 0}}"> <block wx:if="{{loginType == 0}}">
<view class="wx opacity-view"> <view class="wx opacity-view">
<view class="title"> <view class="title">
您好 您好
</view> </view>
<view class="subtitle"> <view class="subtitle">
欢迎登录生意助手 欢迎登录生意助手
</view> </view>
<image webp class="img" src="{{IMGURL}}login/login-2.webp" /> <image webp class="img" src="{{IMGURL}}login/login-2.webp" />
</view> </view>
</block> </block>
<block wx:else> <block wx:else>
<view class="box"> <view class="box">
<view class="input-box opacity-view"> <view class="input-box opacity-view">
<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
<input-icon show="{{formData.phone}}" bindtap="clear" data-name="phone" /> type="number"
</view> placeholder="填写手机号"
<view class="input"> placeholder-class="placeholder"
<input type="number" placeholder="填写验证码" placeholder-class="placeholder" bindinput="input" data-name="code" value="{{formData.code}}" maxlength="4" /> bindinput="input"
<input-icon show="{{formData.code}}" bindtap="clear" data-name="code" /> data-name="phone"
<button class="sms text-center " bindtap="getSmsCode" disabled="{{count || !phoneReady}}" loading="{{smsLoading}}">{{ value="{{formData.phone}}"
count? count + 's':'获取验证码' maxlength="11" />
}}</button> <input-icon show="{{formData.phone}}" bindtap="clear" data-name="phone" />
<block wx:if="{{smsError}}"> </view>
<view class="error">验证码错误</view> <view class="input">
</block> <input
</view> type="number"
</block> placeholder="填写验证码"
<block wx:else> placeholder-class="placeholder"
<view class="input"> bindinput="input"
<input type="text" placeholder="填写账号" placeholder-class="placeholder" bindinput="input" data-name="account" value="{{formData.account}}" maxlength="15" /> data-name="code"
<input-icon show="{{formData.account}}" bindtap="clear" data-name="account" /> value="{{formData.code}}"
</view> maxlength="4" />
<view class="input"> <input-icon show="{{formData.code}}" bindtap="clear" data-name="code" />
<input type="text" placeholder="填写密码" placeholder-class="placeholder" bindinput="input" data-name="password" value="{{formData.password}}" maxlength="20" password='{{!showPwd}}' /> <button
<input-icon show bindtap="pwdSwitch" type="{{showPwd?'showPwd':'hidePwd'}}" /> class="sms text-center "
<input-icon show="{{formData.password}}" bindtap="clear" data-name="password" /> bindtap="getSmsCode"
</view> disabled="{{count || !phoneReady}}"
</block> loading="{{smsLoading}}">{{
</view> count? count + 's':'获取验证码'
</view> }}
</button>
<block wx:if="{{smsError}}">
<view class="error">验证码错误</view>
</block>
</view>
</block>
<block wx:else>
<view class="input">
<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" />
</view>
<view class="input">
<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="{{formData.password}}" bindtap="clear" data-name="password" />
</view>
</block>
</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>
</block>
\ No newline at end of file \ No newline at end of file
<button
class="button"
disabled="{{disabled}}"
hover-class="btn-hover"
bindtap="login"
loading="{{loading}}">登录
</button>
</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
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
}, },
"navigationStyle": "custom", "navigationStyle": "custom",
"disableScroll": true "disableScroll": true
}
\ 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!