Initial commit

pull/2/head
ZY 4 weeks ago
commit 816f9b8ae5

@ -0,0 +1,7 @@
{
"permissions": {
"openapi": [
"wxacode.get"
]
}
}

@ -0,0 +1,186 @@
const cloud = require("wx-server-sdk");
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
});
const db = cloud.database();
// 获取openid
const getOpenId = async () => {
// 获取基础信息
const wxContext = cloud.getWXContext();
return {
openid: wxContext.OPENID,
appid: wxContext.APPID,
unionid: wxContext.UNIONID,
};
};
// 获取小程序二维码
const getMiniProgramCode = async () => {
// 获取小程序二维码的buffer
const resp = await cloud.openapi.wxacode.get({
path: "pages/index/index",
});
const { buffer } = resp;
// 将图片上传云存储空间
const upload = await cloud.uploadFile({
cloudPath: "code.png",
fileContent: buffer,
});
return upload.fileID;
};
// 创建集合
const createCollection = async () => {
try {
// 创建集合
await db.createCollection("sales");
await db.collection("sales").add({
// data 字段表示需新增的 JSON 数据
data: {
region: "华东",
city: "上海",
sales: 11,
},
});
await db.collection("sales").add({
// data 字段表示需新增的 JSON 数据
data: {
region: "华东",
city: "南京",
sales: 11,
},
});
await db.collection("sales").add({
// data 字段表示需新增的 JSON 数据
data: {
region: "华南",
city: "广州",
sales: 22,
},
});
await db.collection("sales").add({
// data 字段表示需新增的 JSON 数据
data: {
region: "华南",
city: "深圳",
sales: 22,
},
});
return {
success: true,
};
} catch (e) {
// 这里catch到的是该collection已经存在从业务逻辑上来说是运行成功的所以catch返回success给前端避免工具在前端抛出异常
return {
success: true,
data: "create collection success",
};
}
};
// 查询数据
const selectRecord = async () => {
// 返回数据库查询结果
return await db.collection("sales").get();
};
// 更新数据
const updateRecord = async (event) => {
try {
// 遍历修改数据库信息
for (let i = 0; i < event.data.length; i++) {
await db
.collection("sales")
.where({
_id: event.data[i]._id,
})
.update({
data: {
sales: event.data[i].sales,
},
});
}
return {
success: true,
data: event.data,
};
} catch (e) {
return {
success: false,
errMsg: e,
};
}
};
// 新增数据
const insertRecord = async (event) => {
try {
const insertRecord = event.data;
// 插入数据
await db.collection("sales").add({
data: {
region: insertRecord.region,
city: insertRecord.city,
sales: Number(insertRecord.sales),
},
});
return {
success: true,
data: event.data,
};
} catch (e) {
return {
success: false,
errMsg: e,
};
}
};
// 删除数据
const deleteRecord = async (event) => {
try {
await db
.collection("sales")
.where({
_id: event.data._id,
})
.remove();
return {
success: true,
};
} catch (e) {
return {
success: false,
errMsg: e,
};
}
};
// const getOpenId = require('./getOpenId/index');
// const getMiniProgramCode = require('./getMiniProgramCode/index');
// const createCollection = require('./createCollection/index');
// const selectRecord = require('./selectRecord/index');
// const updateRecord = require('./updateRecord/index');
// const sumRecord = require('./sumRecord/index');
// const fetchGoodsList = require('./fetchGoodsList/index');
// const genMpQrcode = require('./genMpQrcode/index');
// 云函数入口函数
exports.main = async (event, context) => {
switch (event.type) {
case "getOpenId":
return await getOpenId();
case "getMiniProgramCode":
return await getMiniProgramCode();
case "createCollection":
return await createCollection();
case "selectRecord":
return await selectRecord();
case "updateRecord":
return await updateRecord(event);
case "insertRecord":
return await insertRecord(event);
case "deleteRecord":
return await deleteRecord(event);
}
};

@ -0,0 +1,14 @@
{
"name": "quickstartFunctions",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "~2.4.0"
}
}

@ -0,0 +1,20 @@
// app.js
App({
onLaunch: function () {
this.globalData = {
// env 参数说明:
// env 参数决定接下来小程序发起的云开发调用wx.cloud.xxx会默认请求到哪个云环境的资源
// 此处请填入环境 ID, 环境 ID 可打开云控制台查看
// 如不填则使用默认环境(第一个创建的环境)
env: ""
};
if (!wx.cloud) {
console.error("请使用 2.2.3 或以上的基础库以使用云能力");
} else {
wx.cloud.init({
env: this.globalData.env,
traceUser: true,
});
}
},
});

@ -0,0 +1,16 @@
{
"pages": [
"pages/index/index",
"pages/example/index"
],
"window": {
"backgroundColor": "#F6F6F6",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#F6F6F6",
"navigationBarTitleText": "云开发 QuickStart",
"navigationBarTextStyle": "black"
},
"sitemapLocation": "sitemap.json",
"style": "v2",
"lazyCodeLoading": "requiredComponents"
}

@ -0,0 +1,27 @@
/**app.wxss**/
.container {
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
}
button {
background: initial;
}
button:focus{
outline: 0;
}
button::after{
border: none;
}
page {
background: #f6f6f6;
display: flex;
flex-direction: column;
justify-content: flex-start;
}

@ -0,0 +1,28 @@
Component({
/**
* 页面的初始数据
*/
data: {
showTip: false,
},
properties: {
showTipProps: Boolean,
title:String,
content:String
},
observers: {
showTipProps: function(showTipProps) {
this.setData({
showTip: showTipProps
});
}
},
methods: {
onClose(){
this.setData({
showTip: !this.data.showTip
});
},
}
});

