Index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. <template>
  2. <view class="content">
  3. <!-- <image class="logo" src="/static/logo.png"></image> -->
  4. <!--导航栏-->
  5. <view @tap="common.navTo('/components/addressSelect/AddressSelect?option='+address)">
  6. <cu-custom bgColor="bg-gradual-earkblue" :isBack="false">
  7. <block slot="backText">
  8. <view style="height: 80rpx;line-height: 80rpx;">返回</view>
  9. </block>
  10. <block slot="content">
  11. <text :class="'cuIcon-locationfill'"></text>
  12. </block>
  13. <block slot="content">{{address}}</block>
  14. <block slot="content">
  15. <image style="width: 15px;height: 15px;margin-left: 4px;" src="../../static/picture/SanJiao.png">
  16. </block>
  17. </cu-custom>
  18. </view>
  19. <div class="ThermometerCard">
  20. <!-- <scroll-view scroll-y scroll-with-animation class="scrollList"> -->
  21. <ThermometerCard ref="thermometerCard" @listenEven="weatherDayNightSwitch"></ThermometerCard>
  22. <!-- </scroll-view> -->
  23. </div>
  24. <div class="weatherDetails">
  25. <div class="weatherText" :style="{'margin-left':marginleftBiao}"><strong>气象指标</strong></div>
  26. <div class="detailsText" @tap="common.navTo('/components/detail/Detail')">详情ㅤ〉</div>
  27. </div>
  28. <view v-if="weatherSwitch==true">
  29. <scroll-view scroll-y scroll-with-animation class="scrollList" :style="{'height':height}">
  30. <view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']" style="background-color: rgba(0, 0, 0, 0);">
  31. <view class="cu-item">
  32. <!-- <div :class="[index%4==3?'border-right':'border-left']"> -->
  33. <div class="cu-listAll" :style="{'width':width}">
  34. <div class="cuIcon" :style="{'height':xianHeight}">
  35. <view class="icon iconfont" :class="['icon-' + cuIconList[6].cuIcon,'text-'+ cuIconList[0].color]"></view><a class="wenZhi"
  36. :style="{'font-size':fontSize}">白气象</br>{{weatherProphetData_1[0].weather1}}</a>
  37. </div>
  38. <div class="cuIcon" :style="{'height':xianHeight}">
  39. <view class="icon iconfont" :class="['icon-' + cuIconList[7].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  40. class="wenZhi" :style="{'font-size':fontSize}">白气温</br>{{weatherProphetData_1[0].temperature1}}℃</a>
  41. </div>
  42. <div class="cuIcon" :style="{'height':xianHeight}">
  43. <view class="icon iconfont" :class="['icon-' + cuIconList[8].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  44. class="wenZhi" :style="{'font-size':fontSize}">白体感</br>{{weatherProphetData_1[0].realfeel1}}℃</a>
  45. </div>
  46. <div class="cuIcon4">
  47. <view class="icon iconfont" :class="['icon-' + cuIconList[9].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  48. class="wenZhi" :style="{'font-size':fontSize}">白降水</br>{{weatherProphetData_1[0].precipitation1}}m/s</a>
  49. </div>
  50. </div>
  51. <div class="cu-listAllTwo" :style="{'width':width,'margin-top':margintop}">
  52. <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
  53. <view class="icon iconfont" :class="['icon-' + cuIconList[10].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  54. class="wenZhi" :style="{'font-size':fontSize}">白风向</br>{{weatherProphetData_1[0].winddirection1}}</a>
  55. </div>
  56. <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
  57. <view class="icon iconfont" :class="['icon-' + cuIconList[11].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  58. class="wenZhi" :style="{'font-size':fontSize}">白风速</br>{{weatherProphetData_1[0].speed1}}km/h</a>
  59. </div>
  60. <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
  61. <view class="icon iconfont" :class="['icon-' + cuIconList[12].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  62. class="wenZhi" :style="{'font-size':fontSize}">白阵风速</br>{{weatherProphetData_1[0].gust1}}km/h</a>
  63. </div>
  64. <div class="cuIcon4" :style="{'margin-top':margintop}">
  65. <view class="icon iconfont" :class="['icon-' + cuIconList[0].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  66. class="wenZhi" :style="{'font-size':fontSize}">天气</br>{{weatherProphetData_1[0].weather}}</a>
  67. </div>
  68. </div>
  69. <div class="cu-listAllTThree" :style="{'width':width,'margin-top':margintopThree}">
  70. <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
  71. <view class="icon iconfont" :class="['icon-' + cuIconList[1].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  72. class="wenZhi" :style="{'font-size':fontSize}">最高温度</br>{{weatherProphetData_1[0].maximumtem}}℃</a>
  73. </div>
  74. <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
  75. <view class="icon iconfont" :class="['icon-' + cuIconList[2].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  76. class="wenZhi" :style="{'font-size':fontSize}">最低温度</br>{{weatherProphetData_1[0].minimumtem}}℃</a>
  77. </div>
  78. <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
  79. <view class="icon iconfont" :class="['icon-' + cuIconList[3].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  80. class="wenZhi" :style="{'font-size':fontSize}">日出</br>{{weatherProphetData_1[0].sunrise}}</a>
  81. </div>
  82. <div class="cuIcon4" :style="{'margin-top':margintopThree}">
  83. <view class="icon iconfont" :class="['icon-' + cuIconList[4].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  84. class="wenZhi" :style="{'font-size':fontSize}">日落</br>{{weatherProphetData_1[0].sunset}}</a>
  85. </div>
  86. </div>
  87. <div class="cu-listAllTFour" :style="{'width':width,'margin-top':margintopThree}">
  88. <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
  89. <view class="icon iconfont" :class="['icon-' + cuIconList[5].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  90. class="wenZhi" :style="{'font-size':fontSize}">持续时间</br>{{weatherProphetData_1[0].sunduration}}</a>
  91. </div>
  92. <div class="cuIcon2">
  93. </div>
  94. <div class="cuIcon2">
  95. </div>
  96. <div class="cuIcon2">
  97. </div>
  98. </div>
  99. </view>
  100. </view>
  101. </scroll-view>
  102. </view>
  103. <view v-if="weatherSwitch==false">
  104. <scroll-view scroll-y scroll-with-animation class="scrollList" :style="{'height':height}">
  105. <view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']" style="background-color: rgba(0, 0, 0, 0);">
  106. <view class="cu-item">
  107. <!-- <div :class="[index%4==3?'border-right':'border-left']"> -->
  108. <div class="cu-listAll" :style="{'width':width}">
  109. <div class="cuIcon" :style="{'height':xianHeight}">
  110. <view class="icon iconfont" :class="['icon-' + cuIconList[6].cuIcon,'text-'+ cuIconList[0].color]"></view><a class="wenZhi"
  111. :style="{'font-size':fontSize}">夜气象</br>{{weatherProphetData_1[0].weather2}}</a>
  112. </div>
  113. <div class="cuIcon" :style="{'height':xianHeight}">
  114. <view class="icon iconfont" :class="['icon-' + cuIconList[7].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  115. class="wenZhi" :style="{'font-size':fontSize}">夜气温</br>{{weatherProphetData_1[0].temperature2}}℃</a>
  116. </div>
  117. <div class="cuIcon" :style="{'height':xianHeight}">
  118. <view class="icon iconfont" :class="['icon-' + cuIconList[8].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  119. class="wenZhi" :style="{'font-size':fontSize}">夜体感</br>{{weatherProphetData_1[0].realfeel2}}℃</a>
  120. </div>
  121. <div class="cuIcon4">
  122. <view class="icon iconfont" :class="['icon-' + cuIconList[9].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  123. class="wenZhi" :style="{'font-size':fontSize}">夜降水</br>{{weatherProphetData_1[0].precipitation2}}m/s</a>
  124. </div>
  125. </div>
  126. <div class="cu-listAllTwo" :style="{'width':width,'margin-top':margintop}">
  127. <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
  128. <view class="icon iconfont" :class="['icon-' + cuIconList[10].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  129. class="wenZhi" :style="{'font-size':fontSize}">夜风向</br>{{weatherProphetData_1[0].winddirection2}}</a>
  130. </div>
  131. <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
  132. <view class="icon iconfont" :class="['icon-' + cuIconList[11].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  133. class="wenZhi" :style="{'font-size':fontSize}">夜风速</br>{{weatherProphetData_1[0].speed2}}km/h</a>
  134. </div>
  135. <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
  136. <view class="icon iconfont" :class="['icon-' + cuIconList[12].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  137. class="wenZhi" :style="{'font-size':fontSize}">夜阵风速</br>{{weatherProphetData_1[0].gust2}}km/h</a>
  138. </div>
  139. <div class="cuIcon4" :style="{'margin-top':margintop}">
  140. <view class="icon iconfont" :class="['icon-' + cuIconList[0].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  141. class="wenZhi" :style="{'font-size':fontSize}">天气</br>{{weatherProphetData_1[0].weather}}</a>
  142. </div>
  143. </div>
  144. <div class="cu-listAllTThree" :style="{'width':width,'margin-top':margintopThree}">
  145. <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
  146. <view class="icon iconfont" :class="['icon-' + cuIconList[1].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  147. class="wenZhi" :style="{'font-size':fontSize}">最高温度</br>{{weatherProphetData_1[0].maximumtem}}℃</a>
  148. </div>
  149. <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
  150. <view class="icon iconfont" :class="['icon-' + cuIconList[2].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  151. class="wenZhi" :style="{'font-size':fontSize}">最低温度</br>{{weatherProphetData_1[0].minimumtem}}℃</a>
  152. </div>
  153. <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
  154. <view class="icon iconfont" :class="['icon-' + cuIconList[3].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  155. class="wenZhi" :style="{'font-size':fontSize}">日出</br>{{weatherProphetData_1[0].sunrise}}</a>
  156. </div>
  157. <div class="cuIcon4" :style="{'margin-top':margintopThree}">
  158. <view class="icon iconfont" :class="['icon-' + cuIconList[4].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  159. class="wenZhi" :style="{'font-size':fontSize}">日落</br>{{weatherProphetData_1[0].sunset}}</a>
  160. </div>
  161. </div>
  162. <div class="cu-listAllTFour" :style="{'width':width,'margin-top':margintopThree}">
  163. <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
  164. <view class="icon iconfont" :class="['icon-' + cuIconList[5].cuIcon,'text-'+ cuIconList[0].color]"></view><a
  165. class="wenZhi" :style="{'font-size':fontSize}">持续时间</br>{{weatherProphetData_1[0].sunduration}}</a>
  166. </div>
  167. <div class="cuIcon2">
  168. </div>
  169. <div class="cuIcon2">
  170. </div>
  171. <div class="cuIcon2">
  172. </div>
  173. </div>
  174. </view>
  175. </view>
  176. </scroll-view>
  177. </view>
  178. </view>
  179. </template>
  180. <script>
  181. import utils from '../../components/tools/shoyu-date/utils.filter.js';
  182. // 直接使用办法
  183. import ThermometerCard from '../../components/thermometerCard/ThermometerCard.vue'
  184. /* import thermometerCard from '../../components/thermometerCard/ThermometerCard.vue' */
  185. export default {
  186. components: {
  187. "ThermometerCard": ThermometerCard
  188. },
  189. data: function() {
  190. return {
  191. utils: utils,
  192. margintop:'',
  193. margintopThree:'',
  194. messageTop:'',
  195. // 直接使用需要进行声明
  196. // 直接使用需要进行声明 End
  197. date: '2020/03/27 08:00:00',
  198. timestamp: "",
  199. address: '',
  200. option: '',
  201. cuIconList: [{
  202. cuIcon: 'weather',
  203. color: 'white',
  204. name: '天气',
  205. }, {
  206. cuIcon: 'maxTemperature',
  207. color: 'white',
  208. name: '最高温度',
  209. }, {
  210. cuIcon: 'minTemperature',
  211. color: 'white',
  212. name: '最低温度',
  213. }, {
  214. cuIcon: 'sunRise',
  215. color: 'white',
  216. name: '日出',
  217. }, {
  218. cuIcon: 'sunSet',
  219. color: 'white',
  220. name: '日落',
  221. }, {
  222. cuIcon: 'sunDuration',
  223. color: 'white',
  224. name: '持续时间',
  225. }, {
  226. cuIcon: 'dayWeather',
  227. color: 'white',
  228. name: '白气象',
  229. }, {
  230. cuIcon: 'dayTemperature',
  231. color: 'white',
  232. name: '白气温',
  233. }, {
  234. cuIcon: 'dayRealFeel',
  235. color: 'white',
  236. name: '白体感',
  237. }, {
  238. cuIcon: 'dayPrecipitation',
  239. color: 'white',
  240. name: '白降水',
  241. }, {
  242. cuIcon: 'dayWindDirection',
  243. color: 'white',
  244. name: '白风向',
  245. }, {
  246. cuIcon: 'dayWindSpeed',
  247. color: 'white',
  248. name: '白风速',
  249. }, {
  250. cuIcon: 'dayGust',
  251. color: 'white',
  252. name: '白阵风速',
  253. }, {
  254. cuIcon: 'nightWeather',
  255. color: 'white',
  256. name: '夜气象',
  257. }, {
  258. cuIcon: 'nightTemperature',
  259. color: 'white',
  260. name: '夜温度',
  261. }, {
  262. cuIcon: 'nightRealFeel',
  263. color: 'white',
  264. name: '夜体感',
  265. }, {
  266. cuIcon: 'nightPrecipitation',
  267. color: 'white',
  268. name: '夜降水',
  269. }, {
  270. cuIcon: 'nightWindDirection',
  271. color: 'white',
  272. name: '夜风向',
  273. }, {
  274. cuIcon: 'nightWindSpeed',
  275. color: 'white',
  276. name: '夜风速',
  277. }, {
  278. cuIcon: 'nightGust',
  279. color: 'white',
  280. name: '夜阵风速',
  281. }],
  282. modalName: null,
  283. gridCol: 4,
  284. gridBorder: false,
  285. weatherProphetDataAll_17Hour: [],
  286. weatherProphetData_17Hour: [{
  287. date:'',
  288. id:'',
  289. realfeel:'',
  290. region:'',
  291. speed:'',
  292. temperature:'',
  293. weather:'',
  294. winddirection:'',
  295. windpowerstationid:''
  296. }],
  297. weatherProphetDataAll_1: [],
  298. weatherProphetData_1: [{
  299. weather1:'',
  300. gust1:'',
  301. gust2:'',
  302. id:'',
  303. maximumtem:'',
  304. minimumtem:'',
  305. precipitation1:"",
  306. precipitation2:'',
  307. realfeel1:'',
  308. realfeel1:'',
  309. recodedata:'',
  310. region:'',
  311. speed1:'',
  312. speed2:'',
  313. sunduration:"",
  314. sunrise:'',
  315. sunset:'',
  316. temperature1:'',
  317. temperature2:'',
  318. weather:'',
  319. weather1:'',
  320. weather2:"",
  321. winddirection1:'',
  322. winddirection2:'',
  323. windpowerstationid:'',
  324. }],
  325. weatherSwitch: true,
  326. windPowerStationId: "MHS_FDC",
  327. windPowerStations: [],
  328. width:'',
  329. height:'',
  330. windowWidth:"",
  331. windowHeight:"",
  332. ziHeight:'',
  333. fontSize:'',
  334. xianHeight:'',
  335. marginleftBiao:'',
  336. }
  337. },
  338. created: function() {
  339. //this.pushWindPowerStationNameToSessionStorage("麻黄山");
  340. this.address = this.getWindPowerStationNameToSessionStorage();
  341. this.windPowerStationId=uni.getStorageSync('windPowerStationId');
  342. this.windowWidth=uni.getSystemInfoSync().windowWidth;
  343. this.windowHeight=uni.getSystemInfoSync().windowHeight;
  344. // this.getTodayWeatherData();
  345. this.$nextTick(function(){
  346. this.getWeatherData();
  347. });
  348. if(this.windowWidth>=768){
  349. this.margintop="60px";
  350. this.margintopThree="80px";
  351. this.messageTop="10px";
  352. this.fontSize="18px";
  353. this.xianHeight="168px";
  354. this.marginleftBiao="50px";
  355. }else{
  356. this.margintop="10px";
  357. this.margintopThree="10px";
  358. this.fontSize="14px";
  359. this.xianHeight="92px";
  360. this.marginleftBiao="26px";
  361. }
  362. this.height = parseInt(uni.getSystemInfoSync().windowHeight - 500) + "px"
  363. this.width = parseInt(uni.getSystemInfoSync().windowWidth) + "px"
  364. //alert(this.address);
  365. },
  366. onShow() {
  367. this.windPowerStationId=uni.getStorageSync('windPowerStationId');
  368. this.address = this.getWindPowerStationNameToSessionStorage();
  369. this.getWeatherData();
  370. },
  371. methods: {
  372. pushWindPowerStationNameToSessionStorage(windpowerstationName) {
  373. uni.setStorageSync('windpowerstationName', windpowerstationName);
  374. //sessionStorage.setItem('windpowerstationName', windpowerstationName);
  375. //alert("v"+ sessionStorage.getItem("windpowerstationName"));
  376. //this.common.goback('/pages/index/Index');
  377. },
  378. getWindPowerStationNameToSessionStorage() {
  379. uni.getStorageSync('windpowerstationName');
  380. return uni.getStorageSync('windpowerstationName');
  381. },
  382. getWeatherData: function() {
  383. //得到数据
  384. let _this = this;
  385. // 创建一个this.socketTask对象【发送、接收、关闭socket都由这个对象操作】
  386. // 按小时数据
  387. this.socketTaskHour = uni.connectSocket({
  388. // 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
  389. url: "ws://49.4.78.143:8081/websocket/pageNumber_3/functionNumber_2",
  390. success(data) {
  391. console.log("websocket连接成功");
  392. },
  393. });
  394. // 今天数据
  395. this.socketTaskToday = uni.connectSocket({
  396. // 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
  397. url: "ws://49.4.78.143:8081/websocket/pageNumber_2/functionNumber_1",
  398. success(data) {
  399. console.log("websocket连接成功");
  400. },
  401. });
  402. this.socketTaskToday.onOpen((res) => {
  403. console.log("WebSocket连接正常打开中...!");
  404. this.is_open_socket = true;
  405. // 注:只有连接正常打开中 ,才能正常收到消息
  406. this.socketTaskToday.onMessage((res) => {
  407. //console.log("收到服务器内容:" + res.data);
  408. _this.weatherProphetDataAll_1 = res.data;
  409. _this.weatherProphetDataAll_1 = JSON.parse(res.data);
  410. _this.weatherProphetData_1 = [];
  411. //判断风场id 40天
  412. for (let i = 0; i < _this.weatherProphetDataAll_1.length; i++) {
  413. if (_this.weatherProphetDataAll_1[i].windpowerstationid == _this.windPowerStationId) {
  414. _this.weatherProphetData_1.push(_this.weatherProphetDataAll_1[i]);
  415. }
  416. }
  417. console.log(_this.weatherProphetData_1)
  418. _this.$nextTick(function(){
  419. console.log(_this.$refs.thermometerCard);
  420. _this.$refs.thermometerCard.getHourWeatherData("90","360",_this.weatherProphetData_17Hour,_this.weatherProphetData_1);
  421. })
  422. });
  423. })
  424. // 消息的发送和接收必须在正常连接打开中,才能发送或接收【否则会失败】
  425. this.socketTaskHour.onOpen((res) => {
  426. console.log("WebSocket连接正常打开中...!");
  427. this.is_open_socket = true;
  428. // 注:只有连接正常打开中 ,才能正常收到消息
  429. this.socketTaskHour.onMessage((res) => {
  430. //console.log("收到服务器内容:" + res.data);
  431. _this.weatherProphetDataAll_17Hour = res.data;
  432. _this.weatherProphetDataAll_17Hour = JSON.parse(res.data);
  433. _this.weatherProphetData_17Hour = [];
  434. //判断风场id 40天
  435. for (let i1 = 0; i1 < _this.weatherProphetDataAll_17Hour.length; i1++) {
  436. if (_this.weatherProphetDataAll_17Hour[i1].windpowerstationid == _this.windPowerStationId) {
  437. _this.weatherProphetData_17Hour.push(_this.weatherProphetDataAll_17Hour[i1]);
  438. }
  439. }
  440. // console.log(_this.weatherProphetData_17Hour)
  441. _this.$nextTick(function(){
  442. console.log(_this.$refs.thermometerCard);
  443. _this.$refs.thermometerCard.getHourWeatherData("90","360",_this.weatherProphetData_17Hour,_this.weatherProphetData_1);
  444. })
  445. });
  446. })
  447. // 这里仅是事件监听【如果socket关闭了会执行】
  448. this.socketTaskHour.onClose(() => {
  449. console.log("已经被关闭了")
  450. })
  451. this.socketTaskToday.onClose(() => {
  452. console.log("已经被关闭了")
  453. })
  454. },
  455. weatherDayNightSwitch: function(flag) {
  456. if (flag == "day") {
  457. this.weatherSwitch = true;
  458. } else if (flag == "night") {
  459. this.weatherSwitch = false;
  460. }
  461. }
  462. },
  463. onLoad() {
  464. let that = this;
  465. // 时间转换为时间戳
  466. // 如果是时间戳直接传递,无需转换
  467. //that.timestamp = new Date(this.date).getTime();
  468. //console.log(that.timestamp);
  469. this.address = this.getWindPowerStationNameToSessionStorage();
  470. // this.getHourWeatherData();
  471. }
  472. }
  473. </script>
  474. <style>
  475. page {
  476. height: 100%;
  477. background: -webkit-gradient(linear, 0% 100%, 0% 0%, from(#2F698E), color-stop(0.15, #5C757C), to(#004C90));
  478. overflow-x: hidden;
  479. overflow-y: hidden;
  480. }
  481. .ThermometerCard {
  482. margin-top: -10px;
  483. height: 400px;
  484. width: 100%;
  485. }
  486. .border-left {
  487. border-style: solid;
  488. border-top-width: 0px;
  489. border-right-width: 1px;
  490. border-bottom-width: 0px;
  491. border-left-width: 0px;
  492. border-right-color: white;
  493. }
  494. .border-right {
  495. border-style: solid;
  496. border-top-width: 0px;
  497. border-right-width: 0px;
  498. border-bottom-width: 0px;
  499. border-left-width: 0px;
  500. border-right-color: #19B5BC;
  501. }
  502. .scrollList {
  503. height: 210px;
  504. // white-space: nowrap;
  505. }
  506. .content {
  507. /* display: flex;
  508. flex-direction: column;
  509. align-items: center;
  510. justify-content: center; */
  511. }
  512. .weatherDetails {
  513. width: 100%;
  514. height: 25rpx;
  515. float: left;
  516. }
  517. .wenZhi{
  518. color: white;
  519. }
  520. .weatherText {
  521. width: 40%;
  522. height: 10px;
  523. float: left;
  524. font-size: 14px;
  525. color: white;
  526. margin-left: 26px;
  527. margin-top: -15px;
  528. }
  529. .detailsText {
  530. width: 40%;
  531. height: 10px;
  532. float: right;
  533. font-size: 14px;
  534. color: white;
  535. margin-right: 5%;
  536. text-align: right;
  537. margin-top: -15px;
  538. }
  539. .logo {
  540. height: 200rpx;
  541. width: 200rpx;
  542. margin-top: 200rpx;
  543. margin-left: auto;
  544. margin-right: auto;
  545. margin-bottom: 50rpx;
  546. }
  547. .icon {
  548. font-size: 50upx;
  549. }
  550. .cuIcon {
  551. border-right: 1px solid white;
  552. height: 92px;
  553. }
  554. .cu-listAll {
  555. width: 390px;
  556. height: 100px;
  557. display: -webkit-flex;
  558. display: flex;
  559. justify-content: space-around;
  560. margin-top: -20px;
  561. }
  562. .cu-listAllTwo {
  563. width: 390px;
  564. height: 100px;
  565. display: -webkit-flex;
  566. display: flex;
  567. justify-content: space-around;
  568. margin-top: 10px;
  569. }
  570. .cu-listAllTThree {
  571. width: 390px;
  572. height: 100px;
  573. display: -webkit-flex;
  574. display: flex;
  575. justify-content: space-around;
  576. margin-top: 10px;
  577. }
  578. .cu-listAllTFour {
  579. width: 390px;
  580. height: 100px;
  581. display: -webkit-flex;
  582. display: flex;
  583. justify-content: space-around;
  584. margin-top: 10px;
  585. // justify-content: space-around;
  586. }
  587. .cuIcon1 {
  588. margin-top: 20px;
  589. }
  590. </style>