ソースを参照

fix:“修复其他页面设备列表获取失败的问题”

soobin 7 ヶ月 前
コミット
c1a7ad8368

+ 12 - 0
common/util.js

@@ -131,6 +131,18 @@ var dateUtils = {
 		currentMonFirstDate.setMonth(currentMonFirstDate.getMonth() + 1);
 		return currentMonFirstDate;
 	},
+	// 获取当天时间
+	getCurrentDate() {
+	    const today = new Date();
+	    // 获取年份
+	    const year = today.getFullYear();
+	    // 获取月份 (注意,JavaScript 的月份是从0开始的,所以要加1)
+	    const month = String(today.getMonth() + 1).padStart(2, '0');
+	    // 获取日期
+	    const day = String(today.getDate()).padStart(2, '0');
+	    // 格式化为 "yyyy-MM-dd" 格式
+	    return `${year}-${month}-${day}`;
+	},
 	dateformat: function(fmt) {
 		if (fmt.length === 1) {
 			fmt = '0' + fmt;

+ 1 - 0
packageA/pages/equipmentStatus/equipmentlist.vue

@@ -188,6 +188,7 @@
 		onShow() {
 			// this.input = this.input + 1;
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			uni.setNavigationBarTitle({
 				title: this.$t('user.equipmentlist')
 			});

+ 5 - 1
packageA/pages/remote/advancedParameters.vue

@@ -160,7 +160,10 @@
 		mapState,
 		mapActions,
 		mapMutations
-	} from 'vuex'
+	} from 'vuex';
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -191,6 +194,7 @@
 		onShow() {
 			var token = uni.getStorageSync("token");
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			uni.setNavigationBarTitle({
 				title: this.$t('parameters.advanced')
 			});

+ 4 - 0
packageA/pages/remote/alarmClockItem.vue

@@ -88,6 +88,9 @@
 	// import ldSelect from "../../components/ld-select/ld-select.vue";
 	import ldSelect from "../../components/ld-select/ld-select.vue"
 	import likeButton from "../../components/like-button/like-button.vue";
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		components: {
 			MxDatePicker,
@@ -129,6 +132,7 @@
 		},
 		onShow() {
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			this.clock = uni.getStorageSync("clock");
 			uni.setNavigationBarTitle({
 				title: this.$t('alarmClock.setAlarm')

+ 5 - 1
packageA/pages/remote/debugParameters.vue

@@ -258,7 +258,10 @@
 		mapState,
 		mapActions,
 		mapMutations
-	} from 'vuex'
+	} from 'vuex';
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -275,6 +278,7 @@
 		onShow() {
 			var token = uni.getStorageSync("token");
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			if (token.length > 1) {
 				this.getEquipmentListData();
 				// this.getParam();

+ 5 - 8
packageA/pages/remote/dosugar.vue

@@ -53,7 +53,10 @@
 		mapState,
 		mapActions,
 		mapMutations
-	} from 'vuex'
+	} from 'vuex';
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -71,13 +74,7 @@
 		},
 		onShow() {
 			this.globalUser = uni.getStorageSync("globalUser");
-			// uni.setNavigationBarTitle({
-			// 	title: this.$t('equipmentStatusList.title')
-			// });
-			// uni.setTabBarItem({
-			// 	index: 3,
-			// 	text: this.$t('tabs.tab4')
-			// });
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			var token = uni.getStorageSync("token");
 			uni.setNavigationBarTitle({
 				title: this.$t('remoteList.dosugur')

+ 5 - 1
packageA/pages/remote/flowerShow.vue

@@ -99,7 +99,10 @@
 		mapState,
 		mapActions,
 		mapMutations
-	} from 'vuex'
+	} from 'vuex';
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -118,6 +121,7 @@
 		},
 		onShow() {
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			// uni.setNavigationBarTitle({
 			// 	title: this.$t('equipmentStatusList.title')
 			// });

+ 5 - 1
packageA/pages/remote/generalParameters.vue

@@ -236,7 +236,10 @@
 		mapState,
 		mapActions,
 		mapMutations
-	} from 'vuex'
+	} from 'vuex';
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -277,6 +280,7 @@
 		onShow() {
 			var token = uni.getStorageSync("token");
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			uni.setNavigationBarTitle({
 				title: this.$t('parameters.general')
 			});

+ 5 - 1
packageA/pages/remote/humidityParameters.vue

@@ -83,7 +83,10 @@
 		mapState,
 		mapActions,
 		mapMutations
-	} from 'vuex'
+	} from 'vuex';
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -102,6 +105,7 @@
 		onShow() {
 			var token = uni.getStorageSync("token");
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			uni.setNavigationBarTitle({
 				title: this.$t('parameters.cabinet_hd')
 			});

+ 4 - 0
packageA/pages/remote/updatePassword.vue

@@ -56,6 +56,9 @@
 	// import ldSelect from "../../components/ld-select/ld-select.vue";
 	import ldSelect from "../../components/ld-select/ld-select.vue"
 	import likeButton from "../../components/like-button/like-button.vue";
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		components: {
 			MxDatePicker,
@@ -76,6 +79,7 @@
 		},
 		onShow() {
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			uni.setNavigationBarTitle({
 				title: this.$t('remoteList.password')
 			});

+ 4 - 0
packageA/pages/remote/volume.vue

@@ -45,6 +45,9 @@
 		mapActions,
 		mapMutations
 	} from 'vuex'
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -62,6 +65,7 @@
 		onShow() {
 			var token = uni.getStorageSync("token");
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			uni.setNavigationBarTitle({
 				title: this.$t('remoteList.volume')
 			});

+ 4 - 1
packageA/pages/user/equipmentName.vue

@@ -28,7 +28,9 @@
 		mapActions,
 		mapMutations
 	} from 'vuex'
-	
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 
 		data() {
@@ -63,6 +65,7 @@
 			uni.setNavigationBarTitle({title: this.$t('equipmentname.title')});
 			// uni.startPullDownRefresh();
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			this.globalUser.offset = 0;
 			this.globalUser.limit = 10;
 			var token = uni.getStorageSync("token");

+ 4 - 0
packageA/pages/user/timeRule.vue

@@ -20,6 +20,9 @@
 		mapActions,
 		mapMutations
 	} from 'vuex'
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -35,6 +38,7 @@
 		},
 		onShow(state){
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			this.init();
 		},
 		onLoad(state){

+ 4 - 0
packageB/pages/remote/updatePayment.vue

@@ -55,6 +55,9 @@
 		mapActions,
 		mapMutations
 	} from 'vuex'
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		data() {
 			return {
@@ -93,6 +96,7 @@
 		},
 		onShow() {
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			var token = uni.getStorageSync("token");
 			uni.setNavigationBarTitle({
 				title: this.$t('remoteList.payment')

+ 4 - 0
packageB/pages/remote/updatePrice.vue

@@ -471,6 +471,9 @@
 	// import ldSelect from "../../components/ld-select/ld-select.vue";
 	import ldSelect from "../../components/ld-select/ld-select.vue"
 	import likeButton from "../../components/like-button/like-button.vue";
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		components: {
 			MxDatePicker,
@@ -536,6 +539,7 @@
 		},
 		onShow() {
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			uni.setNavigationBarTitle({
 				title: this.$t('remoteList.price')
 			});

+ 4 - 0
pages/User/equipmentSratisticsList.vue

@@ -21,6 +21,9 @@
 	import uniList from '@/components/uni-list/uni-list.vue'
 	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
 	import {equipmentStatistics} from '@/pages/Charts/equipmentStatistics';
+	import {
+		dateUtils
+	} from '@/common/util.js';
     export default {
 		components: {
 			uniCollapse,
@@ -56,6 +59,7 @@
 		},
 		onShow(state){
 			this.globalUser = uni.getStorageSync("globalUser");
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			this.init();
 		},
 		onLoad(state){

+ 2 - 14
pages/User/equipmentStatusList.vue

@@ -413,7 +413,7 @@
 				this.searchDeviceName = null;
 				this.globalUser.deviceName = null;
 				this.globalUser.clientId = null;
-				this.globalUser.todayDate = this.getCurrentDate();
+				this.globalUser.todayDate = dateUtils.getCurrentDate();
 				uni.setNavigationBarTitle({
 					title: this.$t('equipmentStatusList.title')
 				});
@@ -443,17 +443,6 @@
 			getEquipmentTitle(equipment) {
 				return equipment.name ? equipment.name : equipment.clientId;
 			},
-			getCurrentDate() {
-			    const today = new Date();
-			    // 获取年份
-			    const year = today.getFullYear();
-			    // 获取月份 (注意,JavaScript 的月份是从0开始的,所以要加1)
-			    const month = String(today.getMonth() + 1).padStart(2, '0');
-			    // 获取日期
-			    const day = String(today.getDate()).padStart(2, '0');
-			    // 格式化为 "yyyy-MM-dd" 格式
-			    return `${year}-${month}-${day}`;
-			},
 			getEquipmentListData() {
 				if(this.globalUser.id == 1) {
 					uni.showToast({
@@ -462,8 +451,7 @@
 					});
 					return;
 				} else {
-					this.isLoading = true;
-					console.log('参数', this.globalUser);
+					this.isLoading = true;					
 					this.getEquipmentListByUser(this.globalUser)
 						.then(data => {
 							this.merchantList = data;

+ 4 - 0
pages/User/merchantList.vue

@@ -35,6 +35,9 @@
 	import uniList from '@/components/uni-list/uni-list.vue'
 	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
 	import mixTree from '@/components/mix-tree/mix-tree'
+	import {
+		dateUtils
+	} from '@/common/util.js';
 	export default {
 		components: {
 			uniCollapse,
@@ -75,6 +78,7 @@
 			this.id = this.globalUser.id;
 			this.globalUser.offset = 0;
 			this.globalUser.limit = 20;
+			this.globalUser.todayDate = dateUtils.getCurrentDate();
 			var token = uni.getStorageSync("token");
 			if (token.length>1) {
 				this.getEquipmentListData();