Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-id-pages-x
提交
a98d1cdd
H
hello uni-id-pages-x
项目概览
DCloud
/
hello uni-id-pages-x
通知
43
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-id-pages-x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a98d1cdd
编写于
12月 04, 2024
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重要更新 兼容微信小程序
上级
2b6bce7f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
171 addition
and
121 deletion
+171
-121
uni_modules/uni-id-pages-x/common/common.uts
uni_modules/uni-id-pages-x/common/common.uts
+8
-5
uni_modules/uni-id-pages-x/components/uni-id-pages-x-agreements/uni-id-pages-x-agreements.uvue
.../uni-id-pages-x-agreements/uni-id-pages-x-agreements.uvue
+34
-15
uni_modules/uni-id-pages-x/components/uni-id-pages-x-avatar/uni-id-pages-x-avatar.uvue
...mponents/uni-id-pages-x-avatar/uni-id-pages-x-avatar.uvue
+48
-49
uni_modules/uni-id-pages-x/components/uni-id-pages-x-icons/uni-id-pages-x-icons.uvue
...components/uni-id-pages-x-icons/uni-id-pages-x-icons.uvue
+8
-2
uni_modules/uni-id-pages-x/components/uni-id-pages-x-input/uni-id-pages-x-input.uvue
...components/uni-id-pages-x-input/uni-id-pages-x-input.uvue
+29
-22
uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/fab-sms-code-input.uvue
...components/uni-id-pages-x-smsCode/fab-sms-code-input.uvue
+14
-7
uni_modules/uni-id-pages-x/init.uts
uni_modules/uni-id-pages-x/init.uts
+1
-2
uni_modules/uni-id-pages-x/pages/userinfo/setNickname/setNickname.uvue
...ni-id-pages-x/pages/userinfo/setNickname/setNickname.uvue
+19
-4
uni_modules/uni-id-pages-x/pages/userinfo/userinfo.uvue
uni_modules/uni-id-pages-x/pages/userinfo/userinfo.uvue
+2
-5
uni_modules/uni-id-pages-x/store.uts
uni_modules/uni-id-pages-x/store.uts
+8
-10
未找到文件。
uni_modules/uni-id-pages-x/common/common.uts
浏览文件 @
a98d1cdd
...
...
@@ -3,18 +3,21 @@ import config from '@/uni_modules/uni-id-pages-x/config.uts';
export const loginSuccess = (_ : UTSJSONObject) => {
// console.log('loginSuccess', e);
// console.log("新用户uid", e["uid"]);
// state.currentUserInfo = uniCloud.getCurrentUserInfo()
// state.currentUserInfo = uniCloud.getCurrentUserInfo()
mutations.updateUserInfo(null)
// state.userInfo["_id"] = e["uid"]
state.isLogin = true
uni.$emit('uni-id-pages-x-login-success', '')
// 登录后重定向设置
function loginAfterToPage() {
function loginAfterToPage() {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const uniIdRedirectUrl = currentPage.options["uniIdRedirectUrl"];
if (uniIdRedirectUrl != null) {
let uniIdRedirectUrl = currentPage.options["uniIdRedirectUrl"];
if (uniIdRedirectUrl != null) {
// #ifndef APP
uniIdRedirectUrl = decodeURIComponent(uniIdRedirectUrl)
// #endif
// console.log('uniIdRedirectUrl', uniIdRedirectUrl);
uni.redirectTo({
url: uniIdRedirectUrl,
...
...
@@ -102,4 +105,4 @@ export const checkPassword = (password : string) : UTSJSONObject => {
res["pass"] = passwordRegExp.test(password);
res["errMsg"] = passwordRules.getString(passwordStrength + '.errMsg');
return res
}
}
uni_modules/uni-id-pages-x/components/uni-id-pages-x-agreements/uni-id-pages-x-agreements.uvue
浏览文件 @
a98d1cdd
<template>
<view class="agreements-root" v-if="agreements.length != 0">
<template v-if="needAgreements">
<checkbox-group @change="setAgree">
<checkbox class="checkbox" style="transform: scale(0.7);margin-right: -6px;padding-right: 3px;margin-left: 1px;"
:checked="!pendingAgreements" value="agreement">
<text class="checkbox-text">同意</text>
</checkbox>
<checkbox-group @change="setAgree" class="checkbox-group">
<checkbox class="checkbox" :checked="!pendingAgreements" value="agreement">
<text class="text">同意</text>
</checkbox>
</checkbox-group>
<view class="content">
<view class="agreements-item" v-for="(agreement,index) in agreements" :key="index">
...
...
@@ -140,21 +139,41 @@
margin-left: -9px;
}
.checkbox-text {
transform: scale(1.3);
margin-left: 3px;
color: #8a8f8b;
font-size: 12px;
}
.checkbox-group {
transform: scale(0.6);
margin-left: -6px;
margin-right: -18px;
padding-right: 10px;
.checkbox {
margin-left: 5px;
padding-right: 15px;
.text {
margin-left: 8px;
margin-right: 10px;
transform: scale(1.8);
color: #8a8f8b;
font-size: 12px;
line-height: 24px;
}
}
/* #ifdef MP-WEIXIN */
// 解决微信小程序中外层有transform: scale内层再设置transform: scale无效的问题
.checkbox {
padding-right: 40px;
.text {
position: absolute;
margin-right: 0;
top: 0;
}
}
/* #endif */
}
.agreements-item {
flex-direction: row;
}
.text {
line-height: 26px;
font-size: 12px;
}
.popup-text{
line-height: 30px;
font-size:14px;
...
...
uni_modules/uni-id-pages-x/components/uni-id-pages-x-avatar/uni-id-pages-x-avatar.uvue
浏览文件 @
a98d1cdd
<template>
<view class="avatar-box-root">
<!-- #ifdef MP-WEIXIN -->
<button open-type="chooseAvatar" @chooseavatar="bindchooseavatar" @click="uploadAvatarImg" class="box"
<button open-type="chooseAvatar" @chooseavatar="bindchooseavatar" @click="uploadAvatarImg" class="box
chooseAvatar
"
:class="{'showBorder':border}" :style="{width,height,lineHeight:height}">
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
...
...
@@ -9,8 +9,7 @@
:style="{width,height}">
<!-- #endif -->
<!-- {{avatar_file!.getString("url")}} -->
<cloud-image v-if="avatar_file != null" :src="avatar_file!.getString('url')" :width="width" :height="height"></cloud-image>
<cloud-image v-if="avatar_file != null" :src="avatar_file!['url']" :width="width" :height="height"></cloud-image>
<image v-else-if="readOnly" class="default-avatarUrl" src="@/uni_modules/uni-id-pages-x/static/default-avatar.png" mode="widthFix"></image>
<view v-else class="upload-img-icon">
<uni-id-pages-x-icons :size="35" color="#eee" type="jiahao"></uni-id-pages-x-icons>
...
...
@@ -73,7 +72,7 @@
return state.userInfo
},
avatar_file() : UTSJSONObject | null {
return this.userInfo
.getJSON("avatar_file")
return this.userInfo
["avatar_file"] as UTSJSONObject | null
}
},
methods: {
...
...
@@ -81,36 +80,37 @@
// 使用 clientDB 提交数据
// mutations.updateUserInfo({avatar_file})
},
bindchooseavatar() {
// res
// let avatarUrl = res.detail.avatarUrl
// let avatar_file = {
// extname: avatarUrl.split('.')[avatarUrl.split('.').length - 1],
// name:'',
// url:''
// }
// //上传到服务器
// let cloudPath = this.userInfo._id + '' + Date.now()
// avatar_file.name = cloudPath
// try{
// uni.showLoading({
// title: "更新中",
// mask: true
// });
// let {
// fileID
// } = await uniCloud.uploadFile({
// filePath:avatarUrl,
// cloudPath,
// fileType: "image"
// });
// avatar_file.url = fileID
// uni.hideLoading()
// }catch(e){
// console.error(e);
// }
// console.log('avatar_file',avatar_file);
// this.setAvatarFile(avatar_file)
async bindchooseavatar(res:any) {
// #ifdef MP-WEIXIN
let avatarUrl = res.detail.avatarUrl
let avatar_file = {
extname: avatarUrl.split('.')[avatarUrl.split('.').length - 1],
name:'',
url:''
}
//上传到服务器
let cloudPath = this.userInfo._id + '' + Date.now()
avatar_file.name = cloudPath
try{
uni.showLoading({
title: "更新中",
mask: true
});
let {
fileID
} = await uniCloud.uploadFile({
filePath:avatarUrl,
cloudPath,
fileType: "image"
});
avatar_file.url = fileID
uni.hideLoading()
}catch(e){
console.error(e);
}
console.log('avatar_file',avatar_file);
mutations.updateUserInfo({ avatar_file } as UTSJSONObject)
// #endif
},
uploadAvatarImg() {
if(this.readOnly){
...
...
@@ -216,10 +216,10 @@
},
fail:(err)=>{
console.error('chooseImage fail: ', err)
uni.showModal({
content: '失败,' + err.errMsg,
showCancel: false
});
//
uni.showModal({
//
content: '失败,' + err.errMsg,
//
showCancel: false
//
});
}
})
// #endif
...
...
@@ -242,20 +242,19 @@
padding: 0;
}
.chooseAvatar {
/* #ifndef UNI-APP-X */
display: inline-block;
box-sizing: border-box;
/* #endif */
border-radius: 100px;
text-align: center;
padding: 1px;
}
/* #ifdef MP */
.chooseAvatar {
border-radius: 0;
}
.chooseAvatar:after{
display: none;
}
/* #endif */
.upload-img-icon {
border: 1px dotted #c8c8c8;
width:
55px
;
height:
55px
;
width:
100%
;
height:
100%
;
justify-content: center;
align-items: center;
}
...
...
uni_modules/uni-id-pages-x/components/uni-id-pages-x-icons/uni-id-pages-x-icons.uvue
浏览文件 @
a98d1cdd
<template>
<view>
<view
@click="clickHandle"
>
<text class="uni-id-icon" :style="{color,'fontSize':size + 'px'}">{{iconCode}}</text>
</view>
</template>
<script>
export default {
emits: ["click"],
props: {
type: {
type: String,
...
...
@@ -21,6 +22,11 @@
default: 16
},
},
methods: {
clickHandle() {
this.$emit("click");
}
},
computed: {
iconCode() : string {
const iconCode : UTSJSONObject = {
...
...
@@ -51,4 +57,4 @@
font-size: 16px;
font-style: normal;
}
</style>
\ No newline at end of file
</style>
uni_modules/uni-id-pages-x/components/uni-id-pages-x-input/uni-id-pages-x-input.uvue
浏览文件 @
a98d1cdd
...
...
@@ -4,7 +4,7 @@
<text v-if="hasTitleAndContent" class="title">{{title}}</text>
<input class="input" ref="input" :placeholder="_placeholder" :class="{'move-down':hasTitleAndContent}"
:value="modelValue" @input="updateValue" :type="type" :maxlength="maxlength"
:password="password && !visiblePwd" :focus="focus" @blur="onBlur" @focus="onFocus" @confirm="confirm"
:password="password && !visiblePwd" :focus="focus
Input
" @blur="onBlur" @focus="onFocus" @confirm="confirm"
:confirm-type="confirmType" />
<view class="my-input-icon-box" v-if="modelValue">
<uni-id-pages-x-icons v-if="password" :color="visiblePwd?'#0070ff':'#ddd'"
...
...
@@ -23,9 +23,15 @@
emits: ["blur", "focus", "confirm", "update:modelValue"],
data() {
return {
visiblePwd: false
visiblePwd: false,
focusInput: false
}
},
mounted(){
if(this.focus){
this.setFocus(true)
}
},
computed: {
_placeholder() : string {
if (this.placeholder.length > 0) {
...
...
@@ -78,7 +84,10 @@
default: "done"
},
/**
* @param touch click
* 显示密码的方式
* @type {String}
* @default click
* @example click | touch
*/
visiblePwdOption:{
type: String,
...
...
@@ -103,31 +112,29 @@
// this.$emit('update:focus', true);
},
setFocus(state : boolean) {
const inputEl = this.$refs['input'] as UniElement
if (state) {
inputEl.focus();
} else {
inputEl.blur();
}
// console.error('setFocus',state)
this.focusInput = state
},
confirm(event : InputConfirmEvent) {
this.$emit('confirm', event)
},
setVisiblePwd(eventName:string){
console.error('eventName',eventName)
if(eventName == "click" && this.visiblePwdOption == 'click'){
this.visiblePwd = !this.visiblePwd
}else if(eventName == "touch"){
// switch (eventName){
// case "touchstart":
// this.visiblePwd = true
// break;
// case "touchend":
// this.visiblePwd = false
// break;
// case "touchcancel":
// this.visiblePwd = false
// break;
// }
}else if(eventName.includes("touch") && this.visiblePwdOption == 'touch'){
console.error('eventName',eventName)
switch (eventName){
case "touchstart":
this.visiblePwd = true
break;
case "touchend":
this.visiblePwd = false
break;
case "touchcancel":
this.visiblePwd = false
break;
}
}
}
}
...
...
@@ -137,7 +144,6 @@
<style lang="scss" scoped>
.input-box {
position: relative;
margin: 0;
background-color: #F8F8F8;
height: 50px !important;
border-radius: 5rpx;
...
...
@@ -179,6 +185,7 @@
right: 10px;
bottom:14px;
flex-direction: row;
z-index: 2;
}
.password-icon {
...
...
uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/fab-sms-code-input.uvue
浏览文件 @
a98d1cdd
...
...
@@ -7,8 +7,8 @@
<view class="code-input-list">
<template v-for="(_,i) in smsCodeList" :key="i">
<!-- TODO APP :value="item" 第一次不触发@input -->
<input @input="setSmsCode(i,$event as InputEvent)" type="number" ref="code-input"
class="code-input"
maxlength="7" @focus="onFocus(i)
" />
<input @input="setSmsCode(i,$event as InputEvent)" type="number" ref="code-input"
:value="smsCodeList[i]"
class="code-input"
:maxlength="i == 0 ? 7 : 2" @focus="onFocus(i)" @blur="onBlur(i)" :focus="focusInputs[i]
" />
</template>
</view>
<view class="fab-sms-code-input-foot">
...
...
@@ -25,6 +25,7 @@
data() {
return {
smsCodeList: ["\u200b", "\u200b", "\u200b", "\u200b", "\u200b", "\u200b"],
focusInputs: [false, false, false, false, false, false],
isOpen: false
}
},
...
...
@@ -60,11 +61,17 @@
this.$emit('update:modelValue', smsCode);
},
},
// mounted() {
// this.show()
// },
methods: {
onBlur(i : number) {
this.focusInputs[i] = false
},
show() {
(this.$refs['popup'] as UniPopupComponentPublicInstance).open();
this.$nextTick(() => {
(this.$refs["code-input"] as UniElement[])[0].focus()
;
this.focusInputs[0] = true
;
})
this.isOpen = true
},
...
...
@@ -75,7 +82,7 @@
clear() {
this.smsCodeList = ["\u200b", "\u200b", "\u200b", "\u200b", "\u200b", "\u200b"];
if (this.isOpen) {
(this.$refs["code-input"] as UniElement[])[0].focus()
;
this.focusInputs[0] = true
;
// console.log('clear success');
} else {
// console.log('已经关了,不能清空');
...
...
@@ -84,10 +91,10 @@
setSmsCode(i : number, e : InputEvent) {
const { value } = e.detail
// console.log('~~',value,value.length);
// 已满6位数就直接调登录
let $value = value.replace(/\u200b/g, '')
if ($value.length == 6) {
// (this.$refs["code-input"] as Element[])[0].focus();
$value.split('').forEach((item : string, index : number) => {
this.smsCodeList[index] = "\u200b" + item
})
...
...
@@ -107,13 +114,13 @@
this.smsCodeList[i] = '\u200b'
})
if (i != 0) {
(this.$refs["code-input"] as UniElement[])[i - 1].focus()
;
this.focusInputs[i - 1] = true
;
this.smsCodeList[i - 1] = ""
}
} else if (value != "\u200b") {
this.smsCodeList[i] = value;
if (i != (this.smsCodeList.length - 1)) {
(this.$refs["code-input"] as UniElement[])[i + 1].focus()
;
this.focusInputs[i + 1] = true
;
} else {
// console.log(i, (this.smsCodeList.length - 1));
}
...
...
uni_modules/uni-id-pages-x/init.uts
浏览文件 @
a98d1cdd
...
...
@@ -152,8 +152,7 @@ export default async function () {
// needLogin相关代码-start(此代码仅为版本兼容提示使用,如已知晓可删除)
const needLogin = config.getArray<string>('needLogin')
const uniCompileVersionCode = uni.getSystemInfoSync().uniCompileVersionCode
if(needLogin != null && (uniCompileVersionCode >= 3.99 ) ){
if(needLogin != null){
const tipText = "uni-id-pages x v1.0.4+ 不再支持配置项config.needLogin,请升级HBuilderX 版本为3.99+,使用更强大 uni-id-router替代。详情查看:https://uniapp.dcloud.net.cn/uniCloud/uni-id/summary.html#uni-id-router"
console.error(tipText)
uni.showModal({
...
...
uni_modules/uni-id-pages-x/pages/userinfo/setNickname/setNickname.uvue
浏览文件 @
a98d1cdd
<template>
<view class="page">
<uni-navbar-lite title="设置昵称" class="uni-navbar-lite">
<template v-slot:right>
<text class="submit" :class="{disabled:!hasChange || nickname == ''}" @click="setNickname">完成</text>
<!-- #ifndef MP-WEIXIN -->
<template v-slot:right>
<text class="submit" :class="{disabled:!hasChange || nickname == ''}" @click="setNickname">完成</text>
</template>
<!-- #endif -->
</uni-navbar-lite>
<uni-id-pages-x-input class="my-input" v-model="nickname" @confirm="setNickname" placeholder="请输入昵称" :focus="true"
:maxlength="25"></uni-id-pages-x-input>
<!-- #ifdef MP-WEIXIN -->
<button class="submit-mp" :disabled="!hasChange || nickname == ''" type="primary" @click="setNickname">完成</button>
<!-- #endif -->
</view>
</template>
...
...
@@ -24,7 +29,8 @@
return this.currentNickname != this.nickname
},
currentNickname() : string {
return state.userInfo.get("nickname") == null?'':(state.userInfo.get("nickname") as string)
const nickname = state.userInfo["nickname"]
return nickname == null ? '' : nickname as string
}
},
onLoad() {
...
...
@@ -83,7 +89,7 @@
}
.my-input {
background-color: #FFF;
background-color: #FFF
!important
;
}
.uni-navbar-lite .right-content {
...
...
@@ -106,4 +112,13 @@
background-color: #EFEFEF;
color: #AAA;
}
/* #ifdef MP-WEIXIN */
.submit-mp {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
border-radius: 0;
}
/* #endif */
</style>
uni_modules/uni-id-pages-x/pages/userinfo/userinfo.uvue
浏览文件 @
a98d1cdd
...
...
@@ -9,12 +9,9 @@
<text class="title">昵称</text>
<view @click="setNickname" class="content">
<text class="unset" v-if="!isLogin">未登录</text>
<text class="value"
v-else-if="userInfo['nickname'] != null && userInfo['nickname'] != ''">{{userInfo['nickname']}}
</text>
<text class="value" v-else-if="userInfo['nickname'] != null && userInfo['nickname'] != ''">{{userInfo['nickname']}}</text>
<text class="unset" v-else>未设置</text>
<uni-id-pages-x-icons v-if="isLogin" :size="16" type="right-arrow"
class="link-icon"></uni-id-pages-x-icons>
<uni-id-pages-x-icons v-if="isLogin" :size="16" type="right-arrow" class="link-icon"></uni-id-pages-x-icons>
</view>
</view>
<view class="item">
...
...
uni_modules/uni-id-pages-x/store.uts
浏览文件 @
a98d1cdd
...
...
@@ -23,7 +23,7 @@ function initState() {
// #ifdef APP-IOS
userInfo = new UTSJSONObject(userInfo)
// #endif
if (userInfo
instanceof UTSJSONObject
) {
if (userInfo
!= null
) {
state.userInfo = userInfo as UTSJSONObject
// console.log('init userInfo',userInfo);
}
...
...
@@ -62,15 +62,13 @@ export const mutations = {
customUI: true
})
uniIdCo
.getRealNameInfo()
.then((realNameInfo) => {
state.userInfo = Object.assign(res.data[0], {
realNameInfo
uniIdCo.getRealNameInfo()
.then((realNameInfo) => {
state.userInfo = Object.assign(res.data[0], {
realNameInfo
}) as UTSJSONObject
afterUpdateUserInfo()
})
afterUpdateUserInfo()
})
})
.catch((err: any | null) => {
const error = err as UniCloudError
...
...
@@ -79,7 +77,7 @@ export const mutations = {
} else {
param.toMap().forEach((value, key) => {
state.userInfo
.set(key, value)
state.userInfo
[key] = value
})
usersCollection
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录