@ -0,0 +1,4 @@
{
"usingComponents": {},
"component": true
}

@ -0,0 +1,10 @@
<!--miniprogram/components/cloudTipModal/index.wxml-->
<!-- wx:if="{{showUploadTip}}" -->
<view class="install_tip" wx:if="{{showTip}}">
<view class="install_tip_back"></view>
<view class="install_tip_detail">
<image class="install_tip_close" bind:tap="onClose" src="../../images/icons/close.png"/>
<view class="install_tip_detail_title">{{title}}</view>
<view class="install_tip_detail_tip">{{content}}</view>
</view>
</view>

@ -0,0 +1,60 @@
.install_tip_back {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0,0,0,0.4);
z-index: 1;
}
.install_tip_close{
position:absolute;
right: 10rpx;
top: 10rpx;
width: 32px;
height: 32px;
/* background-color: red; */
}
.install_tip_detail {
position: fixed;
background-color: white;
right: 0;
bottom: 0;
left: 0;
border-radius: 40rpx 40rpx 0 0;
padding: 50rpx 50rpx 100rpx 50rpx;
z-index: 9;
}
.install_tip_detail_title {
font-weight: 400;
font-size: 40rpx;
text-align: center;
}
.install_tip_detail_tip {
font-size: 25rpx;
color: rgba(0,0,0,0.4);
margin-top: 20rpx;
text-align: left;
}
.install_tip_detail_buttons {
padding-top: 50rpx;
display: flex;
}
.install_tip_detail_button {
color: #07C160;
font-weight: 500;
background-color: rgba(0,0,0,0.1);
width: 40%;
text-align: center;
/* height: 90rpx; */
/* line-height: 90rpx; */
border-radius: 10rpx;
margin: 0 auto;
}
.install_tip_detail_button_primary {
background-color: #07C160;
color: #fff;
}

