WeatherTemperatureWindSpeedCard_7.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <div>
  3. <div class="weatherDay7" :style="{'margin-left':marginleft}">
  4. <div :key="index" class="weatherParentComponent" :style="{'width':width7}" @tap="changeTap(item)" v-for="(item,index) in weatherProphetData_7">
  5. <div :class="[classNameweatherIconBackgroundColor,bgcolor]" :style="{'width':assemblyWidth,'height':assemblyHeight}">
  6. <div class="assembly_time l" :style="{'margin-left':timeleft}"> {{ utils.timeTodate('d', item.recodedata) }}日</div>
  7. <!--<div class="today_time l">今天</div>-->
  8. <div :class="[classNameDay[index],assembly_1_page]" :style="{'margin-left':tuleft}"></div>
  9. <div :class="[classNameNight[index],assembly_2_page]" :style="{'margin-left':tuleft}"></div>
  10. <div class="assembly_weather l" :style="{'margin-left':weatherleft}">{{item.weather}}</div>
  11. <div class="assembly_temperature l" :style="{'margin-left':temperleft}">{{item.temperature2}}~{{item.temperature1}}℃</div>
  12. <div class="assembly_wind l" :style="{'margin-left':weatherleft}">{{item.speed1}}km/h</div>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import utils from '@/components/tools/shoyu-date/utils.filter.js';
  20. export default {
  21. data: function() {
  22. return {
  23. classNameweatherIconBackgroundColor: [],
  24. bgcolor: "lightBlue",
  25. assemblyWidth: '',
  26. assemblyHeight: '',
  27. weatherProphetData_7: [],
  28. assembly_1_page: "assembly_1",
  29. classNameDay: [],
  30. classNameNight: [],
  31. assembly_2_page: "assembly_2",
  32. weatherIconsDay:[],
  33. weatherIconsNight:[],
  34. // 直接使用需要进行声明
  35. utils: utils,
  36. // 直接使用需要进行声明 End
  37. timestamp: "",
  38. windowWidth:"",
  39. windowHeight:"",
  40. marginleft:'',
  41. width7:'',
  42. timeleft:'',
  43. tuleft:'',
  44. weatherleft:'',
  45. temperleft:'',
  46. }
  47. },
  48. created: function() {
  49. this.windowWidth=uni.getSystemInfoSync().windowWidth;
  50. this.windowHeight=uni.getSystemInfoSync().windowHeight;
  51. if(this.windowWidth>=768){
  52. this.marginleft="5%";
  53. this.width7="150px";
  54. this.timeleft="30px";
  55. this.tuleft="62px";
  56. this.weatherleft="27px"
  57. this.temperleft="28px";
  58. }else{
  59. this.marginleft="20px";
  60. }
  61. },
  62. methods: {
  63. changeTap: function(item) {
  64. let itemString = JSON.stringify(item);
  65. this.$emit("listenEven", itemString);
  66. },
  67. setDate: function() {
  68. // var newDate = new Date(this.weatherProphetData_40.recodedata).Format("dd");
  69. // this.newDate = newDate;
  70. this.timestamp = new Date(this.weatherProphetData_7.recodedata).getTime();
  71. this.newDate = this.utils.timeTodate('d', this.timestamp);
  72. // this.timestamp = 1582560000000;
  73. // console.log(this.timestamp);
  74. },
  75. weatherInformationCard: function(assemblyWidth, assemblyHeight, classNameDay, classNameNight, weatherProphetData_7) {
  76. //console.log(this.weatherProphetData_7);
  77. let _this = this;
  78. this.assemblyWidth = assemblyWidth + "px";;
  79. this.assemblyHeight = assemblyHeight + "%";
  80. this.classNameDay = classNameDay;
  81. this.classNameNight = classNameNight;
  82. this.weatherIconsDay = [];
  83. this.weatherIconsNight = [];
  84. this.weatherProphetData_7 = weatherProphetData_7;
  85. for (let i = 0; i < _this.weatherProphetData_7.length; i++) {
  86. _this.weatherIconsDay.push(_this.weatherProphetData_7[i].weather1);
  87. _this.weatherIconsNight.push(_this.weatherProphetData_7[i].weather2);
  88. // console.log(_this.weatherIconsNight)
  89. }
  90. uni.request({
  91. url: 'http://49.4.78.143:8081/WeatherfdController/weatherInformationChangePictureName?model=weatherProphet_7,weatherDataTable_7,white30&weatherInformation=' +
  92. this.weatherIconsDay,
  93. success: function(res) {
  94. _this.classNameDay = [];
  95. for (let i = 0; i < res.data.length; i++) {
  96. _this.classNameDay.push(res.data[i]);
  97. }
  98. },
  99. fail: (e) => {
  100. _this.tips = "网络错误"
  101. },
  102. });
  103. uni.request({
  104. url:'http://49.4.78.143:8081/WeatherfdController/weatherInformationChangePictureName?model=weatherProphet_7,weatherDataTable_7,white30&weatherInformation=' + this.weatherIconsNight,
  105. success: function(res) {
  106. _this.classNameNight = [];
  107. for (let i = 0; i < res.data.length; i++) {
  108. _this.classNameNight.push(res.data[i]);
  109. }
  110. // console.log(_this.classNameNight)
  111. },
  112. fail: (e) => {
  113. _this.tips = "网络错误"
  114. },
  115. });
  116. this.setDate();
  117. this.changeTap(this.weatherProphetData_7[0]);
  118. },
  119. },
  120. }
  121. </script>
  122. <style scoped="scoped">
  123. .assembly_time {
  124. height: 23px;
  125. width: 100%;
  126. border: 0px;
  127. font-size: 16px;
  128. margin-top: 5%;
  129. color: #FFF;
  130. text-decoration: none;
  131. font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
  132. text-align: center;
  133. }
  134. .assembly_2 {
  135. height: 31px;
  136. width: 31px;
  137. border: 0px;
  138. margin-top: 10%;
  139. margin-left: 35%;
  140. background-position: 0px 0px;
  141. }
  142. .assembly_1 {
  143. height: 31px;
  144. width: 31px;
  145. border: 0px;
  146. margin-top: 10%;
  147. margin-left: 35%;
  148. background-position: 0px 80px;
  149. }
  150. .assembly_weather {
  151. height: 23px;
  152. width: 100%;
  153. border: 0px;
  154. font-size: 16px;
  155. color: #FFF;
  156. text-decoration: none;
  157. font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
  158. text-align: center;
  159. margin-top: 30px;
  160. font-weight: bold;
  161. }
  162. .assembly_temperature {
  163. height: 23px;
  164. width: 100%;
  165. border: 0px;
  166. font-size: 16px;
  167. color: #FFF;
  168. text-decoration: none;
  169. font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
  170. text-align: center;
  171. margin-top: 15%;
  172. font-weight: bold;
  173. }
  174. .assembly_wind {
  175. height: 23px;
  176. width: 100%;
  177. border: 0px;
  178. font-size: 16px;
  179. color: #FFF;
  180. text-decoration: none;
  181. font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
  182. text-align: center;
  183. margin-top: 15%;
  184. font-weight: normal;
  185. }
  186. .weatherParentComponent {
  187. border-right: 1rpx solid white;
  188. border-left: 1rpx solid white;
  189. /* border:1px solid white; */
  190. }
  191. .weatherDay7 {
  192. width: 90%;
  193. height: 260px;
  194. /* background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#024F93), color-stop(1.5, #cccccc), to(#437193)); */
  195. background-color: #242424;
  196. float: left;
  197. /* margin: 0px auto; */
  198. /* border-radius: 20px; */
  199. margin-top: 5px;
  200. margin-left: 20px;
  201. margin-bottom: 20px;
  202. margin-right: 20px;
  203. display: -webkit-box;
  204. overflow-x: auto;
  205. /* position:fixed; */
  206. /*适应苹果*/
  207. -webkit-overflow-scrolling: touch;
  208. }
  209. .weatherProphet_7_weatherDataTable_7_white30_taiYang {
  210. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px 0px;
  211. }
  212. .weatherProphet_7_weatherDataTable_7_white30_yunShui {
  213. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -560px 0px;
  214. }
  215. .weatherProphet_7_weatherDataTable_7_white30_yunYun {
  216. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -160px 0px;
  217. }
  218. .weatherProphet_7_weatherDataTable_7_white30_taiYang {
  219. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px 0px;
  220. }
  221. .weatherProphet_7_weatherDataTable_7_white30_taiYangYun {
  222. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px 0px;
  223. }
  224. .weatherProphet_7_weatherDataTable_7_white30_yunYun {
  225. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -160px 0px;
  226. }
  227. .weatherProphet_7_weatherDataTable_7_white30_taiYangYunShui {
  228. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -238px 0px;
  229. }
  230. .weatherProphet_7_weatherDataTable_7_white30_taiYangShanDianShui {
  231. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px 0px;
  232. }
  233. .weatherProphet_7_weatherDataTable_7_white30_taiYangShanDianShuiShui {
  234. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px 0px;
  235. }
  236. .weatherProphet_7_weatherDataTable_7_white30_yunShuiXue {
  237. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -480px 0px;
  238. }
  239. .weatherProphet_7_weatherDataTable_7_white30_yunLiangShui {
  240. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -638px 0px;
  241. }
  242. .weatherProphet_7_weatherDataTable_7_white30_sanHengGang {
  243. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -718px 0px;
  244. }
  245. .weatherProphet_7_weatherDataTable_7_white30_liangDianLiangQuan {
  246. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -798px 0px;
  247. }
  248. .weatherProphet_7_weatherDataTable_7_white30_yunYunShuiShui {
  249. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -880px 0px;
  250. }
  251. .weatherProphet_7_weatherDataTable_7_white30_yunSanShui {
  252. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px -76px;
  253. }
  254. .weatherProphet_7_weatherDataTable_7_white30_yunYunSiShui {
  255. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -76px -76px;
  256. }
  257. .weatherProphet_7_weatherDataTable_7_white30_yunYunWuShui {
  258. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -152px -76px;
  259. }
  260. .weatherProphet_7_weatherDataTable_7_white30_yunYunLiuShui {
  261. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -232px -76px;
  262. }
  263. .weatherProphet_7_weatherDataTable_7_white30_taiYangYunXueXue {
  264. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -76px;
  265. }
  266. .weatherProphet_7_weatherDataTable_7_white30_yunXue {
  267. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px -76px;
  268. }
  269. .weatherProphet_7_weatherDataTable_7_white30__yunXueXue {
  270. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -476px -76px;
  271. }
  272. .weatherProphet_7_weatherDataTable_7_white30_yunSanXue {
  273. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -556px -76px;
  274. }
  275. .weatherProphet_7_weatherDataTable_7_white30_yunYunSiXue {
  276. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -638px -76px;
  277. }
  278. .weatherProphet_7_weatherDataTable_7_white30_sanHengGang {
  279. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -718px -76px;
  280. }
  281. .weatherProphet_7_weatherDataTable_7_white30_sanDianSanQuan {
  282. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -798px -76px;
  283. }
  284. .weatherProphet_7_weatherDataTable_7_white30_yunYunXueXue {
  285. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -876px -76px;
  286. }
  287. .weatherProphet_7_weatherDataTable_7_white30_sanHengGang {
  288. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px -152px;
  289. }
  290. .weatherProphet_7_weatherDataTable_7_white30_boLang {
  291. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -76px -152px;
  292. }
  293. .weatherProphet_7_weatherDataTable_7_white30_sYouJianTou {
  294. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -152px -152px;
  295. }
  296. .weatherProphet_7_weatherDataTable_7_white30_yunShuiShui {
  297. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -232px -152px;
  298. }
  299. .weatherProphet_7_weatherDataTable_7_white30_yunSanShui {
  300. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -152px;
  301. }
  302. .weatherProphet_7_weatherDataTable_7_white30_yunYunSiShui {
  303. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px -152px;
  304. }
  305. .weatherProphet_7_weatherDataTable_7_white30_yunYunWuShui {
  306. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -476px -152px;
  307. }
  308. .weatherProphet_7_weatherDataTable_7_white30_yunYunLiuShui {
  309. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -556px -152px;
  310. }
  311. .weatherProphet_7_weatherDataTable_7_white30_yunXueXue {
  312. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -638px -152px;
  313. }
  314. .weatherProphet_7_weatherDataTable_7_white30_yunSanXue {
  315. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px -232px;
  316. }
  317. .weatherProphet_7_weatherDataTable_7_white30_yunYunSiXue {
  318. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -76px -232px;
  319. }
  320. .weatherProphet_7_weatherDataTable_7_white30_s {
  321. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -152px -232px;
  322. }
  323. .weatherProphet_7_weatherDataTable_7_white30_sShangJianTou {
  324. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -232px -232px;
  325. }
  326. .weatherProphet_7_weatherDataTable_7_white30_sYouJianTou {
  327. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -232px;
  328. }
  329. .weatherProphet_7_weatherDataTable_7_white30_yunShuiShui {
  330. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px -232px;
  331. }
  332. .weatherProphet_7_weatherDataTable_7_white30_yunXueXue {
  333. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -476px -232px;
  334. }
  335. .weatherProphet_7_weatherDataTable_7_white30_yueLiang {
  336. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px -314px;
  337. }
  338. .weatherProphet_7_weatherDataTable_7_white30_yueLiangYun {
  339. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -76px -314px;
  340. }
  341. .weatherProphet_7_weatherDataTable_7_white30_yunYueLiangYun {
  342. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -152px -314px;
  343. }
  344. .weatherProphet_7_weatherDataTable_7_white30_yueLiangYunShui {
  345. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -232px -314px;
  346. }
  347. .weatherProphet_7_weatherDataTable_7_white30_yunShanDianShui {
  348. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -314px;
  349. }
  350. .weatherProphet_7_weatherDataTable_7_white30_yueShanDianShuiShui {
  351. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px -314px;
  352. }
  353. .weatherProphet_7_weatherDataTable_7_white30_yunShuiXue {
  354. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -481px -318px;
  355. }
  356. .weatherProphet_7_weatherDataTable_7_white30_yunShuiShui {
  357. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -638px -314px;
  358. }
  359. .weatherProphet_7_weatherDataTable_7_white30_yunYunShuiShui {
  360. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -876px -314px;
  361. }
  362. .weatherProphet_7_weatherDataTable_7_white30_yueLiangYunXueXue {
  363. background: url(../../../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -396px;
  364. }
  365. </style>