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

优化体积/小程序端用wx.cropImage裁切头像

上级 b3519382
<template> <template>
<view @click="onClick" :style="{width,height}"> <view @click="onClick" :style="{width,height}" style="justify-content: center;">
<image v-if="cSrc" :style="{width,height}" :src="cSrc" :mode="mode"></image> <image v-if="cSrc" :style="{width,height}" :src="cSrc" :mode="mode"></image>
</view> </view>
</template> </template>
...@@ -46,13 +46,10 @@ ...@@ -46,13 +46,10 @@
watch: { watch: {
src:{ src:{
handler(src) { handler(src) {
// console.log(src);
// console.log(src.substring(0, 8));
if (src&&src.substring(0, 8) == "cloud://") { if (src&&src.substring(0, 8) == "cloud://") {
uniCloud.getTempFileURL({ uniCloud.getTempFileURL({
fileList: [src] fileList: [src]
}).then(res=>{ }).then(res=>{
// console.log(res);
this.cSrc = res.fileList[0].tempFileURL this.cSrc = res.fileList[0].tempFileURL
}) })
}else{ }else{
...@@ -61,9 +58,6 @@ ...@@ -61,9 +58,6 @@
}, },
immediate: true immediate: true
} }
},
async mounted() {
}, },
methods:{ methods:{
onClick(){ onClick(){
......
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
}, },
methods: { methods: {
popupConfirm(){ popupConfirm(){
// console.log("popupConfirm");
this.isAgree = true this.isAgree = true
retryFun() retryFun()
// this.$emit('popupConfirm') // this.$emit('popupConfirm')
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
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);
// #endif // #endif
}, },
computed: { computed: {
...@@ -68,7 +67,6 @@ ...@@ -68,7 +67,6 @@
mutations.updateUserInfo({avatar_file}) mutations.updateUserInfo({avatar_file})
}, },
uploadAvatarImg(res) { uploadAvatarImg(res) {
// 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 +82,6 @@ ...@@ -84,7 +82,6 @@
count: 1, count: 1,
crop, crop,
success: async (res) => { success: async (res) => {
// console.log(res);
let tempFile = res.tempFiles[0], let tempFile = res.tempFiles[0],
avatar_file = { avatar_file = {
// #ifdef H5 // #ifdef H5
...@@ -95,10 +92,12 @@ ...@@ -95,10 +92,12 @@
// #endif // #endif
}, },
filePath = res.tempFilePaths[0] filePath = res.tempFilePaths[0]
//非app端剪裁头像,app端用内置的原生裁剪
// #ifndef APP-PLUS // #ifndef APP-PLUS
//非app端用前端组件剪裁头像,app端用内置的原生裁剪
if (!this.isPC) {
filePath = await new Promise((callback) => { filePath = await new Promise((callback) => {
// #ifdef H5
if (!this.isPC) {
uni.navigateTo({ uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage?path=' + url: '/uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage?path=' +
filePath + `&options=${JSON.stringify(crop)}`, filePath + `&options=${JSON.stringify(crop)}`,
...@@ -112,10 +111,25 @@ ...@@ -112,10 +111,25 @@
// console.log(e); // console.log(e);
} }
}); });
})
} }
// #endif // #endif
// console.log(this.userInfo);
// #ifdef MP-WEIXIN
wx.cropImage({
src:filePath,
cropScale:"1:1",
success: res => {
callback(res.tempFilePath)
},
fail(e){
console.error(e)
callback(filePath)
}
})
// #endif
})
// #endif
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({
...@@ -129,9 +143,7 @@ ...@@ -129,9 +143,7 @@
cloudPath, cloudPath,
fileType: "image" fileType: "image"
}); });
// console.log(result)
avatar_file.url = fileID avatar_file.url = fileID
// console.log({avatar_file});
uni.hideLoading() uni.hideLoading()
this.setAvatarFile(avatar_file) this.setAvatarFile(avatar_file)
} }
......
...@@ -41,13 +41,11 @@ ...@@ -41,13 +41,11 @@
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);
resolve() resolve()
}).catch(e=>{ }).catch(e=>{
console.log(e); console.log(e);
reject() reject()
}).finally(e=>{ }).finally(e=>{
// console.log(e);
uni.hideLoading() uni.hideLoading()
}) })
}, },
...@@ -61,13 +59,10 @@ ...@@ -61,13 +59,10 @@
}) })
}, },
async bindMobileByMpWeixin(e) { async bindMobileByMpWeixin(e) {
// console.log(e);
if (e.detail.errMsg == "getPhoneNumber:ok") { if (e.detail.errMsg == "getPhoneNumber:ok") {
// 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);
this.$emit('success') this.$emit('success')
}).finally(e => { }).finally(e => {
this.closeMe() this.closeMe()
...@@ -157,8 +152,8 @@ ...@@ -157,8 +152,8 @@
.agree::after { .agree::after {
border: none; border: none;
} }
/* #endif */ /* #endif */
.agree:active { .agree:active {
background-color: #F5F5F6; background-color: #F5F5F6;
} }
......
...@@ -141,7 +141,6 @@ ...@@ -141,7 +141,6 @@
const uniIdCo = uniCloud.importObject("uni-id-co", { const uniIdCo = uniCloud.importObject("uni-id-co", {
customUI: true customUI: true
}) })
// console.log('uniIdCo', uniIdCo)
console.log('sendEmailCode',{ console.log('sendEmailCode',{
"email": this.email, "email": this.email,
"scene": this.type, "scene": this.type,
...@@ -152,7 +151,6 @@ ...@@ -152,7 +151,6 @@
"scene": this.type, "scene": this.type,
"captcha": this.captcha "captcha": this.captcha
}).then(result => { }).then(result => {
// console.log(result.code);
uni.showToast({ uni.showToast({
title: "邮箱验证码发送成功", title: "邮箱验证码发送成功",
icon: 'none', icon: 'none',
...@@ -161,7 +159,6 @@ ...@@ -161,7 +159,6 @@
this.reverseNumber = Number(this.count); this.reverseNumber = Number(this.count);
this.getCode(); this.getCode();
}).catch(e => { }).catch(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({
......
...@@ -15,13 +15,7 @@ ...@@ -15,13 +15,7 @@
<script> <script>
import config from '@/uni_modules/uni-id-pages/config.js' import config from '@/uni_modules/uni-id-pages/config.js'
//前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回 //前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回
import { import {store,mutations} from '@/uni_modules/uni-id-pages/common/store.js'
store,
mutations
} from '@/uni_modules/uni-id-pages/common/store.js'
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
let allServicesList = [] let allServicesList = []
export default { export default {
...@@ -49,7 +43,6 @@ ...@@ -49,7 +43,6 @@
return this.getParentComponent().agree return this.getParentComponent().agree
}, },
set(agree) { set(agree) {
// console.log('setAgree', agree);
return this.getParentComponent().agree = agree return this.getParentComponent().agree = agree
} }
} }
...@@ -59,64 +52,64 @@ ...@@ -59,64 +52,64 @@
servicesList: [{ servicesList: [{
"id": "username", "id": "username",
"text": "账号登录", "text": "账号登录",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/user.png", "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/user.png",
"path": "/uni_modules/uni-id-pages/pages/login/login-withpwd" "path": "/uni_modules/uni-id-pages/pages/login/login-withpwd"
}, },
{ {
"id": "smsCode", "id": "smsCode",
"text": "短信验证码", "text": "短信验证码",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/sms.png", "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/sms.png",
"path": "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=smsCode" "path": "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=smsCode"
}, },
{ {
"id": "weixin", "id": "weixin",
"text": "微信登录", "text": "微信登录",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/weixin.png", "logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png",
}, },
{ {
"id": "apple", "id": "apple",
"text": "苹果登录", "text": "苹果登录",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/apple.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/apple.png",
}, },
{ {
"id": "univerify", "id": "univerify",
"text": "一键登录", "text": "一键登录",
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/univerify.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/univerify.png",
}, },
{ {
"id": "taobao", "id": "taobao",
"text": "淘宝登录", //暂未提供该登录方式的接口示例 "text": "淘宝登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/taobao.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/taobao.png",
}, },
{ {
"id": "facebook", "id": "facebook",
"text": "脸书登录", //暂未提供该登录方式的接口示例 "text": "脸书登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/facebook.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/facebook.png",
}, },
{ {
"id": "alipay", "id": "alipay",
"text": "支付宝登录", //暂未提供该登录方式的接口示例 "text": "支付宝登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/alipay.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/alipay.png",
}, },
{ {
"id": "qq", "id": "qq",
"text": "QQ登录", //暂未提供该登录方式的接口示例 "text": "QQ登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/qq.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/qq.png",
}, },
{ {
"id": "google", "id": "google",
"text": "谷歌登录", //暂未提供该登录方式的接口示例 "text": "谷歌登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/google.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/google.png",
}, },
{ {
"id": "douyin", "id": "douyin",
"text": "抖音登录", //暂未提供该登录方式的接口示例 "text": "抖音登录", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/douyin.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/douyin.png",
}, },
{ {
"id": "sinaweibo", "id": "sinaweibo",
"text": "新浪微博", //暂未提供该登录方式的接口示例 "text": "新浪微博", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/uni-fab-login/sinaweibo.png", "logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/sinaweibo.png",
} }
], ],
univerifyStyle: { //一键登录弹出窗的样式配置参数 univerifyStyle: { //一键登录弹出窗的样式配置参数
...@@ -189,7 +182,6 @@ ...@@ -189,7 +182,6 @@
let path = item.path ? item.path.split('?')[0] : ''; let path = item.path ? item.path.split('?')[0] : '';
return path != this.getRoute(1) return path != this.getRoute(1)
}) })
//console.log('servicesList', servicesList, this.servicesList);
}, },
methods: { methods: {
getParentComponent(){ getParentComponent(){
...@@ -206,7 +198,6 @@ ...@@ -206,7 +198,6 @@
}, },
getRoute(n = 0) { getRoute(n = 0) {
let pages = getCurrentPages(); let pages = getCurrentPages();
// console.log('route-pages-length', pages.length);
if (n > pages.length) { if (n > pages.length) {
return '' return ''
} }
...@@ -222,7 +213,6 @@ ...@@ -222,7 +213,6 @@
} else if (this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启 } else if (this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启
uni.navigateBack(); uni.navigateBack();
} else if (this.getRoute(1) != path) { } else if (this.getRoute(1) != path) {
//console.log(3);
uni.navigateTo({ uni.navigateTo({
url: path, url: path,
animationType: 'slide-in-left', animationType: 'slide-in-left',
...@@ -294,13 +284,10 @@ ...@@ -294,13 +284,10 @@
} }
//判断是否需要弹出隐私协议授权框 //判断是否需要弹出隐私协议授权框
// console.log(type, this.agree);
let needAgreements = (config?.agreements?.scope || []).includes('register') let needAgreements = (config?.agreements?.scope || []).includes('register')
// console.log({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);
this.login_before(type, navigateBack, options) this.login_before(type, navigateBack, options)
}) })
} }
...@@ -312,7 +299,6 @@ ...@@ -312,7 +299,6 @@
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);
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('在微信公众号内');
...@@ -341,7 +327,6 @@ ...@@ -341,7 +327,6 @@
// 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);
this.agree = agree this.agree = agree
let { let {
path path
...@@ -353,11 +338,9 @@ ...@@ -353,11 +338,9 @@
if (agree) { if (agree) {
closeUniverify() closeUniverify()
setTimeout(() => { setTimeout(() => {
//console.log('login_before');
this.login_before(res.provider) this.login_before(res.provider)
}, 500) }, 500)
} else { } else {
//console.log("你未同意隐私政策协议");
uni.showToast({ uni.showToast({
title: "你未同意隐私政策协议", title: "你未同意隐私政策协议",
icon: 'none', icon: 'none',
...@@ -379,7 +362,6 @@ ...@@ -379,7 +362,6 @@
return univerifyManager.login({ return univerifyManager.login({
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
success: res => { success: res => {
// console.log('login success', res)
this.login(res.authResult, 'univerify') this.login(res.authResult, 'univerify')
}, },
fail(err) { fail(err) {
...@@ -390,7 +372,6 @@ ...@@ -390,7 +372,6 @@
}); });
}, },
complete: async e => { complete: async e => {
// console.log(e);
uni.hideLoading() uni.hideLoading()
//同步一键登录弹出层隐私协议框是否打勾 //同步一键登录弹出层隐私协议框是否打勾
this.agree = (await uni.getCheckBoxState())[1].state this.agree = (await uni.getCheckBoxState())[1].state
...@@ -413,7 +394,6 @@ ...@@ -413,7 +394,6 @@
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
// #endif // #endif
success: async e => { success: async e => {
// console.log(e);
if (type == 'apple') { if (type == 'apple') {
let res = await this.getUserInfo({ let res = await this.getUserInfo({
provider: "apple" provider: "apple"
...@@ -440,7 +420,6 @@ ...@@ -440,7 +420,6 @@
customUI:true customUI:true
}) })
uniIdCo[action](params).then(result => { uniIdCo[action](params).then(result => {
// console.log("login-result", result);
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',
icon: 'none', icon: 'none',
...@@ -463,7 +442,6 @@ ...@@ -463,7 +442,6 @@
mutations.loginSuccess(result) mutations.loginSuccess(result)
}) })
.catch(e=>{ .catch(e=>{
// console.log(e);
uni.showModal({ uni.showModal({
content: e.message, content: e.message,
confirmText:"知道了", confirmText:"知道了",
...@@ -513,7 +491,6 @@ ...@@ -513,7 +491,6 @@
box-sizing: border-box; box-sizing: border-box;
flex-direction: column; flex-direction: column;
} }
/* #endif */ /* #endif */
.fab-login-box { .fab-login-box {
...@@ -552,8 +529,6 @@ ...@@ -552,8 +529,6 @@
/* #endif */ /* #endif */
.logo { .logo {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
...@@ -563,7 +538,6 @@ ...@@ -563,7 +538,6 @@
border: solid 1px #F6F6F6; border: solid 1px #F6F6F6;
} }
.login-title { .login-title {
text-align: center; text-align: center;
margin-top: 6px; margin-top: 6px;
......
...@@ -146,7 +146,6 @@ ...@@ -146,7 +146,6 @@
"scene": this.type, "scene": this.type,
"captcha": this.captcha "captcha": this.captcha
}).then(result => { }).then(result => {
// console.log(result.code);
uni.showToast({ uni.showToast({
title: "短信验证码发送成功", title: "短信验证码发送成功",
icon: 'none', icon: 'none',
...@@ -155,7 +154,6 @@ ...@@ -155,7 +154,6 @@
this.reverseNumber = Number(this.count); this.reverseNumber = Number(this.count);
this.getCode(); this.getCode();
}).catch(e => { }).catch(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({
...@@ -209,7 +207,6 @@ ...@@ -209,7 +207,6 @@
/* #endif */ /* #endif */
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.inner-text { .inner-text {
......
...@@ -31,12 +31,10 @@ ...@@ -31,12 +31,10 @@
uni.getUserProfile({ uni.getUserProfile({
desc: "用于设置账户昵称和头像", desc: "用于设置账户昵称和头像",
complete: (e) => { complete: (e) => {
// console.log("getUserProfile:", e);
callBack(e) callBack(e)
} }
}) })
}) })
// console.log("userInfo", res.userInfo);
if(res.errMsg != "getUserProfile:ok"){ if(res.errMsg != "getUserProfile:ok"){
return this.closeMe() return this.closeMe()
} }
...@@ -62,13 +60,11 @@ ...@@ -62,13 +60,11 @@
}) })
const extName = tempFilePath.split('.').pop() || 'jpg' const extName = tempFilePath.split('.').pop() || 'jpg'
const cloudPath = 'user/avatar/'+ userId+'/'+Date.now()+'-avatar.'+extName; const cloudPath = 'user/avatar/'+ userId+'/'+Date.now()+'-avatar.'+extName;
// console.log(tempFilePath);
const result = await uniCloud.uploadFile({ const result = await uniCloud.uploadFile({
filePath: tempFilePath, filePath: tempFilePath,
cloudPath, cloudPath,
fileType:'image' fileType:'image'
}); });
// console.log("上传成功",{result});
let userInfo = { let userInfo = {
"nickname":nickName, "nickname":nickName,
"avatar_file":{ "avatar_file":{
...@@ -89,7 +85,6 @@ ...@@ -89,7 +85,6 @@
}) })
}, },
doUpdate(data,callback){ doUpdate(data,callback){
// console.log('dododo',data);
// 使用 clientDB 提交数据 // 使用 clientDB 提交数据
usersTable.where('_id==$env.uid').update(data).then((res) => { usersTable.where('_id==$env.uid').update(data).then((res) => {
callback(res) callback(res)
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
}); });
title = "页面路径错误" title = "页面路径错误"
}else{ }else{
// console.log(url,title);
this.url = url; this.url = url;
} }
if(title){ if(title){
...@@ -34,7 +33,3 @@ ...@@ -34,7 +33,3 @@
} }
} }
</script> </script>
<style lang="scss">
</style>
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
this.phone = phoneNumber; this.phone = phoneNumber;
}, },
onShow() { 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 +67,12 @@ ...@@ -68,14 +67,12 @@
"code": this.code, "code": this.code,
"captcha": this.captcha "captcha": this.captcha
}).then(e => { }).then(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);
} }
}).finally(e => { }).finally(e => {
this.captcha = '' this.captcha = ''
......
...@@ -52,14 +52,14 @@ ...@@ -52,14 +52,14 @@
return /^1\d{10}$/.test(this.phone); return /^1\d{10}$/.test(this.phone);
}, },
imgSrc() { //大快捷登录按钮图 imgSrc() { //大快捷登录按钮图
return '/uni_modules/uni-id-pages/static/login/' + this.type + '.png' return this.type == 'weixin'? '/uni_modules/uni-id-pages/static/login/weixin.png' : '/uni_modules/uni-id-pages/static/app-plus/apple.png'
} }
}, },
async onLoad(e) { async onLoad(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
// console.log("this.type: -----------",this.type);
if(type != 'univerify'){ if(type != 'univerify'){
this.focusPhone = true this.focusPhone = true
} }
...@@ -111,7 +111,6 @@ ...@@ -111,7 +111,6 @@
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);
if (!this.isPhone) { if (!this.isPhone) {
this.focusPhone = true this.focusPhone = true
return uni.showToast({ return uni.showToast({
...@@ -201,7 +200,6 @@ ...@@ -201,7 +200,6 @@
} }
.quickLogin { .quickLogin {
// width: 650rpx;
height: 350px; height: 350px;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
......
...@@ -108,12 +108,9 @@ ...@@ -108,12 +108,9 @@
}, },
submitForm(params) { submitForm(params) {
uniIdCo.registerAdmin(this.formData).then(e => { uniIdCo.registerAdmin(this.formData).then(e => {
// console.log(e);
uni.navigateBack() uni.navigateBack()
}) })
.catch(e => { .catch(e => {
// console.log(e);
// console.log(e.message);
//更好的体验:登录错误,直接刷新验证码 //更好的体验:登录错误,直接刷新验证码
this.$refs.captcha.getImageCaptcha() this.$refs.captcha.getImageCaptcha()
uni.showModal({ uni.showModal({
......
...@@ -109,17 +109,14 @@ ...@@ -109,17 +109,14 @@
}).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);
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);
this.loginSuccess(e) this.loginSuccess(e)
}) })
.catch(e => { .catch(e => {
// console.log(e);
console.log(e.message); console.log(e.message);
//更好的体验:登录错误,直接刷新验证码 //更好的体验:登录错误,直接刷新验证码
this.$refs.captcha.getImageCaptcha() this.$refs.captcha.getImageCaptcha()
......
...@@ -137,8 +137,6 @@ ...@@ -137,8 +137,6 @@
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
// console.log("formData", this.formData);
// console.log('rules', this.rules);
this.$refs.form.validate() this.$refs.form.validate()
.then(res => { .then(res => {
let { let {
...@@ -153,7 +151,6 @@ ...@@ -153,7 +151,6 @@
password, password,
captcha captcha
}).then(e => { }).then(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) => {
...@@ -171,11 +168,9 @@ ...@@ -171,11 +168,9 @@
}).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);
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);
this['focus'+key] = true this['focus'+key] = true
}) })
}, },
......
...@@ -166,8 +166,6 @@ ...@@ -166,8 +166,6 @@
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
// console.log("formData", this.formData);
// console.log('rules', this.rules);
this.$refs.form.validate() this.$refs.form.validate()
.then(res => { .then(res => {
let { let {
...@@ -182,7 +180,6 @@ ...@@ -182,7 +180,6 @@
password, password,
captcha captcha
}).then(e => { }).then(e => {
// console.log(e);
uni.navigateBack() uni.navigateBack()
}) })
.catch(e => { .catch(e => {
...@@ -195,11 +192,9 @@ ...@@ -195,11 +192,9 @@
}).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);
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);
this['focus'+key] = true this['focus'+key] = true
}) })
}, },
......
...@@ -65,10 +65,8 @@ ...@@ -65,10 +65,8 @@
}); });
} }
// 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);
uni.showToast({ uni.showToast({
title: e.errMsg, title: e.errMsg,
icon: 'none', icon: 'none',
......
...@@ -82,8 +82,6 @@ ...@@ -82,8 +82,6 @@
* 完成并提交 * 完成并提交
*/ */
submit() { submit() {
// console.log("formData", this.formData);
// console.log('rules', this.rules);
this.$refs.form.validate() this.$refs.form.validate()
.then(res => { .then(res => {
let { let {
...@@ -94,7 +92,6 @@ ...@@ -94,7 +92,6 @@
oldPassword, oldPassword,
newPassword newPassword
}).then(e => { }).then(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 +106,6 @@ ...@@ -109,7 +106,6 @@
}).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);
this['focus' + key] = true this['focus' + key] = true
}) })
} }
......
...@@ -39,11 +39,8 @@ ...@@ -39,11 +39,8 @@
content: '已经仔细阅读注销提示,知晓可能带来的后果,并确认要注销', content: '已经仔细阅读注销提示,知晓可能带来的后果,并确认要注销',
complete: (e) => { complete: (e) => {
if (e.confirm) { if (e.confirm) {
const db = uniCloud.database();
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);
uni.showToast({ uni.showToast({
title: '注销成功', title: '注销成功',
duration: 3000 duration: 3000
......
...@@ -115,7 +115,6 @@ export default { ...@@ -115,7 +115,6 @@ export default {
this.$refs.popup.open() this.$refs.popup.open()
} else { } else {
console.log(e.errMsg); console.log(e.errMsg);
// console.log(e.errCode);
} }
}).finally(e => { }).finally(e => {
this.formData.captcha = '' this.formData.captcha = ''
......
...@@ -14,9 +14,11 @@ ...@@ -14,9 +14,11 @@
<uni-list-item v-if="hasPwd" class="item" @click="changePassword" title="修改密码" link> <uni-list-item v-if="hasPwd" class="item" @click="changePassword" title="修改密码" link>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
<!-- #ifndef MP -->
<uni-list class="mt10"> <uni-list class="mt10">
<uni-list-item @click="deactivate" title="注销账号" link="navigateTo"></uni-list-item> <uni-list-item @click="deactivate" title="注销账号" link="navigateTo"></uni-list-item>
</uni-list> </uni-list>
<!-- #endif -->
<uni-popup ref="dialog" type="dialog"> <uni-popup ref="dialog" type="dialog">
<uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" title="设置昵称" <uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" title="设置昵称"
placeholder="请输入要设置的昵称"> placeholder="请输入要设置的昵称">
...@@ -30,8 +32,6 @@ ...@@ -30,8 +32,6 @@
</view> </view>
</template> </template>
<script> <script>
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
const uniIdCo = uniCloud.importObject("uni-id-co") const uniIdCo = uniCloud.importObject("uni-id-co")
import { import {
store, store,
...@@ -123,9 +123,7 @@ ...@@ -123,9 +123,7 @@
"provider": 'univerify', "provider": 'univerify',
"univerifyStyle": this.univerifyStyle, "univerifyStyle": this.univerifyStyle,
success: async e => { success: async e => {
// console.log(e.authResult);
uniIdCo.bindMobileByUniverify(e.authResult).then(res => { uniIdCo.bindMobileByUniverify(e.authResult).then(res => {
// console.log(res);
mutations.updateUserInfo() mutations.updateUserInfo()
}).catch(e => { }).catch(e => {
console.log(e); console.log(e);
...@@ -148,7 +146,6 @@ ...@@ -148,7 +146,6 @@
}) })
}, },
setNickname(nickname) { setNickname(nickname) {
// console.log(nickname);
if (nickname) { if (nickname) {
mutations.updateUserInfo({nickname}) mutations.updateUserInfo({nickname})
this.$refs.dialog.close() this.$refs.dialog.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册