-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 腾讯云云开发圣诞祝福 | ||
|
||
这是云开发团队为云开发者特制的圣诞祝福,在打开后请按照下述步骤完成配置,即可看到: | ||
|
||
- 开通云开发 | ||
- 在云开发下创建一个数据库,名称为happy; | ||
- 将cloudfunctions/database文件夹下的json文件导入happy数据库 | ||
- 将cloudfunctions/getbless右键创建云函数 | ||
- 重新编译运行,即可看到祝福哦 | ||
|
||
## 参考文档 | ||
|
||
- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html) | ||
|
10 changes: 10 additions & 0 deletions
10
miniprogram/tcb-demo-happy/cloudfunctions/getbless/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const cloud = require('wx-server-sdk') | ||
|
||
cloud.init(); | ||
const db = cloud.database(); | ||
|
||
exports.main = async (event, context) => { | ||
let ibless = (await db.collection('happy').doc('mess').get()).data.bless; | ||
let lucky = Math.floor(Math.random() * ibless.length); | ||
return ibless[lucky]; | ||
} |
14 changes: 14 additions & 0 deletions
14
miniprogram/tcb-demo-happy/cloudfunctions/getbless/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "getbless", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"wx-server-sdk": "latest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
App({ | ||
onLaunch(){ | ||
if (!wx.cloud) { | ||
console.error('请使用 2.2.3 或以上的基础库以使用云能力') | ||
} else { | ||
wx.cloud.init(); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"pages": [ | ||
"index/index" | ||
], | ||
"window": { | ||
"navigationBarBackgroundColor": "#f3302d", | ||
"navigationBarTitleText": "", | ||
"navigationBarTextStyle": "white" | ||
}, | ||
"sitemapLocation": "sitemap.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
page{ | ||
background-color: #f3302d; | ||
padding-top: 15px; | ||
} | ||
button::after{ | ||
border: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Page({ | ||
data: { | ||
dear:'亲爱的微信小程序开发者:', | ||
message:'圣诞快乐!感谢你对腾讯云云开发的支持,我们的进步离不开你的努力。我们会与你携手共进,一起去发现更多可能。', | ||
me:'——腾讯云云开发团队' | ||
}, | ||
Getbless:function(){ | ||
wx.showLoading({ | ||
title: '获取祝福中', | ||
}) | ||
wx.cloud.callFunction({ | ||
name:'getbless', | ||
success(res){ | ||
wx.hideLoading(); | ||
wx.showModal({ | ||
title: '圣诞快乐', | ||
content: res.result, | ||
showCancel: false, | ||
confirmText: '收下' | ||
}) | ||
}, | ||
fail(e){ | ||
wx.hideLoading(); | ||
wx.showModal({ | ||
title: '圣诞快乐', | ||
content: '内容走丢了,请连接网络重试吧!', | ||
showCancel:false | ||
}) | ||
} | ||
}) | ||
}, | ||
onShareAppMessage:function(){ | ||
return { | ||
title:"【云开发】圣诞节祝福卡片", | ||
imageUrl:'https://636c-cloud-cmm55-1300478727.tcb.qcloud.la/happy/share.png' | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"usingComponents": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<view class="mywish">Merry Christmas!</view> | ||
|
||
<button class="mytouch" bindtap="Getbless">来个圣诞祝福</button> | ||
|
||
<view class="mycard"> | ||
<view class="mycard_text"> | ||
<view class="card_title">{{dear}}</view> | ||
<view class="card_text">{{message}}</view> | ||
<view class="card_bottom">{{me}}</view> | ||
</view> | ||
</view> | ||
|
||
<image class="myimage" | ||
src="cloud://cloud-cmm55.636c-cloud-cmm55-1300478727/happy/bottom.png" | ||
mode="widthFix"></image> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.mywish{ | ||
font-size: 25px; | ||
color: #ecb444; | ||
font-weight: 900; | ||
text-align: center; | ||
} | ||
|
||
.myblessbox{ | ||
margin:25px 12px; | ||
color: white; | ||
font-size: 12px; | ||
} | ||
|
||
.myblessitem{ | ||
margin-bottom: 12px; | ||
letter-spacing: 1px; | ||
} | ||
|
||
.mytouch{ | ||
margin-top: 25px; | ||
width: 75%; | ||
font-size: 15px; | ||
font-weight: 900; | ||
background-color: #30c07a; | ||
color: #fdf8e5; | ||
} | ||
|
||
.mycard{ | ||
width: 75%; | ||
margin: 25px auto; | ||
padding: 15px; | ||
background-color: rgb(238, 231, 234); | ||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2); | ||
} | ||
|
||
.mycard_text{ | ||
font-size: 13px; | ||
height: calc(100% - 30px); | ||
padding: 10px; | ||
border: 5px solid #f3302d; | ||
color: rgb(95, 90, 78); | ||
} | ||
|
||
.card_title{ | ||
line-height: 4; | ||
font-weight:bold; | ||
} | ||
|
||
.card_text{ | ||
line-height: 1.8; | ||
} | ||
|
||
.card_bottom{ | ||
line-height: 4; | ||
text-align: right; | ||
font-weight:bold; | ||
} | ||
|
||
.myimage{ | ||
width: 100%; | ||
position: fixed; | ||
bottom:0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", | ||
"rules": [{ | ||
"action": "allow", | ||
"page": "*" | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"miniprogramRoot": "miniprogram/", | ||
"cloudfunctionRoot": "cloudfunctions/", | ||
"setting": { | ||
"urlCheck": true, | ||
"es6": true, | ||
"postcss": true, | ||
"minified": true, | ||
"newFeature": true, | ||
"enhance": true | ||
}, | ||
"appid": "", | ||
"projectname": "happy", | ||
"libVersion": "2.8.1", | ||
"simulatorType": "wechat", | ||
"simulatorPluginLibVersion": {}, | ||
"condition": { | ||
"search": { | ||
"current": -1, | ||
"list": [] | ||
}, | ||
"conversation": { | ||
"current": -1, | ||
"list": [] | ||
}, | ||
"plugin": { | ||
"current": -1, | ||
"list": [] | ||
}, | ||
"game": { | ||
"list": [] | ||
}, | ||
"miniprogram": { | ||
"current": 0, | ||
"list": [ | ||
{ | ||
"id": -1, | ||
"name": "db guide", | ||
"pathName": "pages/databaseGuide/databaseGuide" | ||
} | ||
] | ||
} | ||
} | ||
} |