123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- // pages/home/index.js
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- height: app.globalData.height * 2 + 25,
- navbarData: {
- name: '节俭会'
- },
- heat: 80,
- heatColor: {
- '0%': '#E1FFFF',
- '25%': '#00FF7F',
- '50%': '#191970',
- '75%': '#ee0a24',
- '100%': '#ff0000',
- },
- },
- // 查看本周菜谱
- reserveBtn: function () {
- wx.redirectTo({
- url: '/pages/food/index',
- })
- },
- // 报餐:1,余菜打包:2,卡路里计算:3
- twoBtn: function (e) {
- let type = e.currentTarget.dataset.smile
- if (type == '1') {
- wx.switchTab({
- url: '/pages/reserve/index',
- })
- } else if (type == '2') {
- wx.showToast({
- title: '暂无开通',
- })
- } else {
- wx.redirectTo({
- url: '/pages/calorie/index',
- })
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- // const test = `${app.globalData.publicUrl}/api/st/dining/arrange`;
- // console.log(test);
- wx.request({
- url: `${app.globalData.publicUrl}/api/st/dining/arrange`,
- method: "get",
- header: {
- 'x-tenant': app.globalData.tenant
- },
- data: {},
- success: res => {
- console.log(res);
- },
- error: err => {
- wx.showToast({
- title: err.msg,
- icon: 'error'
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- if (typeof this.getTabBar === 'function' &&
- this.getTabBar()) {
- this.getTabBar().setData({
- selected: 0
- })
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|