Ver código fonte

登录功能优化,首页初始化升级

shilin 4 anos atrás
pai
commit
2915c1b973
3 arquivos alterados com 63 adições e 49 exclusões
  1. 3 0
      common/dataprocessing.js
  2. 7 7
      components/login/Login.vue
  3. 53 42
      pages/index/Index.vue

+ 3 - 0
common/dataprocessing.js

@@ -149,6 +149,9 @@ class Dataprocessing {
 
 					plusDrawerList.push(obj);
 				}
+				uni.setStorageSync('windpowerstationName', plusDrawerList[0].name);
+				uni.setStorageSync('windPowerStationId', plusDrawerList[0].windId);
+		
 
 				for (let j = 0; j < res.data.data.length; j++) {
 

+ 7 - 7
components/login/Login.vue

@@ -236,10 +236,10 @@
 					this.dataprocessing.viewUserid();
 					this.dataprocessing.monitoringAuthority();
 					
-					let plusDrawerList = uni.getStorageSync('plusList');
+					//let plusDrawerList = uni.getStorageSync('plusList');
 					
-					this.dataprocessing.putWindPowerStationId(plusDrawerList[0].windId);
-					this.dataprocessing.putWindPowerStationName(plusDrawerList[0].name);
+					//this.dataprocessing.putWindPowerStationId(plusDrawerList[0].windId);
+					//this.dataprocessing.putWindPowerStationName(plusDrawerList[0].name);
 
 					uni.switchTab({
 						url: '/pages/index/Index'
@@ -272,7 +272,7 @@
 					data: {},
 					method: 'GET',
 					success: function(res) {
-						console.log(res.data);
+						//console.log(res.data);
 						_this.userid = res.data.data;
 
 
@@ -285,10 +285,10 @@
 							_this.dataprocessing.viewUserid();
 							_this.dataprocessing.monitoringAuthority();
 							
-							let plusDrawerList = uni.getStorageSync('plusList');
+							// let plusDrawerList = uni.getStorageSync('plusList');
 							
-							_this.dataprocessing.putWindPowerStationId(plusDrawerList[0].windId);
-							_this.dataprocessing.putWindPowerStationName(plusDrawerList[0].name);
+							// _this.dataprocessing.putWindPowerStationId(plusDrawerList[0].windId);
+							// _this.dataprocessing.putWindPowerStationName(plusDrawerList[0].name);
 							
 							// if(_this.dataprocessing.getWindPowerStationId()=='')
 							// {

+ 53 - 42
pages/index/Index.vue

@@ -391,7 +391,7 @@
 				<view class="qiun-chart"><canvas canvas-id="canvasColumnStack" id="canvasColumnStack" class="chart" @touchstart="touchColumn"></canvas></view>
 			</view>
 			<!-- 风电场卡片 -->
-			<view class="windStation">
+			<view class="windStation" >
 				<scroll-view scroll-x class="scrollWindStationCard">
 					<view class="windStationCardContainer" :style="{'width':windStationCardContainerwidth}">
 						<view v-for="(item,index) in plusDrawerList" :key="index">
@@ -550,6 +550,7 @@
 			this.$nextTick(function(){
 				this.viewUserid();
 			});
+			this.viewUserid();
 			this.monitoringAuthority();
 			this.judgeWindfield();
 			this.address = this.dataprocessing.getWindPowerStationName();
@@ -557,33 +558,36 @@
 			this.windPowerStationId = this.dataprocessing.getWindPowerStationId();
 		},onLoad: function() {
 
-			let that = this;
-			setTimeout(function() {
-				that.loading = true;
-			}, 500);
-			_self = this;
-
-			this.address = this.dataprocessing.getWindPowerStationName();
-			this.FDC = this.dataprocessing.getWindPowerStationId();
-			this.windPowerStationId = this.dataprocessing.getWindPowerStationId();
-			this.cWidth = uni.upx2px(750);
-			this.cHeight = uni.upx2px(400);
-			this.getServerData();
-			this.getColumnData();
-			this.windStationCardCWidth = 250;
-			this.windStationCardCHeight = 150;
-			this.target_comprehensive_indicators();
-			this.index_electricQuantity();
-			this.index_target_basic_indicators();
-			this.index_curve_columnar_five_loss();
-			this.target_windSpeed_power();
-			this.index_windturbine_status();
-			this.getWindStationCardData();
-			this.index_curve_columnar_windSpeed_power();
-			this.index_windStation_card(); /* P6F8与P6F4冲突 */
+			// let that = this;
+			// setTimeout(function() {
+			// 	that.loading = true;
+			// }, 500);
+			// _self = this;
+			// this.viewUserid();
+			// this.monitoringAuthority();
+			// this.judgeWindfield();
+			// this.address = this.dataprocessing.getWindPowerStationName();
+			// this.FDC = this.dataprocessing.getWindPowerStationId();
+			// this.windPowerStationId = this.dataprocessing.getWindPowerStationId();
+			// this.cWidth = uni.upx2px(750);
+			// this.cHeight = uni.upx2px(400);
+			// this.getServerData();
+			// this.getColumnData();
+			// this.windStationCardCWidth = 250;
+			// this.windStationCardCHeight = 150;
+			// this.target_comprehensive_indicators();
+			// this.index_electricQuantity();
+			// this.index_target_basic_indicators();
+			// this.index_curve_columnar_five_loss();
+			// this.target_windSpeed_power();
+			// this.index_windturbine_status();
+			// this.getWindStationCardData();
+			// this.index_curve_columnar_windSpeed_power();
+			// this.index_windStation_card(); /* P6F8与P6F4冲突 */
 		
 		},
-		onReady: function() {
+		mounted: function() {
+
 			let that = this;
 			setTimeout(function() {
 				that.loading = true;
@@ -627,12 +631,13 @@
 			this.hideModal();
 		},
 		onShow: function() {
-			this.address = this.dataprocessing.getWindPowerStationName();
-			this.FDC = this.dataprocessing.getWindPowerStationId();
-			this.windPowerStationId = this.dataprocessing.getWindPowerStationId();
 			this.viewUserid();
 			this.monitoringAuthority();
 			this.judgeWindfield();
+			this.address = this.dataprocessing.getWindPowerStationName();
+			this.FDC = this.dataprocessing.getWindPowerStationId();
+			this.windPowerStationId = this.dataprocessing.getWindPowerStationId();
+			
 		},
 		methods: {
 			timeNow() {
@@ -646,12 +651,13 @@
 				this.plusDrawerList = uni.getStorageSync('plusList');
 				let _this = this;
 				
-				if(_this.$refs.windFarmcard !=undefined)
-				{
-					for (let i = 0; i < _this.plusDrawerList.length; i++) {
-						_this.$refs.windFarmcard[i].getWindfieldid(_this.plusDrawerList[i]);
-					}
-				}
+				// if(_this.$refs.windFarmcard !=undefined)
+				// {
+				// 	for (let i = 0; i < _this.plusDrawerList.length; i++) {
+						
+				// 		_this.$refs.windFarmcard[i].getWindfieldid(_this.plusDrawerList[i]);
+				// 	}
+				// }
 				
 				this.windStationCardContainerwidth = (260 * this.plusDrawerList.length - 260)+"px";
 				console.log(this.windStationCardContainerwidth)
@@ -660,12 +666,13 @@
 				this.plusDrawerList = uni.getStorageSync('plusList');
 				let _this = this;
 				
-				if(_this.$refs.windFarmcard!=undefined)
-				{
-					for (let i = 0; i < _this.plusDrawerList.length; i++) {
-						_this.$refs.windFarmcard[i].getWindfieldid(_this.plusDrawerList[i]);
-					}
-				}
+				// if(_this.$refs.windFarmcard!=undefined)
+				// {
+				// 	for (let i = 0; i < _this.plusDrawerList.length; i++) {
+						
+				// 		_this.$refs.windFarmcard[i].getWindfieldid(_this.plusDrawerList[i]);
+				// 	}
+				// }
 
 			},
 			monitoringAuthority: function() {
@@ -936,7 +943,9 @@
 								_this.windFielddata.push(json[x])
 						}
 						for(let i=0;i<_this.plusDrawerList.length;i++){
+							_this.$refs.windFarmcard[i].getWindfieldid(_this.plusDrawerList[i]);
 							_this.$refs.windFarmcard[i].getWindfielddata(_this.windFielddata[i]);
+							
 						}
 						_this.cardmodule = false;
 					});
@@ -982,7 +991,7 @@
 						//console.log("收到服务器内容:" + res.data);
 						let json = JSON.parse(res.data);
 					
-						console.log(json);
+						//console.log(json);
 						for(let x in json){
 							if(x==_this.FDC)
 							{
@@ -991,6 +1000,7 @@
 							_this.lineChartdata.push(json[x]);
 						}
 						for(let i=0;i<_this.plusDrawerList.length;i++){
+							_this.$refs.windFarmcard[i].getWindfieldid(_this.plusDrawerList[i]);
 							_this.$refs.windFarmcard[i].getUchartData(_this.lineChartdata[i]);
 						}
 						
@@ -1234,6 +1244,7 @@
 								_this.windFieldsituation.push(json[x]);
 						}
 							for(let i=0;i<_this.plusDrawerList.length;i++){
+								_this.$refs.windFarmcard[i].getWindfieldid(_this.plusDrawerList[i]);
 								_this.$refs.windFarmcard[i].getHoursWeatherData(_this.windFieldsituation[i]);
 							}
 						_this.cardmodule = false;