Skip to content
This repository was archived by the owner on Dec 14, 2024. It is now read-only.

Commit 3056072

Browse files
authored
Merge pull request #2 from rendeyuwei/dev
添加微信云服务器,用来存储数据
2 parents 57109bc + a7ab34e commit 3056072

File tree

12 files changed

+1071
-80
lines changed

12 files changed

+1071
-80
lines changed

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
presets: [
33
['taro', {
44
framework: 'vue',
5-
ts: false
5+
ts: true
66
}]
77
]
88
}

cloud/login/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"permissions": {
3+
"openapi": [
4+
]
5+
}
6+
}

cloud/login/index.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// 云函数入口文件
2+
const cloud = require('wx-server-sdk')
3+
4+
cloud.init({
5+
env: cloud.DYNAMIC_CURRENT_ENV
6+
})
7+
8+
// 云函数入口函数
9+
exports.main = async (event, context) => {
10+
console.log(event)
11+
console.log(context)
12+
13+
// 可执行其他自定义逻辑
14+
// console.log 的内容可以在云开发云函数调用日志查看
15+
16+
// 获取 WX Context (微信调用上下文),包括 OPENID、APPID、及 UNIONID(需满足 UNIONID 获取条件)等信息
17+
const wxContext = cloud.getWXContext()
18+
19+
return {
20+
event,
21+
openid: wxContext.OPENID,
22+
appid: wxContext.APPID,
23+
unionid: wxContext.UNIONID,
24+
}
25+
}

cloud/login/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "login",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"wx-server-sdk": "~2.5.3"
13+
}
14+
}

0 commit comments

Comments
 (0)