|
@@ -1,28 +1,66 @@
|
|
|
// pages/deviceDetail/detail.js
|
|
|
+
|
|
|
+const BtHelper = require('../../devices/bt_helper');
|
|
|
+const { deviceVersion } = require('../../request/deviceListRequest')
|
|
|
+import EventManager from '../../utils/event_bus'
|
|
|
+
|
|
|
Page({
|
|
|
data: {
|
|
|
+ nvabarData: {
|
|
|
+ showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
|
|
+ title: '设备详情', //导航栏 中间的标题
|
|
|
+ },
|
|
|
+ hasNew: true,
|
|
|
// 页面数据
|
|
|
-
|
|
|
+ device: getApp().globalData.device,
|
|
|
+ btHelper: null,
|
|
|
},
|
|
|
- onLoad: function () {
|
|
|
- // 页面加载时的逻辑
|
|
|
+ checkOtaVersion(device) {
|
|
|
+ let _this = this;
|
|
|
+ deviceVersion(device.clienlType, device.connectType, device.version).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ let updateData = res.data;
|
|
|
+ let hasNewVersion = updateData.isEnforcement === 1 || updateData.isEnforcement === 2;
|
|
|
+ _this.setData({
|
|
|
+ hasNew: hasNewVersion,
|
|
|
+ });
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
- goToAccountSecurity: function () {
|
|
|
+
|
|
|
+ goToWallpaper: function () {
|
|
|
+
|
|
|
wx.navigateTo({
|
|
|
- url: '/pages/accountSecurity/accountSecurity'
|
|
|
+ url: '/pages/piano/wallpaper/wallpaper'
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- goToPrivacySettings: function () {
|
|
|
+ goToOta: function () {
|
|
|
+
|
|
|
wx.navigateTo({
|
|
|
- url: '/pages/privacySettings/privacySettings'
|
|
|
+ url: '/pages/piano/wallpaper/wallpaper'
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- goToNotificationSettings: function () {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/notificationSettings/notificationSettings'
|
|
|
- });
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onLoad: function () {
|
|
|
+ let device = getApp().globalData.device;
|
|
|
+ if (!device.connect) {
|
|
|
+ // btHelper
|
|
|
+ wx.showToast({
|
|
|
+ title: '设备已经失去连接',
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const btHelper = BtHelper.getInstance();
|
|
|
+ btHelper.getVersion()
|
|
|
+
|
|
|
+ this.data.btHelper = btHelper;
|
|
|
+ this.checkOtaVersion(device);
|
|
|
+ EventManager.addNotification(CmdEvent,)
|
|
|
},
|
|
|
+
|
|
|
})
|