Commit e4610c73 by 张卓

登录页用户协议,放防重复点击

parent d1b50bb3
......@@ -19,6 +19,10 @@ console.log(process.env,'-----------------config------')
// sso登录
getSsoBcakUrl(options) {
return requestPOST(`${process.env.OLSHOP_URL}/common/getSsoCallbackUrl`,options)
}
},
//获取用户协议
getShopUserProtocol() {
return requestPOST(`${process.env.OLSHOP_URL}/getShopUserProtocol`)
},
}
\ No newline at end of file
......@@ -16,6 +16,23 @@
</div>
<div class="layer" @click="isShowPhone=false"></div>
</div>
<div class="readAgreement">
<van-checkbox :value="checked" @click="checked = !checked">我已阅读并同意</van-checkbox>
<span v-if="content" @click="contentShow = true">《用户协议》</span>
</div>
<van-popup
:show="contentShow"
custom-style="width:80vw;height:80vh;background:#fff;"
:close-on-click-overlay="true"
@close="closeDia"
>
<div class="posterWrap">
<div v-html="content"></div>
</div>
<div class="posterWrap_btn">
<div @click="conF">我已阅读并同意</div>
</div>
</van-popup>
</div>
</template>
......@@ -30,7 +47,10 @@ const app = getApp();
export default {
data() {
return {
checked: false,
contentShow: false,
code: "",
content: '',
session_key: "",
shopName: "",
logoUrl: "",
......@@ -85,6 +105,12 @@ export default {
})
},
onLoad(options) {
login.getShopUserProtocol().then(res => {
console.log(res,777888999)
if(res.data.code == '200') {
this.content = res.data.data;
}
});
Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化
options.scene && (this.scene=options.scene)
if (options.back) {
......@@ -99,6 +125,13 @@ export default {
this.getshop();
},
methods: {
conF() {
this.contentShow = false;
this.checked = true;
},
closeDia() {
this.contentShow = false;
},
getshop() {
this.shopName = wx.getStorageSync("shopName");
this.logoUrl = wx.getStorageSync("logoUrl");
......@@ -160,6 +193,17 @@ export default {
}
},
getUserProfile() {
if(this.content&&!this.checked) {
wx.showToast({
title: '您还未同意协议',
icon: "none"
});
return
}
wx.showLoading({
title: '登录中...',
mask: true
})
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
......@@ -204,6 +248,9 @@ export default {
wx.hideLoading();
wx.showToast({ title: err, icon: "none" });
});
},
fail: (e) => {
wx.hideLoading()
}
})
},
......@@ -243,6 +290,7 @@ export default {
} else {
//不是会员需要绑定手机号
this.isShowPhone = true;
wx.hideLoading()
this.addRecord(true)
}
}
......@@ -255,6 +303,7 @@ export default {
wx.hideLoading();
//不是会员需要绑定手机号
this.isShowPhone = true;
wx.hideLoading()
this.addRecord(true)
}
......@@ -295,6 +344,14 @@ export default {
}
},
getPhoneNumber(e) {
if(this.content&&!this.checked) {
wx.showToast({
title: '您还未同意协议',
icon: "none"
});
return
}
wx.checkSession({
success: () => {
//session_key 未过期,并且在本生命周期一直有效
......@@ -405,6 +462,42 @@ export default {
</script>
<style lang="scss" scoped>
.posterWrap_btn {
position: absolute;
bottom: 0px;
background: #fff;
width: 100%;
height: 46px;
display: flex;
justify-content: center;
box-sizing: border-box;
padding: 5px;
div {
padding: 0 20px;
color: #fff;
background-color: red;
border-radius: 20px;
line-height: 36px;
height: 36px;
}
}
.posterWrap {
box-sizing: border-box;
height: 100%;
overflow: auto;
padding: 0 16px;
padding-bottom: 46px;
}
.readAgreement {
width: 100%;
position: fixed;
bottom: 20px;
font-size: 12px;
display: flex;
justify-content: center;
color: #1989fa;
}
.domain {
position: relative;
.toCLogin {
......
{
"navigationBarTitleText": "登录"
"navigationBarTitleText": "登录",
"usingComponents": {
"van-checkbox": "/static/vant/checkbox/index",
"van-popup":"/static/vant/popup/index",
"van-icon":"/static/vant/icon/index"
}
}
import { VantComponent } from '../common/component';
VantComponent({
field: true,
relation: {
name: 'checkbox-group',
type: 'ancestor'
},
classes: ['icon-class', 'label-class'],
props: {
value: null,
disabled: Boolean,
useIconSlot: Boolean,
checkedColor: String,
labelPosition: String,
labelDisabled: Boolean,
shape: {
type: String,
value: 'round'
}
},
methods: {
emitChange(value) {
const parent = this.getRelationNodes('../checkbox-group/index')[0];
if (parent) {
this.setParentValue(parent, value);
}
else {
this.$emit('input', value);
this.$emit('change', value);
}
},
toggle() {
if (!this.data.disabled) {
this.emitChange(!this.data.value);
}
},
onClickLabel() {
if (!this.data.disabled && !this.data.labelDisabled) {
this.emitChange(!this.data.value);
}
},
setParentValue(parent, value) {
const parentValue = parent.data.value.slice();
const { name } = this.data;
if (value) {
if (parent.data.max && parentValue.length >= parent.data.max) {
return;
}
/* istanbul ignore else */
if (parentValue.indexOf(name) === -1) {
parentValue.push(name);
parent.$emit('input', parentValue);
parent.$emit('change', parentValue);
}
}
else {
const index = parentValue.indexOf(name);
/* istanbul ignore else */
if (index !== -1) {
parentValue.splice(index, 1);
parent.$emit('input', parentValue);
parent.$emit('change', parentValue);
}
}
}
}
});
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-checkbox custom-class">
<view class="van-checkbox__icon-wrap" bindtap="toggle">
<slot wx:if="{{ useIconSlot }}" name="icon" />
<van-icon
wx:else
name="success"
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
style="{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
custom-class="icon-class"
custom-style="line-height: 20px;"
/>
</view>
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled }]) }}" bindtap="onClickLabel">
<slot />
</view>
</view>
@import '../common/index.wxss';.van-checkbox{overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{display:inline-block;line-height:20px;vertical-align:middle}.van-checkbox__icon{display:block;font-size:14px;width:20px;height:20px;color:transparent;text-align:center;box-sizing:border-box;border:1px solid #e5e5e5;transition:.2s}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;border-color:#1989fa;background-color:#1989fa}.van-checkbox__icon--disabled{border-color:#c9c9c9;background-color:#eee}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c9c9c9}.van-checkbox__label{color:#333;margin-left:10px}.van-checkbox__label--left{float:left;margin:0 10px 0 0}.van-checkbox__label--disabled{color:#c9c9c9}.van-checkbox__label:empty{margin:0}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment