Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦想橡皮擦
uni-starter
提交
19d91730
U
uni-starter
项目概览
梦想橡皮擦
/
uni-starter
与 Fork 源项目一致
Fork自
DCloud / uni-starter
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
19d91730
编写于
2月 06, 2023
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
2.1.1
上级
9b381cb0
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
358 addition
and
329 deletion
+358
-329
changelog.md
changelog.md
+3
-0
package.json
package.json
+1
-1
uni_modules/uni-id-pages/changelog.md
uni_modules/uni-id-pages/changelog.md
+2
-0
uni_modules/uni-id-pages/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
...es/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
+64
-25
uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue
...ponents/uni-id-pages-fab-login/uni-id-pages-fab-login.vue
+10
-34
uni_modules/uni-id-pages/package.json
uni_modules/uni-id-pages/package.json
+1
-1
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
+254
-246
uni_modules/uni-id-pages/uniCloud/database/uni-id-users.schema.json
...s/uni-id-pages/uniCloud/database/uni-id-users.schema.json
+2
-2
uni_modules/uni-popup/changelog.md
uni_modules/uni-popup/changelog.md
+2
-0
uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
...ni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
+18
-19
uni_modules/uni-popup/package.json
uni_modules/uni-popup/package.json
+1
-1
未找到文件。
changelog.md
浏览文件 @
19d91730
## 2.1.1(2023-02-02)
-
重要 分包加载uni-id-pages 优化后 运行时主包大小为:637KB 分包为:78KB,发布后主包大小为:585KB 分包为:75KB
-
新增 微信小程序端 支持选择使用微信资料的“头像”和“昵称” 设置用户资料
[
详情参考
](
https://wdoc-76491.picgzc.qpic.cn/MTY4ODg1MDUyNzQyMDUxNw_21263_rTNhg68FTngQGdvQ_1647431233?w=1280&h=695.7176470588236
)
## 2.1.0(2023-01-17)
-
重要 新增uni-admin需要的相关依赖和初始化数据(方便uni-admin关联uni-starter后可直接运行)
-
升级依赖的
[
uni-id-pages
](
https://ext.dcloud.net.cn/plugin?name=uni-id-pages
)
修复如下问题:
...
...
package.json
浏览文件 @
19d91730
{
"id"
:
"uni-starter"
,
"displayName"
:
"uni-starter"
,
"version"
:
"2.1.
0
"
,
"version"
:
"2.1.
1
"
,
"description"
:
"云端一体应用快速开发基本项目模版"
,
"keywords"
:
[
"login"
,
...
...
uni_modules/uni-id-pages/changelog.md
浏览文件 @
19d91730
## 1.1.1(2023-02-02)
-
新增 微信小程序端 支持选择使用微信资料的“头像”和“昵称” 设置用户资料
[
详情参考
](
https://wdoc-76491.picgzc.qpic.cn/MTY4ODg1MDUyNzQyMDUxNw_21263_rTNhg68FTngQGdvQ_1647431233?w=1280&h=695.7176470588236
)
## 1.1.0(2023-01-31)
-
【重要】优化 小程序端资源包大小(运行时大小为:731KB,发行后为:583KB;注:可以直接将本插件作为分包使用)
-
更新 微信小程序端 上传头像功能 用
`wx.cropImage`
实现图片裁剪
...
...
uni_modules/uni-id-pages/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
浏览文件 @
19d91730
<
template
>
<
view
@
click=
"uploadAvatarImg"
class=
"box"
:class=
"
{'showBorder':border}" :style="{width,height,lineHeight:height}">
<
button
open-type=
"chooseAvatar"
@
chooseavatar=
"bindchooseavatar"
@
click=
"uploadAvatarImg"
class=
"box"
:class=
"
{'showBorder':border}" :style="{width,height,lineHeight:height}">
<cloud-image
v-if=
"avatar_file"
:src=
"avatar_file.url"
:width=
"width"
:height=
"height"
></cloud-image>
<uni-icons
v-else
:style=
"
{width,height,lineHeight:height}" class="chooseAvatar" type="plusempty" size="30"
color="#dddddd">
</uni-icons>
</
view
>
</
button
>
</
template
>
<
script
>
...
...
@@ -65,13 +65,71 @@
setAvatarFile
(
avatar_file
)
{
// 使用 clientDB 提交数据
mutations
.
updateUserInfo
({
avatar_file
})
},
async
bindchooseavatar
(
res
){
let
avatarUrl
=
res
.
detail
.
avatarUrl
let
avatar_file
=
{
extname
:
avatarUrl
.
split
(
'
.
'
)[
avatarUrl
.
split
(
'
.
'
).
length
-
1
],
name
:
''
,
url
:
avatarUrl
}
// 裁剪
let
filePath
=
await
new
Promise
((
callback
)
=>
{
wx
.
cropImage
({
src
:
avatarUrl
,
cropScale
:
"
1:1
"
,
success
:
res
=>
{
callback
(
res
.
tempFilePath
)
},
fail
(
e
){
console
.
error
(
e
)
uni
.
showModal
({
content
:
'
wx.cropImage
'
+
e
.
errMsg
,
showCancel
:
false
,
confirmText
:
"
跳过裁剪
"
,
complete
()
{
callback
(
avatarUrl
)
}
});
}
})
})
//上传到服务器
let
cloudPath
=
this
.
userInfo
.
_id
+
''
+
Date
.
now
()
avatar_file
.
name
=
cloudPath
try
{
uni
.
showLoading
({
title
:
"
更新中
"
,
mask
:
true
});
let
{
fileID
}
=
await
uniCloud
.
uploadFile
({
filePath
,
cloudPath
,
fileType
:
"
image
"
});
avatar_file
.
url
=
fileID
uni
.
hideLoading
()
}
catch
(
e
){
console
.
error
(
e
);
}
this
.
setAvatarFile
(
avatar_file
)
},
uploadAvatarImg
(
res
)
{
// #ifdef MP-WEIXIN
return
false
// 微信小程序走 bindchooseavatar方法
// #endif
if
(
!
this
.
hasLogin
){
return
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-id-pages/pages/login/login-withoutpwd
'
})
}
}
const
crop
=
{
quality
:
100
,
width
:
600
,
...
...
@@ -113,27 +171,6 @@
});
}
// #endif
// #ifdef MP-WEIXIN
wx
.
cropImage
({
src
:
filePath
,
cropScale
:
"
1:1
"
,
success
:
res
=>
{
callback
(
res
.
tempFilePath
)
},
fail
(
e
){
console
.
error
(
e
)
uni
.
showModal
({
content
:
'
wx.cropImage
'
+
e
.
errMsg
,
showCancel
:
false
,
confirmText
:
"
跳过裁剪
"
,
complete
()
{
callback
(
filePath
)
}
});
}
})
// #endif
})
// #endif
...
...
@@ -166,13 +203,15 @@
overflow
:
hidden
;
}
/* #endif */
.box
{
padding
:
0
;
}
.chooseAvatar
{
/* #ifndef APP-NVUE */
display
:
inline-block
;
box-sizing
:
border-box
;
/* #endif */
border
:
dotted
1px
#ddd
;
border-radius
:
10px
;
text-align
:
center
;
padding
:
1px
;
...
...
uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue
浏览文件 @
19d91730
...
...
@@ -7,9 +7,6 @@
<text
class=
"login-title"
>
{{
item
.
text
}}
</text>
</view>
</view>
<!-- #ifdef MP-WEIXIN -->
<uni-id-pages-user-profile
@
next=
"doUserProfileNext"
ref=
"userProfile"
></uni-id-pages-user-profile>
<!-- #endif -->
</view>
</
template
>
<
script
>
...
...
@@ -64,7 +61,7 @@
"
id
"
:
"
weixin
"
,
"
text
"
:
"
微信登录
"
,
"
logo
"
:
"
/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png
"
,
},
},
// #ifndef MP-WEIXIN
{
"
id
"
:
"
apple
"
,
...
...
@@ -110,7 +107,7 @@
"
id
"
:
"
sinaweibo
"
,
"
text
"
:
"
新浪微博
"
,
//暂未提供该登录方式的接口示例
"
logo
"
:
"
/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/sinaweibo.png
"
,
}
}
// #endif
],
univerifyStyle
:
{
//一键登录弹出窗的样式配置参数
...
...
@@ -330,17 +327,14 @@
let
onButtonsClickFn
=
async
res
=>
{
console
.
log
(
'
点击了第三方登录,provider:
'
,
res
,
res
.
provider
,
this
.
univerifyStyle
.
buttons
.
list
);
clickAnotherButtons
=
true
let
checkBoxState
=
await
uni
.
getCheckBoxState
();
// 同步一键登录弹出层隐私协议框是否打勾
// #ifdef VUE2
let
agree
=
checkBoxState
[
1
].
state
let
checkBoxState
=
await
uni
.
getCheckBoxState
();
// 同步一键登录弹出层隐私协议框是否打勾
// #ifdef VUE2
this
.
agree
=
checkBoxState
[
1
].
state
// #endif
// #ifdef VUE3
this
.
agree
=
checkBoxState
.
state
// #endif
// #ifdef VUE3
let
agree
=
checkBoxState
.
state
// #endif
this
.
agree
=
agree
let
{
path
}
=
this
.
univerifyStyle
.
buttons
.
list
[
res
.
index
]
...
...
@@ -351,7 +345,7 @@
this
.
toPage
(
path
,
1
)
closeUniverify
()
}
else
{
if
(
agree
)
{
if
(
this
.
agree
)
{
closeUniverify
()
setTimeout
(()
=>
{
this
.
login_before
(
res
.
provider
)
...
...
@@ -445,17 +439,6 @@
icon
:
'
none
'
,
duration
:
2000
});
// #ifdef MP-WEIXIN
//如果是微信小程序端的微信登录,且为首次登录,就弹出获取微信昵称+头像用于绑定资料
if
([
'
weixin
'
,
'
weixinMobile
'
].
includes
(
type
)
&&
result
.
type
==
"
register
"
)
{
mutations
.
loginSuccess
({
...
result
,
showToast
:
false
,
autoBack
:
false
})
return
this
.
$refs
.
userProfile
.
open
(
result
.
uid
)
}
// #endif
// #ifdef H5
result
.
loginType
=
type
// #endif
...
...
@@ -475,13 +458,6 @@
uni
.
hideLoading
()
})
},
doUserProfileNext
()
{
try
{
mutations
.
loginSuccess
()
}
catch
(
e
)
{
console
.
log
(
e
);
}
},
async
getUserInfo
(
e
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
getUserInfo
({
...
...
uni_modules/uni-id-pages/package.json
浏览文件 @
19d91730
{
"id"
:
"uni-id-pages"
,
"displayName"
:
"uni-id-pages"
,
"version"
:
"1.1.
0
"
,
"version"
:
"1.1.
1
"
,
"description"
:
"云端一体简单、统一、可扩展的用户中心页面模版"
,
"keywords"
:
[
"用户管理"
,
...
...
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
浏览文件 @
19d91730
<!-- 用户资料页 -->
<
template
>
<view
class=
"uni-content"
>
<view
class=
"avatar"
>
<uni-id-pages-avatar
width=
"260rpx"
height=
"260rpx"
></uni-id-pages-avatar>
</view>
<uni-list>
<uni-list-item
class=
"item"
@
click=
"setNickname('')"
title=
"昵称"
:rightText=
"userInfo.nickname||'未设置'"
link
>
</uni-list-item>
<uni-list-item
class=
"item"
@
click=
"bindMobile"
title=
"手机号"
:rightText=
"userInfo.mobile||'未绑定'"
link
>
</uni-list-item>
<uni-list-item
v-if=
"userInfo.email"
class=
"item"
title=
"电子邮箱"
:rightText=
"userInfo.email"
>
</uni-list-item>
<uni-list-item
v-if=
"hasPwd"
class=
"item"
@
click=
"changePassword"
title=
"修改密码"
link
>
</uni-list-item>
</uni-list>
<!-- #ifndef MP -->
<uni-list
class=
"mt10"
>
<uni-list-item
@
click=
"deactivate"
title=
"注销账号"
link=
"navigateTo"
></uni-list-item>
</uni-list>
<!-- #endif -->
<uni-popup
ref=
"dialog"
type=
"dialog"
>
<uni-popup-dialog
mode=
"input"
:value=
"userInfo.nickname"
@
confirm=
"setNickname"
title=
"设置昵称"
placeholder=
"请输入要设置的昵称"
>
</uni-popup-dialog>
</uni-popup>
<uni-id-pages-bind-mobile
ref=
"bind-mobile-by-sms"
@
success=
"bindMobileSuccess"
></uni-id-pages-bind-mobile>
<template
v-if=
"showLoginManage"
>
<button
v-if=
"userInfo._id"
@
click=
"logout"
>
退出登录
</button>
<button
v-else
@
click=
"login"
>
去登录
</button>
</
template
>
</view>
</template>
<
script
>
const
uniIdCo
=
uniCloud
.
importObject
(
"
uni-id-co
"
)
import
{
store
,
mutations
}
from
'
@/uni_modules/uni-id-pages/common/store.js
'
export
default
{
computed
:
{
userInfo
()
{
return
store
.
userInfo
}
},
data
()
{
return
{
univerifyStyle
:
{
authButton
:
{
"
title
"
:
"
本机号码一键绑定
"
,
// 授权按钮文案
},
otherLoginButton
:
{
"
title
"
:
"
其他号码绑定
"
,
}
},
// userInfo: {
// mobile:'',
// nickname:''
// },
hasPwd
:
false
,
showLoginManage
:
false
//通过页面传参隐藏登录&退出登录按钮
}
},
async
onShow
()
{
this
.
univerifyStyle
.
authButton
.
title
=
"
本机号码一键绑定
"
this
.
univerifyStyle
.
otherLoginButton
.
title
=
"
其他号码绑定
"
},
async
onLoad
(
e
)
{
if
(
e
.
showLoginManage
){
this
.
showLoginManage
=
true
//通过页面传参隐藏登录&退出登录按钮
}
//判断当前用户是否有密码,否则就不显示密码修改功能
let
res
=
await
uniIdCo
.
getAccountInfo
()
this
.
hasPwd
=
res
.
isPasswordSet
},
methods
:
{
login
()
{
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-id-pages/pages/login/login-withoutpwd
'
,
complete
:
(
e
)
=>
{
// console.log(e);
}
})
},
logout
(){
mutations
.
logout
()
},
bindMobileSuccess
(){
mutations
.
updateUserInfo
()
},
changePassword
(){
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd
'
,
complete
:
(
e
)
=>
{
// console.log(e);
}
})
},
bindMobile
()
{
// #ifdef APP-PLUS
uni
.
preLogin
({
provider
:
'
univerify
'
,
success
:
this
.
univerify
(),
//预登录成功
fail
:
(
res
)
=>
{
// 预登录失败
// 不显示一键登录选项(或置灰)
console
.
log
(
res
)
this
.
bindMobileBySmsCode
()
}
})
// #endif
// #ifdef MP-WEIXIN
this
.
$refs
[
'
bind-mobile-by-sms
'
].
open
()
// #endif
// #ifdef H5
//...去用验证码绑定
this
.
bindMobileBySmsCode
()
// #endif
},
univerify
()
{
uni
.
login
({
"
provider
"
:
'
univerify
'
,
"
univerifyStyle
"
:
this
.
univerifyStyle
,
success
:
async
e
=>
{
uniIdCo
.
bindMobileByUniverify
(
e
.
authResult
).
then
(
res
=>
{
mutations
.
updateUserInfo
()
}).
catch
(
e
=>
{
console
.
log
(
e
);
}).
finally
(
e
=>
{
// console.log(e);
uni
.
closeAuthView
()
})
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
if
(
err
.
code
==
'
30002
'
||
err
.
code
==
'
30001
'
)
{
this
.
bindMobileBySmsCode
()
}
}
})
},
bindMobileBySmsCode
()
{
uni
.
navigateTo
({
url
:
'
./bind-mobile/bind-mobile
'
})
},
setNickname
(
nickname
)
{
if
(
nickname
)
{
mutations
.
updateUserInfo
({
nickname
})
this
.
$refs
.
dialog
.
close
()
}
else
{
this
.
$refs
.
dialog
.
open
()
}
},
deactivate
(){
uni
.
navigateTo
({
url
:
"
/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate
"
})
},
async
bindThirdAccount
(
provider
)
{
const
uniIdCo
=
uniCloud
.
importObject
(
"
uni-id-co
"
)
const
bindField
=
{
weixin
:
'
wx_openid
'
,
alipay
:
'
ali_openid
'
,
apple
:
'
apple_openid
'
,
qq
:
'
qq_openid
'
}[
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
()
}
<!-- 用户资料页 -->
<
template
>
<view
class=
"uni-content"
>
<view
class=
"avatar"
>
<uni-id-pages-avatar
width=
"260rpx"
height=
"260rpx"
></uni-id-pages-avatar>
</view>
<uni-list>
<uni-list-item
class=
"item"
@
click=
"setNickname('')"
title=
"昵称"
:rightText=
"userInfo.nickname||'未设置'"
link
>
</uni-list-item>
<uni-list-item
class=
"item"
@
click=
"bindMobile"
title=
"手机号"
:rightText=
"userInfo.mobile||'未绑定'"
link
>
</uni-list-item>
<uni-list-item
v-if=
"userInfo.email"
class=
"item"
title=
"电子邮箱"
:rightText=
"userInfo.email"
>
</uni-list-item>
<uni-list-item
v-if=
"hasPwd"
class=
"item"
@
click=
"changePassword"
title=
"修改密码"
link
>
</uni-list-item>
</uni-list>
<!-- #ifndef MP -->
<uni-list
class=
"mt10"
>
<uni-list-item
@
click=
"deactivate"
title=
"注销账号"
link=
"navigateTo"
></uni-list-item>
</uni-list>
<!-- #endif -->
<uni-popup
ref=
"dialog"
type=
"dialog"
>
<uni-popup-dialog
mode=
"input"
:value=
"userInfo.nickname"
@
confirm=
"setNickname"
:inputType=
"setNicknameIng?'nickname':'text'"
title=
"设置昵称"
placeholder=
"请输入要设置的昵称"
>
</uni-popup-dialog>
</uni-popup>
<uni-id-pages-bind-mobile
ref=
"bind-mobile-by-sms"
@
success=
"bindMobileSuccess"
></uni-id-pages-bind-mobile>
<template
v-if=
"showLoginManage"
>
<button
v-if=
"userInfo._id"
@
click=
"logout"
>
退出登录
</button>
<button
v-else
@
click=
"login"
>
去登录
</button>
</
template
>
</view>
</template>
<
script
>
const
uniIdCo
=
uniCloud
.
importObject
(
"
uni-id-co
"
)
import
{
store
,
mutations
}
from
'
@/uni_modules/uni-id-pages/common/store.js
'
export
default
{
computed
:
{
userInfo
()
{
return
store
.
userInfo
}
},
data
()
{
return
{
univerifyStyle
:
{
authButton
:
{
"
title
"
:
"
本机号码一键绑定
"
,
// 授权按钮文案
},
otherLoginButton
:
{
"
title
"
:
"
其他号码绑定
"
,
}
},
// userInfo: {
// mobile:'',
// nickname:''
// },
hasPwd
:
false
,
showLoginManage
:
false
,
//通过页面传参隐藏登录&退出登录按钮
setNicknameIng
:
false
}
},
async
onShow
()
{
this
.
univerifyStyle
.
authButton
.
title
=
"
本机号码一键绑定
"
this
.
univerifyStyle
.
otherLoginButton
.
title
=
"
其他号码绑定
"
},
async
onLoad
(
e
)
{
if
(
e
.
showLoginManage
)
{
this
.
showLoginManage
=
true
//通过页面传参隐藏登录&退出登录按钮
}
//判断当前用户是否有密码,否则就不显示密码修改功能
let
res
=
await
uniIdCo
.
getAccountInfo
()
this
.
hasPwd
=
res
.
isPasswordSet
},
methods
:
{
login
()
{
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-id-pages/pages/login/login-withoutpwd
'
,
complete
:
(
e
)
=>
{
// console.log(e);
}
})
},
logout
()
{
mutations
.
logout
()
},
bindMobileSuccess
()
{
mutations
.
updateUserInfo
()
},
changePassword
()
{
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd
'
,
complete
:
(
e
)
=>
{
// console.log(e);
}
})
},
bindMobile
()
{
// #ifdef APP-PLUS
uni
.
preLogin
({
provider
:
'
univerify
'
,
success
:
this
.
univerify
(),
//预登录成功
fail
:
(
res
)
=>
{
// 预登录失败
// 不显示一键登录选项(或置灰)
console
.
log
(
res
)
this
.
bindMobileBySmsCode
()
}
})
// #endif
// #ifdef MP-WEIXIN
this
.
$refs
[
'
bind-mobile-by-sms
'
].
open
()
// #endif
// #ifdef H5
//...去用验证码绑定
this
.
bindMobileBySmsCode
()
// #endif
},
univerify
()
{
uni
.
login
({
"
provider
"
:
'
univerify
'
,
"
univerifyStyle
"
:
this
.
univerifyStyle
,
success
:
async
e
=>
{
uniIdCo
.
bindMobileByUniverify
(
e
.
authResult
).
then
(
res
=>
{
mutations
.
updateUserInfo
()
}).
catch
(
e
=>
{
console
.
log
(
e
);
}).
finally
(
e
=>
{
// console.log(e);
uni
.
closeAuthView
()
})
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
if
(
err
.
code
==
'
30002
'
||
err
.
code
==
'
30001
'
)
{
this
.
bindMobileBySmsCode
()
}
}
})
},
bindMobileBySmsCode
()
{
uni
.
navigateTo
({
url
:
'
./bind-mobile/bind-mobile
'
})
},
setNickname
(
nickname
)
{
if
(
nickname
)
{
mutations
.
updateUserInfo
({
nickname
})
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
@import
"@/uni_modules/uni-id-pages/common/login-page.scss"
;
.uni-content
{
padding
:
0
;
}
/* #ifndef APP-NVUE */
view
{
display
:
flex
;
box-sizing
:
border-box
;
flex-direction
:
column
;
}
@media
screen
and
(
min-width
:
690px
)
{
.uni-content
{
padding
:
0
;
max-width
:
690px
;
margin-left
:
calc
(
50%
-
345px
);
border
:
none
;
max-height
:
none
;
border-radius
:
0
;
box-shadow
:
none
;
}
}
/* #endif */
.avatar
{
align-items
:
center
;
justify-content
:
center
;
margin
:
22px
0
;
width
:
100%
;
}
.item
{
flex
:
1
;
flex-direction
:
row
;
justify-content
:
space-between
;
align-items
:
center
;
}
button
{
margin
:
10%
;
margin-top
:
40px
;
border-radius
:
0
;
background-color
:
#FFFFFF
;
width
:
80%
;
}
.mt10
{
margin-top
:
10px
;
}
this
.
setNicknameIng
=
false
this
.
$refs
.
dialog
.
close
()
}
else
{
this
.
setNicknameIng
=
true
this
.
$refs
.
dialog
.
open
()
}
},
deactivate
()
{
uni
.
navigateTo
({
url
:
"
/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate
"
})
},
async
bindThirdAccount
(
provider
)
{
const
uniIdCo
=
uniCloud
.
importObject
(
"
uni-id-co
"
)
const
bindField
=
{
weixin
:
'
wx_openid
'
,
alipay
:
'
ali_openid
'
,
apple
:
'
apple_openid
'
,
qq
:
'
qq_openid
'
}
[
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
()
}
})
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
@import
"@/uni_modules/uni-id-pages/common/login-page.scss"
;
.uni-content
{
padding
:
0
;
}
/* #ifndef APP-NVUE */
view
{
display
:
flex
;
box-sizing
:
border-box
;
flex-direction
:
column
;
}
@media
screen
and
(
min-width
:
690px
)
{
.uni-content
{
padding
:
0
;
max-width
:
690px
;
margin-left
:
calc
(
50%
-
345px
);
border
:
none
;
max-height
:
none
;
border-radius
:
0
;
box-shadow
:
none
;
}
}
/* #endif */
.avatar
{
align-items
:
center
;
justify-content
:
center
;
margin
:
22px
0
;
width
:
100%
;
}
.item
{
flex
:
1
;
flex-direction
:
row
;
justify-content
:
space-between
;
align-items
:
center
;
}
button
{
margin
:
10%
;
margin-top
:
40px
;
border-radius
:
0
;
background-color
:
#FFFFFF
;
width
:
80%
;
}
.mt10
{
margin-top
:
10px
;
}
</
style
>
uni_modules/uni-id-pages/uniCloud/database/uni-id-users.schema.json
浏览文件 @
19d91730
...
...
@@ -32,7 +32,7 @@
"title"
:
"头像地址"
,
"trim"
:
"both"
,
"permission"
:
{
"read"
:
"doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission"
,
"read"
:
true
,
"write"
:
"doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
}
},
...
...
@@ -41,7 +41,7 @@
"description"
:
"用file类型方便使用uni-file-picker组件"
,
"title"
:
"头像文件"
,
"permission"
:
{
"read"
:
"doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission"
,
"read"
:
true
,
"write"
:
"doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
}
},
...
...
uni_modules/uni-popup/changelog.md
浏览文件 @
19d91730
## 1.8.2(2023-02-02)
-
uni-popup-dialog 组件新增 inputType 属性
## 1.8.1(2022-12-01)
-
修复 nvue 下 v-show 报错
## 1.8.0(2022-11-29)
...
...
uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
浏览文件 @
19d91730
...
...
@@ -10,7 +10,7 @@
</view>
<view
v-else
class=
"uni-dialog-content"
>
<slot>
<input
class=
"uni-dialog-input"
v-model=
"val"
type=
"text
"
:placeholder=
"placeholderText"
:focus=
"focus"
>
<input
class=
"uni-dialog-input"
v-model=
"val"
:type=
"inputType
"
:placeholder=
"placeholderText"
:focus=
"focus"
>
</slot>
</view>
<view
class=
"uni-dialog-button-group"
>
...
...
@@ -56,7 +56,11 @@
name
:
"
uniPopupDialog
"
,
mixins
:
[
popup
],
emits
:[
'
confirm
'
,
'
close
'
],
props
:
{
props
:
{
inputType
:{
type
:
String
,
default
:
'
text
'
},
value
:
{
type
:
[
String
,
Number
],
default
:
''
...
...
@@ -84,14 +88,14 @@
beforeClose
:
{
type
:
Boolean
,
default
:
false
},
cancelText
:{
type
:
String
,
default
:
''
},
confirmText
:{
type
:
String
,
default
:
''
},
cancelText
:{
type
:
String
,
default
:
''
},
confirmText
:{
type
:
String
,
default
:
''
}
},
data
()
{
...
...
@@ -171,11 +175,6 @@
</
script
>
<
style
lang=
"scss"
>
$uni-primary
:
#007aff
!
default
;
$uni-success
:
#4cd964
!
default
;
$uni-warning
:
#f0ad4e
!
default
;
$uni-error
:
#dd524d
!
default
;
.uni-popup-dialog
{
width
:
300px
;
border-radius
:
11px
;
...
...
@@ -245,7 +244,7 @@
}
.uni-button-color
{
color
:
$uni-primary
;
color
:
#007aff
;
}
.uni-dialog-input
{
...
...
@@ -259,15 +258,15 @@
}
.uni-popup__success
{
color
:
$uni-success
;
color
:
#4cd964
;
}
.uni-popup__warn
{
color
:
$uni-warning
;
color
:
#f0ad4e
;
}
.uni-popup__error
{
color
:
$uni-error
;
color
:
#dd524d
;
}
.uni-popup__info
{
...
...
uni_modules/uni-popup/package.json
浏览文件 @
19d91730
{
"id"
:
"uni-popup"
,
"displayName"
:
"uni-popup 弹出层"
,
"version"
:
"1.8.
1
"
,
"version"
:
"1.8.
2
"
,
"description"
:
" Popup 组件,提供常用的弹层"
,
"keywords"
:
[
"uni-ui"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录