var i18n = require('../../i18n/index') Page({ data: { statusBarHeight: 44, // Ordered list of lights; strings live in i18n under lightInfo.lights[key], // colors are presentation-only and stay in JS. lights: [ { key: 'red', color: '#E8503A' }, { key: 'uv', color: '#7C4DFF' }, { key: 'yellow', color: '#F5B841' }, { key: 'infrared', color: '#8B2E3C' } ], // Parallel to i18n.lightInfo.modes (matched by index). modeColors: ['#E8503A', '#7C4DFF', '#F5B841', '#8B2E3C', '#F08AA8'] }, onLoad: function (options) { var app = getApp() // 报告页分区跳转带 ?wave=red|ir|uv|yellow,高亮对应光卡片('ir' 对应本页 key 'infrared') var focus = (options && options.wave) || '' if (focus === 'ir') focus = 'infrared' this.setData({ statusBarHeight: app.globalData.statusBarHeight, focusWave: focus }) }, onShow: function () { i18n.bind(this) }, onBack: function () { wx.navigateBack({ fail: function () { wx.switchTab({ url: '/pages/profile/profile' }) } }) } })