|
@@ -17,6 +17,8 @@ import route_constant from '../../utils/route_constant.js'
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
+ ///下午好
|
|
|
+ greeting: "",
|
|
|
nvabarData: {
|
|
|
showCapsule: 0, //是否显示左上角图标 1表示显示 0表示不显示
|
|
|
title: 'OhPlay', //导航栏 中间的标题
|
|
@@ -46,55 +48,7 @@ Page({
|
|
|
actionIndex: null,
|
|
|
luoma: ["Ⅰ", "Ⅱ", "Ⅲ", "Ⅳ", "Ⅴ", "Ⅵ", " Ⅶ", "Ⅷ", "Ⅸ", "Ⅹ", "Ⅺ", "Ⅻ"],
|
|
|
channelData: [],
|
|
|
- deviceList: [{
|
|
|
- "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
- "name": "BLUFI_7cdfa1fcbb24",
|
|
|
- "state": "online",
|
|
|
- "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
- "devName": "猫王小王子OTR-X"
|
|
|
- }, {
|
|
|
- "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
- "name": "BLUFI_7cdfa1fcbb24",
|
|
|
- "state": "online",
|
|
|
- "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
- "devName": "猫王小王子OTR-X"
|
|
|
- }, {
|
|
|
- "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
- "name": "BLUFI_7cdfa1fcbb24",
|
|
|
- "state": "online",
|
|
|
- "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
- "devName": "猫王小王子OTR-X"
|
|
|
- }, {
|
|
|
- "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
- "name": "BLUFI_7cdfa1fcbb24",
|
|
|
- "state": "online",
|
|
|
- "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
- "devName": "猫王小王子OTR-X"
|
|
|
- }, {
|
|
|
- "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
- "name": "BLUFI_7cdfa1fcbb24",
|
|
|
- "state": "online",
|
|
|
- "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
- "devName": "猫王小王子OTR-X"
|
|
|
- }, {
|
|
|
- "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
- "name": "BLUFI_7cdfa1fcbb24",
|
|
|
- "state": "online",
|
|
|
- "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
- "devName": "猫王小王子OTR-X"
|
|
|
- }, {
|
|
|
- "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
- "name": "BLUFI_7cdfa1fcbb24",
|
|
|
- "state": "online",
|
|
|
- "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
- "devName": "猫王小王子OTR-X"
|
|
|
- }, {
|
|
|
- "deviceId": "BLUFI_7cdfa1fcbb24",
|
|
|
- "name": "BLUFI_7cdfa1fcbb24",
|
|
|
- "state": "online",
|
|
|
- "ProdModel": "MW-2AX(WIFI-N)",
|
|
|
- "devName": "猫王小王子OTR-X"
|
|
|
- }],
|
|
|
+ deviceList: [],
|
|
|
deviceListIndex: null,
|
|
|
showLogin: false,
|
|
|
isOneLoading: true,
|
|
@@ -106,7 +60,7 @@ Page({
|
|
|
|
|
|
////我的界面
|
|
|
loginStatus: true,
|
|
|
- userName: "未登录",
|
|
|
+ nickname: "未登录",
|
|
|
userPic: './../../img/head_pic.png',
|
|
|
islogin: false,
|
|
|
},
|
|
@@ -121,14 +75,30 @@ Page({
|
|
|
var that = this;
|
|
|
that.onHomeShow();
|
|
|
that.onMeShow();
|
|
|
+ var nickname = that.data.nickname;
|
|
|
+ var greeting = that.updateGreeting();
|
|
|
+ if (nickname != "" && nickname != "未登录") {
|
|
|
+ greeting = greeting + ',' + nickname;;
|
|
|
+ }
|
|
|
+ console.log("gadfqwwerqewrqr===00==" + greeting);
|
|
|
+ console.log("gadfqwwerqewrqr===11==" + nickname);
|
|
|
+ that.setData({
|
|
|
+ greeting: greeting
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- getDevices({}).then((res) => {
|
|
|
- console.log("gadfadfqwwerqewqr===" + JSON.stringify(res));
|
|
|
- // wx.setStorage({
|
|
|
- // key: "channelData",
|
|
|
- // data: res
|
|
|
- // });
|
|
|
- })
|
|
|
+ updateGreeting() {
|
|
|
+ const now = new Date();
|
|
|
+ const hour = now.getHours();
|
|
|
+ let greeting;
|
|
|
+ if (hour >= 5 && hour < 12) {
|
|
|
+ greeting = '上午好';
|
|
|
+ } else if (hour >= 12 && hour < 18) {
|
|
|
+ greeting = '下午好';
|
|
|
+ } else {
|
|
|
+ greeting = '晚上好';
|
|
|
+ }
|
|
|
+ return greeting;
|
|
|
},
|
|
|
|
|
|
onHomeLoad() {
|
|
@@ -177,18 +147,30 @@ Page({
|
|
|
|
|
|
onMeLoad() {
|
|
|
// wx.getStorage("userInfo")
|
|
|
- const _this = this;
|
|
|
+ var that = this;
|
|
|
wx.getStorage({
|
|
|
key: "userInfo",
|
|
|
success(res) {
|
|
|
if (!res.data.phone) {
|
|
|
return;
|
|
|
};
|
|
|
- _this.setData({
|
|
|
- userName: res.data.nickname || "",
|
|
|
+
|
|
|
+ var nickname = res.data.nickname || "";
|
|
|
+ console.log("gadfqwwerqewrqr===44==" + res.data.nickname);
|
|
|
+ var greeting = that.updateGreeting();
|
|
|
+ if (nickname != "" && nickname != "未登录") {
|
|
|
+ greeting = greeting + ',' + nickname;;
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("gadfqwwerqewrqr===22==" + greeting);
|
|
|
+ console.log("gadfqwwerqewrqr===33==" + nickname);
|
|
|
+ that.setData({
|
|
|
+ greeting: greeting,
|
|
|
+ nickname: nickname,
|
|
|
userPic: res.data.headUrl || "",
|
|
|
islogin: true,
|
|
|
- })
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -671,20 +653,26 @@ Page({
|
|
|
},
|
|
|
|
|
|
goMeLogin() {
|
|
|
- const _this = this;
|
|
|
- if (this.data.islogin) {
|
|
|
+ const that = this;
|
|
|
+ if (that.data.islogin) {
|
|
|
// 退出登录
|
|
|
wx.removeStorage({
|
|
|
key: 'userInfo',
|
|
|
success(res) {
|
|
|
- _this.setData({
|
|
|
+ var nickname = "未登录";
|
|
|
+ var greeting = that.updateGreeting();
|
|
|
+ if (nickname != "" && nickname != "未登录") {
|
|
|
+ greeting = greeting + ',' + nickname;;
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ greeting: greeting,
|
|
|
islogin: false,
|
|
|
- userName: "未登录",
|
|
|
+ nickname: nickname,
|
|
|
userPic: "./../../img/head_pic.png",
|
|
|
});
|
|
|
- wx.switchTab({
|
|
|
- url: `./../index/index`
|
|
|
- });
|
|
|
+ // wx.switchTab({
|
|
|
+ // url: `./../index/index`
|
|
|
+ // });
|
|
|
}
|
|
|
});
|
|
|
wx.removeStorage({
|
|
@@ -802,4 +790,12 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
-})
|
|
|
+})
|
|
|
+
|
|
|
+// getDevices({}).then((res) => {
|
|
|
+// console.log("gadfadfqwwerqewqr===" + JSON.stringify(res));
|
|
|
+// // wx.setStorage({
|
|
|
+// // key: "channelData",
|
|
|
+// // data: res
|
|
|
+// // });
|
|
|
+// })
|