Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-id-pages-x
提交
4b2fe29e
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看板
提交
4b2fe29e
编写于
1月 26, 2024
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 兼容uni-app-x web端
上级
4e094a0f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
209 addition
and
225 deletion
+209
-225
components/uni-navbar-lite/uni-icons.css
components/uni-navbar-lite/uni-icons.css
+0
-2
components/uni-navbar-lite/uni-navbar-lite.uvue
components/uni-navbar-lite/uni-navbar-lite.uvue
+114
-109
components/uni-navbar-lite/uni-navbar-lite.vue
components/uni-navbar-lite/uni-navbar-lite.vue
+79
-82
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
+8
-21
uni_modules/uni-id-pages-x/pages/userinfo/bindMobile/bindMobile.uvue
.../uni-id-pages-x/pages/userinfo/bindMobile/bindMobile.uvue
+3
-5
uni_modules/uni-id-pages-x/pages/userinfo/setNickname/setNickname.uvue
...ni-id-pages-x/pages/userinfo/setNickname/setNickname.uvue
+2
-2
uni_modules/uni-id-pages-x/store.uts
uni_modules/uni-id-pages-x/store.uts
+3
-4
未找到文件。
components/uni-navbar-lite/uni-icons.css
浏览文件 @
4b2fe29e
...
...
@@ -7,8 +7,6 @@
font-family
:
"iconfont"
!important
;
font-size
:
16px
;
font-style
:
normal
;
-webkit-font-smoothing
:
antialiased
;
-moz-osx-font-smoothing
:
grayscale
;
}
.uniui-back
:before
{
...
...
components/uni-navbar-lite/uni-navbar-lite.uvue
浏览文件 @
4b2fe29e
<template>
<view class="uni-navbar">
<view class="uni-navbar-inner" :style="navbarStyle">
<view class="left-content" @click="back">
<text class="uni-icons">{{unicode}}</text>
</view>
<view class="uni-navbar-content" :class="{'is-left':isLeft}">
<slot name="title">{{title}}</slot>
</view>
<view class="right-content">
<slot name="right"></slot>
</view>
</view>
</view>
<view class="uni-navbar">
<view class="uni-navbar-inner" :style="navbarStyle">
<view class="left-content" @click="back">
<text :style="{ color: textColor }" class="uni-icons">{{
unicode
}}</text>
</view>
<view class="uni-navbar-content" :class="{ 'is-left': isLeft }">
<text :style="{ color: textColor }">
<slot>{{ title }}</slot>
</text>
</view>
<view class="right-content">
<slot name="right"></slot>
</view>
</view>
</view>
</template>
<script>
import iconpath from './uniicons.ttf'
export default {
name: "uni-navbar",
props: {
title: {
type: String,
default: ''
},
isLeft: {
type: Boolean,
default: false
}
},
data() {
return {
statusBarHeight: 0
};
},
computed: {
navbarStyle() : string {
return `margin-top:${this.statusBarHeight}px`
},
unicode() : string {
return '\ue600'
}
},
created() {
uni.loadFontFace({
global: false,
family: 'UniIconsFontFamily',
source: iconpath,
success() { },
fail(err) {
console.log(err);
},
})
const sys = uni.getSystemInfoSync()
const statusBarHeight = sys.statusBarHeight
this.statusBarHeight = statusBarHeight
},
mounted() {
// TODO 暂时加定时器,否则不生效
setTimeout(() => {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
}, 100)
},
methods: {
back() {
uni.navigateBack({})
}
},
}
import iconpath from "./uniicons.ttf";
export default {
name: "uni-navbar",
props: {
title: {
type: String,
default: "",
},
isLeft: {
type: Boolean,
default: false,
},
textColor: {
type: String,
default: "#000",
},
},
data() {
return {
statusBarHeight: 0,
};
},
computed: {
navbarStyle() : string {
return `margin-top:${this.statusBarHeight}px`;
},
unicode() : string {
return "\ue600";
},
},
created() {
uni.loadFontFace({
global: false,
family: "UniIconsFontFamily",
source: `url("${iconpath}")`,
success() { },
fail(err) {
console.log(err);
},
});
const sys = uni.getSystemInfoSync();
const statusBarHeight = sys.statusBarHeight;
this.statusBarHeight = statusBarHeight;
},
mounted() {
// TODO 暂时加定时器,否则不生效
setTimeout(() => {
uni.setNavigationBarColor({
frontColor: "#000000",
backgroundColor: "#ffffff",
});
}, 100);
},
methods: {
back() {
uni.navigateBack({});
},
},
};
</script>
<style>
.uni-icons {
font-family: "UniIconsFontFamily" !important;
font-size: 22px;
font-style: normal;
color: #333;
}
.uni-icons {
font-family: "UniIconsFontFamily" !important;
font-size: 22px;
font-style: normal;
color: #333;
}
.uni-navbar {
border: 1px #eee solid;
background-color: #
fff;
}
.uni-navbar {
border: 1px #eee solid;
background-color: #fff
fff;
}
.uni-navbar-inner {
position: relative;
display: flex;
flex-direction: row;
justify-content: space-between;
height: 45px;
}
.uni-navbar-inner {
position: relative;
flex-direction: row;
justify-content: space-between;
height: 45px;
}
.left-content,
.right-content {
display: flex;
justify-content: center;
align-items: center;
width: 45px;
height: 100%;
}
.left-content,
.right-content {
justify-content: center;
align-items: center;
width: 66px;
height: 100%;
}
.uni-navbar-content {
position: absolute;
height: 100%;
top: 0;
bottom: 0;
left: 45px;
right: 45px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.uni-navbar-content {
position: absolute;
height: 100%;
top: 0;
bottom: 0;
left: 45px;
right: 45px;
flex-direction: row;
justify-content: center;
align-items: center;
}
.is-left {
justify-content: flex-start;
}
</style>
\ No newline at end of file
.is-left {
justify-content: flex-start;
}
</style>
components/uni-navbar-lite/uni-navbar-lite.vue
浏览文件 @
4b2fe29e
<
template
>
<view
class=
"uni-navbar"
>
<view
class=
"uni-navbar-inner"
:style=
"navbarStyle"
>
<view
class=
"left-content"
@
click=
"back"
>
<text
class=
"uni-icons uniui-back"
></text>
</view>
<view
class=
"uni-navbar-content"
>
<slot>
{{
title
}}
</slot>
</view>
<view
class=
"right-content"
>
<slot
name=
"right"
></slot>
</view>
</view>
</view>
<view
class=
"uni-navbar"
>
<view
class=
"uni-navbar-inner"
:style=
"navbarStyle"
>
<view
class=
"left-content"
@
click=
"back"
>
<text
class=
"uni-icons uniui-back"
></text>
</view>
<view
class=
"uni-navbar-content"
>
<slot>
{{
title
}}
</slot>
</view>
<view
class=
"right-content"
>
<slot
name=
"right"
></slot>
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
name
:
"
uni-navbar
"
,
props
:
{
title
:
{
type
:
String
,
default
:
''
}
},
data
()
{
return
{
statusBarHeight
:
0
};
},
computed
:
{
navbarStyle
()
{
return
`margin-top:
${
this
.
statusBarHeight
}
px`
},
},
created
()
{
const
sys
=
uni
.
getSystemInfoSync
()
const
statusBarHeight
=
sys
.
statusBarHeight
this
.
statusBarHeight
=
statusBarHeight
},
methods
:
{
back
()
{
uni
.
navigateBack
({})
}
},
}
export
default
{
name
:
"
uni-navbar
"
,
props
:
{
title
:
{
type
:
String
,
default
:
''
}
},
data
()
{
return
{
statusBarHeight
:
0
};
},
computed
:
{
navbarStyle
()
{
return
`margin-top:
${
this
.
statusBarHeight
}
px`
},
},
created
()
{
const
sys
=
uni
.
getSystemInfoSync
()
const
statusBarHeight
=
sys
.
statusBarHeight
this
.
statusBarHeight
=
statusBarHeight
},
methods
:
{
back
()
{
uni
.
navigateBack
({})
}
},
}
</
script
>
<
style
>
@import
'./uni-icons.css'
;
@import
'./uni-icons.css'
;
.uni-icons
{
font-family
:
UniIconsLight
;
text-decoration
:
none
;
text-align
:
center
;
font-size
:
22px
;
font-style
:
normal
;
color
:
#333
;
}
.uni-icons
{
font-family
:
UniIconsLight
;
text-decoration
:
none
;
text-align
:
center
;
font-size
:
22px
;
font-style
:
normal
;
color
:
#333
;
}
.uni-navbar
{
border
:
1px
#eee
solid
;
background-color
:
#fff
;
}
.uni-navbar
{
border
:
1px
#eee
solid
;
background-color
:
#fff
;
}
.uni-navbar-inner
{
position
:
relative
;
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
height
:
45px
;
}
.uni-navbar-inner
{
position
:
relative
;
flex-direction
:
row
;
justify-content
:
space-between
;
height
:
45px
;
}
.left-content
,
.right-content
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
width
:
45px
;
height
:
100%
;
}
.left-content
,
.right-content
{
justify-content
:
center
;
align-items
:
center
;
width
:
45px
;
height
:
100%
;
}
.uni-navbar-content
{
position
:
absolute
;
height
:
100%
;
top
:
0
;
bottom
:
0
;
left
:
45px
;
right
:
45px
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
</
style
>
\ No newline at end of file
.uni-navbar-content
{
position
:
absolute
;
height
:
100%
;
top
:
0
;
bottom
:
0
;
left
:
45px
;
right
:
45px
;
justify-content
:
center
;
align-items
:
center
;
}
</
style
>
uni_modules/uni-id-pages-x/components/uni-id-pages-x-avatar/uni-id-pages-x-avatar.uvue
浏览文件 @
4b2fe29e
...
...
@@ -113,16 +113,12 @@
// this.setAvatarFile(avatar_file)
},
uploadAvatarImg() {
if(this.readOnly){
return
}
// #ifdef MP-WEIXIN
return // 微信小程序走 bindchooseavatar方法
// #endif
// #ifndef MP-WEIXIN
// if(!this.hasLogin){
// uni.navigateTo({
...
...
@@ -139,21 +135,20 @@
uni.chooseImage({
count: 1,
crop,
success
(res) : void
{
success
: (res) =>
{
// console.log('res', res);
let tempFiles = res.tempFiles as UTSJSONObject[];
let tempFile = tempFiles[0];
let tempFileName = tempFile
.getString('name')
let tempFilePath = tempFile
.getString('path')
let tempFileName = tempFile
['name'] as string
let tempFilePath = tempFile
['path'] as string
if (tempFileName == null) {
tempFileName = ""
}
if (tempFilePath == null) {
tempFilePath = ""
}
console.log(9527,tempFileName.length);
console.log('tempFileName',tempFileName);
console.log('tempFilePath',tempFilePath);
// console.log('tempFileName',tempFileName);
// console.log('tempFilePath',tempFilePath);
let avatar_file = {
// #ifdef WEB
extname: tempFileName.split(".")[tempFileName.split(".").length - 1],
...
...
@@ -164,7 +159,7 @@
name: tempFileName,
url: tempFilePath
} as UTSJSONObject
console.log('avatar_file', avatar_file);
//
console.log('avatar_file', avatar_file);
let filePath = res.tempFilePaths[0]
//非app端剪裁头像,app端用内置的原生裁剪
...
...
@@ -191,12 +186,6 @@
});
})
// #endif
console.log("state",state)
console.log("state.userInfo",state.userInfo)
console.log("this.userInfo",this.userInfo)
let _id = this.userInfo["_id"] as string
console.log("id",_id)
// if(_id != null){
...
...
@@ -204,19 +193,17 @@
// }
let cloudPath = _id + '' + Date.now()
avatar_file.name = cloudPath
uni.showLoading({
title: "更新中",
mask: true
});
// console.log('filePath', filePath);
uniCloud.uploadFile({
filePath,
cloudPath,
})
.then(function (res) {
// console.log('res777777777',
res);
// console.log('res',
res);
avatar_file.url = res.fileID
// console.log('avatar_file111', avatar_file);
mutations.updateUserInfo({ avatar_file } as UTSJSONObject)
...
...
@@ -232,7 +219,7 @@
uni.hideLoading()
})
},
fail
(err) : void
{
fail
:(err)=>
{
console.error('chooseImage fail: ', err)
uni.showModal({
content: '失败,' + err.errMsg,
...
...
uni_modules/uni-id-pages-x/pages/userinfo/bindMobile/bindMobile.uvue
浏览文件 @
4b2fe29e
...
...
@@ -14,7 +14,7 @@
</template>
<script>
import {
state,
mutations } from '@/uni_modules/uni-id-pages-x/store.uts';
import { mutations } from '@/uni_modules/uni-id-pages-x/store.uts';
export default {
data() {
return {
...
...
@@ -44,7 +44,7 @@
},
bindMobileBySms(param : UTSJSONObject) {
// 设置(添加)验证码并重新发起
function setCaptchaRetry()
{
const setCaptchaRetry = ()=>
{
uni.showToast({
title: '请输入验证码',
icon: 'none',
...
...
@@ -70,8 +70,7 @@
uni.hideLoading()
})
.then((e : UTSJSONObject) : void => {
// console.log('then');
console.log(e);
console.log(e,"-----------");
uni.showToast({
title: '绑定成功',
icon: 'none',
...
...
@@ -107,7 +106,6 @@
})
},
popupCaptchaCancel() {
// console.log('popupCaptchaCancel');
this.smsCodeEl!.reset();
this.captcha = ""
}
...
...
uni_modules/uni-id-pages-x/pages/userinfo/setNickname/setNickname.uvue
浏览文件 @
4b2fe29e
...
...
@@ -98,8 +98,8 @@
font-size: 14px;
border-radius: 5px;
margin-right: 15px;
background-color: #0070ff;
color: #FFF;
background-color: #0070ff
!important
;
color: #FFF
!important
;
}
.submit.disabled {
...
...
uni_modules/uni-id-pages-x/store.uts
浏览文件 @
4b2fe29e
...
...
@@ -20,7 +20,7 @@ function initState() {
let userInfo = uni.getStorageSync('uni-id-pages-x-userInfo')
if (userInfo instanceof UTSJSONObject) {
state.userInfo = userInfo
//
console.log('init userInfo',userInfo);
console.log('init userInfo',userInfo);
}
} catch (e) {
console.error('init userInfo error', e);
...
...
@@ -35,7 +35,7 @@ type Mutations = {
}
export const mutations = {
updateUserInfo: function (param: null | UTSJSONObject) {
console.log('updateUserInfo', param); // param为 null 时从云端获取数据更新,为UTSJSONObject时直接根据传入的值来更新
//
console.log('updateUserInfo', param); // param为 null 时从云端获取数据更新,为UTSJSONObject时直接根据传入的值来更新
function afterUpdateUserInfo() {
// console.log('afterUpdateUserInfo', state.userInfo);
uni.setStorageSync('uni-id-pages-x-userInfo', state.userInfo)
...
...
@@ -44,7 +44,7 @@ export const mutations = {
if (param == null) {
const db = uniCloud.databaseForJQL()
const user_id = uniCloud.getCurrentUserInfo().uid
//
console.log('user_id', user_id);
console.log('user_id', user_id);
if (user_id != null) {
db.collection('uni-id-users')
.doc(user_id)
...
...
@@ -72,7 +72,6 @@ export const mutations = {
}
} else {
param.toMap().forEach((value, key) => {
console.log("updateUserInfo.", key, value)
state.userInfo.set(key, value)
})
afterUpdateUserInfo()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录