@ -0,0 +1,6 @@
const envList = [];
const isMac = false;
module.exports = {
envList,
isMac
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="8px" height="14px" viewBox="0 0 8 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>☀ iOS/☀ 图标/线型/icons_outlined_arrow@3x</title>
<g id="控件" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.3">
<g id="4.列表/z.覆盖层/右边/箭头" transform="translate(-334.000000, -21.000000)" fill="#000000">
<g id="☀-iOS/☀-图标/线型/icons_outlined_arrow" transform="translate(332.000000, 16.000000)">
<path d="M2.45405845,6.58064919 L3.51471863,5.51998901 L9.29361566,11.298886 C9.68374096,11.6890113 9.6872014,12.318069 9.29361566,12.7116547 L3.51471863,18.4905518 L2.45405845,17.4298916 L7.87867966,12.0052704 L2.45405845,6.58064919 Z" id="Combined-Shape"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@ -0,0 +1,2 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 2H15V7.5H13V4H4V13H7.5V15H2V2ZM9 9H22V22H9V9ZM11 11V20H20V11H11Z" fill="#8b8b8b" />
</svg>

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.95693 15.75H19.5V6H4.5V17.7974L6.95693 15.75ZM3.73808 20.3849C3.44499 20.6292 3 20.4208 3 20.0392V6C3 5.17157 3.67157 4.5 4.5 4.5H19.5C20.3284 4.5 21 5.17157 21 6V15.75C21 16.5784 20.3284 17.25 19.5 17.25H7.5L3.73808 20.3849Z" fill="black" fill-opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.0911 17.4C11.0911 16.9029 11.494 16.5 11.9911 16.5C12.4881 16.5 12.8911 16.9029 12.8911 17.4C12.8911 17.8971 12.4881 18.3 11.9911 18.3C11.494 18.3 11.0911 17.8971 11.0911 17.4Z" fill="black" fill-opacity="0.9"/>
<path d="M11.9911 6.00915C9.98467 6.00915 8.35363 7.64019 8.35363 9.64665H9.85363C9.85363 8.46862 10.8131 7.50915 11.9911 7.50915C13.1692 7.50915 14.1286 8.46862 14.1286 9.64665C14.1286 10.4533 13.4619 11.2621 12.5917 11.6156L12.5878 11.6172C11.7935 11.945 11.2412 12.7262 11.2412 13.6387V15H12.7412V13.6387C12.7412 13.3474 12.9142 13.106 13.1585 13.0044C14.3995 12.4993 15.6286 11.248 15.6286 9.64665C15.6286 7.64019 13.9976 6.00915 11.9911 6.00915Z" fill="black" fill-opacity="0.9"/>
<path d="M22.4912 12C22.4912 6.20101 17.7902 1.5 11.9912 1.5C6.19222 1.5 1.49121 6.20101 1.49121 12C1.49121 17.799 6.19222 22.5 11.9912 22.5C17.7902 22.5 22.4912 17.799 22.4912 12ZM20.9912 12C20.9912 16.9706 16.9618 21 11.9912 21C7.02065 21 2.99121 16.9706 2.99121 12C2.99121 7.02944 7.02065 3 11.9912 3C16.9618 3 20.9912 7.02944 20.9912 12Z" fill="black" fill-opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16.5002 12C16.5002 14.4853 14.4855 16.5 12.0002 16.5C9.51497 16.5 7.50025 14.4853 7.50025 12C7.50025 9.51472 9.51497 7.5 12.0002 7.5C14.4855 7.5 16.5002 9.51472 16.5002 12ZM15.0002 12C15.0002 10.3431 13.6571 9 12.0002 9C10.3434 9 9.00025 10.3431 9.00025 12C9.00025 13.6569 10.3434 15 12.0002 15C13.6571 15 15.0002 13.6569 15.0002 12Z" fill="black" fill-opacity="0.9"/>
<path d="M12.0002 1.875L21.0935 6.9375V17.0625L12.0002 22.125L2.90698 17.0625V6.9375L12.0002 1.875ZM4.40698 7.8192V16.1808L12.0002 20.4082L19.5935 16.1808V7.8192L12.0002 3.59179L4.40698 7.8192Z" fill="black" fill-opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 711 B

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.43993 20.5601C3.72112 20.8413 4.10234 20.9995 4.5 21H19.5C19.8977 20.9995 20.2789 20.8413 20.5601 20.5601C20.8413 20.2789 20.9995 19.8977 21 19.5V12.75H19.5V19.5H4.5V4.5H11.25V3H4.5C4.10234 3.00054 3.72112 3.15874 3.43993 3.43993C3.15874 3.72112 3.00054 4.10234 3 4.5V19.5C3.00054 19.8977 3.15874 20.2789 3.43993 20.5601Z" fill="black" fill-opacity="0.9"/>
<path d="M13.5 4.5V3H20.25C20.6642 3 21 3.33579 21 3.75V10.5H19.5V5.5605L13.0605 12L12 10.9395L18.4395 4.5H13.5Z" fill="black" fill-opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@ -0,0 +1,569 @@
// pages/exampleDetail/index.js
Page({
data: {
type: "",
envId: "",
showTip: false,
title: "",
content: "",
haveGetOpenId: false,
openId: "",
haveGetCodeSrc: false,
codeSrc: "",
haveGetRecord: false,
record: [],
haveGetImgSrc: false,
imgSrc: "",
// ai
modelConfig: {
modelProvider: "deepseek", // 大模型服务厂商
quickResponseModel: "deepseek-v3", // 快速响应模型 (混元 turbo, gpt4 turbo版deepseek v3等
logo: "https://cloudcache.tencent-cloud.com/qcloud/ui/static/static_source_business/2339414f-2c0d-4537-9618-1812bd14f4af.svg", // model 头像
welcomeMsg: "我是deepseek-v3很高兴见到你", // model 欢迎语
},
callcbrCode: "",
initEnvCode: "",
callOpenIdCode: "",
callMiniProgramCode: "",
callFunctionCode: "",
callCreateCollectionCode: "",
callUploadFileCode: "",
showInsertModal: false,
insertRegion: "",
insertCity: "",
insertSales: "",
haveGetCallContainerRes: false,
callContainerResStr: "",
ai_page_config: `{
"usingComponents": {
"agent-ui":"/components/agent-ui/index"
},
}`,
ai_wxml_config: `&lt;agent-ui agentConfig="{{agentConfig}}" showBotAvatar="{{showBotAvatar}}" chatMode="{{chatMode}}" modelConfig="{{modelConfig}}""&gt;&lt;/agent-ui&gt;`,
ai_data_config: `data: {
chatMode: "bot", // bot 表示使用agentmodel 表示使用大模型
showBotAvatar: true, // 是否在对话框左侧显示头像
agentConfig: {
botId: "your agent id", // agent id,
allowWebSearch: true, // 允许客户端选择展示联网搜索按钮
allowUploadFile: true, // 允许客户端展示上传文件按钮
allowPullRefresh: true, // 允许客户端展示下拉刷新
allowUploadImage: true, // 允许客户端展示上传图片按钮
allowMultiConversation: true, // 允许客户端展示查看会话列表/新建会话按钮
showToolCallDetail: true, // 是否展示 mcp server toolCall 细节
allowVoice: true, // 允许客户端展示语音按钮
showBotName: true, // 允许展示bot名称
},
modelConfig: {
modelProvider: "hunyuan-open", // 大模型服务厂商
quickResponseModel: "hunyuan-lite", // 大模型名称
logo: "", // model 头像
welcomeMsg: "欢迎语", // model 欢迎语
},
}`,
},
onLoad(options) {
console.log("options", options);
if (
options.type === "cloudbaserunfunction" ||
options.type === "cloudbaserun"
) {
this.getCallcbrCode();
}
if (options.type === "getOpenId") {
this.getOpenIdCode();
}
if (options.type === "getMiniProgramCode") {
this.getMiniProgramCode();
}
if (options.type === "createCollection") {
this.getCreateCollectionCode();
}
if (options.type === "uploadFile") {
this.getUploadFileCode();
}
this.setData({ type: options?.type, envId: options?.envId });
},
copyUrl() {
wx.setClipboardData({
data: "https://gitee.com/TencentCloudBase/cloudbase-agent-ui/tree/main/apps/miniprogram-agent-ui/miniprogram/components/agent-ui",
success: function (res) {
wx.showToast({
title: "复制成功",
icon: "success",
});
},
});
},
insertRecord() {
this.setData({
showInsertModal: true,
insertRegion: "",
insertCity: "",
insertSales: "",
});
},
deleteRecord(e) {
console.log("deleteRecord e", e);
// 调用云函数删除记录
wx.showLoading({
title: "删除中...",
});
wx.cloud
.callFunction({
name: "quickstartFunctions",
data: {
type: "deleteRecord",
data: {
_id: e.currentTarget.dataset.id,
},
},
})
.then((resp) => {
wx.showToast({
title: "删除成功",
});
this.getRecord(); // 刷新列表
wx.hideLoading();
})
.catch((e) => {
wx.showToast({
title: "删除失败",
icon: "none",
});
wx.hideLoading();
});
// const index = e.currentTarget.dataset.index;
// const record = this.data.record;
// record.splice(index, 1);
// this.setData({
// record,
// });
},
// 输入框事件
onInsertRegionInput(e) {
this.setData({ insertRegion: e.detail.value });
},
onInsertCityInput(e) {
this.setData({ insertCity: e.detail.value });
},
onInsertSalesInput(e) {
this.setData({ insertSales: e.detail.value });
},
// 取消弹窗
onInsertCancel() {
this.setData({ showInsertModal: false });
},
// 确认插入
async onInsertConfirm() {
const { insertRegion, insertCity, insertSales } = this.data;
if (!insertRegion || !insertCity || !insertSales) {
wx.showToast({ title: "请填写完整信息", icon: "none" });
return;
}
wx.showLoading({ title: "插入中..." });
try {
await wx.cloud.callFunction({
name: "quickstartFunctions",
data: {
type: "insertRecord",
data: {
region: insertRegion,
city: insertCity,
sales: Number(insertSales),
},
},
});
wx.showToast({ title: "插入成功" });
this.setData({ showInsertModal: false });
this.getRecord(); // 刷新列表
} catch (e) {
wx.showToast({ title: "插入失败", icon: "none" });
} finally {
wx.hideLoading();
}
},
getOpenId() {
wx.showLoading({
title: "",
});
wx.cloud
.callFunction({
name: "quickstartFunctions",
data: {
type: "getOpenId",
},
})
.then((resp) => {
this.setData({
haveGetOpenId: true,
openId: resp.result.openid,
});
wx.hideLoading();
})
.catch((e) => {
wx.hideLoading();
const { errCode, errMsg } = e;
if (errMsg.includes("Environment not found")) {
this.setData({
showTip: true,
title: "云开发环境未找到",
content:
"如果已经开通云开发请检查环境ID与 `miniprogram/app.js` 中的 `env` 参数是否一致。",
});
return;
}
if (errMsg.includes("FunctionName parameter could not be found")) {
this.setData({
showTip: true,
title: "请上传云函数",
content:
"在'cloudfunctions/quickstartFunctions'目录右键,选择【上传并部署-云端安装依赖】,等待云函数上传完成后重试。",
});
return;
}
});
},
clearOpenId() {
this.setData({
haveGetOpenId: false,
openId: "",
});
},
clearCallContainerRes() {
this.setData({
haveGetCallContainerRes: false,
callContainerResStr: "",
});
},
getCodeSrc() {
wx.showLoading({
title: "",
});
wx.cloud
.callFunction({
name: "quickstartFunctions",
data: {
type: "getMiniProgramCode",
},
})
.then((resp) => {
this.setData({
haveGetCodeSrc: true,
codeSrc: resp.result,
});
wx.hideLoading();
})
.catch((e) => {
wx.hideLoading();
const { errCode, errMsg } = e;
if (errMsg.includes("Environment not found")) {
this.setData({
showTip: true,
title: "云开发环境未找到",
content:
"如果已经开通云开发请检查环境ID与 `miniprogram/app.js` 中的 `env` 参数是否一致。",
});
return;
}
if (errMsg.includes("FunctionName parameter could not be found")) {
this.setData({
showTip: true,
title: "请上传云函数",
content:
"在'cloudfunctions/quickstartFunctions'目录右键,选择【上传并部署-云端安装依赖】,等待云函数上传完成后重试。",
});
return;
}
});
},
clearCodeSrc() {
this.setData({
haveGetCodeSrc: false,
codeSrc: "",
});
},
bindInput(e) {
const index = e.currentTarget.dataset.index;
const record = this.data.record;
record[index].sales = Number(e.detail.value);
this.setData({
record,
});
},
getRecord() {
wx.showLoading({
title: "",
});
wx.cloud
.callFunction({
name: "quickstartFunctions",
data: {
type: "selectRecord",
},
})
.then((resp) => {
this.setData({
haveGetRecord: true,
record: resp.result.data,
});
wx.hideLoading();
})
.catch((e) => {
this.setData({
showTip: true,
});
wx.hideLoading();
});
},
clearRecord() {
this.setData({
haveGetRecord: false,
record: [],
});
},
updateRecord() {
wx.showLoading({
title: "",
});
wx.cloud
.callFunction({
name: "quickstartFunctions",
data: {
type: "updateRecord",
data: this.data.record,
},
})
.then((resp) => {
wx.showToast({
title: "更新成功",
});
wx.hideLoading();
})
.catch((e) => {
console.log(e);
this.setData({
showUploadTip: true,
});
wx.hideLoading();
});
},
uploadImg() {
wx.showLoading({
title: "",
});
// 让用户选择一张图片
wx.chooseMedia({
count: 1,
success: (chooseResult) => {
// 将图片上传至云存储空间
wx.cloud
.uploadFile({
// 指定上传到的云路径
cloudPath: `my-photo-${new Date().getTime()}.png`,
// 指定要上传的文件的小程序临时文件路径
filePath: chooseResult.tempFiles[0].tempFilePath,
})
.then((res) => {
console.log("upload res", res);
this.setData({
haveGetImgSrc: true,
imgSrc: res.fileID,
});
})
.catch((e) => {
console.log("e", e);
});
},
complete: () => {
wx.hideLoading();
},
});
},
clearImgSrc() {
this.setData({
haveGetImgSrc: false,
imgSrc: "",
});
},
goOfficialWebsite() {
const url = "https://docs.cloudbase.net/toolbox/quick-start";
wx.navigateTo({
url: `../web/index?url=${url}`,
});
},
runCallContainer: async function () {
const app = getApp();
console.log("globalData", app.globalData);
const c1 = new wx.cloud.Cloud({
resourceEnv: app.globalData.env,
});
await c1.init();
const r = await c1.callContainer({
path: "/api/users", // 填入业务自定义路径
header: {
"X-WX-SERVICE": "express-test", // 填入服务名称
},
// 其余参数同 wx.request
method: "GET",
});
console.log(r);
this.setData({
haveGetCallContainerRes: true,
callContainerResStr: `${JSON.stringify(r.data.items, null, 2)}`,
});
},
getCallcbrCode: function () {
const app = getApp();
this.setData({
callcbrCode: `const c1 = new wx.cloud.Cloud({
resourceEnv: ${app.globalData.env}
})
await c1.init()
const r = await c1.callContainer({
path: '/api/users', // 此处填入业务自定义路径, /api/users 为示例路径
header: {
'X-WX-SERVICE': 'express-test', // 填入业务服务名称express-test 为示例服务
},
// 其余参数同 wx.request
method: 'GET',
})`,
});
},
getInitEnvCode: function () {
const app = getApp();
this.setData({
initEnvCode: `wx.cloud.init({
env: ${app.globalData.env},
traceUser: true,
});`,
});
},
getCreateCollectionCode: function () {
this.setData({
callCreateCollectionCode: `const cloud = require('wx-server-sdk');
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database();
// 创建集合云函数入口函数
exports.main = async (event, context) => {
try {
// 创建集合
await db.createCollection('sales');
return {
success: true
};
} catch (e) {
return {
success: true,
data: 'create collection success'
};
}
};`,
});
},
getOpenIdCode: function () {
this.setData({
callOpenIdCode: `const cloud = require('wx-server-sdk');
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
});
// 获取openId云函数入口函数
exports.main = async (event, context) => {
// 获取基础信息
const wxContext = cloud.getWXContext();
return {
openid: wxContext.OPENID,
appid: wxContext.APPID,
unionid: wxContext.UNIONID,
};
};`,
callFunctionCode: `wx.cloud.callFunction({
name: 'quickstartFunctions',
data: {
type: 'getOpenId'
}
}).then((resp) => console.log(resp))`,
});
},
getMiniProgramCode: function () {
this.setData({
callMiniProgramCode: `const cloud = require('wx-server-sdk');
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
});
// 获取小程序二维码云函数入口函数
exports.main = async (event, context) => {
// 获取小程序二维码的buffer
const resp = await cloud.openapi.wxacode.get({
path: 'pages/index/index'
});
const { buffer } = resp;
// 将图片上传云存储空间
const upload = await cloud.uploadFile({
cloudPath: 'code.png',
fileContent: buffer
});
return upload.fileID;
};
`,
callFunctionCode: `wx.cloud.callFunction({
name: 'quickstartFunctions',
data: {
type: 'getMiniProgramCode'
}
}).then((resp) => console.log(resp))`,
});
},
getUploadFileCode: function () {
this.setData({
callUploadFileCode: `wx.chooseMedia({
count: 1,
success: (chooseResult) => {
// 将图片上传至云存储空间
wx.cloud
.uploadFile({
// 指定上传到的云路径
cloudPath: "my-photo.png",
// 指定要上传的文件的小程序临时文件路径
filePath: chooseResult.tempFiles[0].tempFilePath,
})
.then((res) => {
console.log(res)
})
.catch((e) => {
console.log('e', e)
});
}
});`,
});
},
});

@ -0,0 +1,5 @@
{
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -0,0 +1,189 @@
<!--pages/exampleDetail/index.wxml-->
<block wx:if="{{ type === 'getOpenId' }}">
<view class="page-container">
<view class="title">功能介绍</view>
<view class="info">云函数无需维护鉴权机制及登录票据,仅一行代码即可获得。</view>
<view class="title">云函数获取OpenId示例</view>
<!-- <view class="info">云函数无需维护鉴权机制及登录票据,仅一行代码即可获得。</view> -->
<view class="block">
<view class="step-title"><text class="step-left">step</text> <text class="step-right">1 </text>quickStartFunctions 云函数代码</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{callOpenIdCode}}</pre>" />
</view>
<view class="step-title"><text class="step-left">step</text> <text class="step-right">2 </text>小程序代码段</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{callFunctionCode}}</pre>" />
</view>
</view>
<view class="block">
<view class="btn-full" bind:tap="getOpenId" wx:if="{{!haveGetOpenId}}">运行示例</view>
<view class="box_text">{{ openId ? openId : 'OpenID将展示在这里' }}</view>
<cloud-tip-modal showTipProps="{{showTip}}" title="{{title}}" content="{{content}}"></cloud-tip-modal>
<view class="button_clear" bindtap="clearOpenId" wx:if="{{haveGetOpenId}}">清空</view>
</view>
</view>
</block>
<block wx:if="{{ type === 'getMiniProgramCode' }}">
<view class="page-container">
<view class="title">功能介绍</view>
<view class="info">可通过云函数免接口调用凭证,直接生成小程序码。</view>
<view class="title">云函数获取小程序码示例</view>
<view class="block">
<view class="step-title"><text class="step-left">step</text> <text class="step-right">1 </text>quickStartFunctions 云函数代码</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{callMiniProgramCode}}</pre>" />
</view>
<view class="step-title"><text class="step-left">step</text> <text class="step-right">2 </text>小程序代码段</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{callFunctionCode}}</pre>" />
</view>
</view>
<view class="block">
<view class="btn-full" bind:tap="getCodeSrc" wx:if="{{!haveGetCodeSrc}}">运行示例</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_clear" bindtap="clearCodeSrc" wx:if="{{haveGetCodeSrc}}">清空</view>
<cloud-tip-modal showTipProps="{{showTip}}" title="{{title}}" content="{{content}}"></cloud-tip-modal>
</view>
</view>
</block>
<block wx:if="{{ type === 'createCollection' }}">
<view class="page-container">
<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 class="title">云函数代码示例</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{callCreateCollectionCode}}</pre>" />
</view>
</view>
</block>
<block wx:if="{{ type === 'selectRecord' }}">
<view class="page-container">
<view class="title">功能介绍</view>
<view class="top_tip">体验查询记录能力,查询数据表中的销量数据。</view>
<view class="box_text" wx:if="{{!record}}">销量数据将展示在这里</view>
<view class="title">数据库操作示例</view>
<view class="top_tip">参考云函数 quickstartFunctions 示例代码</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 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> -->
<input style="background-color: rgba(0, 0, 0, 0.03)" class="code_box_record_detail" bindinput="bindInput" data-index="{{index}}" value="{{item.sales}}" type="number"></input>
<view class="code_box_record_detail">
<button style="font-size: 12px" bind:tap="deleteRecord" data-id="{{item._id}}">删除</button>
</view>
</view>
</view>
<view class="btn-full" bind:tap="getRecord" >查询记录</view>
<view class="btn-full" bind:tap="updateRecord" >更新记录</view>
<view class="btn-full" bind:tap="insertRecord" >新增记录</view>
<!-- <view class="button_clear" bindtap="clearRecord" wx:if="{{haveGetRecord}}">清空</view> -->
<cloud-tip-modal showTipProps="{{showTip}}"></cloud-tip-modal>
</view>
<view wx:if="{{showInsertModal}}" class="modal-mask">
<view class="modal-content">
<view class="modal-title">新增销量记录</view>
<input class="modal-input" placeholder="地域" value="{{insertRegion}}" bindinput="onInsertRegionInput"/>
<input class="modal-input" placeholder="城市" value="{{insertCity}}" bindinput="onInsertCityInput"/>
<input class="modal-input" placeholder="销量" value="{{insertSales}}" bindinput="onInsertSalesInput" type="number"/>
<view class="modal-actions">
<button bindtap="onInsertCancel">取消</button>
<button bindtap="onInsertConfirm" type="primary">确认</button>
</view>
</view>
</view>
</block>
<block wx:if="{{ type === 'uploadFile' }}">
<view class="page-container">
<view class="title">功能介绍</view>
<view class="top_tip">多存储类型,仅需一个云函数即可完成上传。</view>
<view class="title">文件上传示例</view>
<view class="block">
<view class="step-title">小程序代码段</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{callUploadFileCode}}</pre>" />
</view>
</view>
<view class="btn-full" bind:tap="uploadImg" wx:if="{{!haveGetImgSrc}}">运行示例</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_clear" bindtap="clearImgSrc" wx:if="{{haveGetImgSrc}}">清空</view>
<cloud-tip-modal showTipProps="{{showTip}}"></cloud-tip-modal>
</view>
</block>
<block wx:if="{{ type === 'model-guide'}}">
<view class="page-container">
<view class="title">功能介绍</view>
<view class="top_tip">腾讯云开发提供 AI 对话能力,支持 Agent大模型流式对话可通过 Agent-UI 组件快速集成 AI 能力</view>
<view class="title">集成 Agent-UI 组件指引</view>
<view class="block">
<view class="step-title"><text class="step-left">step</text> <text class="step-right">1 </text>拷贝组件源码包</view>
<view style="display: flex;align-items: center;">点击复制查看组件仓库地址 <image mode="widthFix" style="width: 20px;height: 20px" bind:tap="copyUrl" src='../../images/copy.svg'/></view>
<view class="step-title"><text class="step-left">step</text> <text class="step-right">2 </text>将组件拷贝至小程序目录中</view>
<image class="img" mode="widthFix" src="../../images/ai_example2.png"></image>
<view class="step-title"><text class="step-left">step</text> <text class="step-right">3 </text>在页面 .json 配置文件中注册组件</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{ai_page_config}}</pre>" />
</view>
<view class="step-title"><text class="step-left">step</text> <text class="step-right">4 </text>在页面 .wxml 文件中引用组件</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{ai_wxml_config}}</pre>" />
</view>
<view class="step-title"><text class="step-left">step</text> <text class="step-right">4 </text>在页面 .js 文件中编写配置</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{ai_data_config}}</pre>" />
</view>
</view>
</view>
</block>
<block wx:if="{{ type === 'cloudbaserun' }}">
<view class="page-container">
<view class="title">功能介绍</view>
<view class="info">云托管 支持托管用任意语言和框架编写的容器化应用,为开发者提供高可用、自动弹性扩缩的云服务。</view>
<view class="title">小程序调用云托管示例</view>
<view class="block">
<view class="step-title"><text class="step-left">step</text> <text class="step-right">1 </text>前往云开发平台开通云托管</view>
<view class="step-title"><text class="step-left">step</text> <text class="step-right">2 </text>新建容器型托管服务,等待部署完成</view>
<view class="step-text">
此处可使用 Express 示例模板进行安装,此处示例命名为 express-test
</view>
<view>
<image class="img" src="../../images/create_cbr.png" mode="aspectFill"></image>
</view>
<view class="step-title"><text class="step-left">step</text> <text class="step-right">3</text>小程序端调用</view>
<view class="code_zone">
<rich-text nodes="<pre style='overflow: scroll;'>{{callcbrCode}}</pre>" />
</view>
<view class="btn-full" bind:tap="runCallContainer" wx:if="{{!haveGetCallContainerRes}}">运行示例</view>
<view class="box_text">{{ callContainerResStr ? callContainerResStr : '云托管调用结果将展示在这里' }}</view>
<view class="button_clear" bindtap="clearCallContainerRes" wx:if="{{haveGetCallContainerRes}}">清空</view>
</view>
</view>
</block>

