From 8804019eadb3f79a956d6b929c92a531c6f229d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=80=9D=E6=B6=B5?= <10205501407@stu.ecnu.edu.cn> Date: Thu, 2 Jun 2022 14:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'=E5=89=8D=E7=AB=AF/miniprogram'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 前端/miniprogram/app.js | 53 ++++++++++++++++++++++++++++++++++++++++ 前端/miniprogram/app.json | 17 +++++++++++++ 前端/miniprogram/app.wxss | Bin 0 -> 1024 bytes 前端/miniprogram/sitemap.json | 7 ++++++ 4 files changed, 77 insertions(+) create mode 100644 前端/miniprogram/app.js create mode 100644 前端/miniprogram/app.json create mode 100644 前端/miniprogram/app.wxss create mode 100644 前端/miniprogram/sitemap.json diff --git a/前端/miniprogram/app.js b/前端/miniprogram/app.js new file mode 100644 index 0000000..8d88d7a --- /dev/null +++ b/前端/miniprogram/app.js @@ -0,0 +1,53 @@ +// app.js, +App({ + globalData: { + userInfo: {}, + hasUserInfo: false, + canIUse: wx.canIUse('button.open-type.getUserInfo'), + canIUseGetUserProfile: false, + canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'), // 如需尝试获取用户信息可改为false, + flag_value: 0 + }, + onLaunch: function () { + if (!wx.cloud) { + console.error('请使用 2.2.3 或以上的基础库以使用云能力'); + } else { + wx.cloud.init({ + env: 'prod-2g058voqbea31ecb', + traceUser: true, + }); + } + wx.cloud.callContainer({ + "config": { + "env": "prod-2g058voqbea31ecb" + }, + "path": "general/openid/", + "header": { + "X-WX-SERVICE": "django-5198", + "content-type": "application/json" + }, + "method": "GET", + data: {}, + success(res){ + console.log(res.data) + } + }) + + + this.globalData = {}; + }, + parse_json(res){ + let arr = res.data.result + if(arr.toString().indexOf("|")!=-1){ + arr = arr.split('| ') + arr = arr.map((item,index,arr)=>{ + item = JSON.parse(item); + return item + }) + } + else if(arr){ + arr = [JSON.parse(arr)] + } + return arr + }, +}); diff --git a/前端/miniprogram/app.json b/前端/miniprogram/app.json new file mode 100644 index 0000000..6a8f823 --- /dev/null +++ b/前端/miniprogram/app.json @@ -0,0 +1,17 @@ +{ + "pages": [ + "pages/fridge/fridge", + "pages/choices/choices", + "pages/add_new_food/add_new_food", + "pages/change_stock/change_stock", + "pages/dishes/dishes", + "pages/menu/menu" + ], + "window": { + "backgroundColor": "#F6F6F6", + "backgroundTextStyle": "light", + "navigationStyle": "custom" + }, + "sitemapLocation": "sitemap.json", + "style": "v2" +} \ No newline at end of file diff --git a/前端/miniprogram/app.wxss b/前端/miniprogram/app.wxss new file mode 100644 index 0000000000000000000000000000000000000000..06d7405020018ddf3cacee90fd4af10487da3d20 GIT binary patch literal 1024 ScmZQz7zLvtFd70QH3R?z00031 literal 0 HcmV?d00001 diff --git a/前端/miniprogram/sitemap.json b/前端/miniprogram/sitemap.json new file mode 100644 index 0000000..354d6cf --- /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