WeatherTemperatureWindSpeedCard_7.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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: 102px;
  126. border: 0px;
  127. font-size: 16px;
  128. color: #FFF;
  129. text-decoration: none;
  130. font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
  131. text-align: center;
  132. margin-top: 30px;
  133. }
  134. .assembly_2 {
  135. height: 31px;
  136. width: 31px;
  137. border: 0px;
  138. margin-top: 30px;
  139. margin-left: 36px;
  140. /* background-image: url(../week/white30.png);*/
  141. background-position: 0px 0px;
  142. }
  143. .assembly_1 {
  144. height: 31px;
  145. width: 31px;
  146. border: 0px;
  147. margin-top: 30px;
  148. margin-left: 36px;
  149. /*background-image: url(../week/white30.png);*/
  150. background-position: 0px 80px;
  151. }
  152. .assembly_weather {
  153. height: 23px;
  154. width: 102px;
  155. border: 0px;
  156. font-size: 16px;
  157. color: #FFF;
  158. text-decoration: none;
  159. font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
  160. text-align: center;
  161. margin-top: 30px;
  162. font-weight: bold;
  163. }
  164. .assembly_temperature {
  165. height: 23px;
  166. width: 102px;
  167. border: 0px;
  168. font-size: 16px;
  169. color: #FFF;
  170. text-decoration: none;
  171. font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
  172. text-align: center;
  173. margin-top: 40px;
  174. font-weight: bold;
  175. }
  176. .assembly_wind {
  177. height: 23px;
  178. width: 102px;
  179. border: 0px;
  180. font-size: 16px;
  181. color: #FFF;
  182. text-decoration: none;
  183. font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
  184. text-align: center;
  185. margin-top: 40px;
  186. font-weight: normal;
  187. }
  188. .weatherParentComponent {
  189. border-right: 1rpx solid white;
  190. border-left: 1rpx solid white;
  191. /* border:1px solid white; */
  192. }
  193. .weatherDay7 {
  194. width: 90%;
  195. height: 380px;
  196. background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#024F93), color-stop(1.5, #cccccc), to(#437193));
  197. background: rgba(0, 0, 0, 0.1);
  198. float: left;
  199. /* margin: 0px auto; */
  200. /* border-radius: 20px; */
  201. margin-top: 5px;
  202. margin-left: 20px;
  203. margin-bottom: 20px;
  204. margin-right: 20px;
  205. display: -webkit-box;
  206. overflow-x: auto;
  207. /* position:fixed; */
  208. /*适应苹果*/
  209. -webkit-overflow-scrolling: touch;
  210. }
  211. .weatherProphet_7_weatherDataTable_7_white30_taiYang {
  212. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px 0px;
  213. }
  214. .weatherProphet_7_weatherDataTable_7_white30_yunShui {
  215. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -560px 0px;
  216. }
  217. .weatherProphet_7_weatherDataTable_7_white30_yunYun {
  218. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -160px 0px;
  219. }
  220. .weatherProphet_7_weatherDataTable_7_white30_taiYang {
  221. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px 0px;
  222. }
  223. .weatherProphet_7_weatherDataTable_7_white30_taiYangYun {
  224. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px 0px;
  225. }
  226. .weatherProphet_7_weatherDataTable_7_white30_yunYun {
  227. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -160px 0px;
  228. }
  229. .weatherProphet_7_weatherDataTable_7_white30_taiYangYunShui {
  230. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -238px 0px;
  231. }
  232. .weatherProphet_7_weatherDataTable_7_white30_taiYangShanDianShui {
  233. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px 0px;
  234. }
  235. .weatherProphet_7_weatherDataTable_7_white30_taiYangShanDianShuiShui {
  236. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px 0px;
  237. }
  238. .weatherProphet_7_weatherDataTable_7_white30_yunShuiXue {
  239. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -480px 0px;
  240. }
  241. .weatherProphet_7_weatherDataTable_7_white30_yunLiangShui {
  242. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -638px 0px;
  243. }
  244. .weatherProphet_7_weatherDataTable_7_white30_sanHengGang {
  245. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -718px 0px;
  246. }
  247. .weatherProphet_7_weatherDataTable_7_white30_liangDianLiangQuan {
  248. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -798px 0px;
  249. }
  250. .weatherProphet_7_weatherDataTable_7_white30_yunYunShuiShui {
  251. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -880px 0px;
  252. }
  253. .weatherProphet_7_weatherDataTable_7_white30_yunSanShui {
  254. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px -76px;
  255. }
  256. .weatherProphet_7_weatherDataTable_7_white30_yunYunSiShui {
  257. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -76px -76px;
  258. }
  259. .weatherProphet_7_weatherDataTable_7_white30_yunYunWuShui {
  260. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -152px -76px;
  261. }
  262. .weatherProphet_7_weatherDataTable_7_white30_yunYunLiuShui {
  263. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -232px -76px;
  264. }
  265. .weatherProphet_7_weatherDataTable_7_white30_taiYangYunXueXue {
  266. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -76px;
  267. }
  268. .weatherProphet_7_weatherDataTable_7_white30_yunXue {
  269. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px -76px;
  270. }
  271. .weatherProphet_7_weatherDataTable_7_white30__yunXueXue {
  272. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -476px -76px;
  273. }
  274. .weatherProphet_7_weatherDataTable_7_white30_yunSanXue {
  275. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -556px -76px;
  276. }
  277. .weatherProphet_7_weatherDataTable_7_white30_yunYunSiXue {
  278. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -638px -76px;
  279. }
  280. .weatherProphet_7_weatherDataTable_7_white30_sanHengGang {
  281. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -718px -76px;
  282. }
  283. .weatherProphet_7_weatherDataTable_7_white30_sanDianSanQuan {
  284. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -798px -76px;
  285. }
  286. .weatherProphet_7_weatherDataTable_7_white30_yunYunXueXue {
  287. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -876px -76px;
  288. }
  289. .weatherProphet_7_weatherDataTable_7_white30_sanHengGang {
  290. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px -152px;
  291. }
  292. .weatherProphet_7_weatherDataTable_7_white30_boLang {
  293. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -76px -152px;
  294. }
  295. .weatherProphet_7_weatherDataTable_7_white30_sYouJianTou {
  296. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -152px -152px;
  297. }
  298. .weatherProphet_7_weatherDataTable_7_white30_yunShuiShui {
  299. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -232px -152px;
  300. }
  301. .weatherProphet_7_weatherDataTable_7_white30_yunSanShui {
  302. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -152px;
  303. }
  304. .weatherProphet_7_weatherDataTable_7_white30_yunYunSiShui {
  305. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px -152px;
  306. }
  307. .weatherProphet_7_weatherDataTable_7_white30_yunYunWuShui {
  308. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -476px -152px;
  309. }
  310. .weatherProphet_7_weatherDataTable_7_white30_yunYunLiuShui {
  311. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -556px -152px;
  312. }
  313. .weatherProphet_7_weatherDataTable_7_white30_yunXueXue {
  314. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -638px -152px;
  315. }
  316. .weatherProphet_7_weatherDataTable_7_white30_yunSanXue {
  317. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px -232px;
  318. }
  319. .weatherProphet_7_weatherDataTable_7_white30_yunYunSiXue {
  320. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -76px -232px;
  321. }
  322. .weatherProphet_7_weatherDataTable_7_white30_s {
  323. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -152px -232px;
  324. }
  325. .weatherProphet_7_weatherDataTable_7_white30_sShangJianTou {
  326. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -232px -232px;
  327. }
  328. .weatherProphet_7_weatherDataTable_7_white30_sYouJianTou {
  329. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -232px;
  330. }
  331. .weatherProphet_7_weatherDataTable_7_white30_yunShuiShui {
  332. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px -232px;
  333. }
  334. .weatherProphet_7_weatherDataTable_7_white30_yunXueXue {
  335. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -476px -232px;
  336. }
  337. .weatherProphet_7_weatherDataTable_7_white30_yueLiang {
  338. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat 0px -314px;
  339. }
  340. .weatherProphet_7_weatherDataTable_7_white30_yueLiangYun {
  341. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -76px -314px;
  342. }
  343. .weatherProphet_7_weatherDataTable_7_white30_yunYueLiangYun {
  344. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -152px -314px;
  345. }
  346. .weatherProphet_7_weatherDataTable_7_white30_yueLiangYunShui {
  347. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -232px -314px;
  348. }
  349. .weatherProphet_7_weatherDataTable_7_white30_yunShanDianShui {
  350. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -314px;
  351. }
  352. .weatherProphet_7_weatherDataTable_7_white30_yueShanDianShuiShui {
  353. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -396px -314px;
  354. }
  355. .weatherProphet_7_weatherDataTable_7_white30_yunShuiXue {
  356. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -481px -318px;
  357. }
  358. .weatherProphet_7_weatherDataTable_7_white30_yunShuiShui {
  359. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -638px -314px;
  360. }
  361. .weatherProphet_7_weatherDataTable_7_white30_yunYunShuiShui {
  362. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -876px -314px;
  363. }
  364. .weatherProphet_7_weatherDataTable_7_white30_yueLiangYunXueXue {
  365. background: url(../../static/picture/weatherTemperatureWindSpeedCard_7/white30.png) no-repeat -314px -396px;
  366. }
  367. </style>