init miniprogram #6

Merged
mvpola2e5 merged 4 commits from dev into master 1 year ago

@ -1,25 +1,37 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/getOpenId/index", "pages/msg/index",
"pages/getMiniProgramCode/index", "pages/profile/index"
"pages/deployService/index",
"pages/createCollection/index",
"pages/uploadFile/index",
"pages/selectRecord/index",
"pages/updateRecord/index",
"pages/updateRecordResult/index",
"pages/updateRecordSuccess/index",
"pages/sumRecord/index",
"pages/sumRecordResult/index"
], ],
"window": { "window": {
"backgroundColor": "#F6F6F6", "backgroundColor": "#FFF",
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#F6F6F6", "navigationBarBackgroundColor": "#FFF",
"navigationBarTitleText": "云开发 QuickStart", "navigationBarTitleText": "家教帮",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
}, },
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"text": "main",
"iconPath": "images/main.png",
"selectedIconPath": "images/main_on.png"
},
{
"pagePath": "pages/msg/index",
"text": "msg",
"iconPath": "images/msg.png",
"selectedIconPath": "images/msg_on.png"
},
{
"pagePath": "pages/profile/index",
"text": "profile",
"iconPath": "images/profile.png",
"selectedIconPath": "images/profile_on.png"
}
]
},
"sitemapLocation": "sitemap.json", "sitemapLocation": "sitemap.json",
"style": "v2" "style": "v2"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

@ -1,10 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
},
});

@ -1,7 +0,0 @@
<view class="page">
<view class="title">功能介绍</view>
<view class="info">集合为常用数据库中表的概念。云开发数据库支持自动备份、无损回档并且QPS高达3千+。</view>
<view class="title">如何体验</view>
<view class="info">已自动创建名为“sales”的体验合集可打开“云开发控制台>数据库>记录列表”中找到该集合。</view>
<image class="img" src="../../images/database.png"></image>
</view>

@ -1,29 +0,0 @@
page {
background-color: white;
padding-bottom: 50px;
}
.page {
padding: 0 32px;
}
.title {
margin-top: 16px;
font-size: 17px;
font-family: PingFang SC;
font-weight: 500;
color: #000000;
}
.info {
margin-top: 12px;
font-size: 17px;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.img {
margin-top: 16px;
width: 100%;
}

@ -1,11 +0,0 @@
// miniprogram/pages/deployService/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
});

@ -1,3 +0,0 @@
{
"usingComponents": {}
}

@ -1,10 +0,0 @@
<!--miniprogram/pages/deployService/index.wxml-->
<view class="page">
<view class="title">功能介绍</view>
<view class="info">云托管是全托管的容器服务,支持任何语言及框架运行,只需将已有业务代码打包上传,即可快速迁移。</view>
<view class="title">如何体验</view>
<view class="info">步骤一:切换按量付费,打开“云开发控制台>设置>环境设置”找到按量付费,点击切换。</view>
<image class="img" src="../../images/deploy_step1.png"></image>
<view class="info">步骤二:开通云托管,体验相关能力</view>
<image class="img" src="../../images/deploy_step2.png"></image>
</view>

@ -1,30 +0,0 @@
/* miniprogram/pages/deployService/index.wxss */
page {
background-color: white;
padding-bottom: 50px;
}
.page {
padding: 0 32px;
}
.title {
margin-top: 16px;
font-size: 17px;
font-family: PingFang SC;
font-weight: 500;
color: #000000;
}
.info {
margin-top: 12px;
font-size: 17px;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
}
.img {
margin-top: 16px;
width: 100%;
}

