1000 lines
28 KiB
Vue
1000 lines
28 KiB
Vue
<template>
|
||
<view>
|
||
<!-- #ifndef MP-WEIXIN -->
|
||
<view class="page" :style="themeColor">
|
||
<!---flex布局flex布局开始-->
|
||
|
||
<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout passwordLogin_flex_0">
|
||
<view class='flex flex-wrap align-center passwordLogin_fd0_0'>
|
||
<text class='passwordLogin_fd0_0_c0'>欢迎来到萬家商超</text>
|
||
</view>
|
||
<view class='flex flex-direction flex-wrap align-stretch passwordLogin_fd0_1'>
|
||
<text class='passwordLogin_fd0_1_c0'>账号</text>
|
||
<view class='flex flex-wrap align-center justify-between'>
|
||
<input type="number" placeholder="请输入手机号" confirm-type="done" :maxlength="11"
|
||
placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="mobile" />
|
||
</view>
|
||
</view>
|
||
<view class='flex flex-direction flex-wrap align-stretch passwordLogin_fd0_2'>
|
||
<text class='passwordLogin_fd0_2_c0'>密码</text>
|
||
<view class='flex flex-wrap align-center justify-between'>
|
||
<benben-flex-password-diy v-model="password"
|
||
class-name="flex flex align-center passwordLogin_fd0_2_c1_c0"
|
||
:placeholder="'请输入密码(6~12位字母+数字)'" :maxlength="12" :default-type='true'
|
||
placeholder-style="color:#999;font-size:32rpx">
|
||
<template #show>
|
||
<text class='fu-iconfont2 passwordLogin_fd0_2_c1_c0_icon1'
|
||
data-type="show"></text>
|
||
</template>
|
||
<template #hide>
|
||
<text class='fu-iconfont2 passwordLogin_fd0_2_c1_c0_icon2'
|
||
data-type="hide"></text>
|
||
</template>
|
||
</benben-flex-password-diy>
|
||
</view>
|
||
</view>
|
||
<view class='flex flex-direction-row-reverse flex-wrap align-center passwordLogin_fd0_3'>
|
||
<text class='passwordLogin_fd0_3_c0' @tap.stop="handleJumpDiy" data-type="redirectTo"
|
||
:data-url="`/pages/dl/codeLogin/codeLogin`">验证码登录</text>
|
||
</view>
|
||
<view class='flex flex-wrap align-center passwordLogin_fd0_4'>
|
||
<button class='flex-sub passwordLogin_fd0_4_c0' @tap.stop="validationLoginFunc()">立即登录</button>
|
||
</view>
|
||
<view class='flex flex-wrap align-center justify-center passwordLogin_fd0_5'>
|
||
<text class='passwordLogin_fd0_5_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
|
||
:data-url="`/pages/dl/registerLogin/registerLogin`">注册账号</text>
|
||
|
||
<view class='flex passwordLogin_fd0_5_c1'></view>
|
||
|
||
<text class='passwordLogin_fd0_5_c2' @tap.stop="handleJumpDiy" data-type="navigateTo"
|
||
:data-url="`/pages/dl/forgotPassword/forgotPassword`">忘记密码</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!---flex布局flex布局结束-->
|
||
<view class="flex flex-direction align-center benben-position-layout flex passwordLogin_flex_1"
|
||
v-if="isPublish">
|
||
<view class='flex flex-wrap align-center'>
|
||
<view class='flex flex-wrap align-center passwordLogin_fd1_0_c0'>
|
||
</view>
|
||
<text class='passwordLogin_fd1_0_c1'>快捷登录</text>
|
||
<view class='flex flex-wrap align-center passwordLogin_fd1_0_c2'>
|
||
</view>
|
||
</view>
|
||
<image class='passwordLogin_fd1_1' :src='STATIC_URL+"116.png"' @tap.stop="wxLogin"
|
||
data-type="navigateTo" :data-url="`/pages/dl/quickLogin/quickLogin`"></image>
|
||
|
||
</view>
|
||
|
||
<view class="text-center text-sm fixed flex align-center justify-center read">
|
||
<image v-if="!isRead" :src='STATIC_URL+"123.png"' mode="widthFix" @tap="handleToggle"></image>
|
||
<image v-else :src='STATIC_URL+"122.png"' mode="widthFix" @tap="handleToggle"></image>
|
||
已阅读并同意
|
||
<text class="alink margin-lr-xs" @tap="navto(8)">《用户注册协议》</text>
|
||
和
|
||
<text class="alink margin-lr-xs" @tap="navto(16)">《隐私政策》</text>
|
||
</view>
|
||
<view :style="{height: '300rpx'}"></view>
|
||
|
||
|
||
|
||
|
||
</view>
|
||
<!-- #endif -->
|
||
<!-- #ifdef MP-WEIXIN -->
|
||
<view class="page-container">
|
||
<fu-custom bgColor="bg-white" :isBack="true" :isBottom="false">
|
||
<block slot="content">授权登录</block>
|
||
</fu-custom>
|
||
<view class="container">
|
||
<view class="header">
|
||
<image src="/static/logo.png"></image>
|
||
</view>
|
||
<view class="content">
|
||
<view class="text-lg text-bold" style="color: #4B5269; margin-top: 28rpx;">萬家商超</view>
|
||
<!-- <view class="text-333 text-bold text-lg" style="margin: 40rpx 0 24rpx;">申请获取以下权限</view>
|
||
<text class="text-666 text-bold text-df">获得你的手机号码信息</text> -->
|
||
</view>
|
||
<button v-if="canIUseGetUserProfile" class="bottom bg-white" @click="wxGetUserProfile">
|
||
<image class="margin-right-xs" src="../../static/login/login-icon.png" mode="aspectFit"></image>
|
||
一键授权登录
|
||
</button>
|
||
<button v-else class="bottom bg-white" type="" open-type="getUserInfo" withCredentials="true"
|
||
lang="zh_CN" @getuserinfo="wxGetUserInfo">
|
||
<image class="margin-right-xs" src="../../static/login/login-icon.png" mode="aspectFit"></image>
|
||
一键授权登录
|
||
</button>
|
||
<view class="text-center text-sm fixed flex align-center justify-center">
|
||
<image v-if="!isRead" :src='STATIC_URL+"123.png"' mode="widthFix" @tap="handleToggle"></image>
|
||
<image v-else :src='STATIC_URL+"122.png"' mode="widthFix" @tap="handleToggle"></image>
|
||
阅读并同意
|
||
<text class="alink margin-lr-xs" @tap="navto(8)">《用户协议》</text>
|
||
和
|
||
<text class="alink margin-lr-xs" @tap="navto(16)">《隐私政策》</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- #endif -->
|
||
</view>
|
||
|
||
</template>
|
||
<script>
|
||
import {
|
||
validate
|
||
} from '@/common/utils/validate.js'
|
||
export default {
|
||
components: {},
|
||
|
||
|
||
data() {
|
||
return {
|
||
"mobile": "",
|
||
"password": "",
|
||
"token": "",
|
||
code: '',
|
||
isRead: false,
|
||
source: '',
|
||
canIUseGetUserProfile: false,
|
||
invite_code: ''
|
||
};
|
||
},
|
||
computed: {
|
||
themeColor() {
|
||
return this.$store.getters.themeColor
|
||
},
|
||
|
||
},
|
||
watch: {},
|
||
onLoad(options) {
|
||
this.source = options.source || '';
|
||
// #ifdef MP-WEIXIN
|
||
if (wx.getUserProfile) {
|
||
this.canIUseGetUserProfile = true;
|
||
}
|
||
|
||
// 扫码进入分享
|
||
let scene = decodeURIComponent(options.scene)
|
||
let params = this.strToParams(scene)
|
||
if (params?.invite_code) {
|
||
this.invite_code = params.invite_code
|
||
uni.setStorageSync('INVITE_CODE', this.invite_code)
|
||
}
|
||
// #endif
|
||
|
||
// #ifdef APP-PLUS
|
||
this.getPublishStatus()
|
||
// #endif
|
||
},
|
||
onUnload() {
|
||
|
||
},
|
||
onReady() {
|
||
|
||
},
|
||
onShow() {
|
||
},
|
||
onHide() {
|
||
|
||
},
|
||
onResize() {
|
||
|
||
},
|
||
onPullDownRefresh() {
|
||
|
||
},
|
||
onReachBottom(e) {
|
||
|
||
},
|
||
onPageScroll(e) {
|
||
|
||
},
|
||
methods: {
|
||
strToParams(str) {
|
||
var newparams = {}
|
||
for (let item of str.split('&')) {
|
||
newparams[item.split('=')[0]] = item.split('=')[1]
|
||
}
|
||
return newparams
|
||
},
|
||
|
||
// 去查看用户隐私协议
|
||
navto(id) {
|
||
uni.navigateTo({
|
||
url: '/pages/dl/agreementPolicy/agreementPolicy?type=' + id
|
||
});
|
||
},
|
||
handleToggle() {
|
||
this.isRead = !this.isRead;
|
||
},
|
||
// 取消登录
|
||
cancle() {
|
||
uni.navigateBack();
|
||
},
|
||
// 获取手机号
|
||
getPhoneNumber(e) {
|
||
if (!this.isRead) {
|
||
return this.$message.info('请先阅读并同意《用户协议》和 《隐私政策》');
|
||
}
|
||
// 用户取消授权,返回上一页
|
||
// 用户同意授权,调用登录方法
|
||
if (e.detail.errMsg.indexOf('user deny') !== -1) {
|
||
uni.navigateBack();
|
||
} else {
|
||
|
||
uni.login({
|
||
success: res => {
|
||
const code = res.code;
|
||
// 允许授权用户登录
|
||
// 请求登录接口
|
||
this.$api
|
||
.post(global.apiUrls.postUserSocialLogin, {
|
||
extend_info: JSON.stringify({
|
||
code: code
|
||
}),
|
||
third_type: 'wx_miniapp'
|
||
})
|
||
.then(result => {
|
||
result = result.data;
|
||
console.log('后台返回登录信息', result);
|
||
if (result.code == 1) {
|
||
uni.hideLoading();
|
||
// 如果后台返回来的是 result 字段,表示此账号还没有绑定过手机号 跳转到绑定手机号页面
|
||
// 如果后台返回的是 userinfo 字段,表示已经登录成功,把用户信息存到 store 中,并返回跳转来的页面
|
||
if (result.data.result) {
|
||
let params = {
|
||
openId: result.data.result.openId,
|
||
session_key: result.data.result.session_key,
|
||
unionid: result.data.result.unionid
|
||
}
|
||
setTimeout(() => {
|
||
this.bindMoblile(e.detail.encryptedData, e.detail
|
||
.iv, params);
|
||
}, 100)
|
||
} else if (result.data.userinfo) {
|
||
this.$store.commit('updateUserInfo', result.data.userinfo);
|
||
// uni.navigateBack();
|
||
let inviteCode = uni.getStorageSync('INVITE_CODE') || '';
|
||
if (inviteCode) {
|
||
this.bindDriverCode(inviteCode);
|
||
}
|
||
if (this.source == 'scan') {
|
||
uni.navigateBack();
|
||
} else {
|
||
uni.reLaunch({
|
||
url: '/pages/tab/home/home/index'
|
||
})
|
||
}
|
||
|
||
}
|
||
|
||
} else if (result.code == -999) {
|
||
// 服务器解析参数错误
|
||
uni.hideLoading();
|
||
this.$message.info(result.msg);
|
||
} else {
|
||
uni.hideLoading();
|
||
this.$message.info(this.i18n['授权失败,请使用其他方式登录']);
|
||
}
|
||
})
|
||
.catch(err => {
|
||
console.log('ERROR', err);
|
||
uni.hideLoading();
|
||
this.$message.info(err.msg);
|
||
});
|
||
},
|
||
fail: err => {
|
||
console.log('ERROR', err);
|
||
this.$message.info(this.i18n['获取用户授权失败']);
|
||
uni.hideLoading();
|
||
}
|
||
});
|
||
|
||
|
||
}
|
||
},
|
||
// 新版微信登录接口
|
||
wxGetUserProfile() {
|
||
if (!this.isRead) {
|
||
return this.$message.info('请先阅读并同意《用户协议》和 《隐私政策》');
|
||
}
|
||
uni.showLoading({
|
||
title: '登录中...'
|
||
});
|
||
|
||
uni.getUserProfile({
|
||
desc: '用于完善会员资料',
|
||
success: infoRes => {
|
||
console.log('infoRes', infoRes);
|
||
uni.login({
|
||
success: res => {
|
||
const code = res.code;
|
||
// 允许授权用户登录
|
||
// 请求登录接口
|
||
this.$api
|
||
.post(global.apiUrls.postUserSocialLogin, {
|
||
extend_info: JSON.stringify({
|
||
code: code
|
||
}),
|
||
third_type: 'wx_miniapp'
|
||
})
|
||
.then(result => {
|
||
result = result.data;
|
||
console.log('后台返回登录信息', result);
|
||
if (result.code == 1) {
|
||
uni.hideLoading();
|
||
// 如果后台返回来的是 result 字段,表示此账号还没有绑定过手机号 跳转到绑定手机号页面
|
||
// 如果后台返回的是 userinfo 字段,表示已经登录成功,把用户信息存到 store 中,并返回跳转来的页面
|
||
if (result.data.result) {
|
||
let params = {
|
||
openid: result.data.result.openid,
|
||
// session_key: result.data.result.session_key,
|
||
unionid: result.data.result.unionid,
|
||
nickName: infoRes.userInfo.nickName,
|
||
gender: infoRes.userInfo.gender,
|
||
avatarUrl: infoRes.userInfo.avatarUrl
|
||
}
|
||
uni.setStorageSync('Wxinfo_tmp', params);
|
||
setTimeout(function() {
|
||
uni.redirectTo({
|
||
url: '/pages/dl/authPhone/authPhone'
|
||
});
|
||
}, 500);
|
||
} else if (result.data.userinfo) {
|
||
this.$store.commit('updateUserInfo', result
|
||
.data.userinfo);
|
||
global.token = result.data.userinfo.user_token
|
||
global.userInfo = result.data.userinfo
|
||
uni.setStorageSync('USER_INFO', result.data
|
||
.userinfo)
|
||
uni.setStorageSync('USER_TOKEN', result.data
|
||
.userinfo.user_token)
|
||
this.$message.info(result.msg);
|
||
uni.$emit("loginSuccess", {
|
||
msg: 'loginSuccess'
|
||
});
|
||
if (this.invite_code) {
|
||
setTimeout(() => {
|
||
uni.reLaunch({
|
||
url: '/pages/tabBar/homePage/homePage'
|
||
})
|
||
}, 500);
|
||
|
||
} else {
|
||
setTimeout(() => {
|
||
uni.navigateBack({
|
||
delta: 1
|
||
});
|
||
}, 500);
|
||
}
|
||
|
||
}
|
||
} else {
|
||
uni.hideLoading();
|
||
this.$message.info(result.msg);
|
||
}
|
||
})
|
||
.catch(err => {
|
||
console.log('ERROR', err);
|
||
uni.hideLoading();
|
||
this.$message.info(err.msg);
|
||
});
|
||
},
|
||
fail: err => {
|
||
console.log('ERROR', err);
|
||
this.$message.info('获取用户授权失败');
|
||
uni.hideLoading();
|
||
}
|
||
});
|
||
},
|
||
fail: err => {
|
||
console.log('ERROR', err);
|
||
uni.hideLoading();
|
||
}
|
||
});
|
||
},
|
||
// 旧版微信登录接口
|
||
wxGetUserInfo(e) {
|
||
if (!this.isRead) {
|
||
return this.$message.info('请先阅读并同意《用户协议》和 《隐私政策》');
|
||
}
|
||
uni.showLoading({
|
||
title: '登录中...'
|
||
});
|
||
uni.login({
|
||
success: res => {
|
||
const code = res.code;
|
||
uni.getUserInfo({
|
||
provider: 'weixin',
|
||
success: infoRes => {
|
||
console.log('infoRes', infoRes);
|
||
// 允许授权用户登录
|
||
// 请求登录接口
|
||
this.$api
|
||
.post(global.apiUrls.postUserSocialLogin, {
|
||
extend_info: JSON.stringify({
|
||
code: code
|
||
}),
|
||
third_type: 'wx_miniapp'
|
||
})
|
||
.then(result => {
|
||
result = result.data;
|
||
console.log('后台返回登录信息', result);
|
||
if (result.code == 1) {
|
||
uni.hideLoading();
|
||
// 如果后台返回来的是 result 字段,表示此账号还没有绑定过手机号 跳转到绑定手机号页面
|
||
// 如果后台返回的是 userinfo 字段,表示已经登录成功,把用户信息存到 store 中,并返回跳转来的页面
|
||
if (result.data.result) {
|
||
let params = {
|
||
openid: result.data.result.openId,
|
||
session_key: result.data.result
|
||
.session_key,
|
||
unionid: result.data.result.unionid,
|
||
nickName: infoRes.userInfo.nickName,
|
||
gender: infoRes.userInfo.gender,
|
||
avatarUrl: infoRes.userInfo.avatarUrl
|
||
}
|
||
console.log()
|
||
uni.setStorageSync('Wxinfo_tmp', params);
|
||
setTimeout(function() {
|
||
uni.redirectTo({
|
||
url: '/pages/dl/authPhone/authPhone'
|
||
});
|
||
}, 500);
|
||
} else if (result.data.userinfo) {
|
||
this.$store.commit('updateUserInfo', result
|
||
.data.userinfo);
|
||
global.token = result.data.userinfo.user_token
|
||
global.userInfo = result.data.userinfo
|
||
uni.setStorageSync('USER_INFO', result.data
|
||
.userinfo)
|
||
uni.setStorageSync('USER_TOKEN', result.data
|
||
.userinfo.user_token)
|
||
this.$message.info(result.msg);
|
||
uni.$emit("loginSuccess", {
|
||
msg: 'loginSuccess'
|
||
});
|
||
setTimeout(() => {
|
||
uni.navigateBack({
|
||
delta: 1
|
||
});
|
||
}, 500);
|
||
}
|
||
} else {
|
||
uni.hideLoading();
|
||
this.$message.info(result.msg);
|
||
}
|
||
})
|
||
.catch(err => {
|
||
console.log('ERROR', err);
|
||
uni.hideLoading();
|
||
this.$message.info(err.msg);
|
||
});
|
||
},
|
||
fail: err => {
|
||
console.log('ERROR', err);
|
||
this.$message.info('获取用户授权失败');
|
||
uni.hideLoading();
|
||
}
|
||
});
|
||
},
|
||
fail: err => {
|
||
console.log('ERROR', err);
|
||
uni.hideLoading();
|
||
}
|
||
});
|
||
},
|
||
|
||
|
||
/**
|
||
* @event 微信登陆
|
||
*/
|
||
wxLogin() {
|
||
let _this = this;
|
||
// if (!this.is_select_agree) return this.$message.info('请勾选用户协议');
|
||
// #ifdef APP-PLUS
|
||
// 如果是app环境打开微信
|
||
if (
|
||
plus.runtime.isApplicationExist({
|
||
pname: "com.tencent.mm",
|
||
action: "weixin://",
|
||
})
|
||
) {
|
||
uni.getProvider({
|
||
service: "oauth",
|
||
success: function(res) {
|
||
console.log(res);
|
||
// 如果支持微信等,就执行 wx_login_fn 方法
|
||
if (~res.provider.indexOf("weixin")) {
|
||
_this.wx_login_fn();
|
||
}
|
||
},
|
||
fail: function(err) {
|
||
// api错误是打印错误
|
||
console.log(err);
|
||
},
|
||
});
|
||
} else {
|
||
// 调起失败时提醒用户
|
||
this.$message.info("请安装微信后再使用此功能");
|
||
}
|
||
// #endif
|
||
},
|
||
/**
|
||
* @function 微信授权登录
|
||
*/
|
||
wx_login_fn() {
|
||
let _this = this;
|
||
/**
|
||
* @desc uniapp的登陆api
|
||
* @param {String} provider - 登录服务提供商
|
||
* @param {login~success} loginRes - 接口调用成功时的回调函数
|
||
*/
|
||
uni.login({
|
||
provider: "weixin",
|
||
/**
|
||
* @callback login~success
|
||
* @param {Object} loginRes - api返回来的信息
|
||
*/
|
||
success: function(loginRes) {
|
||
/**
|
||
* @desc 获取用户信息
|
||
* @param {String} provider - 登录服务提供商
|
||
* @param {Funtion} success - 接口调用成功时的回调函数
|
||
*/
|
||
uni.getUserInfo({
|
||
provider: "weixin",
|
||
/**
|
||
* @callback success
|
||
* @param {Object} infoRes - api返回来的信息
|
||
*/
|
||
success: function(infoRes) {
|
||
// 显示加载状态
|
||
uni.showLoading({
|
||
title: "加载中...",
|
||
});
|
||
/**
|
||
* @let {String} nickName - 结构出来的变量昵称
|
||
* @let {String} avatarUrl - 解构出来的头像链接
|
||
* @let {String} gender - 结构出来的性别
|
||
*/
|
||
let {
|
||
nickName,
|
||
avatarUrl,
|
||
gender
|
||
} = infoRes.userInfo;
|
||
// #ifdef APP-PLUS
|
||
let clientId = plus.push.getClientInfo().clientid || "";
|
||
console.log("clientId", clientId);
|
||
// @const {Number} appSystem - 判断设备类型 1:ios;2:安卓;
|
||
let appSystem = uni.getSystemInfoSync().platform == "ios" ? 1 : 2;
|
||
// #endif
|
||
console.log(infoRes, "app微信登录");
|
||
console.log(infoRes.userInfo.unionId, "app微信登录");
|
||
/**
|
||
* @description 第三方登录请求接口
|
||
*/
|
||
_this.$api
|
||
.post(global.apiUrls.postUserSocialLogin, {
|
||
third_type: 'wx_app',
|
||
extend_info: JSON.stringify({
|
||
unionid: infoRes.userInfo.unionId,
|
||
clientId: clientId || "",
|
||
appSystem: appSystem || "",
|
||
nickname: nickName,
|
||
avatar: avatarUrl,
|
||
gender: gender,
|
||
openid: infoRes.userInfo.openId,
|
||
})
|
||
})
|
||
.then((res) => {
|
||
console.log(res)
|
||
// 保存用户信息
|
||
global.tempUserLoginInfo = infoRes.userInfo;
|
||
// 关闭加载效果
|
||
uni.hideLoading();
|
||
if (res.data.code == 1) {
|
||
console.log(1)
|
||
if (res.data.data.userinfo && res.data.data
|
||
.userinfo.user_token) {
|
||
_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: 1
|
||
});
|
||
}, 500);
|
||
// _this.$message.info(res.data.msg);
|
||
}
|
||
if (res.data.data.result && res.data.data.result
|
||
.openid) {
|
||
uni.navigateTo({
|
||
url: `/pages/dl/bindPhone/bindPhone?unionId=${infoRes.userInfo.unionId}&openId=${infoRes.userInfo.openId}&sex=${infoRes.userInfo.gender}&nickName=${infoRes.userInfo.nickName}&avatarUrl=${infoRes.userInfo.avatarUrl}&authType=wx_unionid&bind_type=1`
|
||
})
|
||
}
|
||
|
||
// _this.$message.info(res.data.msg);
|
||
// /**
|
||
// * @description 向Vux发送用户信息保存
|
||
// * @param {String} updateUserInfo - 调用的方法名称
|
||
// * @param {Object} res.data.data.userinfo - 用户信息
|
||
// */
|
||
// _this.$store.commit(
|
||
// "updateUserInfo",
|
||
// res.data.data.userinfo
|
||
// );
|
||
// uni.$emit("loginSuccess", {msg: 'loginSuccess'});
|
||
// setTimeout(() => {
|
||
// uni.navigateBack();
|
||
// }, 800);
|
||
} else if (res.data.code == 0) {
|
||
/**
|
||
* @description 清除当前页面,跳转到绑定手机页面
|
||
*/
|
||
// _this.$urouter.redirectTo({
|
||
// url: _this.PAGE_BASE_URL + "bind-phone/index",
|
||
// params: {
|
||
// unionId: infoRes.userInfo.unionId,
|
||
// openId: infoRes.userInfo.openId,
|
||
// sex: infoRes.userInfo.gender,
|
||
// nickName: infoRes.userInfo.nickName,
|
||
// avatarUrl: infoRes.userInfo.avatarUrl,
|
||
// authType: "wx_unionid",
|
||
// bind_type: 1
|
||
// },
|
||
// });
|
||
// 点击手机号账号登录按钮
|
||
} else if (res.code == -1) {
|
||
_this.$message.info(res.data.msg);
|
||
return;
|
||
}
|
||
})
|
||
.catch((err) => {
|
||
uni.hideLoading();
|
||
console.log(err);
|
||
});
|
||
},
|
||
});
|
||
},
|
||
error: function(err) {
|
||
uni.hideLoading();
|
||
console.log(err);
|
||
},
|
||
});
|
||
},
|
||
Get5d8b062aefc08(userinfo) {
|
||
let clientId = '565656565656';
|
||
let appSystem = 'appSystem';
|
||
// #ifdef APP-PLUS
|
||
clientId = plus.push.getClientInfo().clientid || '';
|
||
console.log('clientId', clientId);
|
||
console.log('getClientInfo', plus.push.getClientInfo());
|
||
appSystem = uni.getSystemInfoSync().platform == 'ios' ? 1 : 2;
|
||
// #endif
|
||
this.$api.post(global.apiUrls.Get5d8b062aefc08, {
|
||
client_id: clientId
|
||
}).then(res => {
|
||
if (res.data.code == 1) {
|
||
this.$store.commit("updateUserInfo", userinfo);
|
||
global.token = userinfo.user_token
|
||
global.userInfo = userinfo
|
||
uni.setStorageSync('USER_INFO', userinfo)
|
||
uni.setStorageSync('USER_TOKEN', userinfo.user_token)
|
||
uni.$emit('loginSuccess')
|
||
setTimeout(() => {
|
||
uni.navigateBack({
|
||
delta: 1
|
||
})
|
||
}, 1000)
|
||
}
|
||
})
|
||
},
|
||
|
||
|
||
//效验登录
|
||
validationLoginFunc() {
|
||
if (!validate(this.mobile, 'require')) {
|
||
this.$message.info('请输入手机号');
|
||
return false;
|
||
}
|
||
if (!validate(this.mobile, 'phone')) {
|
||
this.$message.info('请输入正确的手机号');
|
||
return false;
|
||
}
|
||
if (!validate(this.password, 'require')) {
|
||
this.$message.info('密码不能为空');
|
||
return false;
|
||
}
|
||
if (!validate(this.password, 'password')) {
|
||
this.$message.info('请输入6~12位字母+数字的密码');
|
||
return false;
|
||
}
|
||
if (!this.isRead) {
|
||
return this.$message.info('请先阅读并同意《用户注册协议》和 《隐私政策》');
|
||
}
|
||
this.$api.post(global.apiUrls.postPasswordLogin, {
|
||
account: this.mobile,
|
||
password: this.password,
|
||
account_type: 'mobile'
|
||
})
|
||
.then(res => {
|
||
console.log(res.data.data.userinfo);
|
||
this.$message.info(res.data.msg)
|
||
if (res.data.code == 1) {
|
||
global.user_token = res.data.data.userinfo.user_token
|
||
this.Get5d8b062aefc08(res.data.data.userinfo)
|
||
|
||
|
||
// 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)
|
||
// setTimeout(() => {
|
||
// uni.navigateBack({
|
||
// delta: 1
|
||
// })
|
||
// }, 1000)
|
||
}
|
||
});
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
<style lang="scss" scoped>
|
||
.page {
|
||
width: 100vw;
|
||
overflow-x: hidden;
|
||
min-height: calc(100vh - var(--window-bottom));
|
||
background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/117.png) no-repeat, rgba(255, 255, 255, 1);
|
||
background-size: 100% auto !important;
|
||
}
|
||
|
||
.passwordLogin_flex_0 {
|
||
padding: 246rpx 75rpx 0rpx 75rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_5_c2 {
|
||
color: #999999;
|
||
font-size: 28rpx;
|
||
font-weight: 400;
|
||
line-height: 34rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_5_c1 {
|
||
background: rgba(171, 163, 163, 1);
|
||
width: 1rpx;
|
||
height: 30rpx;
|
||
margin: 0rpx 20rpx 0rpx 20rpx;
|
||
transform: scaleX(0.5);
|
||
}
|
||
|
||
.passwordLogin_fd0_5_c0 {
|
||
color: #999999;
|
||
font-size: 28rpx;
|
||
font-weight: 400;
|
||
line-height: 34rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_5 {
|
||
margin: 40rpx 0rpx 0rpx 0rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_4_c0 {
|
||
background: rgba(255, 147, 0, 1);
|
||
border-radius: 44rpx 44rpx 44rpx 44rpx;
|
||
font-size: 32rpx;
|
||
color: #fff;
|
||
height: 80rpx;
|
||
line-height: 80rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_4 {
|
||
padding: 48rpx 0rpx 0rpx 0rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_3_c0 {
|
||
color: #333333;
|
||
font-size: 28rpx;
|
||
font-weight: 400;
|
||
line-height: 38rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_3 {
|
||
margin: 32rpx 0rpx 0rpx 0rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_2_c1_c0_icon2 {
|
||
width: 88rpx;
|
||
line-height: 88rpx;
|
||
text-align: center;
|
||
font-size: 40rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_2_c1_c0_icon1 {
|
||
width: 88rpx;
|
||
line-height: 88rpx;
|
||
text-align: center;
|
||
font-size: 40rpx;
|
||
}
|
||
|
||
::v-deep .passwordLogin_fd0_2_c1_c0 {
|
||
width: 600rpx;
|
||
font-size: 32rpx;
|
||
height: 50rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_2_c0 {
|
||
margin: 0rpx 0rpx 24rpx 0rpx;
|
||
color: #333333;
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
line-height: 32rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_2 {
|
||
border-bottom: 1px solid #eee;
|
||
padding: 40rpx 0rpx 20rpx 0rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_1_c0 {
|
||
margin: 0rpx 0rpx 24rpx 0rpx;
|
||
color: #333333;
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
line-height: 32rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_1 {
|
||
border-bottom: 1px solid #eee;
|
||
padding: 40rpx 0rpx 20rpx 0rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_0_c0 {
|
||
color: #333333;
|
||
font-size: 50rpx;
|
||
font-weight: 600;
|
||
line-height: 50rpx;
|
||
}
|
||
|
||
.passwordLogin_fd0_0 {
|
||
margin: 0rpx 0rpx 24rpx 0rpx;
|
||
}
|
||
|
||
.passwordLogin_flex_1 {
|
||
background: #fff;
|
||
width: 750rpx;
|
||
height: 300rpx;
|
||
overflow: hidden;
|
||
z-index: 10;
|
||
bottom: calc(0rpx + var(--window-bottom));
|
||
background-size: 100% auto !important;
|
||
}
|
||
|
||
.passwordLogin_fd1_1 {
|
||
width: 80rpx;
|
||
height: 80rpx;
|
||
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
||
margin: 40rpx 0rpx 0rpx 0rpx;
|
||
}
|
||
|
||
.passwordLogin_fd1_0_c2 {
|
||
background: rgba(238, 238, 238, 1);
|
||
background-size: 100% auto !important;
|
||
height: 1rpx;
|
||
width: 157rpx;
|
||
}
|
||
|
||
.passwordLogin_fd1_0_c1 {
|
||
line-height: 32rpx;
|
||
font-size: 26rpx;
|
||
font-weight: 400;
|
||
color: #999999;
|
||
padding: 0rpx 7rpx 0rpx 7rpx;
|
||
}
|
||
|
||
.passwordLogin_fd1_0_c0 {
|
||
background: rgba(238, 238, 238, 1);
|
||
background-size: 100% auto !important;
|
||
height: 1rpx;
|
||
width: 157rpx;
|
||
}
|
||
|
||
.container {
|
||
overflow: hidden;
|
||
}
|
||
|
||
// logo样式 start
|
||
.header {
|
||
margin-top: 124rpx;
|
||
height: 202rpx;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
|
||
image {
|
||
width: 202rpx;
|
||
height: 202rpx;
|
||
// border-radius: 40rpx;
|
||
}
|
||
}
|
||
|
||
// logo样式 end
|
||
|
||
// 内容区 start
|
||
.content {
|
||
text-align: center;
|
||
margin-bottom: 90rpx;
|
||
}
|
||
|
||
.content text {
|
||
display: block;
|
||
color: #9d9d9d;
|
||
margin-top: 40rpx;
|
||
}
|
||
|
||
// 内容区 end
|
||
|
||
// 底部说明 start
|
||
.bottom {
|
||
width: 620rpx;
|
||
height: 88rpx;
|
||
line-height: 88rpx;
|
||
border-radius: 44rpx;
|
||
margin: 132rpx auto 0;
|
||
// font-size: 30rpx;
|
||
// border: 2rpx solid #39b54a;
|
||
color: #fff;
|
||
background: rgba(255, 147, 0, 1);
|
||
font-size: 32rpx;
|
||
font-weight: bold;
|
||
|
||
image {
|
||
width: 49rpx;
|
||
height: 40rpx;
|
||
vertical-align: middle;
|
||
}
|
||
}
|
||
|
||
.bottom::after {
|
||
display: none;
|
||
}
|
||
|
||
.fixed {
|
||
width: 100%;
|
||
text-align: center;
|
||
position: fixed;
|
||
bottom: 56rpx;
|
||
color: #666;
|
||
|
||
image {
|
||
margin-right: 12rpx;
|
||
width: 28rpx;
|
||
height: 28rpx;
|
||
}
|
||
}
|
||
|
||
.read {
|
||
bottom: 40rpx;
|
||
z-index: 100;
|
||
}
|
||
|
||
.alink {
|
||
color: #59A6F4;
|
||
}
|
||
|
||
.page-container {
|
||
min-height: 100vh;
|
||
background: #fff;
|
||
}
|
||
</style> |