@ -0,0 +1,185 @@
page {
background-color: white;
padding-bottom: 50px;
font-family: PingFang SC;
}
.page-container {
padding: 20rpx 40rpx;
}
.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: 0 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);
}
.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: 25%;
font-size: 26rpx;
padding: 20rpx 0;
display: flex;
align-items: center;
justify-content: center;
}
.title {
margin-top: 16px;
margin-bottom: 8px;
font-size: 36rpx;
font-weight: 500;
color: #000;
}
.info {
margin-top: 12px;
font-size: 28rpx;
font-weight: 400;
color: rgba(0, 0, 0, 0.6);
line-height: 52rpx;
}
.img {
/* margin-top: 16px; */
width: 100%;
}
.code_img {
width: 360rpx;
height: 360rpx;
}
.block {
font-size: 16px;
line-height: 40px;
}
.step-left {
color: #FFF;
background-color: #1aad19;
border: #1aad19 solid 1px;
padding: 0px 6px;
}
.step-right {
color: #1aad19;
background-color: #FFF;
border: #1aad19 solid 1px;
padding: 0px 6px;
margin-right: 10px;
}
.code_zone {
background-color: #0E190E;
color: rgba(255, 255, 255, 0.7);
border-radius: 12rpx;
padding: 16rpx 32rpx;
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
position: relative;
margin-bottom: 24rpx;
}
.btn-full {
height: 40px;
border-radius: 4px;
line-height: 40px;
color: #fff;
background-color: #1aad19;
text-align: center;
margin-bottom: 5px;
}
.step-title {
line-height: 37px;
font-size: 16px;
}
.step-text{
font-size: 14px;
line-height: 24px;
padding: 10px 0px;
text-align: justify;
}
.modal-mask {
position: fixed; left: 0; top: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.3); z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.modal-content {
background: #fff; padding: 24px; border-radius: 8px; width: 80%;
}
.modal-title { font-size: 18px; margin-bottom: 16px; }
.modal-input { margin-bottom: 12px; border: 1px solid #eee; padding: 8px; border-radius: 4px; width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }

@ -0,0 +1,187 @@
// index.js
Page({
data: {
showTip: false,
powerList: [
{
title: '云托管',
tip: '不限语言的全托管容器服务',
showItem: false,
item: [
{
type: 'cloudbaserun',
title: '云托管调用',
},
],
},
{
title: '云函数',
tip: '安全、免鉴权运行业务代码',
showItem: false,
item: [
{
type: 'getOpenId',
title: '获取OpenId',
},
{
type: 'getMiniProgramCode',
title: '生成小程序码',
},
],
},
{
title: '数据库',
tip: '安全稳定的文档型数据库',
showItem: false,
item: [
{
type: 'createCollection',
title: '创建集合',
},
{
type: 'selectRecord',
title: '增删改查记录',
},
// {
// title: '聚合操作',
// page: 'sumRecord',
// },
],
},
{
title: '云存储',
tip: '自带CDN加速文件存储',
showItem: false,
item: [
{
type: 'uploadFile',
title: '上传文件',
},
],
},
// {
// type: 'singleTemplate',
// title: '云模板',
// tip: '基于页面模板,快速配置、搭建小程序页面',
// tag: 'new',
// },
// {
// type: 'cloudBackend',
// title: '云后台',
// tip: '开箱即用的小程序后台管理系统',
// },
{
title: '拓展能力-AI',
tip: '云开发 AI 拓展能力',
showItem: false,
item: [
{
type: 'model-guide',
title: '大模型对话指引'
},
],
},
],
haveCreateCollection: false,
title: "",
content: ""
},
onClickPowerInfo(e) {
const app = getApp()
if(!app.globalData.env) {
wx.showModal({
title: '提示',
content: '请在 `miniprogram/app.js` 中正确配置 `env` 参数'
})
return
}
console.log("click e", e)
const index = e.currentTarget.dataset.index;
const powerList = this.data.powerList;
const selectedItem = powerList[index];
console.log("selectedItem", selectedItem)
if (selectedItem.link) {
wx.navigateTo({
url: `../web/index?url=${selectedItem.link}&title=${selectedItem.title}`,
});
} else if (selectedItem.type) {
console.log("selectedItem", selectedItem)
wx.navigateTo({
url: `/pages/example/index?envId=${this.data.selectedEnv?.envId}&type=${selectedItem.type}`,
});
} else if (selectedItem.page) {
wx.navigateTo({
url: `/pages/${selectedItem.page}/index`,
});
} else if (
selectedItem.title === '数据库' &&
!this.data.haveCreateCollection
) {
this.onClickDatabase(powerList,selectedItem);
} else {
selectedItem.showItem = !selectedItem.showItem;
this.setData({
powerList,
});
}
},
jumpPage(e) {
const { type, page } = e.currentTarget.dataset;
console.log("jump page", type, page)
if (type) {
wx.navigateTo({
url: `/pages/example/index?envId=${this.data.selectedEnv?.envId}&type=${type}`,
});
} else {
wx.navigateTo({
url: `/pages/${page}/index?envId=${this.data.selectedEnv?.envId}`,
});
}
},
onClickDatabase(powerList,selectedItem) {
wx.showLoading({
title: '',
});
wx.cloud
.callFunction({
name: 'quickstartFunctions',
data: {
type: 'createCollection',
},
})
.then((resp) => {
if (resp.result.success) {
this.setData({
haveCreateCollection: true,
});
}
selectedItem.showItem = !selectedItem.showItem;
this.setData({
powerList,
});
wx.hideLoading();
})
.catch((e) => {
wx.hideLoading();
const { errCode, errMsg } = e
if (errMsg.includes('Environment not found')) {
this.setData({
showTip: true,
title: "云开发环境未找到",
content: "如果已经开通云开发请检查环境ID与 `miniprogram/app.js` 中的 `env` 参数是否一致。"
});
return
}
if (errMsg.includes('FunctionName parameter could not be found')) {
this.setData({
showTip: true,
title: "请上传云函数",
content: "在'cloudfunctions/quickstartFunctions'目录右键,选择【上传并部署-云端安装依赖】,等待云函数上传完成后重试。"
});
return
}
});
},
});

@ -0,0 +1,6 @@
{
"navigationBarTitleText": "基础能力",
"usingComponents": {
"cloud-tip-modal": "/components/cloudTipModal/index"
}
}

@ -0,0 +1,29 @@
<!--index.wxml-->
<view class="container">
<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}}" data-type="{{ power.type }}" bindtap="onClickPowerInfo">
<view class="power_info_text">
<view class="power_info_text_title">
{{power.title}}
<view class="power_info_text_tag" wx:if="{{power.tag}}">{{power.tag}}</view>
</view>
<view class="power_info_text_tip">{{power.tip}}</view>
</view>
<image wx:if="{{!power.showItem && power.item.length}}" class="power_info_more" src="../../images/arrow.svg"></image>
<image wx:if="{{power.showItem && power.item.length}}" class="power_info_less" src="../../images/arrow.svg"></image>
<image wx:if="{{!power.item.length}}" class="power_item_icon" 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-type="{{ item.type }}" 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>
<cloud-tip-modal showTipProps="{{showTip}}" title="{{title}}" content="{{content}}"></cloud-tip-modal>
</view>

