初始化万家商超用户端仓库
This commit is contained in:
411
pages/dl/bindPhone/bindPhone.vue
Normal file
411
pages/dl/bindPhone/bindPhone.vue
Normal file
@ -0,0 +1,411 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- background pic end -->
|
||||
<!-- 表单信息 start -->
|
||||
<view class="bind-phone form-wapper ">
|
||||
<!-- 手机号码 start -->
|
||||
<view class="input-wapper solid-bottom">
|
||||
<!-- <view class="title">
|
||||
<image class="image" src="../../static/phone.png" mode="widthFix"></image>
|
||||
</view> -->
|
||||
<input type="number" v-model="phone" maxlength="11" placeholder-class="placeholderClass" placeholder="请输入手机号"
|
||||
name="input" />
|
||||
</view>
|
||||
<!-- 手机号码 end -->
|
||||
<!-- 获取验证码 start -->
|
||||
<view class="input-wapper solid-bottom ">
|
||||
<!-- <view class="title">
|
||||
<image class="image" src="../../static/yzm.png" mode="widthFix"></image>
|
||||
</view> -->
|
||||
<input type="number" v-model="vercode" placeholder-class="placeholderClass" placeholder="请输入验证码" name="input" />
|
||||
<text class="code" @click="getCode">{{ beginning ? time + 's后重新获取' : '发送验证码' }}</text>
|
||||
</view>
|
||||
<!-- 获取验证码 end -->
|
||||
<!-- 输入密码 start -->
|
||||
<view class="input-wapper solid-bottom ">
|
||||
<!-- <view class="title">
|
||||
<image class="image" src="../../static/pwd.png" mode="widthFix"></image>
|
||||
</view> -->
|
||||
<view class="pwd flex justify-between align-center">
|
||||
<input placeholder-class="placeholderClass" v-if="type == 'password'" type="password" v-model="password"
|
||||
:placeholder="'请输入密码(6~12位字母+数字)'" minlength="6" maxlength="12" />
|
||||
<input placeholder-class="placeholderClass" v-if="type == 'text'" type="text" v-model="password" :placeholder="'请输入密码(6~12位字母+数字)'"
|
||||
minlength="6" maxlength="12" />
|
||||
<view class="pwd-right flex align-center">
|
||||
<text class='fu-iconfont2 text-xxl' :data-type="type" @click.stop="is_kejian" v-if="type == 'password'"></text>
|
||||
<text class='fu-iconfont2 text-xxl' :data-type="type" @click.stop="is_kejian" v-if="type == 'text'"></text>
|
||||
<!-- <image src="../../static/open.png" :data-type="type" @click.stop="is_kejian" v-if="type == 'text'" mode="widthFix"></image>
|
||||
<image src="../../static/close.png" :data-type="type" @click.stop="is_kejian" v-if="type == 'password'" mode="widthFix"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 输入密码 end -->
|
||||
</view>
|
||||
<!-- 表单信息 end -->
|
||||
<!-- 提交按钮 start -->
|
||||
<view class="btn_cloce" :loading="is_click" @click="handleLogin">确定</view>
|
||||
<!-- 提交按钮 end -->
|
||||
<!-- 网络监测 start -->
|
||||
<fu-notwork></fu-notwork>
|
||||
<!-- 网络监测 end -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 表单验证插件
|
||||
import {
|
||||
validate
|
||||
} from '@/common/utils/index.js'
|
||||
let _this;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
openid: '', //openid
|
||||
nickname: '', //昵称
|
||||
head_img_url: '', //头像图片
|
||||
sex: '', //性别
|
||||
phone: '', //手机号
|
||||
vercode: '', //验证码
|
||||
password: '', //密码
|
||||
loginBtnLoading: false, // 登录按钮加载动画
|
||||
verCodeBtnLoading: false,
|
||||
time: 60, //倒计时60S
|
||||
beginning: false, //显示倒计时
|
||||
is_click: false,
|
||||
type: 'password', //密码类型
|
||||
is_agree: false, // 协议
|
||||
invite_code: '', //邀请码
|
||||
is_invite_code: 1, //是否显示邀请码,
|
||||
authType: '',
|
||||
bind_type: 1
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
_this = this;
|
||||
this.bind_type = option.bind_type
|
||||
this.openid = option.openId;
|
||||
this.nickname = option.nickName || '';
|
||||
this.head_img_url = option.avatarUrl || '';
|
||||
this.sex = option.sex || '';
|
||||
this.unionId = option.unionId || '';
|
||||
this.authType = option.authType || '';
|
||||
},
|
||||
onBackPress() {
|
||||
uni.hideKeyboard()
|
||||
},
|
||||
methods: {
|
||||
back(){
|
||||
uni.navigateBack();
|
||||
},
|
||||
//密码是否可见
|
||||
is_kejian(e) {
|
||||
let type = e.currentTarget.dataset.type;
|
||||
if (type == 'password') {
|
||||
this.type = 'text';
|
||||
} else {
|
||||
this.type = 'password';
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @event 点击获取验证码
|
||||
* @description 获取验证码
|
||||
* @property {String} is_test - 是否是测试环境
|
||||
* @property {String} phone - 手机号
|
||||
* @property {String} type - 请求类型 1=注册(未注册手机号),2=忘记密码(已经注册的手机号),3=短信登录,4修改手几号
|
||||
*/
|
||||
// 发送验证码
|
||||
getCode() {
|
||||
let { phone } = this;
|
||||
if (!phone) {
|
||||
_this.$message.info('请输入手机号');
|
||||
return false;
|
||||
}
|
||||
if (!validate(phone, 'phone')) {
|
||||
_this.$message.info('请输入正确的手机号');
|
||||
return false;
|
||||
}
|
||||
if (this.beginning) return false;
|
||||
this.verCodeBtnLoading = true;
|
||||
this.beginning = true;
|
||||
console.log(this.authType);
|
||||
this.$api
|
||||
.post(global.apiUrls.GetVerifyCode, {
|
||||
is_test: global.IS_DEV,
|
||||
mobile: phone,
|
||||
type: '5',
|
||||
auth_type: this.authType,
|
||||
})
|
||||
.then(res => {
|
||||
this.verCodeBtnLoading = false;
|
||||
if (res.data.code == 1) {
|
||||
clearInterval(_this.timer);
|
||||
//开始倒计时
|
||||
_this.timer = setInterval(() => {
|
||||
if (_this.time == 1) {
|
||||
//倒计时结束
|
||||
clearInterval(_this.timer);
|
||||
_this.time = 60;
|
||||
_this.beginning = false;
|
||||
return;
|
||||
}
|
||||
_this.time--;
|
||||
}, 1000);
|
||||
_this.$message.info('验证码为' + res.data.data.code + '请注意查收');
|
||||
} else {
|
||||
clearInterval(_this.timer);
|
||||
_this.beginning = false;
|
||||
_this.$message.info(res.data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 手机绑定
|
||||
*/
|
||||
handleLogin() {
|
||||
// #ifdef APP-PLUS
|
||||
plus.key.hideSoftKeybord();
|
||||
// #endif
|
||||
if (this.is_click) {
|
||||
return;
|
||||
}
|
||||
let {
|
||||
phone,
|
||||
vercode,
|
||||
password,
|
||||
openid,
|
||||
nickname,
|
||||
head_img_url,
|
||||
sex,
|
||||
type,
|
||||
unionId,
|
||||
invite_code,
|
||||
bind_type
|
||||
} = this;
|
||||
if (!phone) {
|
||||
this.$message.info('请输入手机号');
|
||||
return false;
|
||||
}
|
||||
if (!validate(phone, 'phone')) {
|
||||
this.$message.info('请输入正确的手机号');
|
||||
return false;
|
||||
}
|
||||
if (!vercode) {
|
||||
this.$message.info('验证码不能为空');
|
||||
return false;
|
||||
}
|
||||
if (!validate(password, 'password')) {
|
||||
this.$message.info('请输入6-12位密码');
|
||||
return false;
|
||||
}
|
||||
let clientId=''
|
||||
// #ifdef APP-PLUS
|
||||
clientId = plus.push.getClientInfo().clientid || '';
|
||||
// #endif
|
||||
this.is_click = true;
|
||||
_this.$api
|
||||
.post(global.apiUrls.postLoginByWechat, {
|
||||
third_type: 'wx_app',
|
||||
account_type: 'mobile',
|
||||
account: phone,
|
||||
password: password,
|
||||
code_type: 5,
|
||||
code: vercode,
|
||||
client_id: clientId,
|
||||
invite_code: invite_code,
|
||||
extend_info: JSON.stringify({
|
||||
unionid: unionId,
|
||||
openid: openid,
|
||||
nickname: nickname,
|
||||
avatar: head_img_url,
|
||||
gender: sex,
|
||||
})
|
||||
})
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.data.code == 1 && res.data.data) {
|
||||
_this.$store.commit('updateUserInfo', res.data.data.userinfo);
|
||||
global.token=res.data.data.userinfo.user_token
|
||||
global.userInfo=res.data.data.userinfo
|
||||
uni.setStorageSync('USER_INFO', res.data.data.userinfo)
|
||||
uni.setStorageSync('USER_TOKEN', res.data.data.userinfo.user_token)
|
||||
_this.$message.info(res.data.msg);
|
||||
uni.$emit("loginSuccess", {msg: 'loginSuccess'});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta:2
|
||||
});
|
||||
}, 500);
|
||||
_this.$message.info(res.data.msg);
|
||||
} else {
|
||||
_this.$message.info(res.data.msg);
|
||||
}
|
||||
this.is_click = false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.page {
|
||||
width: 100%;
|
||||
background: #F6F6F6;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
.top_title{
|
||||
font-size: 36rpx;
|
||||
font-family: PingFang SC;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.bind-phone {
|
||||
// border-top: 1rpx solid #EEEEEE;
|
||||
}
|
||||
// background pic start
|
||||
.bg {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
.back{
|
||||
position: absolute;
|
||||
top: 28rpx;
|
||||
left: 32rpx;
|
||||
z-index: 99;
|
||||
}
|
||||
.bg_img {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
|
||||
.logo-contnt {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.logo {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
background-image: url('/static/logo.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
border-radius: 40rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.desc {
|
||||
width: 100%;
|
||||
margin-left: -50%;
|
||||
height: 56rpx;
|
||||
line-height: 32rpx;
|
||||
margin-top: 32rpx;
|
||||
text-align: center;
|
||||
font-size: 40rpx;
|
||||
font-family: PingFang SC;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// background pic end
|
||||
.form-wapper {
|
||||
// margin-top: -44rpx;
|
||||
width: 100%;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
z-index: 999;
|
||||
background-color: #fff;
|
||||
.input-wapper {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
height: 124rpx;
|
||||
font-size: 32rpx;
|
||||
.title {
|
||||
margin: 0 28rpx 0 0rpx;
|
||||
width: 34rpx;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position:absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
// 发送验证码 start
|
||||
.code {
|
||||
position: absolute;
|
||||
text-align: right;
|
||||
right: 0;
|
||||
font-size: 28rpx;
|
||||
font-family: PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #FF7F1E;
|
||||
}
|
||||
|
||||
.pwd {
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
input {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.pwd-right {
|
||||
width: 34rpx;
|
||||
height:100%;
|
||||
position:absolute;
|
||||
right:0;
|
||||
top:50%;
|
||||
transform:translateY(-50%);
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.placeholderClass {
|
||||
font-size: 32rpx;
|
||||
font-family: PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #BFBFBF;
|
||||
}
|
||||
|
||||
// 提交按钮 start
|
||||
.btn_cloce {
|
||||
margin: 88rpx 32rpx 0;
|
||||
border-radius: 88rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
font-weight: 500;
|
||||
height: 88rpx;
|
||||
background: #FF9300;
|
||||
opacity: 1;
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
|
||||
// 提交按钮 end
|
||||
</style>
|
||||
183
pages/dl/bindPhone/bindPhone1.vue
Normal file
183
pages/dl/bindPhone/bindPhone1.vue
Normal file
@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<view class="page" :style="themeColor">
|
||||
<view class="flex benben-position-layout flex flex-wrap align-center bindPhone_flex_0" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
|
||||
<view class='flex flex-wrap align-center justify-between flex-sub bindPhone_fd0_0' >
|
||||
<view class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1" >
|
||||
<text class='fu-iconfont2 bindPhone_fd0_0_c0_c0' ></text>
|
||||
</view>
|
||||
<view class='flex flex-wrap align-stretch justify-center flex-sub' >
|
||||
<text class='bindPhone_fd0_0_c1_c0' >绑定手机号</text>
|
||||
</view>
|
||||
<view class='flex flex-wrap align-center bindPhone_fd0_0_c2' >
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view :style="{height: (88+StatusBarRpx)+'rpx'}" ></view>
|
||||
|
||||
<view class="flex flex-direction flex-wrap align-stretch bindPhone_flex_1" >
|
||||
<view class='flex flex-wrap align-center bindPhone_fd1_0' >
|
||||
<input class='flex-sub bindPhone_fd1_0_c0' type="number" placeholder="请输入手机号" confirm-type="done" :maxlength="12" placeholder-style="color:rgba(156, 156, 156, 1);font-size:32rpx" v-model="phone" />
|
||||
</view>
|
||||
<view class='flex flex-wrap align-center justify-between bindPhone_fd1_1' >
|
||||
<input class='bindPhone_fd1_1_c0' type="number" placeholder="请输入您的验证码" confirm-type="done" :maxlength="4" placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx" v-model="code" />
|
||||
<benben-send-verification-code class='flex bindPhone_fd1_1_c1' after-text='后重新获取' before-text='发送验证码' type='5' :phone="phone"></benben-send-verification-code>
|
||||
</view>
|
||||
<view class='flex flex-wrap align-center bindPhone_fd1_2' >
|
||||
<benben-flex-password-diy v-model="Passworld" class-name="flex align-center flex bindPhone_fd1_2_c0" :placeholder="'请输入密码(6~12位字母+数字)'" :maxlength="12" :default-type='true' placeholder-style="color:#999;font-size:32rpx" >
|
||||
<template #show>
|
||||
<text class='fu-iconfont2 bindPhone_fd1_2_c0_icon1' data-type="show"></text>
|
||||
</template>
|
||||
<template #hide>
|
||||
<text class='fu-iconfont2 bindPhone_fd1_2_c0_icon2' data-type="hide"></text>
|
||||
</template>
|
||||
</benben-flex-password-diy>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!---flex布局flex布局开始-->
|
||||
<view class="flex flex-wrap align-center justify-center benben-flex-layout" >
|
||||
<button class='bindPhone_fd2_0' @tap.stop="bindPhoneFunc()" >提交</button>
|
||||
</view>
|
||||
|
||||
<!---flex布局flex布局结束-->
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {validate} from '@/common/utils/validate.js'
|
||||
export default {
|
||||
components:{},
|
||||
|
||||
|
||||
data(){
|
||||
return {"phone":"","code":"","Passworld":""};
|
||||
},
|
||||
computed:{
|
||||
themeColor() {
|
||||
return this.$store.getters.themeColor
|
||||
},
|
||||
|
||||
},
|
||||
watch:{},
|
||||
onLoad(options){
|
||||
|
||||
},
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
onReady(){
|
||||
|
||||
},
|
||||
onShow(){
|
||||
|
||||
},
|
||||
onHide(){
|
||||
|
||||
},
|
||||
onResize(){
|
||||
|
||||
},
|
||||
onPullDownRefresh(){
|
||||
|
||||
},
|
||||
onReachBottom(e){
|
||||
|
||||
},
|
||||
onPageScroll(e){
|
||||
|
||||
},
|
||||
methods:{
|
||||
//绑定手机号
|
||||
bindPhoneFunc(){
|
||||
if(!validate(this.phone,'require')){
|
||||
this.$message.info('手机号不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!validate(this.phone,'phone')){
|
||||
this.$message.info('请输入正确的手机号');
|
||||
return false;
|
||||
}
|
||||
if(!validate(this.code,'require')){
|
||||
this.$message.info('验证码不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!validate(this.code,'length','4')){
|
||||
this.$message.info('请输入四位验证码数字');
|
||||
return false;
|
||||
}
|
||||
if(!validate(this.code,'captcha')){
|
||||
this.$message.info('请输入正确的验证码');
|
||||
return false;
|
||||
}
|
||||
if(!validate(this.Passworld,'require')){
|
||||
this.$message.info('密码不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!validate(this.Passworld,'password')){
|
||||
this.$message.info('请输入正确的密码格式');
|
||||
return false;
|
||||
}
|
||||
this.$urouter.switchTab(`/pages/tabBar/homePage/homePage`);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page{
|
||||
width: 100vw;
|
||||
overflow-x: hidden;
|
||||
min-height: calc(100vh - var(--window-bottom));
|
||||
background:#fff;background-size: 100% auto !important;
|
||||
}
|
||||
.bindPhone_flex_0{
|
||||
border-bottom:1px solid #eee;background:#fff;width:750rpx;height:88rpx;overflow:hidden;z-index:10;top:0rpx;background-size:100% auto !important;
|
||||
}
|
||||
.bindPhone_fd0_0_c2{
|
||||
width:32rpx;height:32rpx;
|
||||
}
|
||||
.bindPhone_fd0_0_c1_c0{
|
||||
font-size:36rpx;font-weight:500;color:#333;line-height:88rpx;
|
||||
}
|
||||
.bindPhone_fd0_0_c0_c0{
|
||||
font-size:32rpx;font-weight:500;color:#333;line-height:88rpx;
|
||||
}
|
||||
.bindPhone_fd0_0{
|
||||
margin:0rpx 32rpx 0rpx 32rpx;
|
||||
}
|
||||
.bindPhone_flex_1{
|
||||
background:#fff;font-size:32rpx;background-size:100% auto !important;padding:0rpx 32rpx 0rpx 32rpx;
|
||||
}
|
||||
.bindPhone_fd1_2_c0_icon2{
|
||||
width:88rpx;line-height:88rpx;text-align:center;font-size:40rpx;
|
||||
}
|
||||
.bindPhone_fd1_2_c0_icon1{
|
||||
width:88rpx;line-height:88rpx;text-align:center;font-size:40rpx;
|
||||
}
|
||||
::v-deep .bindPhone_fd1_2_c0{
|
||||
font-size:32rpx;width:686rpx;
|
||||
}
|
||||
.bindPhone_fd1_2{
|
||||
border-bottom:1px solid rgba(238, 238, 238, 1);padding:32rpx 0rpx 32rpx 0rpx;
|
||||
}
|
||||
.bindPhone_fd1_1_c1{
|
||||
line-height:30rpx;text-align:center;font-size:28rpx;color:#FF7F1E;font-weight:400;
|
||||
}
|
||||
.bindPhone_fd1_1_c0{
|
||||
line-height:45rpx;font-size:32rpx;font-weight:400;color:#333;
|
||||
}
|
||||
.bindPhone_fd1_1{
|
||||
border-bottom:1px solid #eee;padding:32rpx 0rpx 32rpx 0rpx;
|
||||
}
|
||||
.bindPhone_fd1_0_c0{
|
||||
line-height:45rpx;font-size:32rpx;font-weight:400;color:#333;
|
||||
}
|
||||
.bindPhone_fd1_0{
|
||||
border-bottom:1px solid #eee;padding:32rpx 0rpx 32rpx 0rpx;
|
||||
}
|
||||
.bindPhone_fd2_0{
|
||||
background:rgba(255, 147, 0, 1);border-radius:44rpx 44rpx 44rpx 44rpx;font-size:32rpx;color:#fff;width:686rpx;height:88rpx;line-height:88rpx;font-weight:500;margin:88rpx 0rpx 0rpx 0rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user