123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view class="zt">
- <div class="container" :style="{'width':width,'height':height}">
- <div class="leftInnerMatrix">
- <div v-for="(item,index) in weatherProphetData_8_15" :key="index">
- <weatherCalendarCard8_15 ref="weatherCalendarCard8_15"></weatherCalendarCard8_15>
- </div>
- </div>
- </div>
- </view>
- </template>
- <script>
- import weatherCalendarCard8_15 from '../../weathercomponents/weatherCalendarCardList8_15/weatherCalendarCard8_15/weatherCalendarCard8_15.vue'
- export default {
- components: {
- "weatherCalendarCard8_15": weatherCalendarCard8_15
- },
- data: function() {
- return {
- width: "",
- height: "",
- weatherProphetData_8_15: [],
- // innerMatrixWidth: "",
- // innerMatrixHeight: "",
- weatherIconsDay: [],
- weatherIconsNight: [],
- classNameDay: "",
- classNameNight: "",
- classNameWeatherIconBackgroundColor: []
- }
- },
- created: function() {
- },
- methods: {
- getWeatherData: function(width, height, weatherProphetData_8_15) {
- this.width = width + "%";
- this.height = height + "px";
- this.weatherProphetData_8_15 = weatherProphetData_8_15;
- this.weatherIconsDay = [];
- this.weatherIconsNight = [];
- for (let i = 0; i < weatherProphetData_8_15.length; i++) {
- this.weatherIconsDay.push(weatherProphetData_8_15[i].weather1);
- this.weatherIconsNight.push(weatherProphetData_8_15[i].weather2);
- }
- this.commitData();
- },
- commitData: async function() {
- let _this = this;
- await uni.request({
- url: "http://49.4.78.143:8081/WeatherfdController/weatherInformationChangePictureName?model=weatherTemperatureWindSpeedCardList_8_15,weatherTemperatureWindSpeedCard_8_15,white30&weatherInformation=" +
- this.weatherIconsDay, //仅为示例,并非真实接口地址。
- data: {
- },
- method: 'GET',
- success: function(res) {
- //_this.classNameDay = "";
- _this.classNameDay = res.data;
- },
- fail: (e) => {
- console.log(e);
- }
- });
- await uni.request({
- url: "http://49.4.78.143:8081/WeatherfdController/weatherInformationChangePictureName?model=weatherTemperatureWindSpeedCardList_8_15,weatherTemperatureWindSpeedCard_8_15,white30&weatherInformation=" +
- this.weatherIconsNight, //仅为示例,并非真实接口地址。
- data: {
- },
- method: 'GET',
- success: function(res) {
- //_this.classNameNight = "";
- _this.classNameNight = res.data;
- _this.setWeatherIcon();
- },
- fail: (e) => {
- console.log(e);
- }
- });
-
- },
- setWeatherIcon: function() {
- this.classNameWeatherIconBackgroundColor = [];
- for (let i = 0; i < this.classNameDay.length; i++) {
- if (this.classNameDay[i].toLowerCase().search("taiyang") != -1) {
- this.classNameWeatherIconBackgroundColor.push("firstGradeBlue");
- } else if (this.classNameDay[i].toLowerCase().search("xue") != -1) {
- this.classNameWeatherIconBackgroundColor.push("fourGradeBlue");
- } else if (this.classNameDay[i].toLowerCase().search("shui") != -1 || this.classNameDay[i].toLowerCase().search(
- "sanhenggang") != -1) {
- this.classNameWeatherIconBackgroundColor.push("threeGradeBlue");
- } else {
- this.classNameWeatherIconBackgroundColor.push("twoGradeBlue");
- }
- }
- this.pushWeatherData();
- },
- pushWeatherData: function() {
-
- for (let i = 0; i < this.weatherProphetData_8_15.length; i++) {
- this.$nextTick(function(){
- this.$refs.weatherCalendarCard8_15[i].getWeatherData(this.width, this.height,
- this.classNameWeatherIconBackgroundColor[i], this.classNameDay[i], this.classNameNight[i], this.weatherProphetData_8_15[
- i]);
- })
-
- }
- }
- }
- }
- </script>
- <style scoped="scoped">
- </style>
|