@ -1,53 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
showUploadTip: false,
haveGetCodeSrc: false,
envId: '',
codeSrc: ''
},
onLoad(options) {
this.setData({
envId: options.envId
});
},
getCodeSrc() {
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId
},
data: {
type: 'getMiniProgramCode'
}
}).then((resp) => {
this.setData({
haveGetCodeSrc: true,
codeSrc: resp.result
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},
clearCodeSrc() {
this.setData({
haveGetCodeSrc: false,
codeSrc: ''
});
}
});

@ -1,6 +0,0 @@
{
"navigationBarTitleText": "生成小程序码",
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -1,11 +0,0 @@
<view>
<view class="top_tip">可通过云函数免接口调用凭证,直接生成小程序码。</view>
<view class="box_text" wx:if="{{!codeSrc}}">小程序码将展示在这里</view>
<view wx:if="{{codeSrc}}" class="code_box">
<image class="code_img" src="{{codeSrc}}"></image>
</view>
<view class="button" bindtap="getCodeSrc" wx:if="{{!haveGetCodeSrc}}">生成小程序码</view>
<view class="button_clear" bindtap="clearCodeSrc" wx:if="{{haveGetCodeSrc}}">清空</view>
<view class="tip">在”资源管理器>cloudfunctions>quickstartFunctions>getMiniProgramCode>index.js“找到获取小程序码函数体验该能力</view>
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal>
</view>

@ -1,58 +0,0 @@
.tip {
font-size: 23rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: center;
margin: 30rpx auto 0 auto;
}
.top_tip {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: left;
margin-top: 30rpx;
margin-left: 20rpx;
}
.box_text {
background-color: white;
text-align: center;
padding: 300rpx 0;
margin-top: 30rpx;
color: rgba(0, 0, 0, 0.5);
}
.code_box {
text-align: center;
background-color: white;
margin-top: 30rpx;
padding: 17rpx 0;
}
.code_img {
width: 600rpx;
height: 600rpx;
}
.button {
width: 300rpx;
text-align: center;
margin: 20% auto 0 auto;
height: 80rpx;
color: white;
border-radius: 5px;
line-height: 80rpx;
background-color: #07c160;
}
.button_clear {
width: 300rpx;
text-align: center;
margin: 20% auto 0 auto;
height: 80rpx;
color: #07c160;
border-radius: 5px;
line-height: 80rpx;
background-color: rgba(0, 0, 0, 0.03);
}

@ -1,52 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
showUploadTip: false,
haveGetOpenId: false,
envId: '',
openId: ''
},
onLoad(options) {
this.setData({
envId: options.envId
});
},
getOpenId() {
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId
},
data: {
type: 'getOpenId'
}
}).then((resp) => {
this.setData({
haveGetOpenId: true,
openId: resp.result.openid
});
wx.hideLoading();
}).catch((e) => {
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},
clearOpenId() {
this.setData({
haveGetOpenId: false,
openId: ''
});
}
});

