Compare commits

...

2 Commits

Author SHA1 Message Date
chaiyapeng 205e64892a Merge remote-tracking branch 'origin/master' 2024-09-04 20:15:12 +08:00
chaiyapeng 6cc0130bd7 天气预报 2024-09-04 20:14:59 +08:00
2 changed files with 61 additions and 4 deletions

View File

@ -77,6 +77,13 @@ export function getWeather() {
method: 'GET'
})
}
//天气预报
export function getWeatherForecast(cityName) {
return request({
url: '/port/list/getWeatherForecast?cityName='+cityName,
method: 'GET'
})
}
//购买
export function doBuyInterface(data) {

View File

@ -45,6 +45,7 @@
<el-button type="primary" style="float: right; padding: 10px 10px" @click="testWeather()" v-if="connector.connectorName=='气象预警'">API</el-button>
<el-button type="primary" style="float: right; padding: 10px 10px" @click="testBirthdate()" v-if="connector.connectorName=='生辰助手'">API</el-button>
<el-button type="primary" style="float: right; padding: 10px 10px" @click="testMailbox()" v-if="connector.connectorName=='邮编查询'">API</el-button>
<el-button type="primary" style="float: right; padding: 10px 10px" @click="testWeatherForecast()" v-if="connector.connectorName=='天气预报'">API</el-button>
</el-card>
</el-col>
</el-row>
@ -168,6 +169,26 @@
</el-tree>
</el-aside>
</el-dialog>
<!--天气预报-->
<el-dialog title="天气预报" :visible.sync="dialogFormVisible6">
<el-form :model="formWeatherForecast">
<el-form-item label="城市名" >
<el-input v-model="formWeatherForecast.cityName" autocomplete="off" placeholder="请输入城市名"></el-input>
</el-form-item>
<span style="font-weight: bold;font-size: 20px" v-if="formWeatherForecast.reason==true">
城市{{this.formWeatherForecast.city}}<br>
天气{{this.formWeatherForecast.info}}<br>
温度{{this.formWeatherForecast.temperature}}<br>
湿度{{this.formWeatherForecast.humidity}}<br>
风向{{this.formWeatherForecast.direct}}<br>
风力{{this.formWeatherForecast.power}}<br>
空气质量{{this.formWeatherForecast.aqi}}<br>
</span>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="getWeatherForecast(cityName)"></el-button>
</div>
</el-dialog>
<!-- 购买-->
<el-dialog title="购买API" :visible.sync="dialogFormVisible5">
<el-form :model="buyForm">
@ -236,6 +257,7 @@ import {getWeather} from "@/api/port/port";
import {doBuyInterface} from "@/api/port/port";
import {userBalance} from "@/api/system/user";
import {findConnectSort} from "@/api/port/port";
import {getWeatherForecast} from "@/api/port/port";
export default {
//import使"
components: {},
@ -247,6 +269,17 @@ export default {
userBalanceData: {
userBalance: '加载中...'
},
formWeatherForecast:{
cityName:"",
city:"",
info:"",
temperature:"",
humidity:"",
direct:"",
power:"",
aqi:"",
reason:"",
},
formWeather:{},
data:[],
defaultProps: {
@ -327,6 +360,7 @@ export default {
dialogFormVisible3:false,
dialogFormVisible4:false,
dialogFormVisible5:false,
dialogFormVisible6:false,
dialogTableVisible:false,
};
},
@ -409,6 +443,24 @@ export default {
this.formPostCode.reason=true;
})
},
//
getWeatherForecast(){
getWeatherForecast(this.formWeatherForecast.cityName).then((res)=>{
console.log(res.data);
this.formWeatherForecast.city=res.data.city;
this.formWeatherForecast.info=res.data.info;
this.formWeatherForecast.temperature=res.data.temperature;
this.formWeatherForecast.humidity=res.data.humidity;
this.formWeatherForecast.direct=res.data.direct;
this.formWeatherForecast.power=res.data.power;
this.formWeatherForecast.aqi=res.data.aqi;
this.formWeatherForecast.reason=true;
})
},
//
testWeatherForecast(){
this.dialogFormVisible6=true;
},
testMailbox(){
this.dialogFormVisible3=true;
},
@ -459,12 +511,10 @@ export default {
}
})
},
testIP(ip){
this.formIp.ip=ip;
testIP(){
this.dialogFormVisible1=true;
},
testPhone(tel){
this.formInline.tel=tel;
testPhone(){
this.dialogFormVisible=true;
},
phonePlace(){