@ -0,0 +1,142 @@
/**index.wxss**/
page {
padding-top: 54rpx;
background-color: #f6f6f6;
padding-bottom: 60rpx;
}
.container {
font-family: PingFang SC;
}
.title {
font-family: PingFang SC;
font-weight: 500;
color: #000000;
font-size: 44rpx;
margin-bottom: 40rpx;
}
.function_title {
font-family: PingFang SC;
font-weight: 500;
color: #000000;
font-size: 36rpx;
text-align: left;
width: 93%;
margin-top: 50rpx;
}
.top_tip {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #888888;
margin-bottom: 28rpx;
}
.examples_container {
display: flex;
flex-direction: column;
gap: 16rpx;
width: 100%;
align-items: center;
}
.example_item {
border: 3rpx solid #e5e5e5;
border-radius: 10rpx;
padding: 24rpx;
width: 90%;
background-color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
}
.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: 32rpx;
display: flex;
align-items: center;
font-family: 'PingFang SC';
color: #000;
}
.power_info_text_tag {
margin-left: 20rpx;
background-color: #fbe0e0;
color: #e54545;
padding: 0 7px;
font-size: 14px;
vertical-align: middle;
border-radius: 3px;
}
.power_info_text_tip {
color: rgba(0, 0, 0, 0.6);
font-size: 28rpx;
padding-right: 30rpx;
}
.power_item {
padding: 30rpx 25rpx;
display: flex;
justify-content: space-between;
}
.power_item_title {
font-size: 28rpx;
color: rgba(0, 0, 0, 0.9);
}
.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,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

