123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573 |
- <template>
- <view>
- <!-- @tap="common.navTo('/components/addressSelect/AddressSelect?option='+address)" -->
- <view @tap="common.navTo('/components/addressSelect/AddressSelect?option='+address)">
- <cu-custom bgColor="bg-gradual-earkblue" :isBack="false">
- <block slot="backText">
- <view style="height: 80rpx;line-height: 80rpx;">返回</view>
- </block>
- <block slot="content">
- <text :class="'cuIcon-locationfill'"></text>
- </block>
- <block slot="content">{{address}}</block>
- <block slot="content">
- <image style="width: 15px;height: 15px;margin-left: 4px;" src="../../static/picture/SanJiao.png">
- </block>
- </cu-custom>
- </view>
- <div>
- <WeatherTemperatureWindSpeedCard_7 ref='WeatherTemperatureWindSpeedCard_7' @listenEven="changeTap"></WeatherTemperatureWindSpeedCard_7>
- </div>
- <div class="weatherDayAndNightButton">
- <div :class="[weatherSwitch==true?'dayButtonWhite':'dayButtonBlack']" @click="weatherDaySwitch()">白天</div>
- <div :class="[weatherSwitch==false?'nightButtonWhite':'nightButtonBlack']" :style="{'margin-left':nightmarginleft}" @click="weatherNightSwitch()">夜间</div>
- </div>
- ㅤㅤ
- <!-- ㅤ</br></br> -->
- <div v-if="weatherSwitch">
- <scroll-view scroll-y scroll-with-animation class="scrollList" :style="{'height':height}">
- <view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']" style="background-color: rgba(0, 0, 0, 0);">
- <view class="cu-item">
- <div class="cu-listAll" :style="{'width':width}">
- <div class="cuIcon" :style="{'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[6].cuIcon,'text-'+ cuIconList[0].color]"></view><a class="wenZhi"
- :style="{'font-size':fontSize}">白气象</br>{{weatherInformation.weather1}}</a>
- </div>
-
- <div class="cuIcon" :style="{'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[7].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">白气温</br>{{weatherInformation.temperature1}}℃</a>
- </div>
- <div class="cuIcon" :style="{'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[8].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">白体感</br>{{weatherInformation.realfeel1}}℃</a>
- </div>
- <div class="cuIcon4">
- <view class="icon iconfont" :class="['icon-' + cuIconList[9].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">白降水</br>{{weatherInformation.precipitation1}}m/s</a>
- </div>
- </div>
-
- <div class="cu-listAllTwo" :style="{'width':width,'margin-top':margintop}">
- <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[10].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">白风向</br>{{weatherInformation.winddirection1}}</a>
- </div>
-
- <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[11].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">白风速</br>{{weatherInformation.speed1}}km/h</a>
- </div>
- <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[12].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">白阵风速</br>{{weatherInformation.gust1}}km/h</a>
- </div>
- <div class="cuIcon4" :style="{'margin-top':margintop}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[0].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">天气</br>{{weatherInformation.weather}}</a>
- </div>
-
- </div>
- <div class="cu-listAllTThree" :style="{'width':width,'margin-top':margintopThree}">
- <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[1].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">最高温度</br>{{weatherInformation.maximumtem}}℃</a>
- </div>
-
- <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[2].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">最低温度</br>{{weatherInformation.minimumtem}}℃</a>
- </div>
- <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[3].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">日出</br>{{weatherInformation.sunrise}}</a>
- </div>
- <div class="cuIcon4" :style="{'margin-top':margintopThree}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[4].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">日落</br>{{weatherInformation.sunset}}</a>
- </div>
- </div>
- <div class="cu-listAllTFour" :style="{'width':width,'margin-top':margintopThree}">
- <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[5].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">持续时间</br>{{weatherInformation.sunduration}}</a>
- </div>
- <div class="cuIcon2">
- </div>
- <div class="cuIcon2">
- </div>
- <div class="cuIcon2">
- </div>
-
- </div>
- </view>
- </view>
- </scroll-view>
- </div>
- <view v-if=!weatherSwitch>
- <scroll-view scroll-y scroll-with-animation class="scrollList" :style="{'height':height}">
- <view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']" style="background-color: rgba(0, 0, 0, 0);">
- <view class="cu-item">
- <div class="cu-listAll" :style="{'width':width}">
- <div class="cuIcon" :style="{'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[6].cuIcon,'text-'+ cuIconList[0].color]"></view><a class="wenZhi"
- :style="{'font-size':fontSize}">夜气象</br>{{weatherInformation.weather2}}</a>
- </div>
-
- <div class="cuIcon" :style="{'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[7].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">夜气温</br>{{weatherInformation.temperature2}}℃</a>
- </div>
- <div class="cuIcon" :style="{'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[8].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">夜体感</br>{{weatherInformation.realfeel2}}℃</a>
- </div>
- <div class="cuIcon4">
- <view class="icon iconfont" :class="['icon-' + cuIconList[9].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">夜降水</br>{{weatherInformation.precipitation2}}m/s</a>
- </div>
- </div>
-
- <div class="cu-listAllTwo" :style="{'width':width,'margin-top':margintop}">
- <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[10].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">夜风向</br>{{weatherInformation.winddirection2}}</a>
- </div>
-
- <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[11].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">夜风速</br>{{weatherInformation.speed2}}km/h</a>
- </div>
- <div class="cuIcon" :style="{'margin-top':margintop,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[12].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">夜阵风速</br>{{weatherInformation.gust2}}km/h</a>
- </div>
- <div class="cuIcon4" :style="{'margin-top':margintop}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[0].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">天气</br>{{weatherInformation.weather}}</a>
- </div>
-
- </div>
- <div class="cu-listAllTThree" :style="{'width':width,'margin-top':margintopThree}">
- <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[1].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">最高温度</br>{{weatherInformation.maximumtem}}℃</a>
- </div>
-
- <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[2].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">最低温度</br>{{weatherInformation.minimumtem}}℃</a>
- </div>
- <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[3].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">日出</br>{{weatherInformation.sunrise}}</a>
- </div>
- <div class="cuIcon4" :style="{'margin-top':margintopThree}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[4].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">日落</br>{{weatherInformation.sunset}}</a>
- </div>
- </div>
- <div class="cu-listAllTFour" :style="{'width':width,'margin-top':margintopThree}">
- <div class="cuIcon" :style="{'margin-top':margintopThree,'height':xianHeight}">
- <view class="icon iconfont" :class="['icon-' + cuIconList[5].cuIcon,'text-'+ cuIconList[0].color]"></view><a
- class="wenZhi" :style="{'font-size':fontSize}">持续时间</br>{{weatherInformation.sunduration}}</a>
- </div>
- <div class="cuIcon2">
- </div>
- <div class="cuIcon2">
- </div>
- <div class="cuIcon2">
- </div>
-
- </div>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import WeatherTemperatureWindSpeedCard_7 from '../../components/weatherTemperatureWindSpeedCard_7/WeatherTemperatureWindSpeedCard_7.vue'
- export default {
- components: {
- "WeatherTemperatureWindSpeedCard_7": WeatherTemperatureWindSpeedCard_7
- },
- data() {
- return {
- weatherInformation: {},
- cuIconList: [{
- cuIcon: 'weather',
- color: 'white',
- name: '天气',
- }, {
- cuIcon: 'maxTemperature',
- color: 'white',
- name: '最高温度',
- }, {
- cuIcon: 'minTemperature',
- color: 'white',
- name: '最低温度',
- }, {
- cuIcon: 'sunRise',
- color: 'white',
- name: '日出',
- }, {
- cuIcon: 'sunSet',
- color: 'white',
- name: '日落',
- }, {
- cuIcon: 'sunDuration',
- color: 'white',
- name: '持续时间',
- }, {
- cuIcon: 'dayWeather',
- color: 'white',
- name: '白气象',
- }, {
- cuIcon: 'dayTemperature',
- color: 'white',
- name: '白气温',
- }, {
- cuIcon: 'dayRealFeel',
- color: 'white',
- name: '白体感',
- }, {
- cuIcon: 'dayPrecipitation',
- color: 'white',
- name: '白降水',
- }, {
- cuIcon: 'dayWindDirection',
- color: 'white',
- name: '白风向',
- }, {
- cuIcon: 'dayWindSpeed',
- color: 'white',
- name: '白风速',
- }, {
- cuIcon: 'dayGust',
- color: 'white',
- name: '白阵风速',
- }, {
- cuIcon: 'nightWeather',
- color: 'white',
- name: '夜气象',
- }, {
- cuIcon: 'nightTemperature',
- color: 'white',
- name: '夜温度',
- }, {
- cuIcon: 'nightRealFeel',
- color: 'white',
- name: '夜体感',
- }, {
- cuIcon: 'nightPrecipitation',
- color: 'white',
- name: '夜降水',
- }, {
- cuIcon: 'nightWindDirection',
- color: 'white',
- name: '夜风向',
- }, {
- cuIcon: 'nightWindSpeed',
- color: 'white',
- name: '夜风速',
- }, {
- cuIcon: 'nightGust',
- color: 'white',
- name: '夜阵风速',
- }],
- assemblyWidth: '',
- assemblyHeight: '',
- address: "",
- modalName: null,
- gridCol: 4,
- gridBorder: false,
- weatherSwitch: true,
- windPowerStationId: "SBQ_FDC",
- weatherProphetDataAll_7: [],
- weatherProphetData_7: [],
- weatherIconsDay: [],
- weatherIconsNight: [],
- classNameDay: [],
- classNameNight: [],
- height: "",
- width:"",
- windowWidth:"",
- windowHeight:"",
- ziHeight:'',
- fontSize:'',
- xianHeight:'',
- nightmarginleft:'',
- };
- },
- created: function() {
- // this.pushWindPowerStationNameToSessionStorage("麻黄山");
- this.address = this.getWindPowerStationNameToSessionStorage();
- this.windPowerStationId=uni.getStorageSync('windPowerStationId');
- this.getWeatherData();
- this.windowWidth=uni.getSystemInfoSync().windowWidth;
- this.windowHeight=uni.getSystemInfoSync().windowHeight;
- this.height = parseInt(uni.getSystemInfoSync().windowHeight - 550) + "px"
- this.width = parseInt(uni.getSystemInfoSync().windowWidth) + "px"
- if(this.windowWidth>=768){
- this.margintop="60px";
- this.margintopThree="80px";
- this.messageTop="10px";
- this.fontSize="18px";
- this.xianHeight="168px";
- this.nightmarginleft="20px";
- }else{
- this.margintop="10px";
- this.margintopThree="10px";
- this.fontSize="14px";
- this.xianHeight="92px";
- this.nightmarginleft="20px";
- }
- },
- onShow() {
- this.address = this.getWindPowerStationNameToSessionStorage();
- this.windPowerStationId=uni.getStorageSync('windPowerStationId');
- this.getWeatherData();
- },
- methods: {
- pushWindPowerStationNameToSessionStorage(windpowerstationName) {
- uni.setStorageSync('windpowerstationName', windpowerstationName);
- //sessionStorage.setItem('windpowerstationName', windpowerstationName);
- //alert("v"+ sessionStorage.getItem("windpowerstationName"));
- //this.common.goback('/pages/index/Index');
- },
- getWindPowerStationNameToSessionStorage() {
- uni.getStorageSync('windpowerstationName');
- return uni.getStorageSync('windpowerstationName');
- },
- getWeatherData: function() {
- let _this = this;
- // 创建一个this.socketTask对象【发送、接收、关闭socket都由这个对象操作】
- this.socketTask = uni.connectSocket({
- // 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
- url: "ws://49.4.78.143:8081/websocket/pageNumber_3/functionNumber_1",
- success(data) {
- console.log("websocket连接成功");
- },
- });
- // 消息的发送和接收必须在正常连接打开中,才能发送或接收【否则会失败】
- this.socketTask.onOpen((res) => {
- console.log("WebSocket连接正常打开中...!");
- this.is_open_socket = true;
- // 注:只有连接正常打开中 ,才能正常收到消息
- this.socketTask.onMessage((res) => {
- //console.log("收到服务器内容:" + res.data);
- _this.weatherProphetDataAll_7 = res.data;
- _this.weatherProphetDataAll_7 = JSON.parse(res.data);
- _this.weatherProphetData_7 = [];
- //判断风场id 40天
- for (let i = 0; i < _this.weatherProphetDataAll_7.length; i++) {
- if (_this.weatherProphetDataAll_7[i].windpowerstationid == _this.windPowerStationId) {
- _this.weatherProphetData_7.push(_this.weatherProphetDataAll_7[i]);
- }
- }
- // console.log(_this.weatherProphetData_7);
- _this.$refs.WeatherTemperatureWindSpeedCard_7.weatherInformationCard('100', '100', _this.classNameDay, _this
- .classNameNight,
- _this.weatherProphetData_7);
- });
- })
- // 这里仅是事件监听【如果socket关闭了会执行】
- this.socketTask.onClose(() => {
- console.log("已经被关闭了")
- })
- },
- changeTap: function(item) {
- this.weatherInformation = JSON.parse(item); //vue json转object
- },
- weatherDaySwitch: function() {
- this.weatherSwitch = true;
- },
- weatherNightSwitch: function() {
- this.weatherSwitch = false;
- },
- closeSocket: function() {
- this.socket.onclose;
- },
- openSocket: function() {
- this.socket.onOpen;
- }
- }
- }
- </script>
- <style lang="less">
- page {
- height: 100%;
- background: -webkit-gradient(linear, 0% 100%, 0% 0%, from(#2F698E), color-stop(0.15, #5C757C), to(#004C90));
- overflow-x: hidden;
- }
- .weatherDayAndNightButton {
- margin-left: 20px;
- width: 120px;
- height: 20px;
- // border-bottom: 1px solid white;
- margin-top: 400px;
- // position: absolute;
- }
- .border-left {
- border-style: solid;
- border-top-width: 0px;
- border-right-width: 1px;
- border-bottom-width: 0px;
- border-left-width: 0px;
- border-right-color: white;
- }
- .border-right {
- border-style: solid;
- border-top-width: 0px;
- border-right-width: 0px;
- border-bottom-width: 0px;
- border-left-width: 0px;
- border-right-color: #19B5BC;
- }
- .scrollList {
- // height:20%;
- height: 130px;
- width: 95%;
- margin: 0px auto;
- // margin-top: 500px;
- }
- .dayButtonWhite {
- height: 25px;
- margin-top: -4px;
- margin-left: 20px;
- color: white;
- font-size: 18px;
- border-style: solid;
- border-top-width: 0px;
- border-right-width: 0px;
- border-bottom-width: 3px;
- border-bottom-color: #FFEE35;
- border-left-width: 0px;
- font-family: "microsoft yahei";
- float: left;
- }
- .dayButtonBlack {
- height: 25px;
- margin-top: -4px;
- margin-left: 20px;
- color: #DEDEDE;
- font-size: 18px;
- font-family: "microsoft yahei";
- float: left;
- }
- .nightButtonWhite {
- height: 25px;
- margin-top: -4px;
- border-style: solid;
- border-top-width: 0px;
- border-right-width: 0px;
- border-bottom-width: 3px;
- border-left-width: 0px;
- border-bottom-color: #FFEE35;
- color: white;
- margin-left: 50rpx;
- font-size: 18px;
- font-family: "microsoft yahei";
- float: left;
- }
- .nightButtonBlack {
- height: 25px;
- margin-top: -4px;
- color: #DEDEDE;
- margin-left: 50rpx;
- font-size: 18px;
- font-family: "microsoft yahei";
- float: left;
- }
- .cuIcon {
- border-right: 1px solid white;
- height: 92px;
- // float: left;
- // width:100%;
- // height:100px;
- // margin-top:-20px;
- // padding-right: -20px;
- // box-sizing: border-box;
- // padding-left:20px;
- }
- .icon {
- font-size: 50upx;
- }
- .cu-listAll {
- // width: 100%;
- height: 100px;
- display: -webkit-flex;
- display: flex;
- justify-content: space-around;
- margin-top: -20px;
- float: left;
- // margin-left: -5px;
- }
- .cu-listAllTwo {
- // width: 100%;
- height: 100px;
- display: -webkit-flex;
- display: flex;
- justify-content: space-around;
- margin-top: 10px;
- }
- .cu-listAllTThree {
- // width: 100%;
- height: 100px;
- display: -webkit-flex;
- display: flex;
- justify-content: space-around;
- margin-top: 10px;
- }
- .cu-listAllTFour {
- // width: 100%;
- height: 100px;
- display: -webkit-flex;
- display: flex;
- justify-content: space-around;
- margin-top: 10px;
- // justify-content: space-around;
- }
- .wenZhi{
- color: white;
- }
- .cuIcon1 {
- margin-top: 20px;
- }
- .cu-item{
- width: 100%;
- margin-left: -15px;
- }
- </style>
|