diff --git a/README.md b/README.md index add16dc..3031929 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # store_node - +text diff --git a/cloudfunctions/quickstartFunctions/config.json b/cloudfunctions/quickstartFunctions/config.json new file mode 100644 index 0000000..41a485c --- /dev/null +++ b/cloudfunctions/quickstartFunctions/config.json @@ -0,0 +1,7 @@ +{ + "permissions": { + "openapi": [ + "wxacode.get" + ] + } +} \ No newline at end of file diff --git a/cloudfunctions/quickstartFunctions/index.js b/cloudfunctions/quickstartFunctions/index.js new file mode 100644 index 0000000..bf9c62c --- /dev/null +++ b/cloudfunctions/quickstartFunctions/index.js @@ -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); + } +}; diff --git a/cloudfunctions/quickstartFunctions/package.json b/cloudfunctions/quickstartFunctions/package.json new file mode 100644 index 0000000..4350dbb --- /dev/null +++ b/cloudfunctions/quickstartFunctions/package.json @@ -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" + } +} diff --git a/miniprogram/app.js b/miniprogram/app.js new file mode 100644 index 0000000..769441b --- /dev/null +++ b/miniprogram/app.js @@ -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, + }); + } + }, +}); diff --git a/miniprogram/app.json b/miniprogram/app.json new file mode 100644 index 0000000..d2878e6 --- /dev/null +++ b/miniprogram/app.json @@ -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" +} \ No newline at end of file diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss new file mode 100644 index 0000000..df96b0e --- /dev/null +++ b/miniprogram/app.wxss @@ -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; +} \ No newline at end of file diff --git a/miniprogram/components/cloudTipModal/index.js b/miniprogram/components/cloudTipModal/index.js new file mode 100644 index 0000000..8e75cc0 --- /dev/null +++ b/miniprogram/components/cloudTipModal/index.js @@ -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 + }); + }, + } +}); diff --git a/miniprogram/components/cloudTipModal/index.json b/miniprogram/components/cloudTipModal/index.json new file mode 100644 index 0000000..4575d1b --- /dev/null +++ b/miniprogram/components/cloudTipModal/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "component": true +} \ No newline at end of file diff --git a/miniprogram/components/cloudTipModal/index.wxml b/miniprogram/components/cloudTipModal/index.wxml new file mode 100644 index 0000000..b5b6700 --- /dev/null +++ b/miniprogram/components/cloudTipModal/index.wxml @@ -0,0 +1,10 @@ + + + + + + + {{title}} + {{content}} + + diff --git a/miniprogram/components/cloudTipModal/index.wxss b/miniprogram/components/cloudTipModal/index.wxss new file mode 100644 index 0000000..862f70c --- /dev/null +++ b/miniprogram/components/cloudTipModal/index.wxss @@ -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; +} \ No newline at end of file diff --git a/miniprogram/envList.js b/miniprogram/envList.js new file mode 100644 index 0000000..e9a169e --- /dev/null +++ b/miniprogram/envList.js @@ -0,0 +1,6 @@ +const envList = []; +const isMac = false; +module.exports = { + envList, + isMac +}; diff --git a/miniprogram/images/ai_example1.png b/miniprogram/images/ai_example1.png new file mode 100644 index 0000000..c1f452d Binary files /dev/null and b/miniprogram/images/ai_example1.png differ diff --git a/miniprogram/images/ai_example2.png b/miniprogram/images/ai_example2.png new file mode 100644 index 0000000..1b6e26c Binary files /dev/null and b/miniprogram/images/ai_example2.png differ diff --git a/miniprogram/images/arrow.svg b/miniprogram/images/arrow.svg new file mode 100644 index 0000000..cd32a7d --- /dev/null +++ b/miniprogram/images/arrow.svg @@ -0,0 +1,11 @@ + + + ☀ iOS/☀ 图标/线型/icons_outlined_arrow@3x + + + + + + + + \ No newline at end of file diff --git a/miniprogram/images/avatar.png b/miniprogram/images/avatar.png new file mode 100644 index 0000000..48d5ee2 Binary files /dev/null and b/miniprogram/images/avatar.png differ diff --git a/miniprogram/images/cloud_dev.png b/miniprogram/images/cloud_dev.png new file mode 100644 index 0000000..9eb538a Binary files /dev/null and b/miniprogram/images/cloud_dev.png differ diff --git a/miniprogram/images/copy.svg b/miniprogram/images/copy.svg new file mode 100644 index 0000000..63759cb --- /dev/null +++ b/miniprogram/images/copy.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/miniprogram/images/create_cbr.png b/miniprogram/images/create_cbr.png new file mode 100644 index 0000000..8eded5c Binary files /dev/null and b/miniprogram/images/create_cbr.png differ diff --git a/miniprogram/images/create_cbrf.png b/miniprogram/images/create_cbrf.png new file mode 100644 index 0000000..d076f11 Binary files /dev/null and b/miniprogram/images/create_cbrf.png differ diff --git a/miniprogram/images/create_env.png b/miniprogram/images/create_env.png new file mode 100644 index 0000000..c319b9d Binary files /dev/null and b/miniprogram/images/create_env.png differ diff --git a/miniprogram/images/database.png b/miniprogram/images/database.png new file mode 100644 index 0000000..6551376 Binary files /dev/null and b/miniprogram/images/database.png differ diff --git a/miniprogram/images/database_add.png b/miniprogram/images/database_add.png new file mode 100644 index 0000000..f4ac9f9 Binary files /dev/null and b/miniprogram/images/database_add.png differ diff --git a/miniprogram/images/default-goods-image.png b/miniprogram/images/default-goods-image.png new file mode 100644 index 0000000..a5015f3 Binary files /dev/null and b/miniprogram/images/default-goods-image.png differ diff --git a/miniprogram/images/env-select.png b/miniprogram/images/env-select.png new file mode 100644 index 0000000..36a7b6a Binary files /dev/null and b/miniprogram/images/env-select.png differ diff --git a/miniprogram/images/function_deploy.png b/miniprogram/images/function_deploy.png new file mode 100644 index 0000000..8d9c7a6 Binary files /dev/null and b/miniprogram/images/function_deploy.png differ diff --git a/miniprogram/images/icons/avatar.png b/miniprogram/images/icons/avatar.png new file mode 100644 index 0000000..45744b3 Binary files /dev/null and b/miniprogram/images/icons/avatar.png differ diff --git a/miniprogram/images/icons/business-active.png b/miniprogram/images/icons/business-active.png new file mode 100644 index 0000000..690c5b3 Binary files /dev/null and b/miniprogram/images/icons/business-active.png differ diff --git a/miniprogram/images/icons/business.png b/miniprogram/images/icons/business.png new file mode 100644 index 0000000..af0fbcf Binary files /dev/null and b/miniprogram/images/icons/business.png differ diff --git a/miniprogram/images/icons/close.png b/miniprogram/images/icons/close.png new file mode 100644 index 0000000..18f01a2 Binary files /dev/null and b/miniprogram/images/icons/close.png differ diff --git a/miniprogram/images/icons/copy.png b/miniprogram/images/icons/copy.png new file mode 100644 index 0000000..d2d8f61 Binary files /dev/null and b/miniprogram/images/icons/copy.png differ diff --git a/miniprogram/images/icons/customer-service.svg b/miniprogram/images/icons/customer-service.svg new file mode 100644 index 0000000..be7bba4 --- /dev/null +++ b/miniprogram/images/icons/customer-service.svg @@ -0,0 +1,3 @@ + + + diff --git a/miniprogram/images/icons/examples-active.png b/miniprogram/images/icons/examples-active.png new file mode 100644 index 0000000..a5715d7 Binary files /dev/null and b/miniprogram/images/icons/examples-active.png differ diff --git a/miniprogram/images/icons/examples.png b/miniprogram/images/icons/examples.png new file mode 100644 index 0000000..7ce740b Binary files /dev/null and b/miniprogram/images/icons/examples.png differ diff --git a/miniprogram/images/icons/goods-active.png b/miniprogram/images/icons/goods-active.png new file mode 100644 index 0000000..54a4680 Binary files /dev/null and b/miniprogram/images/icons/goods-active.png differ diff --git a/miniprogram/images/icons/goods.png b/miniprogram/images/icons/goods.png new file mode 100644 index 0000000..c1ec7ed Binary files /dev/null and b/miniprogram/images/icons/goods.png differ diff --git a/miniprogram/images/icons/home-active.png b/miniprogram/images/icons/home-active.png new file mode 100644 index 0000000..c1107cb Binary files /dev/null and b/miniprogram/images/icons/home-active.png differ diff --git a/miniprogram/images/icons/home.png b/miniprogram/images/icons/home.png new file mode 100644 index 0000000..e598e18 Binary files /dev/null and b/miniprogram/images/icons/home.png differ diff --git a/miniprogram/images/icons/question.svg b/miniprogram/images/icons/question.svg new file mode 100644 index 0000000..3389b03 --- /dev/null +++ b/miniprogram/images/icons/question.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/miniprogram/images/icons/setting.svg b/miniprogram/images/icons/setting.svg new file mode 100644 index 0000000..1c41dab --- /dev/null +++ b/miniprogram/images/icons/setting.svg @@ -0,0 +1,4 @@ + + + + diff --git a/miniprogram/images/icons/share.svg b/miniprogram/images/icons/share.svg new file mode 100644 index 0000000..297275e --- /dev/null +++ b/miniprogram/images/icons/share.svg @@ -0,0 +1,4 @@ + + + + diff --git a/miniprogram/images/icons/usercenter-active.png b/miniprogram/images/icons/usercenter-active.png new file mode 100644 index 0000000..38a93cf Binary files /dev/null and b/miniprogram/images/icons/usercenter-active.png differ diff --git a/miniprogram/images/icons/usercenter.png b/miniprogram/images/icons/usercenter.png new file mode 100644 index 0000000..e0e0131 Binary files /dev/null and b/miniprogram/images/icons/usercenter.png differ diff --git a/miniprogram/images/scf-enter.png b/miniprogram/images/scf-enter.png new file mode 100644 index 0000000..d71fb3a Binary files /dev/null and b/miniprogram/images/scf-enter.png differ diff --git a/miniprogram/pages/example/index.js b/miniprogram/pages/example/index.js new file mode 100644 index 0000000..5dbaa34 --- /dev/null +++ b/miniprogram/pages/example/index.js @@ -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: `<agent-ui agentConfig="{{agentConfig}}" showBotAvatar="{{showBotAvatar}}" chatMode="{{chatMode}}" modelConfig="{{modelConfig}}""></agent-ui>`, + ai_data_config: `data: { + chatMode: "bot", // bot 表示使用agent,model 表示使用大模型 + 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) + }); +} +});`, + }); + }, +}); diff --git a/miniprogram/pages/example/index.json b/miniprogram/pages/example/index.json new file mode 100644 index 0000000..3ea1434 --- /dev/null +++ b/miniprogram/pages/example/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "cloud-tip-modal": "/components/cloudTipModal/index" + } +} \ No newline at end of file diff --git a/miniprogram/pages/example/index.wxml b/miniprogram/pages/example/index.wxml new file mode 100644 index 0000000..bfebcc2 --- /dev/null +++ b/miniprogram/pages/example/index.wxml @@ -0,0 +1,189 @@ + + + + 功能介绍 + 云函数无需维护鉴权机制及登录票据,仅一行代码即可获得。 + 云函数获取OpenId示例 + + + step 1 quickStartFunctions 云函数代码 + + + + step 2 小程序代码段 + + + + + + 运行示例 + {{ openId ? openId : 'OpenID将展示在这里' }} + + 清空 + + + + + + 功能介绍 + 可通过云函数免接口调用凭证,直接生成小程序码。 + 云函数获取小程序码示例 + + step 1 quickStartFunctions 云函数代码 + + + + step 2 小程序代码段 + + + + + + 运行示例 + 小程序码将展示在这里 + + + + 清空 + + + + + + + + 功能介绍 + 集合为常用数据库中表的概念。云开发数据库支持自动备份、无损回档,并且QPS高达3千+。 + 如何体验 + 已自动创建名为“sales”的体验合集,可打开“云开发控制台>数据库>记录列表”中找到该集合。 + + 云函数代码示例 + + + + + + + + + 功能介绍 + 体验查询记录能力,查询数据表中的销量数据。 + 销量数据将展示在这里 + 数据库操作示例 + 参考云函数 quickstartFunctions 示例代码 + + 地区销量统计 + + 地域 + 城市 + 销量 + 操作 + + + + {{item.region}} + {{item.city}} + + + + + + + + 查询记录 + 更新记录 + 新增记录 + + + + + + 新增销量记录 + + + + + + + + + + + + + + 功能介绍 + 多存储类型,仅需一个云函数即可完成上传。 + 文件上传示例 + + 小程序代码段 + + + + + 运行示例 + 上传的图片将展示在这里 + + + + + 清空 + + + + + + + 功能介绍 + 腾讯云开发提供 AI 对话能力,支持 Agent,大模型流式对话,可通过 Agent-UI 组件快速集成 AI 能力 + 集成 Agent-UI 组件指引 + + step 1 拷贝组件源码包 + 点击复制查看组件仓库地址 + step 2 将组件拷贝至小程序目录中 + + step 3 在页面 .json 配置文件中注册组件 + + + + step 4 在页面 .wxml 文件中引用组件 + + + + step 4 在页面 .js 文件中编写配置 + + + + + + + + + + 功能介绍 + 云托管 支持托管用任意语言和框架编写的容器化应用,为开发者提供高可用、自动弹性扩缩的云服务。 + 小程序调用云托管示例 + + step 1 前往云开发平台开通云托管 + step 2 新建容器型托管服务,等待部署完成 + + 此处可使用 Express 示例模板进行安装,此处示例命名为 express-test + + + + + step 3小程序端调用 + + + + 运行示例 + {{ callContainerResStr ? callContainerResStr : '云托管调用结果将展示在这里' }} + 清空 + + + + + diff --git a/miniprogram/pages/example/index.wxss b/miniprogram/pages/example/index.wxss new file mode 100644 index 0000000..efb6abc --- /dev/null +++ b/miniprogram/pages/example/index.wxss @@ -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; } \ No newline at end of file diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js new file mode 100644 index 0000000..de382ca --- /dev/null +++ b/miniprogram/pages/index/index.js @@ -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 + } + }); + }, +}); diff --git a/miniprogram/pages/index/index.json b/miniprogram/pages/index/index.json new file mode 100644 index 0000000..6112712 --- /dev/null +++ b/miniprogram/pages/index/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "基础能力", + "usingComponents": { + "cloud-tip-modal": "/components/cloudTipModal/index" + } +} \ No newline at end of file diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml new file mode 100644 index 0000000..e61fe7c --- /dev/null +++ b/miniprogram/pages/index/index.wxml @@ -0,0 +1,29 @@ + + + 快速了解云开发 + 免鉴权接口调用 免部署后台 高并发 + + + + + {{power.title}} + {{power.tag}} + + {{power.tip}} + + + + + + + + + + {{item.title}} + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss new file mode 100644 index 0000000..abdcc79 --- /dev/null +++ b/miniprogram/pages/index/index.wxss @@ -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%; +} diff --git a/miniprogram/sitemap.json b/miniprogram/sitemap.json new file mode 100644 index 0000000..27b2b26 --- /dev/null +++ b/miniprogram/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..b13573f --- /dev/null +++ b/project.config.json @@ -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": {} +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..5825b85 --- /dev/null +++ b/project.private.config.json @@ -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" +} \ No newline at end of file diff --git a/uploadCloudFunction.sh b/uploadCloudFunction.sh new file mode 100644 index 0000000..df311b3 --- /dev/null +++ b/uploadCloudFunction.sh @@ -0,0 +1 @@ +${installPath} cloud functions deploy --e ${envId} --n quickstartFunctions --r --project ${projectPath} \ No newline at end of file