Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
0f0ced16
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看板
提交
0f0ced16
编写于
4月 21, 2021
作者:
芊
芊里
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
隐私政策修改为uni_modules组件
上级
1f01e743
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
553 addition
and
50 deletion
+553
-50
components/uni-agree/uni-agree.vue
components/uni-agree/uni-agree.vue
+0
-34
pages.json
pages.json
+15
-0
pages/list/list.vue
pages/list/list.vue
+5
-3
pages/ucenter/ucenter.vue
pages/ucenter/ucenter.vue
+1
-1
uni_modules/opendb-feedback/uniCloud/database/opendb-feedback.schema.json
...db-feedback/uniCloud/database/opendb-feedback.schema.json
+68
-0
uni_modules/uni-agree/components/uni-popup-agree/uni-popup-agree.vue
.../uni-agree/components/uni-popup-agree/uni-popup-agree.vue
+0
-0
uni_modules/uni-agree/pages/uni-agree/uni-agree.vue
uni_modules/uni-agree/pages/uni-agree/uni-agree.vue
+46
-0
uni_modules/uni-agree/utils/uni-agree.js
uni_modules/uni-agree/utils/uni-agree.js
+10
-0
uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/index.js
...ptcha/uniCloud/cloudfunctions/common/uni-captcha/index.js
+1
-1
uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/package.json
...a/uniCloud/cloudfunctions/common/uni-captcha/package.json
+1
-1
uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/package.json
...loud/cloudfunctions/common/uni-config-center/package.json
+2
-2
uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/package-lock.json
...d/uniCloud/cloudfunctions/common/uni-id/package-lock.json
+8
-8
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user-center/index.js
...-quick-login/uniCloud/cloudfunctions/user-center/index.js
+224
-0
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user-center/package-lock.json
...gin/uniCloud/cloudfunctions/user-center/package-lock.json
+25
-0
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user-center/package.json
...ck-login/uniCloud/cloudfunctions/user-center/package.json
+16
-0
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user/index.js
...les/uni-quick-login/uniCloud/cloudfunctions/user/index.js
+82
-0
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user/package-lock.json
...uick-login/uniCloud/cloudfunctions/user/package-lock.json
+25
-0
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user/package.json
...uni-quick-login/uniCloud/cloudfunctions/user/package.json
+16
-0
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user/user.param.json
...-quick-login/uniCloud/cloudfunctions/user/user.param.json
+8
-0
未找到文件。
components/uni-agree/uni-agree.vue
已删除
100644 → 0
浏览文件 @
1f01e743
<
template
>
<view>
<uni-popup
ref=
"popup"
:maskClick=
"false"
type=
"center"
>
<uni-popup-agree
@
cancel=
"cancel"
@
confirm=
"confirm"
></uni-popup-agree>
</uni-popup>
</view>
</
template
>
<
script
>
export
default
{
name
:
"
uni-agree
"
,
mounted
()
{
if
(
uni
.
getSystemInfoSync
().
platform
==
"
android
"
)
{
let
iKnowAgree
=
uni
.
getStorageSync
(
'
iKnowAgree
'
)
||
false
;
if
(
!
iKnowAgree
){
this
.
$refs
.
popup
.
open
();
}
}
},
methods
:{
confirm
(){
this
.
$refs
.
popup
.
close
();
uni
.
setStorageSync
(
'
iKnowAgree
'
,
true
);
},
cancel
(){
plus
.
runtime
.
quit
();
}
}
}
</
script
>
<
style
>
</
style
>
pages.json
浏览文件 @
0f0ced16
...
...
@@ -122,6 +122,21 @@
}
}
},
{
"path"
:
"uni_modules/uni-agree/pages/uni-agree/uni-agree"
,
"style"
:
{
"disableScroll"
:
true
,
"app-plus"
:
{
"backgroundColorTop"
:
"transparent"
,
"background"
:
"transparent"
,
"titleNView"
:
false
,
"scrollIndicator"
:
false
,
"popGesture"
:
"none"
,
"animationType"
:
"fade-in"
,
"animationDuration"
:
200
}
}
},
{
"path"
:
"pages/ucenter/settings/settings"
,
"style"
:
{
...
...
pages/list/list.vue
浏览文件 @
0f0ced16
<
template
>
<view
style=
"overflow: hidden;"
>
<!-- 页面主列表 -->
<news-list
ref=
"newsList"
:canSearch=
"canSearch"
:currentText=
"searchText"
></news-list>
<uni-agree></uni-agree>
<news-list
ref=
"newsList"
:canSearch=
"canSearch"
:currentText=
"searchText"
></news-list>
</view>
</
template
>
<
script
>
import
newsList
from
'
./news-list.vue
'
;
import
checkIsAgree
from
'
@/uni_modules/uni-agree/utils/uni-agree.js
'
;
export
default
{
components
:{
newsList
...
...
@@ -19,6 +18,9 @@
canSearch
:
true
};
},
onLoad
()
{
checkIsAgree
();
},
onShow
(
options
)
{
this
.
searchText
=
getApp
().
globalData
.
searchText
;
},
...
...
pages/ucenter/ucenter.vue
浏览文件 @
0f0ced16
...
...
@@ -144,7 +144,7 @@
/**
* 去应用市场评分
*/
gotoMarket
()
{
gotoMarket
()
{
// #ifdef APP-PLUS
if
(
uni
.
getSystemInfoSync
().
platform
==
"
ios
"
)
{
// 这里填写appstore应用id
...
...
uni_modules/opendb-feedback/uniCloud/database/opendb-feedback.schema.json
0 → 100644
浏览文件 @
0f0ced16
{
"bsonType"
:
"object"
,
"permission"
:
{
"read"
:
"doc.is_reply == false"
,
"create"
:
true
,
"update"
:
false
,
"delete"
:
false
},
"properties"
:
{
"_id"
:
{
"description"
:
"ID,系统自动生成"
},
"user_id"
:
{
"bsonType"
:
"string"
,
"description"
:
"留言反馈用户ID
\/
回复留言用户ID,参考uni-id-users表"
,
"foreignKey"
:
"uni-id-users._id"
,
"forceDefaultValue"
:
{
"$env"
:
"uid"
}
},
"title"
:
{
"description"
:
"反馈标题(用于列表展示)"
},
"ip"
:
{
"forceDefaultValue"
:
{
"$env"
:
"clientIP"
}
},
"create_date"
:
{
"bsonType"
:
"timestamp"
,
"description"
:
"留言时间
\/
回复留言时间"
,
"forceDefaultValue"
:
{
"$env"
:
"now"
}
},
"content"
:
{
"bsonType"
:
"string"
,
"description"
:
"留言内容
\/
回复内容"
,
"trim"
:
"right"
},
"imgs"
:
{
"bsonType"
:
"array"
,
"description"
:
"图片列表"
},
"is_reply"
:
{
"bsonType"
:
"bool"
,
"description"
:
"是否是回复类型"
},
"feedback_id"
:
{
"bsonType"
:
"string"
,
"description"
:
"被回复留言ID"
},
"contact"
:
{
"bsonType"
:
"string"
,
"description"
:
"联系人"
,
"trim"
:
"both"
},
"mobile"
:
{
"bsonType"
:
"string"
,
"description"
:
"联系电话"
,
"trim"
:
"both"
},
"reply_count"
:
{
"bsonType"
:
"int"
,
"description"
:
"被回复条数"
}
}
}
components/uni-popup-agree/uni-popup-agree.vue
→
uni_modules/uni-agree/
components/uni-popup-agree/uni-popup-agree.vue
浏览文件 @
0f0ced16
文件已移动
uni_modules/uni-agree/pages/uni-agree/uni-agree.vue
0 → 100644
浏览文件 @
0f0ced16
<
template
>
<view
class=
"wrap"
>
<uni-popup-agree
@
cancel=
"cancel"
@
confirm=
"confirm"
></uni-popup-agree>
</view>
</
template
>
<
script
>
import
uniPopupAgree
from
'
../../components/uni-popup-agree/uni-popup-agree
'
export
default
{
components
:
{
uniPopupAgree
},
methods
:
{
confirm
()
{
uni
.
setStorageSync
(
'
iKnowAgree
'
,
true
);
uni
.
navigateBack
();
},
cancel
()
{
plus
.
runtime
.
quit
();
}
}
}
</
script
>
<
style
>
/* #ifndef APP-NVUE */
page
{
display
:
flex
;
flex-direction
:
column
;
background
:
transparent
;
}
/* #endif */
.wrap
{
flex
:
1
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
position
:
fixed
;
left
:
0
;
top
:
0
;
right
:
0
;
bottom
:
0
;
background-color
:
rgba
(
0
,
0
,
0
,
.65
);
}
</
style
>
uni_modules/uni-agree/utils/uni-agree.js
0 → 100644
浏览文件 @
0f0ced16
export
default
function
checkIsAgree
(){
if
(
uni
.
getSystemInfoSync
().
platform
==
"
android
"
)
{
let
iKnowAgree
=
uni
.
getStorageSync
(
'
iKnowAgree
'
)
||
false
;
if
(
!
iKnowAgree
){
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-agree/pages/uni-agree/uni-agree
'
})
}
}
}
\ No newline at end of file
uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/index.js
浏览文件 @
0f0ced16
此差异已折叠。
点击以展开。
uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/package.json
浏览文件 @
0f0ced16
{
"name"
:
"uni-captcha"
,
"version"
:
"0.1.
1
"
,
"version"
:
"0.1.
0
"
,
"description"
:
"uni-captcha"
,
"main"
:
"index.js"
,
"homepage"
:
"https://ext.dcloud.net.cn/plugin?id=4048"
,
...
...
uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/package.json
浏览文件 @
0f0ced16
{
"name"
:
"uni-config-center"
,
"version"
:
"0.0.
2
"
,
"version"
:
"0.0.
1
"
,
"description"
:
"配置中心"
,
"main"
:
"index.js"
,
"keywords"
:
[],
"author"
:
"
DCloud
"
,
"author"
:
"
fxy060608
"
,
"license"
:
"Apache-2.0"
}
\ No newline at end of file
uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/package-lock.json
浏览文件 @
0f0ced16
{
"name"
:
"uni-id"
,
"version"
:
"3.0.11"
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
"uni-config-center"
:
{
"version"
:
"file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
"name"
:
"uni-id"
,
"version"
:
"3.0.12"
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
"uni-config-center"
:
{
"version"
:
"file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
}
}
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user-center/index.js
0 → 100644
浏览文件 @
0f0ced16
'
use strict
'
;
let
uniID
=
require
(
'
uni-id
'
)
const
uniCaptcha
=
require
(
'
uni-captcha
'
)
const
db
=
uniCloud
.
database
()
const
dbCmd
=
db
.
command
exports
.
main
=
async
(
event
,
context
)
=>
{
/**
* UNI_WYQ:这里的uniID换成新的,保证多人访问不会冲突
*/
uniID
=
uniID
.
createInstance
({
context
})
//event为客户端上传的参数
console
.
log
(
'
event :
'
+
JSON
.
stringify
(
event
))
let
params
=
event
.
params
||
{}
//防止黑客恶意破解登陆,连续登陆失败一定次数后,需要用户提供验证码
const
getNeedCaptcha
=
async
()
=>
{
//当用户最近“2小时内(recordDate)”登陆失败达到2次(recordSize)时。要求用户提交验证码
const
now
=
Date
.
now
(),
recordDate
=
120
*
60
*
1000
,
recordSize
=
2
;
const
uniIdLogCollection
=
db
.
collection
(
'
uni-id-log
'
)
let
recentRecord
=
await
uniIdLogCollection
.
where
({
deviceId
:
params
.
deviceId
||
context
.
DEVICEID
,
create_date
:
dbCmd
.
gt
(
now
-
recordDate
),
type
:
'
login
'
})
.
orderBy
(
'
create_date
'
,
'
desc
'
)
.
limit
(
recordSize
)
.
get
();
return
recentRecord
.
data
.
filter
(
item
=>
item
.
state
===
0
).
length
===
recordSize
;
}
//设置某些模块不需要token(也就是登陆成功后)才能操作,如果需要token就获取当前操作账户的uid
let
noCheckAction
=
[
'
register
'
,
'
checkToken
'
,
'
login
'
,
'
logout
'
,
'
sendSmsCode
'
,
'
createCaptcha
'
,
'
verifyCaptcha
'
,
'
refreshCaptcha
'
,
'
inviteLogin
'
,
'
login_by_weixin
'
,
'
login_by_univerify
'
,
'
login_by_apple
'
,
'
loginBySms
'
]
let
payload
;
console
.
log
(
event
.
action
);
if
(
!
noCheckAction
.
includes
(
event
.
action
))
{
if
(
!
event
.
uniIdToken
)
{
return
{
code
:
403
,
msg
:
'
缺少token
'
}
}
payload
=
await
uniID
.
checkToken
(
event
.
uniIdToken
)
if
(
payload
.
code
&&
payload
.
code
>
0
)
{
return
payload
}
params
.
uid
=
payload
.
uid
}
//记录成功登陆的日志
const
loginLog
=
async
(
res
=
{},
type
=
'
login
'
)
=>
{
const
now
=
Date
.
now
()
const
uniIdLogCollection
=
db
.
collection
(
'
uni-id-log
'
)
let
logData
=
{
deviceId
:
params
.
deviceId
||
context
.
DEVICEID
,
ip
:
params
.
ip
||
context
.
CLIENTIP
,
type
,
ua
:
context
.
CLIENTUA
,
create_date
:
now
};
Object
.
assign
(
logData
,
res
.
code
===
0
?
{
user_id
:
res
.
uid
,
state
:
1
}
:
{
state
:
0
})
return
uniIdLogCollection
.
add
(
logData
)
}
let
res
=
{}
switch
(
event
.
action
)
{
case
'
register
'
:
res
=
await
uniID
.
register
(
params
);
break
;
case
'
login
'
:
let
passed
=
false
;
let
needCaptcha
=
await
getNeedCaptcha
();
if
(
needCaptcha
)
{
res
=
await
uniCaptcha
.
verify
(
params
)
if
(
res
.
code
===
0
)
passed
=
true
;
}
if
(
!
needCaptcha
||
passed
)
{
res
=
await
uniID
.
login
({
...
params
,
queryField
:
[
'
username
'
,
'
email
'
,
'
mobile
'
]
});
await
loginLog
(
res
);
needCaptcha
=
await
getNeedCaptcha
();
}
res
.
needCaptcha
=
needCaptcha
;
break
;
case
'
login_by_weixin
'
:
res
=
await
uniID
.
loginByWeixin
(
params
);
await
uniID
.
updateUser
({
uid
:
params
.
uid
,
username
:
"
微信用户
"
});
res
.
userInfo
.
username
=
"
微信用户
"
loginLog
(
res
)
break
;
case
'
login_by_univerify
'
:
res
=
await
uniID
.
loginByUniverify
(
params
)
break
;
case
'
login_by_apple
'
:
res
=
await
uniID
.
loginByApple
(
params
)
loginLog
(
res
)
break
;
case
'
checkToken
'
:
res
=
await
uniID
.
checkToken
(
event
.
uniIdToken
);
break
;
case
'
logout
'
:
res
=
await
uniID
.
logout
(
event
.
uniIdToken
)
break
;
case
'
sendSmsCode
'
:
// 简单限制一下客户端调用频率
const
ipLimit
=
await
db
.
collection
(
'
uni-verify
'
).
where
({
ip
:
context
.
CLIENTIP
,
created_at
:
dbCmd
.
gt
(
Date
.
now
()
-
60000
)
}).
get
()
if
(
ipLimit
.
data
.
length
>
0
)
{
return
{
code
:
429
,
msg
:
'
请求过于频繁
'
}
}
const
templateId
=
'
11753
'
// 替换为自己申请的模板id
if
(
!
templateId
)
{
return
{
code
:
500
,
msg
:
'
sendSmsCode需要传入自己的templateId,参考https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=sendsmscode
'
}
}
const
randomStr
=
'
00000
'
+
Math
.
floor
(
Math
.
random
()
*
1000000
)
const
code
=
randomStr
.
substring
(
randomStr
.
length
-
6
)
res
=
await
uniID
.
sendSmsCode
({
mobile
:
params
.
mobile
,
code
,
type
:
params
.
type
,
templateId
})
break
;
case
'
loginBySms
'
:
if
(
!
params
.
code
)
{
return
{
code
:
500
,
msg
:
'
请填写验证码
'
}
}
if
(
!
/^1
\d{10}
$/
.
test
(
params
.
mobile
))
{
return
{
code
:
500
,
msg
:
'
手机号码填写错误
'
}
}
res
=
await
uniID
.
loginBySms
(
params
)
loginLog
(
res
)
break
;
case
'
inviteLogin
'
:
if
(
!
params
.
code
)
{
return
{
code
:
500
,
msg
:
'
请填写验证码
'
}
}
res
=
await
uniID
.
loginBySms
({
...
params
,
type
:
'
register
'
})
break
;
case
'
getInviteCode
'
:
res
=
await
uniID
.
getUserInfo
({
uid
:
params
.
uid
,
field
:
[
'
my_invite_code
'
]
})
if
(
res
.
code
===
0
)
{
res
.
myInviteCode
=
res
.
userInfo
.
my_invite_code
delete
res
.
userInfo
}
break
;
case
'
getInvitedUser
'
:
res
=
await
uniID
.
getInvitedUser
(
params
)
break
;
case
'
updatePwd
'
:
res
=
await
uniID
.
updatePwd
({
uid
:
params
.
uid
,
...
params
})
break
;
case
'
createCaptcha
'
:
res
=
await
uniCaptcha
.
create
(
params
)
break
;
case
'
refreshCaptcha
'
:
res
=
await
uniCaptcha
.
refresh
(
params
)
break
;
case
'
resetPwd
'
:
res
=
await
uniID
.
resetPwd
({...
params
,
"
uid
"
:
payload
.
uid
})
break
;
default
:
res
=
{
code
:
403
,
msg
:
'
非法访问
'
}
break
;
}
//返回数据给客户端
return
res
};
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user-center/package-lock.json
0 → 100644
浏览文件 @
0f0ced16
{
"name"
:
"user-center"
,
"version"
:
"1.0.0"
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
"uni-captcha"
:
{
"version"
:
"file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
},
"uni-config-center"
:
{
"version"
:
"file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"uni-id"
:
{
"version"
:
"file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id"
,
"requires"
:
{
"uni-config-center"
:
"file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"dependencies"
:
{
"uni-config-center"
:
{
"version"
:
"file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
}
}
}
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user-center/package.json
0 → 100644
浏览文件 @
0f0ced16
{
"name"
:
"user-center"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"uni-captcha"
:
"file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
,
"uni-config-center"
:
"file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
,
"uni-id"
:
"file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id"
}
}
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user/index.js
0 → 100644
浏览文件 @
0f0ced16
'
use strict
'
;
const
uniID
=
require
(
'
uni-id
'
)
const
uniCaptcha
=
require
(
'
uni-captcha
'
)
const
db
=
uniCloud
.
database
()
const
dbCmd
=
db
.
command
let
params
,
context
,
res
;
class
User
{
async
quickLogin
(){
let
{
access_token
,
openid
,
type
}
=
params
switch
(
type
){
case
'
weixin
'
:
let
userinfo_res
=
await
uniCloud
.
httpclient
.
request
(
'
https://api.weixin.qq.com/sns/userinfo
'
,
{
method
:
'
GET
'
,
dataType
:
"
json
"
,
data
:{
access_token
,
openid
}
});
return
userinfo_res
.
data
//根据access_token,openid得到userinfo
//检查是否已经注册...
break
;
case
'
univerify
'
:
return
uniID
.
loginByUniverify
({
access_token
,
openid
})
break
;
case
'
apple
'
:
return
await
uniID
.
loginByApple
(
params
)
break
;
default
:
return
{
"
code
"
:
100
,
"
msg
"
:
"
暂不提供
"
+
type
+
"
登陆的云端接口演示
"
}
break
;
}
}
async
sendSmsCode
(){
// 简单限制一下客户端调用频率
const
ipLimit
=
await
db
.
collection
(
'
uni-verify
'
).
where
({
ip
:
context
.
CLIENTIP
,
created_at
:
dbCmd
.
gt
(
Date
.
now
()
-
60000
)
}).
get
()
if
(
ipLimit
.
data
.
length
>
0
)
{
return
{
code
:
429
,
msg
:
'
请求过于频繁
'
}
}
const
templateId
=
'
11753
'
// 替换为自己申请的模板id
if
(
!
templateId
)
{
return
{
code
:
500
,
msg
:
'
sendSmsCode需要传入自己的templateId,参考https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=sendsmscode
'
}
}
const
randomStr
=
'
00000
'
+
Math
.
floor
(
Math
.
random
()
*
1000000
)
const
code
=
randomStr
.
substring
(
randomStr
.
length
-
6
)
return
await
uniID
.
sendSmsCode
({
mobile
:
params
.
mobile
,
code
,
type
:
params
.
type
,
templateId
})
}
}
const
userClass
=
new
User
();
exports
.
main
=
async
(
event
,
ctx
)
=>
{
[{
params
},
context
]
=
[
event
,
ctx
]
//1.判断需要token的action是否有token
/*let noCheckAction = ['register', 'loginByWeixin', 'checkToken','login', 'logout', 'sendSmsCode','loginBySms', 'inviteLogin', 'loginByUniverify','loginByApple', 'createCaptcha', 'verifyCaptcha','refreshCaptcha']
if(!noCheckAction.includes(event.action)) {
if (!event.uniIdToken) {
return {"code":403,"msg":"缺少token"}
}
let payload = {}
payload = await uniID.checkToken(event.uniIdToken)
if (payload.code && payload.code > 0) {
return payload
}
params.uid = payload.uid
}*/
try
{
return
await
userClass
[
event
.
action
]()
||
res
;
}
catch
(
err
){
return
{
"
code
"
:
404
,
"
msg
"
:
err
}
}
}
\ No newline at end of file
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user/package-lock.json
0 → 100644
浏览文件 @
0f0ced16
{
"name"
:
"user"
,
"version"
:
"1.0.0"
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
"uni-captcha"
:
{
"version"
:
"file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
},
"uni-config-center"
:
{
"version"
:
"file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"uni-id"
:
{
"version"
:
"file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id"
,
"requires"
:
{
"uni-config-center"
:
"file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"dependencies"
:
{
"uni-config-center"
:
{
"version"
:
"file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
}
}
}
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user/package.json
0 → 100644
浏览文件 @
0f0ced16
{
"name"
:
"user"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"uni-captcha"
:
"file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
,
"uni-config-center"
:
"file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
,
"uni-id"
:
"file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id"
}
}
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user/user.param.json
0 → 100644
浏览文件 @
0f0ced16
//
本文件中的json内容将在云函数【运行】时作为参数传给云函数。
//
配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{
"action"
:
"sendSmsCode"
,
"params"
:
{
"phone"
:
"17769516081"
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录