提交 e62a9ae4 编写于 作者: study夏羽's avatar study夏羽

1.0.37

上级 0143adf2
<template> <template>
<view class="content"> <view class="content">
<button @click="toUserInfoPage">个人资料</button> <button @click="toUserInfoPage">个人资料</button>
<uni-forms-item label="登录方式"> <uni-forms-item label="登录方式" labelWidth="70">
<uni-data-checkbox :multiple="false" v-model="loginType" :localdata="loginTypeOption"></uni-data-checkbox> <uni-data-checkbox :multiple="false" v-model="loginType" :localdata="loginTypeOption"></uni-data-checkbox>
</uni-forms-item> </uni-forms-item>
<button @click="toLogin">前往登录</button> <button @click="toLogin">前往登录</button>
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
"value": "smsCode", "value": "smsCode",
"text": "手机验证码" "text": "手机验证码"
}, { }, {
"value": "apple", "value": "apple",
"text": "苹果登录" "text": "苹果登录"
}, { }, {
"value": "weixinMobile", "value": "weixinMobile",
"text": "微信手机号登录" "text": "微信手机号登录"
}] }]
} }
}, },
onLoad() {}, onLoad() {},
......
## 1.0.37(2022-12-09)
- 优化admin端样式
## 1.0.36(2022-12-08) ## 1.0.36(2022-12-08)
- uni-id-co 优化 手机号与邮箱验证规则为空字符串时不校验 - uni-id-co 优化 手机号与邮箱验证规则为空字符串时不校验
- uni-id-co 修复 `updateUser` 接口部分参数为空时数据修改异常 - uni-id-co 修复 `updateUser` 接口部分参数为空时数据修改异常
......
...@@ -36,7 +36,7 @@ let mixin = { ...@@ -36,7 +36,7 @@ let mixin = {
}) })
} }
this.$nextTick(n => { this.$nextTick(n => {
console.log(this.$refs.uniFabLogin); // console.log(this.$refs.uniFabLogin);
this.$refs.uniFabLogin.login({ this.$refs.uniFabLogin.login({
code:e.code code:e.code
}, 'weixin') }, 'weixin')
......
...@@ -115,9 +115,10 @@ ...@@ -115,9 +115,10 @@
text-align: center; text-align: center;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
margin: 15px 0 0 0; margin: 15px 0 10px 0;
color: #FFF !important; color: #FFF !important;
border-radius: 5px; border-radius: 5px;
font-size: 16px;
} }
.uni-body.uni_modules-uni-id-pages-pages-login-login-withoutpwd{ .uni-body.uni_modules-uni-id-pages-pages-login-login-withoutpwd{
......
...@@ -6,20 +6,20 @@ const db = uniCloud.database(); ...@@ -6,20 +6,20 @@ const db = uniCloud.database();
const usersTable = db.collection('uni-id-users') const usersTable = db.collection('uni-id-users')
let hostUserInfo = uni.getStorageSync('uni-id-pages-userInfo')||{} let hostUserInfo = uni.getStorageSync('uni-id-pages-userInfo')||{}
console.log( hostUserInfo); // console.log( hostUserInfo);
const data = { const data = {
userInfo: hostUserInfo, userInfo: hostUserInfo,
hasLogin: Object.keys(hostUserInfo).length != 0 hasLogin: Object.keys(hostUserInfo).length != 0
} }
console.log('data', data); // console.log('data', data);
// 定义 mutations, 修改属性 // 定义 mutations, 修改属性
export const mutations = { export const mutations = {
// data不为空,表示传递要更新的值(注意不是覆盖是合并),什么也不传时,直接查库获取更新 // data不为空,表示传递要更新的值(注意不是覆盖是合并),什么也不传时,直接查库获取更新
async updateUserInfo(data = false) { async updateUserInfo(data = false) {
if (data) { if (data) {
usersTable.where('_id==$env.uid').update(data).then(e => { usersTable.where('_id==$env.uid').update(data).then(e => {
console.log(e); // console.log(e);
if (e.result.updated) { if (e.result.updated) {
uni.showToast({ uni.showToast({
title: "更新成功", title: "更新成功",
...@@ -41,7 +41,7 @@ export const mutations = { ...@@ -41,7 +41,7 @@ export const mutations = {
let res = await usersTable.where("'_id' == $cloudEnv_uid") let res = await usersTable.where("'_id' == $cloudEnv_uid")
.field('mobile,nickname,username,email,avatar_file') .field('mobile,nickname,username,email,avatar_file')
.get() .get()
console.log('fromDbData',res.result.data); // console.log('fromDbData',res.result.data);
this.setUserInfo(res.result.data[0]) this.setUserInfo(res.result.data[0])
} catch (e) { } catch (e) {
this.setUserInfo({},{cover:true}) this.setUserInfo({},{cover:true})
...@@ -50,11 +50,11 @@ export const mutations = { ...@@ -50,11 +50,11 @@ export const mutations = {
} }
}, },
async setUserInfo(data, {cover}={cover:false}) { async setUserInfo(data, {cover}={cover:false}) {
console.log('set-userInfo', data); // console.log('set-userInfo', data);
let userInfo = cover?data:Object.assign(store.userInfo,data) let userInfo = cover?data:Object.assign(store.userInfo,data)
store.userInfo = Object.assign({},userInfo) store.userInfo = Object.assign({},userInfo)
store.hasLogin = Object.keys(store.userInfo).length != 0 store.hasLogin = Object.keys(store.userInfo).length != 0
console.log('store.userInfo', store.userInfo); // console.log('store.userInfo', store.userInfo);
uni.setStorage({ uni.setStorage({
key: "uni-id-pages-userInfo", key: "uni-id-pages-userInfo",
data:store.userInfo data:store.userInfo
...@@ -90,7 +90,7 @@ export const mutations = { ...@@ -90,7 +90,7 @@ export const mutations = {
} }
// #ifdef H5 // #ifdef H5
if (e.loginType == 'weixin') { if (e.loginType == 'weixin') {
console.log('window.history', window.history); // console.log('window.history', window.history);
return window.history.go(-3) return window.history.go(-3)
} }
// #endif // #endif
...@@ -110,10 +110,7 @@ export const mutations = { ...@@ -110,10 +110,7 @@ export const mutations = {
const { const {
showToast = true, toastText = '登录成功', autoBack = true, uniIdRedirectUrl = '', passwordConfirmed showToast = true, toastText = '登录成功', autoBack = true, uniIdRedirectUrl = '', passwordConfirmed
} = e } = e
console.log({ // console.log({toastText,autoBack});
toastText,
autoBack
});
if (showToast) { if (showToast) {
uni.showToast({ uni.showToast({
title: toastText, title: toastText,
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
async mounted() { async mounted() {
// #ifdef H5 // #ifdef H5
this.isPC = !['ios', 'android'].includes(uni.getSystemInfoSync().platform); this.isPC = !['ios', 'android'].includes(uni.getSystemInfoSync().platform);
console.log(' this.isPC', this.isPC, uni.getSystemInfoSync().platform); // console.log(' this.isPC', this.isPC, uni.getSystemInfoSync().platform);
// #endif // #endif
}, },
computed: { computed: {
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
mutations.updateUserInfo({avatar_file}) mutations.updateUserInfo({avatar_file})
}, },
uploadAvatarImg(res) { uploadAvatarImg(res) {
console.log(this.hasLogin); // console.log(this.hasLogin);
if(!this.hasLogin){ if(!this.hasLogin){
return uni.navigateTo({ return uni.navigateTo({
url:'/uni_modules/uni-id-pages/pages/login/login-withoutpwd' url:'/uni_modules/uni-id-pages/pages/login/login-withoutpwd'
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
count: 1, count: 1,
crop, crop,
success: async (res) => { success: async (res) => {
console.log(res); // console.log(res);
let tempFile = res.tempFiles[0], let tempFile = res.tempFiles[0],
avatar_file = { avatar_file = {
// #ifdef H5 // #ifdef H5
...@@ -109,13 +109,13 @@ ...@@ -109,13 +109,13 @@
} }
}, },
complete(e) { complete(e) {
console.log(e); // console.log(e);
} }
}); });
}) })
} }
// #endif // #endif
console.log(this.userInfo); // console.log(this.userInfo);
let cloudPath = this.userInfo._id + '' + Date.now() let cloudPath = this.userInfo._id + '' + Date.now()
avatar_file.name = cloudPath avatar_file.name = cloudPath
uni.showLoading({ uni.showLoading({
...@@ -131,9 +131,7 @@ ...@@ -131,9 +131,7 @@
}); });
// console.log(result) // console.log(result)
avatar_file.url = fileID avatar_file.url = fileID
console.log({ // console.log({avatar_file});
avatar_file
});
uni.hideLoading() uni.hideLoading()
this.setAvatarFile(avatar_file) this.setAvatarFile(avatar_file)
} }
......
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
uni.showLoading({ mask: true }) uni.showLoading({ mask: true })
wx.checkSession({ wx.checkSession({
success() { success() {
console.log('session_key 未过期'); // console.log('session_key 未过期');
resolve() resolve()
uni.hideLoading() uni.hideLoading()
}, },
fail() { fail() {
console.log('session_key 已经失效,正在执行更新'); // console.log('session_key 已经失效,正在执行更新');
wx.login({ wx.login({
success({ success({
code code
...@@ -41,13 +41,13 @@ ...@@ -41,13 +41,13 @@
uniCloud.importObject("uni-id-co",{ uniCloud.importObject("uni-id-co",{
customUI:true customUI:true
}).loginByWeixin({code}).then(e=>{ }).loginByWeixin({code}).then(e=>{
console.log(e); // console.log(e);
resolve() resolve()
}).catch(e=>{ }).catch(e=>{
console.log(e); console.log(e);
reject() reject()
}).finally(e=>{ }).finally(e=>{
console.log(e); // console.log(e);
uni.hideLoading() uni.hideLoading()
}) })
}, },
...@@ -61,13 +61,13 @@ ...@@ -61,13 +61,13 @@
}) })
}, },
async bindMobileByMpWeixin(e) { async bindMobileByMpWeixin(e) {
console.log(e); // console.log(e);
if (e.detail.errMsg == "getPhoneNumber:ok") { if (e.detail.errMsg == "getPhoneNumber:ok") {
console.log(e.detail); // console.log(e.detail);
//检查登录信息是否过期,否则通过重新登录刷新session_key //检查登录信息是否过期,否则通过重新登录刷新session_key
await this.beforeGetphonenumber() await this.beforeGetphonenumber()
uniIdCo.bindMobileByMpWeixin(e.detail).then(e => { uniIdCo.bindMobileByMpWeixin(e.detail).then(e => {
console.log(e); // console.log(e);
this.$emit('success') this.$emit('success')
}).finally(e => { }).finally(e => {
this.closeMe() this.closeMe()
......
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
const uniIdCo = uniCloud.importObject("uni-id-co", { const uniIdCo = uniCloud.importObject("uni-id-co", {
customUI: true customUI: true
}) })
console.log('uniIdCo', uniIdCo) // console.log('uniIdCo', uniIdCo)
console.log('sendEmailCode',{ console.log('sendEmailCode',{
"email": this.email, "email": this.email,
"scene": this.type, "scene": this.type,
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
"scene": this.type, "scene": this.type,
"captcha": this.captcha "captcha": this.captcha
}).then(result => { }).then(result => {
console.log(result.code); // console.log(result.code);
uni.showToast({ uni.showToast({
title: "邮箱验证码发送成功", title: "邮箱验证码发送成功",
icon: 'none', icon: 'none',
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
this.reverseNumber = Number(this.count); this.reverseNumber = Number(this.count);
this.getCode(); this.getCode();
}).catch(e => { }).catch(e => {
console.log(JSON.stringify(e)); // console.log(JSON.stringify(e));
if (e.code == "uni-id-invalid-mail-template") { if (e.code == "uni-id-invalid-mail-template") {
this.modelValue = "123456" this.modelValue = "123456"
uni.showToast({ uni.showToast({
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
return this.getParentComponent().agree return this.getParentComponent().agree
}, },
set(agree) { set(agree) {
console.log('setAgree', agree); // console.log('setAgree', agree);
return this.getParentComponent().agree = agree return this.getParentComponent().agree = agree
} }
} }
...@@ -294,15 +294,13 @@ ...@@ -294,15 +294,13 @@
} }
//判断是否需要弹出隐私协议授权框 //判断是否需要弹出隐私协议授权框
console.log(type, this.agree); // console.log(type, this.agree);
let needAgreements = (config?.agreements?.scope || []).includes('register') let needAgreements = (config?.agreements?.scope || []).includes('register')
console.log({ // console.log({needAgreements});
needAgreements
});
if (type != 'univerify' && needAgreements && !this.agree) { if (type != 'univerify' && needAgreements && !this.agree) {
let agreementsRef = this.getParentComponent().$refs.agreements let agreementsRef = this.getParentComponent().$refs.agreements
return agreementsRef.popup(() => { return agreementsRef.popup(() => {
console.log(type, navigateBack); // console.log(type, navigateBack);
this.login_before(type, navigateBack, options) this.login_before(type, navigateBack, options)
}) })
} }
...@@ -314,7 +312,7 @@ ...@@ -314,7 +312,7 @@
document.domain + document.domain +
(window.location.href.includes('#')?'/#':'') + (window.location.href.includes('#')?'/#':'') +
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin' '/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
console.log('redirectUrl----',redirectUrl); // console.log('redirectUrl----',redirectUrl);
let ua = window.navigator.userAgent.toLowerCase(); let ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger'){ if (ua.match(/MicroMessenger/i) == 'micromessenger'){
// console.log('在微信公众号内'); // console.log('在微信公众号内');
...@@ -340,7 +338,7 @@ ...@@ -340,7 +338,7 @@
if (type == 'univerify') { if (type == 'univerify') {
let univerifyManager = uni.getUniverifyManager() let univerifyManager = uni.getUniverifyManager()
let onButtonsClickFn = async res => { let onButtonsClickFn = async res => {
console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list); // console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
//同步一键登录弹出层隐私协议框是否打勾 //同步一键登录弹出层隐私协议框是否打勾
let agree = (await uni.getCheckBoxState())[1].state let agree = (await uni.getCheckBoxState())[1].state
//console.log('agree',agree); //console.log('agree',agree);
...@@ -381,7 +379,7 @@ ...@@ -381,7 +379,7 @@
return univerifyManager.login({ return univerifyManager.login({
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
success: res => { success: res => {
console.log('login success', res) // console.log('login success', res)
this.login(res.authResult, 'univerify') this.login(res.authResult, 'univerify')
}, },
fail(err) { fail(err) {
...@@ -392,7 +390,7 @@ ...@@ -392,7 +390,7 @@
}); });
}, },
complete: async e => { complete: async e => {
console.log(e); // console.log(e);
uni.hideLoading() uni.hideLoading()
//同步一键登录弹出层隐私协议框是否打勾 //同步一键登录弹出层隐私协议框是否打勾
this.agree = (await uni.getCheckBoxState())[1].state this.agree = (await uni.getCheckBoxState())[1].state
...@@ -415,7 +413,7 @@ ...@@ -415,7 +413,7 @@
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
// #endif // #endif
success: async e => { success: async e => {
console.log(e); // console.log(e);
if (type == 'apple') { if (type == 'apple') {
let res = await this.getUserInfo({ let res = await this.getUserInfo({
provider: "apple" provider: "apple"
...@@ -434,18 +432,15 @@ ...@@ -434,18 +432,15 @@
}) })
}, },
login(params, type) { //联网验证登录 login(params, type) { //联网验证登录
console.log('执行登录开始----'); // console.log('执行登录开始----');
console.log({ console.log({params,type});
params,
type
});
//toLowerCase //toLowerCase
let action = 'loginBy' + type.trim().replace(type[0], type[0].toUpperCase()) let action = 'loginBy' + type.trim().replace(type[0], type[0].toUpperCase())
const uniIdCo = uniCloud.importObject("uni-id-co",{ const uniIdCo = uniCloud.importObject("uni-id-co",{
customUI:true customUI:true
}) })
uniIdCo[action](params).then(result => { uniIdCo[action](params).then(result => {
console.log("login-result", result); // console.log("login-result", result);
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',
icon: 'none', icon: 'none',
...@@ -468,7 +463,7 @@ ...@@ -468,7 +463,7 @@
mutations.loginSuccess(result) mutations.loginSuccess(result)
}) })
.catch(e=>{ .catch(e=>{
console.log(e); // console.log(e);
uni.showModal({ uni.showModal({
content: e.message, content: e.message,
confirmText:"知道了", confirmText:"知道了",
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
"scene": this.type, "scene": this.type,
"captcha": this.captcha "captcha": this.captcha
}).then(result => { }).then(result => {
console.log(result.code); // console.log(result.code);
uni.showToast({ uni.showToast({
title: "短信验证码发送成功", title: "短信验证码发送成功",
icon: 'none', icon: 'none',
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
this.reverseNumber = Number(this.count); this.reverseNumber = Number(this.count);
this.getCode(); this.getCode();
}).catch(e => { }).catch(e => {
console.log(JSON.stringify(e)); // console.log(JSON.stringify(e));
if (e.code == "uni-id-invalid-sms-template-id") { if (e.code == "uni-id-invalid-sms-template-id") {
this.modelValue = "123456" this.modelValue = "123456"
uni.showToast({ uni.showToast({
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
uni.getUserProfile({ uni.getUserProfile({
desc: "用于设置账户昵称和头像", desc: "用于设置账户昵称和头像",
complete: (e) => { complete: (e) => {
console.log("getUserProfile:", e); // console.log("getUserProfile:", e);
callBack(e) callBack(e)
} }
}) })
......
...@@ -5,7 +5,7 @@ export default { ...@@ -5,7 +5,7 @@ export default {
登录类型 未列举到的或运行环境不支持的,将被自动隐藏。 登录类型 未列举到的或运行环境不支持的,将被自动隐藏。
如果需要在不同平台有不同的配置,直接用条件编译即可 如果需要在不同平台有不同的配置,直接用条件编译即可
*/ */
"isAdmin": false, // 区分管理端与用户端 "isAdmin": true, // 区分管理端与用户端
"loginTypes": [ "loginTypes": [
// "qq", // "qq",
// "xiaomi", // "xiaomi",
......
...@@ -50,7 +50,7 @@ export default async function() { ...@@ -50,7 +50,7 @@ export default async function() {
uni.preLogin({ uni.preLogin({
provider: 'univerify', provider: 'univerify',
complete: e => { complete: e => {
console.log(e); // console.log(e);
} }
}) })
} }
...@@ -65,10 +65,7 @@ export default async function() { ...@@ -65,10 +65,7 @@ export default async function() {
code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue
message message
}) { }) {
console.error('onDBError', { // console.error('onDBError', {code,message});
code,
message
});
} }
// 解绑clientDB错误事件 // 解绑clientDB错误事件
//db.off('error', onDBError) //db.off('error', onDBError)
...@@ -77,17 +74,17 @@ export default async function() { ...@@ -77,17 +74,17 @@ export default async function() {
//4. 同步客户端push_clientid至device表 //4. 同步客户端push_clientid至device表
if (uniCloud.onRefreshToken) { if (uniCloud.onRefreshToken) {
uniCloud.onRefreshToken(() => { uniCloud.onRefreshToken(() => {
console.log('onRefreshToken'); // console.log('onRefreshToken');
if (uni.getPushClientId) { if (uni.getPushClientId) {
uni.getPushClientId({ uni.getPushClientId({
success: async function(e) { success: async function(e) {
console.log(e) // console.log(e)
let pushClientId = e.cid let pushClientId = e.cid
console.log(pushClientId); // console.log(pushClientId);
let res = await uniIdCo.setPushCid({ let res = await uniIdCo.setPushCid({
pushClientId pushClientId
}) })
console.log('getPushClientId', res); // console.log('getPushClientId', res);
}, },
fail(e) { fail(e) {
console.log(e) console.log(e)
......
{ {
"id": "uni-id-pages", "id": "uni-id-pages",
"displayName": "uni-id-pages", "displayName": "uni-id-pages",
"version": "1.0.36", "version": "1.0.37",
"description": "云端一体简单、统一、可扩展的用户中心页面模版", "description": "云端一体简单、统一、可扩展的用户中心页面模版",
"keywords": [ "keywords": [
"用户管理", "用户管理",
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
}); });
title = "页面路径错误" title = "页面路径错误"
}else{ }else{
console.log(url,title); // console.log(url,title);
this.url = url; this.url = url;
} }
if(title){ if(title){
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
this.phone = phoneNumber; this.phone = phoneNumber;
}, },
onShow() { onShow() {
console.log('onShow'); // console.log('onShow');
// #ifdef H5 // #ifdef H5
document.onkeydown = event => { document.onkeydown = event => {
var e = event || window.event; var e = event || window.event;
...@@ -68,14 +68,14 @@ ...@@ -68,14 +68,14 @@
"code": this.code, "code": this.code,
"captcha": this.captcha "captcha": this.captcha
}).then(e => { }).then(e => {
console.log(e); // console.log(e);
this.loginSuccess(e) this.loginSuccess(e)
}).catch(e => { }).catch(e => {
if (e.errCode == 'uni-id-captcha-required') { if (e.errCode == 'uni-id-captcha-required') {
this.$refs.popup.open() this.$refs.popup.open()
} else { } else {
console.log(e.errMsg); console.log(e.errMsg);
console.log(e.errCode); // console.log(e.errCode);
} }
}).finally(e => { }).finally(e => {
this.captcha = '' this.captcha = ''
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<text class="tip">将根据第三方账号服务平台的授权范围获取你的信息</text> <text class="tip">将根据第三方账号服务平台的授权范围获取你的信息</text>
<view class="quickLogin"> <view class="quickLogin">
<image v-if="type !== 'weixinMobile'" @click="quickLogin" :src="imgSrc" mode="widthFix" class="quickLoginBtn"></image> <image v-if="type !== 'weixinMobile'" @click="quickLogin" :src="imgSrc" mode="widthFix" class="quickLoginBtn"></image>
<button v-else type="primary" open-type="getPhoneNumber" @getphonenumber="quickLogin">微信授权手机号登录</button> <button v-else type="primary" open-type="getPhoneNumber" @getphonenumber="quickLogin" class="uni-btn">微信授权手机号登录</button>
<uni-id-pages-agreements scope="register" ref="agreements"></uni-id-pages-agreements> <uni-id-pages-agreements scope="register" ref="agreements"></uni-id-pages-agreements>
</view> </view>
</template> </template>
<template v-else> <template v-else>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
} }
}, },
async onLoad(e) { async onLoad(e) {
console.log(e); // console.log(e);
//获取通过url传递的参数type设置当前登录方式,如果没传递直接默认以配置的登录 //获取通过url传递的参数type设置当前登录方式,如果没传递直接默认以配置的登录
let type = e.type || config.loginTypes[0] let type = e.type || config.loginTypes[0]
this.type = type this.type = type
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
this.$refs.uniFabLogin.login_before(this.type, true, options) this.$refs.uniFabLogin.login_before(this.type, true, options)
}, },
toSmsPage() { toSmsPage() {
console.log('toSmsPage',this.agree); // console.log('toSmsPage',this.agree);
if (!this.isPhone) { if (!this.isPhone) {
this.focusPhone = true this.focusPhone = true
return uni.showToast({ return uni.showToast({
...@@ -147,7 +147,13 @@ ...@@ -147,7 +147,13 @@
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/uni_modules/uni-id-pages/common/login-page.scss"; @import "@/uni_modules/uni-id-pages/common/login-page.scss";
@media screen and (min-width: 690px) {
.uni-content{
height: 350px;
}
}
.uni-content, .uni-content,
.quickLogin { .quickLogin {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
......
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
@media screen and (min-width: 690px) { @media screen and (min-width: 690px) {
.uni-content { .uni-content {
max-height: 650px; height: 600px;
} }
} }
......
...@@ -102,18 +102,18 @@ ...@@ -102,18 +102,18 @@
}).catch((errors) => { }).catch((errors) => {
let key = errors[0].key let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase()) key = key.replace(key[0], key[0].toUpperCase())
console.log(key); // console.log(key);
this['focus'+key] = true this['focus'+key] = true
}) })
}, },
submitForm(params) { submitForm(params) {
uniIdCo.registerAdmin(this.formData).then(e => { uniIdCo.registerAdmin(this.formData).then(e => {
console.log(e); // console.log(e);
uni.navigateBack() uni.navigateBack()
}) })
.catch(e => { .catch(e => {
console.log(e); // console.log(e);
console.log(e.message); // console.log(e.message);
//更好的体验:登录错误,直接刷新验证码 //更好的体验:登录错误,直接刷新验证码
this.$refs.captcha.getImageCaptcha() this.$refs.captcha.getImageCaptcha()
uni.showModal({ uni.showModal({
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
@media screen and (min-width: 690px) { @media screen and (min-width: 690px) {
.uni-content{ .uni-content{
padding: 30px 40px 60px; padding: 30px 40px 60px;
max-height: 520px;
} }
.link-box { .link-box {
......
...@@ -144,22 +144,22 @@ ...@@ -144,22 +144,22 @@
}).catch((errors) => { }).catch((errors) => {
let key = errors[0].key let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase()) key = key.replace(key[0], key[0].toUpperCase())
console.log(key); // console.log(key);
this['focus'+key] = true this['focus'+key] = true
}) })
}, },
submitForm(params) { submitForm(params) {
uniIdCo.registerUserByEmail(this.formData).then(e => { uniIdCo.registerUserByEmail(this.formData).then(e => {
console.log(e); // console.log(e);
uni.navigateTo({ uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/login/login-withpwd', url: '/uni_modules/uni-id-pages/pages/login/login-withpwd',
complete: (e) => { complete: (e) => {
console.log(e); // console.log(e);
} }
}) })
}) })
.catch(e => { .catch(e => {
console.log(e); // console.log(e);
console.log(e.message); console.log(e.message);
}) })
}, },
......
...@@ -109,17 +109,17 @@ ...@@ -109,17 +109,17 @@
}).catch((errors) => { }).catch((errors) => {
let key = errors[0].key let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase()) key = key.replace(key[0], key[0].toUpperCase())
console.log(key); // console.log(key);
this['focus' + key] = true this['focus' + key] = true
}) })
}, },
submitForm(params) { submitForm(params) {
uniIdCo.registerUser(this.formData).then(e => { uniIdCo.registerUser(this.formData).then(e => {
console.log(e); // console.log(e);
this.loginSuccess(e) this.loginSuccess(e)
}) })
.catch(e => { .catch(e => {
console.log(e); // console.log(e);
console.log(e.message); console.log(e.message);
//更好的体验:登录错误,直接刷新验证码 //更好的体验:登录错误,直接刷新验证码
this.$refs.captcha.getImageCaptcha() this.$refs.captcha.getImageCaptcha()
......
...@@ -137,8 +137,8 @@ ...@@ -137,8 +137,8 @@
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
console.log("formData", this.formData); // console.log("formData", this.formData);
console.log('rules', this.rules); // console.log('rules', this.rules);
this.$refs.form.validate() this.$refs.form.validate()
.then(res => { .then(res => {
let { let {
...@@ -153,11 +153,11 @@ ...@@ -153,11 +153,11 @@
password, password,
captcha captcha
}).then(e => { }).then(e => {
console.log(e); // console.log(e);
uni.navigateTo({ uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/login/login-withpwd', url: '/uni_modules/uni-id-pages/pages/login/login-withpwd',
complete: (e) => { complete: (e) => {
console.log(e); // console.log(e);
} }
}) })
}) })
...@@ -171,11 +171,11 @@ ...@@ -171,11 +171,11 @@
}).catch(errors=>{ }).catch(errors=>{
let key = errors[0].key let key = errors[0].key
if(key == 'code'){ if(key == 'code'){
console.log(this.$refs.shortCode); // console.log(this.$refs.shortCode);
return this.$refs.shortCode.focusSmsCodeInput = true return this.$refs.shortCode.focusSmsCodeInput = true
} }
key = key.replace(key[0], key[0].toUpperCase()) key = key.replace(key[0], key[0].toUpperCase())
console.log(key,'focus'+key); // console.log(key,'focus'+key);
this['focus'+key] = true this['focus'+key] = true
}) })
}, },
...@@ -184,11 +184,11 @@ ...@@ -184,11 +184,11 @@
url: '/uni_modules/uni-id-pages/pages/retrieve/retrieve' url: '/uni_modules/uni-id-pages/pages/retrieve/retrieve'
}) })
}, },
backLogin () { backLogin () {
uni.redirectTo({ uni.redirectTo({
url: '/uni_modules/uni-id-pages/pages/login/login-withpwd' url: '/uni_modules/uni-id-pages/pages/login/login-withpwd'
}) })
} }
} }
} }
</script> </script>
......
...@@ -166,8 +166,8 @@ ...@@ -166,8 +166,8 @@
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
console.log("formData", this.formData); // console.log("formData", this.formData);
console.log('rules', this.rules); // console.log('rules', this.rules);
this.$refs.form.validate() this.$refs.form.validate()
.then(res => { .then(res => {
let { let {
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
password, password,
captcha captcha
}).then(e => { }).then(e => {
console.log(e); // console.log(e);
uni.navigateBack() uni.navigateBack()
}) })
.catch(e => { .catch(e => {
...@@ -195,11 +195,11 @@ ...@@ -195,11 +195,11 @@
}).catch(errors=>{ }).catch(errors=>{
let key = errors[0].key let key = errors[0].key
if(key == 'code'){ if(key == 'code'){
console.log(this.$refs.shortCode); // console.log(this.$refs.shortCode);
return this.$refs.shortCode.focusSmsCodeInput = true return this.$refs.shortCode.focusSmsCodeInput = true
} }
key = key.replace(key[0], key[0].toUpperCase()) key = key.replace(key[0], key[0].toUpperCase())
console.log(key,'focus'+key); // console.log(key,'focus'+key);
this['focus'+key] = true this['focus'+key] = true
}) })
}, },
......
...@@ -65,10 +65,10 @@ ...@@ -65,10 +65,10 @@
}); });
} }
console.log(this.formData); // console.log(this.formData);
const uniIdCo = uniCloud.importObject("uni-id-co") const uniIdCo = uniCloud.importObject("uni-id-co")
uniIdCo.bindMobileBySms(this.formData).then(e => { uniIdCo.bindMobileBySms(this.formData).then(e => {
console.log(e); // console.log(e);
uni.showToast({ uni.showToast({
title: e.errMsg, title: e.errMsg,
icon: 'none', icon: 'none',
......
...@@ -82,8 +82,8 @@ ...@@ -82,8 +82,8 @@
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
console.log("formData", this.formData); // console.log("formData", this.formData);
console.log('rules', this.rules); // console.log('rules', this.rules);
this.$refs.form.validate() this.$refs.form.validate()
.then(res => { .then(res => {
let { let {
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
oldPassword, oldPassword,
newPassword newPassword
}).then(e => { }).then(e => {
console.log(e); // console.log(e);
uni.removeStorageSync('uni_id_token'); uni.removeStorageSync('uni_id_token');
uni.setStorageSync('uni_id_token_expired', 0) uni.setStorageSync('uni_id_token_expired', 0)
uni.redirectTo({ uni.redirectTo({
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
}).catch(errors => { }).catch(errors => {
let key = errors[0].key let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase()) key = key.replace(key[0], key[0].toUpperCase())
console.log(key, 'focus' + key); // console.log(key, 'focus' + key);
this['focus' + key] = true this['focus' + key] = true
}) })
} }
......
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
data() {return {path: '',options:{"width":600,"height":600}}}, data() {return {path: '',options:{"width":600,"height":600}}},
onLoad({path,options}) { onLoad({path,options}) {
this.path = path this.path = path
console.log('path-path-path-path',path); // console.log('path-path-path-path',path);
if(options){ if(options){
this.options = JSON.parse(options) this.options = JSON.parse(options)
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
const uniIdco = uniCloud.importObject("uni-id-co"); const uniIdco = uniCloud.importObject("uni-id-co");
uniIdco.closeAccount().then((e) => { uniIdco.closeAccount().then((e) => {
console.log(e); // console.log(e);
uni.showToast({ uni.showToast({
title: '注销成功', title: '注销成功',
duration: 3000 duration: 3000
......
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
this.$refs.popup.open() this.$refs.popup.open()
} else { } else {
console.log(e.errMsg); console.log(e.errMsg);
console.log(e.errCode); // console.log(e.errCode);
} }
}).finally(e => { }).finally(e => {
this.formData.captcha = '' this.formData.captcha = ''
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
uni.navigateTo({ uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/login/login-withoutpwd', url: '/uni_modules/uni-id-pages/pages/login/login-withoutpwd',
complete: (e) => { complete: (e) => {
console.log(e); // console.log(e);
} }
}) })
}, },
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
uni.navigateTo({ uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd', url: '/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd',
complete: (e) => { complete: (e) => {
console.log(e); // console.log(e);
} }
}) })
}, },
...@@ -123,14 +123,14 @@ ...@@ -123,14 +123,14 @@
"provider": 'univerify', "provider": 'univerify',
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
success: async e => { success: async e => {
console.log(e.authResult); // console.log(e.authResult);
uniIdCo.bindMobileByUniverify(e.authResult).then(res => { uniIdCo.bindMobileByUniverify(e.authResult).then(res => {
console.log(res); // console.log(res);
mutations.updateUserInfo() mutations.updateUserInfo()
}).catch(e => { }).catch(e => {
console.log(e); console.log(e);
}).finally(e=>{ }).finally(e=>{
console.log(e); // console.log(e);
uni.closeAuthView() uni.closeAuthView()
}) })
}, },
...@@ -143,60 +143,57 @@ ...@@ -143,60 +143,57 @@
}) })
}, },
bindMobileBySmsCode() { bindMobileBySmsCode() {
uni.navigateTo({ uni.navigateTo({
url: './bind-mobile/bind-mobile' url: './bind-mobile/bind-mobile'
}) })
}, },
setNickname(nickname) { setNickname(nickname) {
console.log(nickname); // console.log(nickname);
if (nickname) { if (nickname) {
mutations.updateUserInfo({nickname}) mutations.updateUserInfo({nickname})
this.$refs.dialog.close() this.$refs.dialog.close()
} else { } else {
this.$refs.dialog.open() this.$refs.dialog.open()
} }
}, },
deactivate(){ deactivate(){
uni.navigateTo({ uni.navigateTo({
url:"/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate" url:"/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate"
}) })
}, },
async bindThirdAccount(provider) { async bindThirdAccount(provider) {
const uniIdCo = uniCloud.importObject("uni-id-co") const uniIdCo = uniCloud.importObject("uni-id-co")
const bindField = { const bindField = {
weixin: 'wx_openid', weixin: 'wx_openid',
alipay: 'ali_openid', alipay: 'ali_openid',
apple: 'apple_openid', apple: 'apple_openid',
qq: 'qq_openid' qq: 'qq_openid'
}[provider.toLowerCase()] }[provider.toLowerCase()]
if (this.userInfo[bindField]) {
await uniIdCo['unbind' + provider]()
await mutations.updateUserInfo()
} else {
uni.login({
provider: provider.toLowerCase(),
onlyAuthorize: true,
success: async e => {
const res = await uniIdCo['bind' + provider]({
code: e.code
})
if (res.errCode) {
uni.showToast({
title: res.errMsg || '绑定失败',
duration: 3000
})
}
await mutations.updateUserInfo()
},
fail: async (err) => {
console.log(err);
uni.hideLoading()
}
})
}
} if (this.userInfo[bindField]) {
await uniIdCo['unbind' + provider]()
await mutations.updateUserInfo()
} else {
uni.login({
provider: provider.toLowerCase(),
onlyAuthorize: true,
success: async e => {
const res = await uniIdCo['bind' + provider]({code: e.code})
if (res.errCode) {
uni.showToast({
title: res.errMsg || '绑定失败',
duration: 3000
})
}
await mutations.updateUserInfo()
},
fail: async (err) => {
console.log(err);
uni.hideLoading()
}
})
}
}
} }
} }
</script> </script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册