@ -1,6 +0,0 @@
{
"navigationBarTitleText": "获取OpenId",
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -1,8 +0,0 @@
<view>
<view class="top_tip">无需维护鉴权机制及登录票据,仅一行代码即可获得。</view>
<view class="box_text">{{ openId ? openId : 'OpenID将展示在这里' }}</view>
<view class="button" bindtap="getOpenId" wx:if="{{!haveGetOpenId}}">获取OpenId</view>
<view class="button_clear" bindtap="clearOpenId" wx:if="{{haveGetOpenId}}">清空</view>
<view class="tip">在”资源管理器>cloudfunctions>quickstartFunctions>getOpenId>index.js“找到获取openId函数体验该能力</view>
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal>
</view>

@ -1,46 +0,0 @@
.tip {
font-size: 23rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: center;
margin: 30rpx auto 0 auto;
}
.top_tip {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: left;
margin-top: 30rpx;
margin-left: 20rpx;
}
.box_text {
background-color: white;
text-align: center;
padding: 300rpx 0;
margin-top: 30rpx;
color: rgba(0, 0, 0, 0.5);
}
.button {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: white;
border-radius: 5px;
line-height: 80rpx;
background-color: #07c160;
}
.button_clear {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: #07c160;
border-radius: 5px;
line-height: 80rpx;
background-color: rgba(0, 0, 0, 0.03);
}

@ -1,142 +1,10 @@
// index.js
// const app = getApp()
const { envList } = require('../../envList.js');
Page({ Page({
data: { data:{
showUploadTip: false, hello:'Hi~'
powerList: [{
title: '云函数',
tip: '安全、免鉴权运行业务代码',
showItem: false,
item: [{
title: '获取OpenId',
page: 'getOpenId'
},
// {
// title: '微信支付'
// },
{
title: '生成小程序码',
page: 'getMiniProgramCode'
},
// {
// title: '发送订阅消息',
// }
]
}, {
title: '数据库',
tip: '安全稳定的文档型数据库',
showItem: false,
item: [{
title: '创建集合',
page: 'createCollection'
}, {
title: '更新记录',
page: 'updateRecord'
}, {
title: '查询记录',
page: 'selectRecord'
}, {
title: '聚合操作',
page: 'sumRecord'
}]
}, {
title: '云存储',
tip: '自带CDN加速文件存储',
showItem: false,
item: [{
title: '上传文件',
page: 'uploadFile'
}]
}, {
title: '云托管',
tip: '不限语言的全托管容器服务',
showItem: false,
item: [{
title: '部署服务',
page: 'deployService'
}]
}],
envList,
selectedEnv: envList[0],
haveCreateCollection: false
}, },
change:function(){
onClickPowerInfo(e) {
const index = e.currentTarget.dataset.index;
const powerList = this.data.powerList;
powerList[index].showItem = !powerList[index].showItem;
if (powerList[index].title === '数据库' && !this.data.haveCreateCollection) {
this.onClickDatabase(powerList);
} else {
this.setData({
powerList
});
}
},
onChangeShowEnvChoose() {
wx.showActionSheet({
itemList: this.data.envList.map(i => i.alias),
success: (res) => {
this.onChangeSelectedEnv(res.tapIndex);
},
fail (res) {
console.log(res.errMsg);
}
});
},
onChangeSelectedEnv(index) {
if (this.data.selectedEnv.envId === this.data.envList[index].envId) {
return;
}
const powerList = this.data.powerList;
powerList.forEach(i => {
i.showItem = false;
});
this.setData({ this.setData({
selectedEnv: this.data.envList[index], hello:this.data.hello+'~~',
powerList,
haveCreateCollection: false
}); });
}, },
jumpPage(e) {
wx.navigateTo({
url: `/pages/${e.currentTarget.dataset.page}/index?envId=${this.data.selectedEnv.envId}`,
});
},
onClickDatabase(powerList) {
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.selectedEnv.envId
},
data: {
type: 'createCollection'
}
}).then((resp) => {
if (resp.result.success) {
this.setData({
haveCreateCollection: true
});
}
this.setData({
powerList
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
}
}); });

@ -1,32 +1,14 @@
<!--index.wxml--> <view >
<view class="container"> <view class="cover">
<image src="/images/app.png"class="app"/>
<view class="title">快速了解云开发</view>
<view class="top_tip">免鉴权接口调用 免部署后台 高并发</view>
<view class="power" wx:key="title" wx:for="{{powerList}}" wx:for-item="power">
<view class="power_info" data-index="{{index}}" bindtap="onClickPowerInfo">
<view class="power_info_text">
<view class="power_info_text_title">{{power.title}}</view>
<view class="power_info_text_tip">{{power.tip}}</view>
</view>
<image wx:if="{{!power.showItem}}" class="power_info_more" src="../../images/arrow.svg"></image>
<image wx:if="{{power.showItem}}" class="power_info_less" src="../../images/arrow.svg"></image>
</view>
<view wx:if="{{power.showItem}}">
<view wx:key="title" wx:for="{{power.item}}">
<view class="line"></view>
<view class="power_item" bindtap="jumpPage" data-page="{{item.page}}">
<view class="power_item_title">{{item.title}}</view>
<image class="power_item_icon" src="../../images/arrow.svg"></image>
</view>
</view>
</view>
</view> </view>
<view class="title" bind:tap="change">{{hello}}</view>
<view class="environment" bindtap="onChangeShowEnvChoose">当前环境 {{ selectedEnv.alias }}</view> <view class="desc">这里是家教帮平台,再也不用担心孩子的学习了</view>
<view class="choose">
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal> <navigator class="join" url="/pages/form/index">创建小组</navigator>
<navigator class="join" url="/pages/list/index">加入小组</navigator>
<navigator class="join" url="/pages/tip/index">其他小组</navigator>
<navigator class="join" url="/pages/group/index">我的小组</navigator>
</view>>
</view> </view>

@ -1,94 +1,21 @@
/**index.wxss**/ .cover{
background-color: #f1f1f1;
page { text-align: center;
padding-top: 54rpx; padding: 80rpx;
background-color: #f6f6f6;
padding-bottom: 60rpx;
} }
.app{
.title { width: 160rpx;
font-family: PingFang SC; height: 160rpx;
}
.title{
font-weight: 500; font-weight: 500;
color: #000000; color: #000;
font-size: 44rpx; font-size: 44rpx;
margin-bottom: 40rpx; margin: 50rpx 32rpx;
}
.top_tip {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #888888;
margin-bottom: 28rpx;
}
.power {
margin-top: 30rpx;
border-radius: 5px;
background-color: white;
width: 93%;
padding-bottom: 1rpx;
}
.power_info {
display: flex;
padding: 30rpx 25rpx;
align-items: center;
justify-content: space-between;
}
.power_info_more {
width: 30rpx;
height: 30rpx;
transform: rotate(90deg);
}
.power_info_less {
width: 30rpx;
height: 30rpx;
transform: rotate(270deg);
}
.power_info_text {
display: flex;
flex-direction: column;
}
.power_info_text_title {
margin-bottom: 10rpx;
font-weight: 400;
font-size: 35rpx;
} }
.desc{
.power_info_text_tip { font-weight: 500;
color: rgba(0, 0, 0, 0.4); color: #000;
font-size: 25rpx; font-size: 44rpx;
} margin: 50rpx 32rpx;
.power_item {
padding: 30rpx 25rpx;
display: flex;
justify-content: space-between;
}
.power_item_title {
font-size: 30rpx;
}
.power_item_icon {
width: 30rpx;
height: 30rpx;
}
.line {
width: 95%;
margin: 0 auto;
height: 2rpx;
background-color: rgba(0, 0, 0, 0.1);
}
.environment {
color: rgba(0, 0, 0, 0.4);
font-size: 24rpx;
margin-top: 25%;
} }

@ -0,0 +1,22 @@
Page({
data:{
date:"",
region:"",
},
submit:function(e){
console.log(e);
},
dateChange:function(e){
this.setData({
date:e.detail.value,
});
},
regionChange:function(e){
this.setData({
region:e.detail.value,
});
},
});

@ -1,5 +1,4 @@
{ {
"navigationBarTitleText": "查询记录",
"usingComponents": { "usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index" "cloud-tip-modal": "/components/cloudTipModal/index"
} }

@ -0,0 +1,31 @@
.body{
margin: 40rpx;
}
.section{
margin: 40rpx 0 80rpx;
}
.title{
font-weight: 36rpx;
}
.input{
margin:30rpx 0;
border-bottom: 1px solid #666;
padding: 20rpx 0;
width:100%
}
.mg{
margin: 30rpx 0;
}
.area{
margin:100rpx auto;
display:flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.desc{
font-weight: 500;
color: #000;
font-size: 44rpx;
margin: 50rpx 32rpx;
}

@ -0,0 +1,22 @@
Page({
data:{
date:"",
region:"",
},
submit:function(e){
console.log(e);
},
dateChange:function(e){
this.setData({
date:e.detail.value,
});
},
regionChange:function(e){
this.setData({
region:e.detail.value,
});
},
});

@ -1,5 +1,4 @@
{ {
"navigationBarTitleText": "聚合记录",
"usingComponents": { "usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index" "cloud-tip-modal": "/components/cloudTipModal/index"
} }

@ -0,0 +1,57 @@
<view class="body">
<view class="cover">
<image src="/images/user.png"class="user"/>
</view>
<form bindsubmit="submit">
<view class="section">
<view class="title">昵称:</view>
<input type="nickname" class="input"name="nickname"placeholder="昵称" />
</view>
<view class="section">
<view class="title">性别:</view>
<radio-group class="mg" name="gender">
<label >
<radio value="nan" />
</label>
<label >
<radio value="nv" />
</label>
</radio-group>
</view>
<view class="section">
<view class="title">年龄:</view>
<picker bindchange="dateChange" fields="year" value="{{date}}"mode="date"class="input"name="date">
<view class="picker">出生年:{{date}}</view>
</picker>
</view>
<view class="section">
<view class="title">地区:</view>
<picker bindchange="regionChange" value="{{region}}" value="{{region}}"mode="region"class="input"name="region">
<view class="picker">当前选择:{{region}}</view>
</picker>
</view>
<view class="section">
<view class="title">可以添加到你的联系方式:</view>
<input type="input" class="input"name="code"placeholder="昵称" />
</view>
<view class="section">
<view class="title">你的基本情况:</view>
<input type="input" class="input"name="code"placeholder="昵称" />
</view>
<view class="area">
<button style="margin:30rpx 0"type="primary"
form-type="submit">提交</button>
<button style="margin:30rpx 0"type="reset"
form-type="submit">重置</button>
</view>
</form>
</view>

@ -0,0 +1,37 @@
.cover{
background-color: #f1f1f1;
width: 10%;
height: 10%;
padding: 1rpx;
}
.body{
margin: 40rpx;
}
.section{
margin: 40rpx 0 80rpx;
}
.title{
font-weight: 36rpx;
}
.input{
margin:30rpx 0;
border-bottom: 1px solid #666;
padding: 20rpx 0;
width:100%
}
.mg{
margin: 30rpx 0;
}
.area{
margin:100rpx auto;
display:flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.desc{
font-weight: 500;
color: #000;
font-size: 44rpx;
margin: 50rpx 32rpx;
}

@ -1,53 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
showUploadTip: false,
haveGetRecord: false,
envId: '',
record: ''
},
onLoad(options) {
this.setData({
envId: options.envId
});
},
getRecord() {
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId
},
data: {
type: 'selectRecord'
}
}).then((resp) => {
this.setData({
haveGetRecord: true,
record: resp.result.data
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},
clearRecord() {
this.setData({
haveGetRecord: false,
record: ''
});
}
});

@ -1,22 +0,0 @@
<view>
<view class="top_tip">体验查询记录能力,查询数据表中的销量数据。</view>
<view class="box_text" wx:if="{{!record}}">销量数据将展示在这里</view>
<view wx:if="{{record}}" class="code_box">
<view class="code_box_title">地区销量统计</view>
<view class="code_box_record">
<view class="code_box_record_title">地域</view>
<view class="code_box_record_title">城市</view>
<view class="code_box_record_title">销量</view>
</view>
<view class="line"></view>
<view class="code_box_record" wx:for="{{record}}" wx:key="_id">
<view class="code_box_record_detail">{{item.region}}</view>
<view class="code_box_record_detail">{{item.city}}</view>
<view class="code_box_record_detail">{{item.sales}}</view>
</view>
</view>
<view class="button" bindtap="getRecord" wx:if="{{!haveGetRecord}}">查询记录</view>
<view class="button_clear" bindtap="clearRecord" wx:if="{{haveGetRecord}}">清空</view>
<view class="tip">在”资源管理器>cloudfunctions>quickstartFunctions>selectRecord>index.js“找到查询记录函数体验该能力</view>
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal>
</view>

@ -1,83 +0,0 @@
.tip {
font-size: 23rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: center;
margin: 30rpx auto 0 auto;
}
.top_tip {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: left;
margin-top: 30rpx;
margin-left: 20rpx;
}
.box_text {
background-color: white;
text-align: center;
padding: 300rpx 0;
margin-top: 30rpx;
color: rgba(0, 0, 0, 0.5);
}
.code_box {
text-align: center;
background-color: white;
margin-top: 30rpx;
padding: 17rpx;
}
.code_box_title {
color: rgba(0, 0, 0, 0.5);
font-size: 26rpx;
margin-bottom: 20rpx;
text-align: left;
}
.code_box_record {
display: flex;
}
.code_box_record_title {
width: 33%;
font-size: 26rpx;
color: rgba(0, 0, 0, 0.5);
padding: 20rpx 0;
}
.code_box_record_detail {
width: 33%;
font-size: 26rpx;
padding: 20rpx 0;
}
.button {
width: 300rpx;
text-align: center;
margin: 20% auto 0 auto;
height: 80rpx;
color: white;
border-radius: 5px;
line-height: 80rpx;
background-color: #07c160;
}
.button_clear {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: #07c160;
border-radius: 5px;
line-height: 80rpx;
background-color: rgba(0, 0, 0, 0.03);
}
.line {
height: 1rpx;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
}

@ -1,48 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
showUploadTip: false,
haveGetRecord: false,
envId: '',
record: ''
},
onLoad(options) {
this.setData({
envId: options.envId
});
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId
},
data: {
type: 'selectRecord'
}
}).then((resp) => {
this.setData({
record: resp.result.data
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},
sumRecord() {
wx.navigateTo({
url: `/pages/sumRecordResult/index?envId=${this.data.envId}`,
});
},
});

@ -1,21 +0,0 @@
<view>
<view class="top_tip">常用数据库中的groupby操作体验按地域聚合数据。</view>
<view class="box_text" wx:if="{{!record}}">数据将展示在这里</view>
<view wx:if="{{record}}" class="code_box">
<view class="code_box_title">地区销量统计</view>
<view class="code_box_record">
<view class="code_box_record_title">地域</view>
<view class="code_box_record_title">城市</view>
<view class="code_box_record_title">销量</view>
</view>
<view class="line"></view>
<view class="code_box_record" wx:for="{{record}}" wx:key="_id">
<view class="code_box_record_detail">{{item.region}}</view>
<view class="code_box_record_detail">{{item.city}}</view>
<view class="code_box_record_detail">{{item.sales}}</view>
</view>
</view>
<view class="button" bindtap="sumRecord">聚合记录</view>
<view class="tip">在”资源管理器>cloudfunctions>quickstartFunctions>sumRecord>index.js“找到聚合记录函数体验该能力</view>
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal>
</view>

@ -1,83 +0,0 @@
.tip {
font-size: 23rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: center;
margin: 30rpx auto 0 auto;
}
.top_tip {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: left;
margin-top: 30rpx;
margin-left: 20rpx;
}
.box_text {
background-color: white;
text-align: center;
padding: 300rpx 0;
margin-top: 30rpx;
color: rgba(0, 0, 0, 0.5);
}
.code_box {
text-align: center;
background-color: white;
margin-top: 30rpx;
padding: 17rpx;
}
.code_box_title {
color: rgba(0, 0, 0, 0.5);
font-size: 26rpx;
margin-bottom: 20rpx;
text-align: left;
}
.code_box_record {
display: flex;
}
.code_box_record_title {
width: 33%;
font-size: 26rpx;
color: rgba(0, 0, 0, 0.5);
padding: 20rpx 0;
}
.code_box_record_detail {
width: 33%;
font-size: 26rpx;
padding: 20rpx 0;
}
.button {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: white;
border-radius: 5px;
line-height: 80rpx;
background-color: #07c160;
}
.button_clear {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: #07c160;
border-radius: 5px;
line-height: 80rpx;
background-color: rgba(0, 0, 0, 0.03);
}
.line {
height: 1rpx;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
}

@ -1,46 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
showUploadTip: false,
haveGetRecord: false,
envId: '',
record: ''
},
onLoad(options) {
this.setData({
envId: options.envId
});
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId
},
data: {
type: 'sumRecord'
}
}).then((resp) => {
this.setData({
record: resp.result.list
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},
goBack() {
wx.navigateBack();
},
});

@ -1,6 +0,0 @@
{
"navigationBarTitleText": "聚合记录",
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -1,19 +0,0 @@
<view>
<view class="top_tip">常用数据库中的groupby操作体验按地域聚合数据。</view>
<view class="box_text" wx:if="{{!record}}">数据将展示在这里</view>
<view wx:if="{{record}}" class="code_box">
<view class="code_box_title">地区销量统计</view>
<view class="code_box_record">
<view class="code_box_record_title">地域</view>
<view class="code_box_record_title">销量</view>
</view>
<view class="line"></view>
<view class="code_box_record" wx:for="{{record}}" wx:key="_id">
<view class="code_box_record_detail">{{item._id}}</view>
<view class="code_box_record_detail">{{item.sum}}</view>
</view>
</view>
<view class="button" bindtap="goBack">返回上一步</view>
<view class="tip">在”资源管理器>cloudfunctions>quickstartFunctions>sumRecord>index.js“找到聚合记录函数体验该能力</view>
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal>
</view>

@ -1,73 +0,0 @@
.tip {
font-size: 23rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: center;
margin: 30rpx auto 0 auto;
}
.top_tip {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: left;
margin-top: 30rpx;
margin-left: 20rpx;
}
.box_text {
background-color: white;
text-align: center;
padding: 300rpx 0;
margin-top: 30rpx;
color: rgba(0, 0, 0, 0.5);
}
.code_box {
text-align: center;
background-color: white;
margin-top: 30rpx;
padding: 17rpx;
}
.code_box_title {
color: rgba(0, 0, 0, 0.5);
font-size: 26rpx;
margin-bottom: 20rpx;
text-align: left;
}
.code_box_record {
display: flex;
justify-content: space-between;
}
.code_box_record_title {
width: 33%;
font-size: 26rpx;
color: rgba(0, 0, 0, 0.5);
padding: 20rpx 0;
}
.code_box_record_detail {
width: 33%;
font-size: 26rpx;
padding: 20rpx 0;
}
.button {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: #07c160;
border-radius: 5px;
line-height: 80rpx;
background-color: rgba(0, 0, 0, 0.03);
}
.line {
height: 1rpx;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
}

@ -1,51 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
showUploadTip: false,
haveGetRecord: false,
envId: '',
record: ''
},
onLoad(options) {
this.setData({
envId: options.envId
});
},
onShow() {
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId
},
data: {
type: 'selectRecord'
}
}).then((resp) => {
this.setData({
record: resp.result.data
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},
updateRecord() {
wx.navigateTo({
url: `/pages/updateRecordResult/index?envId=${this.data.envId}`,
});
},
});

@ -1,6 +0,0 @@
{
"navigationBarTitleText": "更新记录",
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -1,21 +0,0 @@
<view>
<view class="top_tip">体验更新字段记录能力,更新数据表中的销量数据。</view>
<view class="box_text" wx:if="{{!record}}">数据将展示在这里</view>
<view wx:if="{{record}}" class="code_box">
<view class="code_box_title">地区销量统计</view>
<view class="code_box_record">
<view class="code_box_record_title">地域</view>
<view class="code_box_record_title">城市</view>
<view class="code_box_record_title">销量</view>
</view>
<view class="line"></view>
<view class="code_box_record" wx:for="{{record}}" wx:key="_id">
<view class="code_box_record_detail">{{item.region}}</view>
<view class="code_box_record_detail">{{item.city}}</view>
<view class="code_box_record_detail">{{item.sales}}</view>
</view>
</view>
<view class="button" bindtap="updateRecord">修改数据</view>
<view class="tip">在”资源管理器>cloudfunctions>quickstartFunctions>updateRecord>index.js“找到查询记录函数体验该能力</view>
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal>
</view>

@ -1,83 +0,0 @@
.tip {
font-size: 23rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: center;
margin: 30rpx auto 0 auto;
}
.top_tip {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: left;
margin-top: 30rpx;
margin-left: 20rpx;
}
.box_text {
background-color: white;
text-align: center;
padding: 300rpx 0;
margin-top: 30rpx;
color: rgba(0, 0, 0, 0.5);
}
.code_box {
text-align: center;
background-color: white;
margin-top: 30rpx;
padding: 17rpx;
}
.code_box_title {
color: rgba(0, 0, 0, 0.5);
font-size: 26rpx;
margin-bottom: 20rpx;
text-align: left;
}
.code_box_record {
display: flex;
}
.code_box_record_title {
width: 33%;
font-size: 26rpx;
color: rgba(0, 0, 0, 0.5);
padding: 20rpx 0;
}
.code_box_record_detail {
width: 33%;
font-size: 26rpx;
padding: 20rpx 0;
}
.button {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: white;
border-radius: 5px;
line-height: 80rpx;
background-color: #07c160;
}
.button_clear {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: #07c160;
border-radius: 5px;
line-height: 80rpx;
background-color: rgba(0, 0, 0, 0.03);
}
.line {
height: 1rpx;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
}

@ -1,78 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
showUploadTip: false,
haveGetRecord: false,
envId: '',
record: ''
},
onLoad(options) {
this.setData({
envId: options.envId
});
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId
},
data: {
type: 'selectRecord'
}
}).then((resp) => {
this.setData({
record: resp.result.data
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},
updateRecord() {
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId
},
data: {
type: 'updateRecord',
data: this.data.record
}
}).then((resp) => {
wx.navigateTo({
url: `/pages/updateRecordSuccess/index`,
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},
bindInput (e) {
const index = e.currentTarget.dataset.index;
const record = this.data.record;
record[index].sales = Number(e.detail.value);
this.setData({
record
});
},
});

@ -1,6 +0,0 @@
{
"navigationBarTitleText": "更新记录",
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -1,21 +0,0 @@
<view>
<view class="top_tip">体验更新字段记录能力,更新数据表中的销量数据。</view>
<view class="box_text" wx:if="{{!record}}">数据将展示在这里</view>
<view wx:if="{{record}}" class="code_box">
<view class="code_box_title">地区销量统计</view>
<view class="code_box_record">
<view class="code_box_record_title">地域</view>
<view class="code_box_record_title">城市</view>
<view class="code_box_record_title">销量</view>
</view>
<view class="line"></view>
<view class="code_box_record" wx:for="{{record}}" wx:key="_id">
<view class="code_box_record_detail">{{item.region}}</view>
<view class="code_box_record_detail">{{item.city}}</view>
<input class="code_box_record_detail" bindinput="bindInput" data-index="{{index}}" value="{{item.sales}}" type="number"></input>
</view>
</view>
<view class="button" bindtap="updateRecord">更新</view>
<view class="tip">在”资源管理器>cloudfunctions>quickstartFunctions>updateRecord>index.js“找到查询记录函数体验该能力</view>
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal>
</view>

@ -1,72 +0,0 @@
.tip {
font-size: 23rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: center;
margin: 30rpx auto 0 auto;
}
.top_tip {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: left;
margin-top: 30rpx;
margin-left: 20rpx;
}
.box_text {
background-color: white;
text-align: center;
padding: 300rpx 0;
margin-top: 30rpx;
color: rgba(0, 0, 0, 0.5);
}
.code_box {
text-align: center;
background-color: white;
margin-top: 30rpx;
padding: 17rpx;
}
.code_box_title {
color: rgba(0, 0, 0, 0.5);
font-size: 26rpx;
margin-bottom: 20rpx;
text-align: left;
}
.code_box_record {
display: flex;
}
.code_box_record_title {
width: 33%;
font-size: 26rpx;
color: rgba(0, 0, 0, 0.5);
padding: 20rpx 0;
}
.code_box_record_detail {
width: 33%;
font-size: 26rpx;
padding: 20rpx 0;
}
.button {
width: 300rpx;
text-align: center;
margin: 250rpx auto 0 auto;
height: 80rpx;
color: white;
border-radius: 5px;
line-height: 80rpx;
background-color: #07c160;
}
.line {
height: 1rpx;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
}

@ -1,16 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
},
goBack() {
wx.navigateBack({
delta: 2
});
},
});

