Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦想橡皮擦
uni-starter
提交
ebc9064a
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看板
提交
ebc9064a
编写于
4月 22, 2021
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://gitee.com/dcloud/base-app
上级
6924a42d
6a2358df
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
165 addition
and
132 deletion
+165
-132
baseapp.config.js
baseapp.config.js
+1
-2
pages/list/detail.vue
pages/list/detail.vue
+14
-12
pages/ucenter/settings/settings.vue
pages/ucenter/settings/settings.vue
+4
-2
pages/ucenter/ucenter.vue
pages/ucenter/ucenter.vue
+5
-6
uni_modules/uni-forms/components/uni-forms/uni-forms.vue
uni_modules/uni-forms/components/uni-forms/uni-forms.vue
+2
-1
uni_modules/uni-id-users/pages/uni-id-users/edit.vue
uni_modules/uni-id-users/pages/uni-id-users/edit.vue
+11
-7
uni_modules/uni-login-page/common/loginPage.mixin.js
uni_modules/uni-login-page/common/loginPage.mixin.js
+22
-1
uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue
uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue
+17
-15
uni_modules/uni-login-page/pages/pwd-retrieve/pwd-retrieve.vue
...odules/uni-login-page/pages/pwd-retrieve/pwd-retrieve.vue
+27
-16
uni_modules/uni-news-favorite/pages/uni-news-favorite/list.vue
...odules/uni-news-favorite/pages/uni-news-favorite/list.vue
+62
-70
未找到文件。
baseapp.config.js
浏览文件 @
ebc9064a
...
...
@@ -14,9 +14,8 @@ module.exports = {
},
"
router
"
:{
"
needLogin
"
:[
//配置需要路由拦截的页面地址,在打开这些页面之前会自动检查(不联网)uni_id_token的值是否存在/过期等
"
/pages/ucenter/edit/edit
"
,
"
/uni_modules/uni-login-page/pages/index/pwd-retrieve
"
,
"
/uni_modules/uni-id-users/pages/uni-id-users/edit
"
"
/uni_modules/uni-news-favorite/pages/uni-news-favorite/list
"
],
"
login
"
:[
"
univerify
"
,
"
smsCode
"
,
"
username
"
,
"
weixin
"
,
"
apple
"
]
//默认就是短信验证码登陆
},
...
...
pages/list/detail.vue
浏览文件 @
ebc9064a
...
...
@@ -6,25 +6,27 @@
unicloud-db 组件文档:https://uniapp.dcloud.net.cn/uniCloud/unicloud-db-component
DB Schema 规范:https://uniapp.dcloud.net.cn/uniCloud/schema
-->
<view
class=
"article"
>
<uni-nav-bar
:statusBar=
"true"
:border=
"false"
></uni-nav-bar>
<view
class=
"article"
>
<!-- #ifdef APP-PLUS -->
<uni-nav-bar
:statusBar=
"true"
:border=
"false"
></uni-nav-bar>
<!-- #endif -->
<view
class=
"article-title"
>
{{
title
}}
</view>
<unicloud-db
v-slot:default=
"
{data, loading, error, options}" :options="formData" :collection="collection"
:field="field" :getone="true" :where="where" :manual="true" ref="detail"
foreignKey="opendb-news-articles.author" @load="loadData">
<template
v-if=
"!loading && data"
>
<view
class=
"article-title"
>
{{
title
}}
</view>
<uni-list
:border=
"false"
>
<uni-list-item
thumbSize=
"lg"
:thumb=
"data.image"
>
<!-- 通过body插槽定义作者信息内容 -->
<view
slot=
"body"
class=
"header-content"
>
<view
class=
"uni-title"
>
{{
data
.
author
&&
data
.
author
[
0
].
username
}}
</view>
<view
class=
"uni-note"
>
更新于
<uni-dateformat
:date=
"data.last_modify_date"
format=
"yyyy-MM-dd"
:threshold=
"[60000, 2592000000]"
/>
</view>
</view>
<view
slot=
"footer"
class=
"footer"
>
<button
@
click=
"followClick"
class=
"footer-button"
>
关注
</button>
<view
slot=
"footer"
class=
"footer"
>
<view
class=
"uni-note"
>
更新于
<uni-dateformat
:date=
"data.last_modify_date"
format=
"yyyy-MM-dd hh:mm"
:threshold=
"[60000, 2592000000]"
/>
</view>
<!--
<button
@
click=
"followClick"
class=
"footer-button"
>
关注
</button>
-->
</view>
</uni-list-item>
</uni-list>
...
...
@@ -61,7 +63,7 @@
return
{
// 当前显示 _id
id
:
""
,
title
:
''
,
title
:
'
title
'
,
// 数据表名
collection
:
'
opendb-news-articles,uni-id-users
'
,
// 查询字段,多个字段用 , 分割
...
...
@@ -92,7 +94,7 @@
uni
.
setNavigationBarTitle
({
title
:
event
.
title
})
}
}
},
onNavigationBarButtonTap
(
event
)
{
if
(
event
.
type
==
'
share
'
)
{
...
...
@@ -136,7 +138,7 @@
}
})
.
then
(
res
=>
{
console
.
log
(
res
);
//
console.log(res);
})
.
catch
(
err
=>
{
console
.
log
(
err
);
...
...
pages/ucenter/settings/settings.vue
浏览文件 @
ebc9064a
...
...
@@ -205,9 +205,11 @@
url
:
'
/uni_modules/uni-login-page/pages/index/index
'
});
}
},
},
/**
* 每一项的点击事件
*/
itemClick
(
item
)
{
console
.
log
(
item
);
if
(
item
.
event
)
{
this
[
item
.
event
](
item
);
}
...
...
pages/ucenter/ucenter.vue
浏览文件 @
ebc9064a
...
...
@@ -112,9 +112,6 @@
// #endif
},
methods
:
{
...
mapMutations
({
logout
:
'
user/logout
'
}),
toSettings
()
{
uni
.
navigateTo
({
url
:
"
/pages/ucenter/settings/settings
"
...
...
@@ -175,10 +172,12 @@
uni
.
showLoading
({
mask
:
true
})
db
.
collection
(
dbCollectionName
).
field
(
'
score,balance
'
).
get
().
then
((
res
)
=>
{
db
.
collection
(
dbCollectionName
).
where
(
'
user_id == $env.uid
'
).
field
(
'
score,balance
'
).
get
().
then
((
res
)
=>
{
const
data
=
res
.
result
.
data
[
0
];
let
msg
=
''
;
msg
=
data
?
(
'
当前积分为
'
+
data
.
balance
)
:
'
当前无积分
'
;
uni
.
showToast
({
title
:
'
当前积分为
'
+
data
.
balance
,
title
:
msg
,
icon
:
'
none
'
});
}).
catch
((
err
)
=>
{
...
...
@@ -333,4 +332,4 @@
/* #endif */
background-color
:
#DD524D
;
}
</
style
>
</
style
>
uni_modules/uni-forms/components/uni-forms/uni-forms.vue
浏览文件 @
ebc9064a
...
...
@@ -353,7 +353,8 @@
this
.
formData
[
i
]
=
this
.
_getValue
(
i
,
this
.
value
[
i
])
}
}
}
}
console
.
log
(
this
.
formData
,
this
.
formRules
);
return
this
.
validateAll
(
this
.
formData
,
'
submit
'
,
callback
)
},
...
...
uni_modules/uni-id-users/pages/uni-id-users/edit.vue
浏览文件 @
ebc9064a
<
template
>
<view
class=
"uni-container"
>
<uni-forms
ref=
"form"
:value=
"formData"
:rules=
"rules"
validate-trigger=
"submit"
err-show-type=
"toast"
>
<uni-
list-item
>
<template
v-slot:body
>
<uni-
forms-item
name=
"avatar"
>
<template>
<view
class=
"avatar-box"
>
<image
class=
"avatar-img"
:src=
"formData.avatar || '/static/uni-center/logo.png'"
@
click=
"chooseImg"
mode=
"aspectFill"
></image>
</view>
</
template
>
</uni-
list
-item>
</uni-
forms
-item>
<uni-forms-item
name=
"gender"
label=
"性别"
required
>
<uni-data-checkbox
v-model=
"formData.gender"
:localdata=
"formOptions.gender_localdata"
/>
</uni-forms-item>
...
...
@@ -29,7 +29,8 @@
validator
}
from
'
../../js_sdk/validator/uni-id-users.js
'
;
import
{
mapMutations
mapMutations
,
mapGetters
}
from
'
vuex
'
;
const
db
=
uniCloud
.
database
();
const
dbCollectionName
=
'
uni-id-users
'
;
...
...
@@ -71,10 +72,14 @@
...
getValidator
([
"
avatar
"
,
"
gender
"
,
"
nickname
"
])
}
}
},
computed
:{
...
mapGetters
({
userInfo
:
'
user/info
'
})
},
onLoad
(
e
)
{
let
id
=
"
60795c140983f8000192f235
"
;
id
=
uni
.
getStorageSync
(
'
uni_id_uid
'
);
let
id
=
uni
.
getStorageSync
(
'
uni_id_uid
'
)
||
this
.
userInfo
.
_id
;
this
.
formDataId
=
id
this
.
getDetail
(
id
)
},
...
...
@@ -138,7 +143,6 @@
title
:
'
修改成功
'
})
this
.
setUserInfo
(
value
);
// this.getOpenerEventChannel().emit('refreshData')
setTimeout
(()
=>
uni
.
navigateBack
(),
500
)
}).
catch
((
err
)
=>
{
uni
.
showModal
({
...
...
uni_modules/uni-login-page/common/loginPage.mixin.js
浏览文件 @
ebc9064a
...
...
@@ -21,7 +21,8 @@ let mixin = {
formData
:{
phone
:
''
,
code
:
''
,
pwd
:
''
pwd
:
''
,
pwd2
:
''
},
rules
:
{
phone
:{
...
...
@@ -56,6 +57,26 @@ let mixin = {
errorMessage
:
'
密码应为6到20位
'
,
}
]
},
pwd2
:{
rules
:[{
required
:
true
,
errorMessage
:
'
请确认密码
'
,
},
{
pattern
:
/^.
{6,20}
$/
,
errorMessage
:
'
密码应为6到20位
'
,
},
{
validateFunction
:
function
(
rule
,
value
,
data
,
callback
){
console
.
log
(
value
);
if
(
value
!=
data
.
pwd
){
callback
(
'
两次输入密码不一致
'
)
};
return
true
}
}
]
}
}
}
...
...
uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue
浏览文件 @
ebc9064a
...
...
@@ -17,19 +17,21 @@
<!--
</picker>
-->
</
template
>
</uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"pwd"
>
<uni-easyinput
type=
"password"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.pwd"
placeholder=
"请输入密码"
></uni-easyinput>
</uni-forms-item>
<button
class=
"send-btn-box"
type=
"primary"
@
click=
"pwdLogin"
>
登录
</button>
<button
class=
"send-btn-box"
type=
"primary"
@
click=
"pwdLogin"
>
登录
</button>
</uni-forms>
<!-- 忘记密码 -->
<view
class=
"auth-box"
>
<text
class=
"login-text"
@
click=
"toRetrievePwd"
>
忘记密码
</text>
<text
class=
"login-text"
@
click=
"toRetrievePwd"
>
注册账号
</text>
</view>
</view>
<!-- <button type="primary" plain class="toRegister" @click="toRegister">注册账号</button> -->
</view>
</view>
</view>
<uni-quick-login
ref=
"uniQuickLogin"
></uni-quick-login>
</view>
</template>
...
...
@@ -80,7 +82,7 @@
uni
.
hideLoading
()
console
.
log
(
e
.
result
);
if
(
e
.
result
.
code
===
0
){
this
.
loginSuccess
(
e
.
result
)
this
.
loginSuccess
(
e
.
result
)
}
else
{
uni
.
showModal
({
title
:
'
错误
'
,
...
...
@@ -113,13 +115,13 @@
icon
:
'
none
'
});
// this.currenPhoneArea = this.phoneArea[event.detail.value];
},
/* 前往注册 */
toRegister
(
e
){
console
.
log
(
e
);
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-login-page/pages/register/register
'
})
},
/* 前往注册 */
toRegister
(
e
){
console
.
log
(
e
);
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-login-page/pages/register/register
'
})
}
}
}
...
...
@@ -136,9 +138,9 @@
}
.login-text-sub
{
color
:
#8a8f8b
;
}
.toRegister
{
margin-top
:
80px
;
width
:
600
rpx
;
}
.toRegister
{
margin-top
:
80px
;
width
:
600
rpx
;
}
</
style
>
uni_modules/uni-login-page/pages/pwd-retrieve/pwd-retrieve.vue
浏览文件 @
ebc9064a
...
...
@@ -3,22 +3,30 @@
<view
class=
"wrap-content"
>
<view
class=
"content"
>
<!-- 顶部文字 -->
<text
class=
"content-top-title"
>
重置密码
</text>
<login-ikonw
v-show=
"
formData.p
hone"
class=
"login-iknow"
:text=
"tipText"
></login-ikonw>
<text
class=
"content-top-title"
>
重置密码
</text>
<login-ikonw
v-show=
"
isP
hone"
class=
"login-iknow"
:text=
"tipText"
></login-ikonw>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-forms
ref=
"form"
:value=
"formData"
:rules=
"rules"
>
<uni-forms-item
name=
"phone"
>
<uni-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.phone"
maxlength=
"11"
placeholder=
"请输入手机号"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"code"
>
<uni-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<login-short-code
ref=
"shortCode"
:phone=
"formData.phone"
></login-short-code>
</
template
>
</uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"pwd"
>
<uni-easyinput
type=
"password"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.pwd"
placeholder=
"请输入新密码"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"pwd2"
>
<uni-easyinput
type=
"password"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.pwd2"
placeholder=
"请确认新密码"
></uni-easyinput>
</uni-forms-item>
<button
class=
"send-btn-box"
:disabled=
"!canSubmit"
:type=
"canSubmit?'primary':'default'"
@
click=
"submit"
>
完成
</button>
</uni-forms>
...
...
@@ -52,7 +60,7 @@ import mixin from '../../common/loginPage.mixin.js';
},
onReady
()
{
if
(
this
.
formData
.
phone
){
this
.
$refs
.
shortCode
.
start
();
//
this.$refs.shortCode.start();
}
},
methods
:
{
...
...
@@ -60,19 +68,22 @@ import mixin from '../../common/loginPage.mixin.js';
* 完成并提交
*/
submit
(){
this
.
request
(
'
user-center/resetPwdBySmsCode
'
,{
"
mobile
"
:
this
.
formData
.
phone
,
"
code
"
:
this
.
formData
.
code
,
"
password
"
:
this
.
formData
.
pwd
},(
data
,
result
)
=>
{
console
.
log
(
result
);
uni
.
showToast
({
title
:
result
.
msg
,
icon
:
'
none
'
});
if
(
result
.
code
===
0
){
uni
.
navigateBack
()
}
this
.
$refs
.
form
.
submit
()
.
then
(
res
=>
{
this
.
request
(
'
user-center/resetPwdBySmsCode
'
,{
"
mobile
"
:
this
.
formData
.
phone
,
"
code
"
:
this
.
formData
.
code
,
"
password
"
:
this
.
formData
.
pwd
},(
data
,
result
)
=>
{
console
.
log
(
result
);
uni
.
showToast
({
title
:
result
.
msg
,
icon
:
'
none
'
});
if
(
result
.
code
===
0
){
uni
.
navigateBack
()
}
})
})
}
}
...
...
uni_modules/uni-news-favorite/pages/uni-news-favorite/list.vue
浏览文件 @
ebc9064a
<
template
>
<view
class=
"container"
>
<unicloud-db
ref=
"udb"
v-slot:default=
"
{data, pagination, loading, hasMore, error}" collection="opendb-news-favorite">
<view
v-if=
"error"
>
{{
error
.
message
}}
</view>
<view
v-else-if=
"data"
>
<uni-list>
<uni-list-item
v-for=
"(item, index) in data"
:key=
"index"
:clickable=
"true"
@
click=
"handleItemClick(item)"
>
<view
slot=
"body"
>
<text>
{{
item
.
article_title
||
item
.
article_id
}}
</text>
<uni-dateformat
class=
"article-date"
:date=
"item.update_date"
format=
"yyyy-MM-dd hh:mm"
:threshold=
"[0, 0]"
/>
</view>
</uni-list-item>
</uni-list>
</view>
<uni-load-more
:status=
"loading?'loading':(hasMore ? 'more' : 'noMore')"
></uni-load-more>
</unicloud-db>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
loadMore
:
{
contentdown
:
''
,
contentrefresh
:
''
,
contentnomore
:
''
}
}
},
onPullDownRefresh
()
{
this
.
$refs
.
udb
.
loadData
({
clear
:
true
},
()
=>
{
uni
.
stopPullDownRefresh
()
})
},
onReachBottom
()
{
this
.
$refs
.
udb
.
loadMore
()
},
methods
:
{
handleItemClick
(
item
)
{
console
.
log
(
item
);
uni
.
navigateTo
({
url
:
'
/pages/list/detail?id=
'
+
item
.
article_id
+
'
&title=
'
+
(
item
.
article_title
||
''
)
})
},
fabClick
()
{
// 打开新增页面
uni
.
navigateTo
({
url
:
'
./add
'
,
events
:
{
// 监听新增数据成功后, 刷新当前页面数据
refreshData
:
()
=>
{
this
.
$refs
.
udb
.
loadData
({
clear
:
true
})
}
}
})
}
}
}
</
script
>
<
style
>
.article-date
{
color
:
#C8C7CC
;
}
<
template
>
<view
class=
"container"
>
<unicloud-db
ref=
"udb"
v-slot:default=
"
{data, pagination, loading, hasMore, error}" where="user_id == $env.uid"
orderby="update_date desc" collection="opendb-news-favorite" @load="isLoading == false" @error="isLoading == false">
<view
v-if=
"data && data.length"
>
<uni-list>
<uni-list-item
v-for=
"(item, index) in data"
:key=
"index"
:clickable=
"true"
@
click=
"handleItemClick(item)"
>
<view
slot=
"body"
>
<text>
{{
item
.
article_title
||
item
.
article_id
}}
</text>
<uni-dateformat
class=
"article-date"
:date=
"item.update_date"
format=
"yyyy-MM-dd hh:mm"
:threshold=
"[0, 0]"
/>
</view>
</uni-list-item>
</uni-list>
</view>
<uni-nodata
v-else
:isLoading=
"isLoading"
@
retry=
"refreshData"
></uni-nodata>
<uni-load-more
:status=
"loading?'loading':(hasMore ? 'more' : 'noMore')"
></uni-load-more>
</unicloud-db>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
isLoading
:
true
,
loadMore
:
{
contentdown
:
''
,
contentrefresh
:
''
,
contentnomore
:
''
,
}
}
},
onPullDownRefresh
()
{
this
.
refreshData
();
},
onReachBottom
()
{
this
.
$refs
.
udb
.
loadMore
()
},
methods
:
{
refreshData
()
{
this
.
$refs
.
udb
.
loadData
({
clear
:
true
},
(
res
)
=>
{
console
.
log
(
res
);
uni
.
stopPullDownRefresh
()
})
},
handleItemClick
(
item
)
{
uni
.
navigateTo
({
url
:
'
/pages/list/detail?id=
'
+
item
.
article_id
+
'
&title=
'
+
(
item
.
article_title
||
''
)
})
}
}
}
</
script
>
<
style
>
.article-date
{
color
:
#C8C7CC
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录