Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
a3cad55d
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4684
Star
229
Fork
210
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a3cad55d
编写于
4月 25, 2021
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改组件名称
上级
1882983f
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
242 addition
and
258 deletion
+242
-258
App.vue
App.vue
+1
-1
baseapp.config.js
baseapp.config.js
+5
-1
common/appInit.js
common/appInit.js
+5
-1
components/send-sms-code/send-sms-code.vue
components/send-sms-code/send-sms-code.vue
+13
-33
js_sdk/request.js
js_sdk/request.js
+0
-17
manifest.json
manifest.json
+17
-8
pages.json
pages.json
+14
-13
pages/grid/grid.vue
pages/grid/grid.vue
+1
-3
pages/ucenter/edit/bind-mobile/bind-mobile.vue
pages/ucenter/edit/bind-mobile/bind-mobile.vue
+30
-31
pages/ucenter/edit/edit.vue
pages/ucenter/edit/edit.vue
+3
-1
pages/ucenter/login-page/phone-code/phone-code.vue
pages/ucenter/login-page/phone-code/phone-code.vue
+71
-71
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
+60
-60
pages/ucenter/ucenter.vue
pages/ucenter/ucenter.vue
+7
-4
uniCloud-aliyun/cloudfunctions/user-center/index.js
uniCloud-aliyun/cloudfunctions/user-center/index.js
+15
-14
未找到文件。
App.vue
浏览文件 @
a3cad55d
...
...
@@ -10,7 +10,7 @@
console
.
log
(
'
App Launch
'
)
initApp
();
// #ifdef APP-PLUS
checkIsAgree
();
//checkIsAgree(); 暂时先用默认生成的,自定义的等待原生支持后实现。因为启动vue界面时已经,请求了部分权限这并不符合国家的法规
// #endif
//#ifdef APP-NVUE || H5
...
...
baseapp.config.js
浏览文件 @
a3cad55d
...
...
@@ -34,6 +34,10 @@ module.exports = {
"
url
"
:
"
https://ask.dcloud.net.cn/protocol.html
"
}
],
"
download
"
:
"
https://m3w.cn/uniapp
"
"
download
"
:
"
https://m3w.cn/uniapp
"
},
"
marketId
"
:{
//用于打开应用市场评分界面
"
ios
"
:
"
id1417078253
"
,
"
android
"
:
"
123456
"
}
}
common/appInit.js
浏览文件 @
a3cad55d
...
...
@@ -5,7 +5,11 @@ import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-ch
// #endif
export
default
function
()
{
// 初始化appVersion(仅app生效)
initAppVersion
();
initAppVersion
();
// baseappConfig挂载到getApp().
getApp
({
allowDefault
:
true
}).
config
=
baseappConfig
;
//自定义路由拦截
const
{
...
...
components/
login-short-code/login-short
-code.vue
→
components/
send-sms-code/send-sms
-code.vue
浏览文件 @
a3cad55d
...
...
@@ -20,7 +20,7 @@
}
}
export
default
{
name
:
"
login-short
-code
"
,
name
:
"
send-sms
-code
"
,
props
:
{
/**
* 倒计时时长 s
...
...
@@ -35,6 +35,15 @@
phone
:
{
type
:
[
String
,
Number
],
default
:
''
},
/*
验证码类型,用于防止不同功能的验证码混用,目前支持的类型login登录、register注册、bind绑定手机、unbind解绑手机
*/
codeType
:{
type
:
String
,
default
(){
return
'
login
'
}
}
},
data
()
{
...
...
@@ -69,7 +78,7 @@
this
.
request
(
'
user-center/sendSmsCode
'
,
{
"
mobile
"
:
this
.
phone
,
"
type
"
:
"
login
"
"
type
"
:
this
.
codeType
},(
data
,
result
)
=>
{
console
.
log
(
data
,
result
);
uni
.
showToast
({
...
...
@@ -79,37 +88,8 @@
this
.
reverseNumber
=
Number
(
this
.
count
);
this
.
getCode
();
this
.
$emit
(
'
getCode
'
);
})
// uniCloud.callFunction({
// "name": "user-center",
// "data": {
// "action": "sendSmsCode",
// "params": {
// "mobile": this.phone,
// "type": "login"
// }
// },
// success: (e) => {
// uni.showToast({
// title: "短信验证码发送成功",
// icon: 'none'
// });
// this.reverseNumber = Number(this.count);
// this.getCode();
// this.$emit('getCode');
// },
// fail: (err) => {
// console.log(err);
// uni.showToast({
// title: '短信验证码发送失败',
// icon: 'none'
// });
// },
// complete: () => {
// uni.hideLoading()
// }
// })
}
)
},
getCode
()
{
if
(
this
.
reverseNumber
==
0
)
{
...
...
js_sdk/request.js
浏览文件 @
a3cad55d
...
...
@@ -9,7 +9,6 @@ const debug = true;//开启后,会alert错误信息
export
default
function
request
(
name
,
params
,
callback
=
false
,{
showLoading
=
false
,
loadText
=
''
,
fail
=
()
=>
{}}
=
{}){
// console.log('request');
showLoading
||
loadText
?
uni
.
showLoading
({
title
:
loadText
}):
''
;
let
routers
=
name
.
split
(
'
/
'
);
var
action
=
false
if
(
routers
.
length
>
1
){
...
...
@@ -23,28 +22,12 @@ export default function request(name,params,callback=false,{showLoading=false,lo
console
.
log
(
e
);
const
{
result
:{
data
,
code
}}
=
e
console
.
log
(
data
,
code
);
if
(
code
!=
0
)
{
if
(
debug
){
uni
.
showModal
({
content
:
JSON
.
stringify
(
e
),
showCancel
:
false
,
confirmText
:
'
知道了
'
})
}
}
resolve
(
e
)
return
callback
(
data
,
e
.
result
,
e
)
},
fail
(
err
){
reject
(
err
)
console
.
log
(
err
);
if
(
debug
){
uni
.
showModal
({
content
:
JSON
.
stringify
(
err
),
showCancel
:
false
,
confirmText
:
'
知道了
'
})
}
fail
(
err
)
},
complete
()
{
...
...
manifest.json
浏览文件 @
a3cad55d
...
...
@@ -7,6 +7,15 @@
"transformPx"
:
false
,
/*
5
+App特有相关
*/
"app-plus"
:
{
"privacy"
:
{
"prompt"
:
"template"
,
"template"
:
{
"title"
:
"服务协议和隐私政策"
,
"message"
:
" 请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href=
\"\"
>《服务协议》</a>和<a href=
\"\"
>《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。"
,
"buttonAccept"
:
"我知道了"
,
"buttonRefuse"
:
"暂不同意"
}
},
"compatible"
:
{
"ignoreVersion"
:
true
//
true
表示忽略版本检查提示框,HBuilderX
1.9
.
0
及以上版本支持
},
...
...
@@ -31,14 +40,14 @@
"distribute"
:
{
/*
android打包配置
*/
"android"
:
{
"permissionExternalStorage"
:
{
"request"
:
"none"
,
"prompt"
:
"应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。"
},
"permissionPhoneState"
:
{
"request"
:
"none"
,
"prompt"
:
"为保证您正常、安全地使用,需要获取设备识别码(部分手机提示为获取手机号码)使用权限,请允许。"
},
//
"permissionExternalStorage"
:
{
//
"request"
:
"none"
,
//
"prompt"
:
"应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。"
//
},
//
"permissionPhoneState"
:
{
//
"request"
:
"none"
,
//
"prompt"
:
"为保证您正常、安全地使用,需要获取设备识别码(部分手机提示为获取手机号码)使用权限,请允许。"
//
},
"permissions"
:
[
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
...
...
pages.json
浏览文件 @
a3cad55d
...
...
@@ -61,16 +61,16 @@
}
},
{
"path"
:
"pages/ucenter/edit/bind-mobile/bind-mobile"
,
"style"
:
{
"navigationBarTitleText"
:
"绑定手机号码"
}
},
{
"path"
:
"pages/ucenter/ucenter"
,
"style"
:
{
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/ucenter/ucenter"
,
"style"
:
{
"navigationStyle"
:
"custom"
}
},{
},
{
"path"
:
"uni_modules/uni-feedback/pages/opendb-feedback/list"
,
"style"
:
{
"navigationBarTitleText"
:
"常见问题"
...
...
@@ -90,8 +90,7 @@
"style"
:
{
"navigationBarTitleText"
:
"关于"
//
#ifdef
APP-PLUS
,
"app-plus"
:
{
,
"app-plus"
:
{
"titleNView"
:
{
"buttons"
:
[{
"type"
:
"share"
...
...
@@ -138,7 +137,9 @@
"path"
:
"uni_modules/uni-agree/pages/uni-agree/uni-agree"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"app-plus"
:{
"popGesture"
:
"none"
}
"app-plus"
:
{
"popGesture"
:
"none"
}
}
},
{
"path"
:
"pages/ucenter/settings/settings"
,
...
...
@@ -195,8 +196,8 @@
},
{
"path"
:
"uni_modules/uni-news-favorite/pages/uni-news-favorite/list"
,
"style"
:{
"path"
:
"uni_modules/uni-news-favorite/pages/uni-news-favorite/list"
,
"style"
:
{
"navigationBarTitleText"
:
"阅读记录"
,
"enablePullDownRefresh"
:
false
}
...
...
@@ -246,4 +247,4 @@
"text"
:
"我的"
}]
}
}
}
pages/grid/grid.vue
浏览文件 @
a3cad55d
...
...
@@ -9,7 +9,7 @@
disabled
/>
</
template
>
<!-- banner -->
<unicloud-db
ref=
"bannerdb"
v-slot:default=
"{data, loading, error, options}"
:collection=
"collection
"
<unicloud-db
ref=
"bannerdb"
v-slot:default=
"{data, loading, error, options}"
collection=
"opendb-banner
"
:field=
"field"
@
load=
"load"
>
<uni-swiper-dot
class=
"uni-swiper-dot-box"
@
clickItem=
"clickItem"
:info=
"data || bannerFormate(data, loading)"
:current=
"current"
:mode=
"mode"
:dots-styles=
"dotsStyles"
field=
"content"
>
...
...
@@ -88,8 +88,6 @@
text
:
'
Grid 9
'
}
],
collection
:
'
opendb-banner
'
,
// 查询字段,多个字段用 , 分割
field
:
'
_id,bannerfile,open_url,title
'
,
where
:
'
category_id==grid
'
,
...
...
pages/ucenter/edit/bind-mobile/bind-mobile.vue
浏览文件 @
a3cad55d
<
template
>
<view
class=
"box"
>
<view
class=
"box"
>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-easyinput
focus
type=
"number"
class=
"phone-
input-box"
:inputBorder=
"false"
v-model=
"formData.phone"
<uni-easyinput
clearable
focus
type=
"number"
class=
"
input-box"
:inputBorder=
"false"
v-model=
"formData.phone"
maxlength=
"11"
placeholder=
"请输入手机号"
></uni-easyinput>
<uni-easyinput
type=
"number"
class=
"phone-
input-box"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
<uni-easyinput
clearable
type=
"number"
class=
"
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>
<
send-sms-code
ref=
"shortCode"
code-type=
"bind"
:phone=
"formData.phone"
></send-sms
-code>
</
template
>
</uni-easyinput>
<button
class=
"send-btn-box"
type=
"primary"
@
click=
"submit"
>
提交
</button>
</view>
</template>
<
script
>
import
{
mapMutations
,
mapGetters
<
script
>
import
{
mapMutations
,
mapGetters
}
from
'
vuex
'
;
export
default
{
data
()
{
...
...
@@ -39,28 +39,28 @@
},
onReady
()
{
},
methods
:
{
...
mapMutations
({
setUserInfo
:
'
user/login
'
methods
:
{
...
mapMutations
({
setUserInfo
:
'
user/login
'
}),
/**
* 完成并提交
*/
submit
()
{
console
.
log
(
this
.
formData
);
this
.
request
(
'
user-center/bind_mobile_by_sms
'
,
{
"
mobile
"
:
this
.
formData
.
phone
,
"
code
"
:
this
.
formData
.
code
},
(
data
,
result
)
=>
{
console
.
log
(
result
);
this
.
setUserInfo
({
"
mobile
"
:
result
.
mobile
})
uni
.
showToast
({
title
:
result
.
msg
,
icon
:
'
none
'
});
if
(
result
.
code
===
0
)
{
uni
.
navigateBack
()
}
submit
()
{
console
.
log
(
this
.
formData
);
this
.
request
(
'
user-center/bind_mobile_by_sms
'
,
{
"
mobile
"
:
this
.
formData
.
phone
,
"
code
"
:
this
.
formData
.
code
},
(
data
,
result
)
=>
{
console
.
log
(
result
);
this
.
setUserInfo
({
"
mobile
"
:
result
.
mobile
})
uni
.
showToast
({
title
:
result
.
msg
,
icon
:
'
none
'
});
if
(
result
.
code
===
0
)
{
uni
.
navigateBack
()
}
})
}
}
...
...
@@ -71,16 +71,15 @@
.box
{
align-items
:
center
;
justify-content
:
center
;
padding
:
50
rpx
;
padding-top
:
10px
;
}
.box
/
deep
/
.uni-easyinput__content
{
height
:
45
px
;
height
:
50
px
;
}
.phone-input-box
{
width
:
650
rpx
;
height
:
50px
;
.input-box
{
margin-top
:
16px
;
background-color
:
#f9f9f9
;
border-radius
:
6
rpx
;
...
...
@@ -92,4 +91,4 @@
width
:
650
rpx
;
margin-top
:
15px
;
}
</
style
>
</
style
>
pages/ucenter/edit/edit.vue
浏览文件 @
a3cad55d
...
...
@@ -91,7 +91,9 @@
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
this
.
bindMobileBySmsCode
()
if
(
err
.
code
==
'
30002
'
){
this
.
bindMobileBySmsCode
()
}
}
})
},
...
...
pages/ucenter/login-page/phone-code/phone-code.vue
浏览文件 @
a3cad55d
...
...
@@ -5,31 +5,31 @@
<!-- 顶部文字 -->
<text
class=
"content-top-title"
>
请输入验证码
</text>
<login-ikonw
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-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<
login-short-code
:phone=
"formData.phone"
ref=
"shortCode"
></login-short-code>
</
template
>
</uni-easyinput>
</uni-forms-item>
<button
class=
"send-btn-box"
:disabled=
"!canSubmit"
:type=
"canSubmit?'primary':'default'"
@
click=
"submit"
>
登录
</button>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<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-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<
send-sms-code
:phone=
"formData.phone"
ref=
"shortCode"
></send-sms-code>
</
template
>
</uni-easyinput>
</uni-forms-item>
<button
class=
"send-btn-box"
:disabled=
"!canSubmit"
:type=
"canSubmit?'primary':'default'"
@
click=
"submit"
>
登录
</button>
</uni-forms>
</view>
</view>
</view>
<uni-quick-login></uni-quick-login>
</view>
</template>
<
script
>
<
script
>
import
mixin
from
'
../common/loginPage.mixin.js
'
;
export
default
{
export
default
{
mixins
:[
mixin
],
data
()
{
return
{
...
...
@@ -47,62 +47,62 @@
onLoad
({
phoneNumber
,
phoneArea
})
{
this
.
formData
.
phone
=
phoneNumber
;
this
.
currenPhoneArea
=
'
+
'
+
Number
(
phoneArea
);
},
onReady
()
{
this
.
$refs
.
shortCode
.
start
();
},
methods
:
{
/**
* 完成并提交
*/
submit
(){
uniCloud
.
callFunction
({
//联网验证登陆
"
name
"
:
"
user-center
"
,
"
data
"
:
{
"
action
"
:
"
loginBySms
"
,
"
params
"
:{
"
mobile
"
:
this
.
formData
.
phone
,
"
code
"
:
this
.
formData
.
code
}
},
success
:
async
(
e
)
=>
{
uni
.
hideLoading
()
console
.
log
(
e
.
result
);
if
(
e
.
result
.
code
===
0
){
this
.
loginSuccess
(
e
.
result
)
}
else
{
uni
.
showModal
({
title
:
'
错误
'
,
content
:
e
.
result
.
msg
,
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
}
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
uni
.
showModal
({
title
:
'
错误
'
,
content
:
JSON
.
stringify
(
err
),
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
if
(
err
.
errCode
===
30002
){
}
},
complete
:
()
=>
{
uni
.
hideLoading
()
}
})
onReady
()
{
this
.
$refs
.
shortCode
.
start
();
},
methods
:
{
/**
* 完成并提交
*/
submit
(){
uniCloud
.
callFunction
({
//联网验证登陆
"
name
"
:
"
user-center
"
,
"
data
"
:
{
"
action
"
:
"
loginBySms
"
,
"
params
"
:{
"
mobile
"
:
this
.
formData
.
phone
,
"
code
"
:
this
.
formData
.
code
}
},
success
:
async
(
e
)
=>
{
uni
.
hideLoading
()
console
.
log
(
e
.
result
);
if
(
e
.
result
.
code
===
0
){
this
.
loginSuccess
(
e
.
result
)
}
else
{
uni
.
showModal
({
title
:
'
错误
'
,
content
:
e
.
result
.
msg
,
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
}
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
uni
.
showModal
({
title
:
'
错误
'
,
content
:
JSON
.
stringify
(
err
),
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
if
(
err
.
errCode
===
30002
){
}
},
complete
:
()
=>
{
uni
.
hideLoading
()
}
})
}
}
}
</
script
>
<
style
>
@import
url("../common/loginPage.css")
;
.phone-input-box
{
margin-top
:
10px
;
}
</
style
>
<
style
>
@import
url("../common/loginPage.css")
;
.phone-input-box
{
margin-top
:
10px
;
}
</
style
>
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
浏览文件 @
a3cad55d
...
...
@@ -3,46 +3,46 @@
<view
class=
"wrap-content"
>
<view
class=
"content"
>
<!-- 顶部文字 -->
<text
class=
"content-top-title"
>
重置密码
</text>
<text
class=
"content-top-title"
>
重置密码
</text>
<login-ikonw
v-show=
"isPhone"
class=
"login-iknow"
:text=
"tipText"
></login-ikonw>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-forms
ref=
"form"
:value=
"formData"
:rules=
"rules"
>
<uni-forms-item
name=
"phone"
>
<!-- focus规则如果上一页携带来“手机号码”数据就focus验证码输入框,否则focus手机号码输入框 -->
<uni-easyinput
:focus=
"!formData.phone.length"
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
:focus=
"formData.phone.length"
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
ref=
"form"
:value=
"formData"
:rules=
"rules"
>
<uni-forms-item
name=
"phone"
>
<!-- focus规则如果上一页携带来“手机号码”数据就focus验证码输入框,否则focus手机号码输入框 -->
<uni-easyinput
:focus=
"!formData.phone.length"
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
:focus=
"formData.phone.length"
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<
send-sms-code
ref=
"shortCode"
:phone=
"formData.phone"
></send-sms-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>
</view>
</view>
</view>
</template>
<
script
>
<
script
>
import
mixin
from
'
../common/loginPage.mixin.js
'
;
export
default
{
export
default
{
mixins
:[
mixin
],
data
()
{
return
{
currenPhoneArea
:
''
currenPhoneArea
:
''
}
},
computed
:
{
...
...
@@ -58,42 +58,42 @@ import mixin from '../common/loginPage.mixin.js';
this
.
formData
.
phone
=
event
.
phoneNumber
;
this
.
currenPhoneArea
=
'
+
'
+
Number
(
event
.
phoneArea
);
}
},
onReady
()
{
if
(
this
.
formData
.
phone
){
this
.
$refs
.
shortCode
.
start
();
}
},
methods
:
{
/**
* 完成并提交
*/
submit
(){
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
()
}
})
})
onReady
()
{
if
(
this
.
formData
.
phone
){
this
.
$refs
.
shortCode
.
start
();
}
},
methods
:
{
/**
* 完成并提交
*/
submit
(){
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
()
}
})
})
}
}
}
</
script
>
<
style
>
<
style
>
@import
url("../common/loginPage.css")
;
.
phone-input-box
{
margin-
top
:
20
r
px
;
.
content-top-title
{
margin-
bottom
:
6
px
;
}
</
style
>
</
style
>
pages/ucenter/ucenter.vue
浏览文件 @
a3cad55d
...
...
@@ -111,7 +111,10 @@
appVersion
()
{
return
getApp
().
appVersion
}
// #endif
// #endif
,
appConfig
(){
return
getApp
().
config
}
},
methods
:
{
...
mapMutations
({
...
...
@@ -156,15 +159,15 @@
* 去应用市场评分
*/
gotoMarket
()
{
// #ifdef APP-PLUS
// #ifdef APP-PLUS
if
(
uni
.
getSystemInfoSync
().
platform
==
"
ios
"
)
{
// 这里填写appstore应用id
let
appstoreid
=
'
id1417078253
'
;
let
appstoreid
=
this
.
appConfig
.
marketId
.
ios
;
//
'id1417078253';
plus
.
runtime
.
openURL
(
"
itms-apps://
"
+
'
itunes.apple.com/cn/app/wechat/
'
+
appstoreid
+
'
?mt=8
'
);
}
if
(
uni
.
getSystemInfoSync
().
platform
==
"
android
"
)
{
var
Uri
=
plus
.
android
.
importClass
(
"
android.net.Uri
"
);
var
uri
=
Uri
.
parse
(
"
market://details?id=
"
+
plus
.
runtime
.
app
id
);
var
uri
=
Uri
.
parse
(
"
market://details?id=
"
+
this
.
appConfig
.
marketId
.
andro
id
);
var
Intent
=
plus
.
android
.
importClass
(
'
android.content.Intent
'
);
var
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
uri
);
var
main
=
plus
.
android
.
runtimeMainActivity
();
...
...
uniCloud-aliyun/cloudfunctions/user-center/index.js
浏览文件 @
a3cad55d
...
...
@@ -124,19 +124,20 @@ exports.main = async (event, context) => {
mobile
:
params
.
mobile
,
code
:
params
.
code
});
let
verifyCode
=
await
uniID
.
verifyCode
({
mobile
:
params
.
mobile
,
code
:
params
.
code
// let verifyCode = await uniID.verifyCode({
// mobile: params.mobile,
// code: params.code
// })
// if (verifyCode.code === 0) {
// } else {
// res = verifyCode
// }
res
=
await
uniID
.
bindMobile
({
uid
:
params
.
uid
,
mobile
:
params
.
mobile
,
code
:
params
.
code
})
if
(
verifyCode
.
code
===
0
)
{
res
=
await
uniID
.
bindMobile
({
uid
:
params
.
uid
,
mobile
:
params
.
mobile
})
}
else
{
res
=
verifyCode
}
console
.
log
(
res
,
verifyCode
);
console
.
log
(
res
);
break
;
case
'
register
'
:
let
{
...
...
@@ -210,10 +211,10 @@ exports.main = async (event, context) => {
break
;
case
'
sendSmsCode
'
:
//123546
return
uniID
.
setVerifyCode
({
mobile
:
params
.
mobile
,
code
:
'
123456
'
code
:
'
123456
'
,
type
:
params
.
type
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录