@ -1,6 +0,0 @@
{
"navigationBarTitleText": "更新记录",
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -1,6 +0,0 @@
<view>
<icon class="icon-box-img icon" type="success" size="53"></icon>
<view class="title">地区销量统计更新成功</view>
<view class="info">可在“云开发控制台>数据库>记录列表”中进行查看</view>
<view class="button" bindtap="goBack">我知道了</view>
</view>

@ -1,30 +0,0 @@
page {
text-align: center;
}
.icon {
margin: 80rpx 0 50rpx 0;
}
.title {
font-size: 42rpx;
font-weight: 600;
margin-bottom: 30rpx;
}
.info {
font-size: 36rpx;
width: 90%;
margin: 0 auto;
}
.button {
width: 300rpx;
text-align: center;
margin: 550rpx auto 0 auto;
height: 80rpx;
color: #07c160;
border-radius: 5px;
line-height: 80rpx;
background-color: rgba(0, 0, 0, 0.03);
}

@ -1,58 +0,0 @@
Page({
/**
* 页面的初始数据
*/
data: {
showUploadTip: false,
haveGetImgSrc: false,
envId: '',
imgSrc: ''
},
onLoad(options) {
this.setData({
envId: options.envId
});
},
uploadImg() {
wx.showLoading({
title: '',
});
// 让用户选择一张图片
wx.chooseImage({
count: 1,
success: chooseResult => {
// 将图片上传至云存储空间
wx.cloud.uploadFile({
// 指定上传到的云路径
cloudPath: 'my-photo.png',
// 指定要上传的文件的小程序临时文件路径
filePath: chooseResult.tempFilePaths[0],
config: {
env: this.data.envId
}
}).then(res => {
console.log('上传成功', res);
this.setData({
haveGetImgSrc: true,
imgSrc: res.fileID
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
wx.hideLoading();
});
},
});
},
clearImgSrc() {
this.setData({
haveGetImgSrc: false,
imgSrc: ''
});
}
});

@ -1,6 +0,0 @@
{
"navigationBarTitleText": "上传文件",
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -1,15 +0,0 @@
<view>
<view class="top_tip">多存储类型,仅需一个云函数即可完成上传。</view>
<view class="box_text" wx:if="{{!imgSrc}}">上传的图片将展示在这里</view>
<view wx:if="{{imgSrc}}" class="code_box">
<image class="code_img" src="{{imgSrc}}"></image>
<view class="img_info">
<view class="img_info_title">文件路径</view>
<view class="img_info_detail">{{imgSrc}}</view>
</view>
</view>
<view class="button" bindtap="uploadImg" wx:if="{{!haveGetImgSrc}}">上传一张图片</view>
<view class="button_clear" bindtap="clearImgSrc" wx:if="{{haveGetImgSrc}}">清空</view>
<view class="tip">在“资源管理器>miniprogram>pages>uploadFile>index.js”找到相应代码体验该能力</view>
<cloud-tip-modal showUploadTipProps="{{showUploadTip}}"></cloud-tip-modal>
</view>

@ -1,86 +0,0 @@
.tip {
font-size: 23rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: center;
margin: 30rpx auto 0 auto;
}
.top_tip {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.5);
width: 90%;
text-align: left;
margin-top: 30rpx;
margin-left: 20rpx;
}
.box_text {
background-color: white;
text-align: center;
padding: 300rpx 0;
margin-top: 30rpx;
color: rgba(0, 0, 0, 0.5);
}
.code_box {
text-align: center;
background-color: white;
margin-top: 30rpx;
padding: 50rpx 0 17px 0;
}
.code_img {
width: 300rpx;
height: 300rpx;
}
.button {
width: 300rpx;
text-align: center;
margin: 20% auto 0 auto;
height: 80rpx;
color: white;
border-radius: 5px;
line-height: 80rpx;
background-color: #07c160;
}
.button_clear {
width: 300rpx;
text-align: center;
margin: 20% auto 0 auto;
height: 80rpx;
color: #07c160;
border-radius: 5px;
line-height: 80rpx;
background-color: rgba(0, 0, 0, 0.03);
}
.img_info {
padding-top: 16px;
width: 90%;
margin: 0 auto;
display: flex;
padding: 16rpx 0;
border-top: 0.5px solid #E5E5E5;
margin-top: 50rpx;
}
.img_info_title {
font-size: 14;
font-family: PingFang SC;
font-weight: 400;
color: #888888;
width: 72px;
margin-right: 32px;
}
.img_info_detail {
text-align: left;
font-size: 14;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
width: 500rpx;
}

@ -21,8 +21,6 @@
"compileHotReLoad": false, "compileHotReLoad": false,
"lazyloadPlaceholderEnable": false, "lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true, "useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],
@ -37,11 +35,9 @@
"disableUseStrict": false, "disableUseStrict": false,
"showES6CompileOption": false, "showES6CompileOption": false,
"useCompilerPlugins": false, "useCompilerPlugins": false,
"minifyWXML": true "minifyWXML": true,
"ignoreUploadUnusedFiles": true
}, },
"appid": "wxa443f40488e954d4",
"projectname": "quickstart-wx-cloud",
"libVersion": "2.14.1",
"cloudfunctionTemplateRoot": "cloudfunctionTemplate/", "cloudfunctionTemplateRoot": "cloudfunctionTemplate/",
"condition": { "condition": {
"search": { "search": {
@ -68,12 +64,14 @@
}, },
"srcMiniprogramRoot": "miniprogram/", "srcMiniprogramRoot": "miniprogram/",
"compileType": "miniprogram", "compileType": "miniprogram",
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"libVersion": "2.14.1",
"packOptions": { "packOptions": {
"ignore": [], "ignore": [],
"include": [] "include": []
}, },
"editorSetting": { "appid": "wxa443f40488e954d4"
"tabIndent": "insertSpaces",
"tabSize": 2
}
} }

@ -56,5 +56,5 @@
} }
}, },
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "%E8%BD%AF%E5%B7%A5%E8%AF%BE%E8%AE%BE" "projectname": "miniprogram1"
} }
Loading…
Cancel
Save