@ -0,0 +1,85 @@
{
"miniprogramRoot": "miniprogram/",
"cloudfunctionRoot": "cloudfunctions/",
"setting": {
"urlCheck": true,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"compileWorklet": false,
"minifyWXML": true,
"localPlugins": false,
"disableUseStrict": false,
"useCompilerPlugins": false,
"condition": false,
"swc": false,
"disableSWC": true
},
"appid": "wxd7d00921edfeb9df",
"projectname": "quickstart-wx-cloud",
"libVersion": "3.8.5",
"cloudfunctionTemplateRoot": "cloudfunctionTemplate/",
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"plugin": {
"list": []
},
"game": {
"list": []
},
"miniprogram": {
"list": [
{
"id": -1,
"name": "db guide",
"pathName": "pages/databaseGuide/databaseGuide"
}
]
}
},
"compileType": "miniprogram",
"srcMiniprogramRoot": "miniprogram/",
"packOptions": {
"ignore": [],
"include": []
},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"simulatorPluginLibVersion": {}
}

@ -0,0 +1,25 @@
{
"setting": {
"compileHotReLoad": true,
"urlCheck": false,
"coverView": true,
"lazyloadPlaceholderEnable": false,
"skylineRenderEnable": false,
"preloadBackgroundData": false,
"autoAudits": false,
"useApiHook": true,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"useStaticServer": false,
"useLanDebug": false,
"showES6CompileOption": false,
"checkInvalidKey": true,
"ignoreDevUnusedFiles": true,
"bigPackageSizeSupport": false,
"useIsolateContext": true
},
"condition": {},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "%E7%A9%BA%E7%99%BD",
"libVersion": "3.8.5"
}

@ -0,0 +1 @@
${installPath} cloud functions deploy --e ${envId} --n quickstartFunctions --r --project ${projectPath}
Loading…
Cancel
Save