1、前端工具模块垃圾分类功能实现

pull/254/head
xjs 4 years ago
parent 074ca69f8c
commit 70e51bee88

@ -62,5 +62,33 @@ export function getForecastWeather(city) {
}) })
} }
//获取垃圾分类信息
export function getGarbageSorting(name) {
return request({
url: '/openapi/apitools/garbagesorting/'+name,
method: 'get',
})
}
//获取简繁转换信息
export function getSimpleComplex(content) {
return request({
url: '/openapi/apitools/simplecomplex/'+content,
method: 'get',
})
}
//获取汉语字典信息
export function getChineseDict(content) {
return request({
url: '/openapi/apitools/chinesedict/'+content,
method: 'get',
})
}

@ -15,7 +15,6 @@
<el-form label-width="80px" label-position="right"> <el-form label-width="80px" label-position="right">
<el-form-item label="节假日" label-width="80px"> <el-form-item label="节假日" label-width="80px">
<el-popover <el-popover
v-loading="loading1"
placement="bottom" placement="bottom"
width="400" width="400"
trigger="manual" trigger="manual"
@ -31,6 +30,7 @@
<el-button @click="close" icon="el-icon-close" circle plain size="mini" <el-button @click="close" icon="el-icon-close" circle plain size="mini"
style="float: right"></el-button> style="float: right"></el-button>
<el-button type="primary" <el-button type="primary"
v-loading="loading1"
v-hasPermi="['open:apitools:holiday']" v-hasPermi="['open:apitools:holiday']"
icon="el-icon-search" icon="el-icon-search"
size="mini" size="mini"
@ -48,7 +48,6 @@
<el-form-item label="MM图片" label-width="80px"> <el-form-item label="MM图片" label-width="80px">
<el-popover <el-popover
v-loading="loading2"
placement="bottom" placement="bottom"
width="988" width="988"
trigger="manual" trigger="manual"
@ -60,7 +59,8 @@
</el-image> </el-image>
<el-button @click="close" icon="el-icon-close" circle plain size="mini" <el-button @click="close" icon="el-icon-close" circle plain size="mini"
style="float: right"></el-button> style="float: right"></el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getBeautyPicture()" <el-button v-loading="loading2" type="primary" icon="el-icon-search" size="mini"
@click="getBeautyPicture()"
slot="reference">搜索 slot="reference">搜索
</el-button> </el-button>
</el-popover> </el-popover>
@ -74,7 +74,6 @@
<el-form-item label="历史今天" label-width="80px"> <el-form-item label="历史今天" label-width="80px">
<el-popover <el-popover
v-loading="loading3"
placement="right" placement="right"
width="400" width="400"
trigger="manual" trigger="manual"
@ -92,7 +91,8 @@
</div> </div>
<el-button @click="close" icon="el-icon-close" circle plain size="mini" <el-button @click="close" icon="el-icon-close" circle plain size="mini"
style="float: right"></el-button> style="float: right"></el-button>
<el-button type="primary" icon="el-icon-search" @click="getHistoryToday()" size="mini" <el-button v-loading="loading3" type="primary" icon="el-icon-search" @click="getHistoryToday()"
size="mini"
slot="reference">搜索 slot="reference">搜索
</el-button> </el-button>
@ -132,7 +132,9 @@
</el-card> </el-card>
<el-button @click="close" icon="el-icon-close" circle plain size="mini" <el-button @click="close" icon="el-icon-close" circle plain size="mini"
style="float: right"></el-button> style="float: right"></el-button>
<el-button type="primary" @click="getIdCardQuery('idCardForm')" slot="reference">搜索</el-button> <el-button v-loading="loading4" type="primary" @click="getIdCardQuery('idCardForm')" slot="reference">
搜索
</el-button>
</el-popover> </el-popover>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -200,7 +202,9 @@
</div> </div>
<el-button @click="close" icon="el-icon-close" circle plain size="mini" <el-button @click="close" icon="el-icon-close" circle plain size="mini"
style="float: right"></el-button> style="float: right"></el-button>
<el-button type="primary" slot="reference" @click="getNowWeather('nowWeatherForm')"></el-button> <el-button v-loading="loading6" type="primary" slot="reference"
@click="getNowWeather('nowWeatherForm')">搜索
</el-button>
</el-popover> </el-popover>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -252,7 +256,7 @@
</div> </div>
<el-button @click="close" icon="el-icon-close" circle plain size="mini" <el-button @click="close" icon="el-icon-close" circle plain size="mini"
style="float: right"></el-button> style="float: right"></el-button>
<el-button type="primary" slot="reference" <el-button v-loading="loading7" type="primary" slot="reference"
@click="getForecastWeather('forecastWeatherForm')">搜索 @click="getForecastWeather('forecastWeatherForm')">搜索
</el-button> </el-button>
</el-popover> </el-popover>
@ -261,12 +265,35 @@
</div> </div>
<div class="table2_col_div"> <div class="table2_col_div">
<el-form :inline="true" class=""> <el-form :inline="true" :rules="rules" :model="garbageSortingForm" ref="garbageSortingForm">
<el-form-item label="垃圾分类" label-width="100px"> <el-form-item label="垃圾分类" label-width="100px" prop="name">
<el-input placeholder="请输入垃圾名称"></el-input> <el-input v-model="garbageSortingForm.name" placeholder="请输入垃圾名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary">搜索</el-button> <el-popover
placement="bottom"
width="350"
trigger="manual"
v-model="garbageSortingVisible">
<div v-loading="loading8">
<el-card shadow="hover">
<span>名称{{ aim.goodsName }}</span>
<el-divider direction="vertical"></el-divider>
<span>类型{{ aim.goodsType }}</span>
</el-card>
<el-divider content-position="center">推荐</el-divider>
<el-card shadow="hover" v-for="data in recommendList">
<span>名称{{ data.goodsName }}</span>
<el-divider direction="vertical"></el-divider>
<span>类型{{ data.goodsType }}</span>
</el-card>
</div>
<el-button @click="close" icon="el-icon-close" circle plain size="mini"
style="float: right"></el-button>
<el-button v-loading="loading8" type="primary" slot="reference"
@click="getGarbageSorting('garbageSortingForm')">搜索
</el-button>
</el-popover>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -310,6 +337,9 @@ import {
getMobileBelong, getMobileBelong,
getNowWeather, getNowWeather,
getForecastWeather, getForecastWeather,
getGarbageSorting,
getSimpleComplex,
getChineseDict
} from "@/api/business/openapi/apitools"; } from "@/api/business/openapi/apitools";
import weather from "@/assets/icons/weather/天气.png" import weather from "@/assets/icons/weather/天气.png"
@ -328,6 +358,18 @@ export default {
mobileBelongData: {}, mobileBelongData: {},
nowWeatherData: {}, nowWeatherData: {},
forecastWeatherData: {}, forecastWeatherData: {},
aim: {
goodsName: '-',
goodsType: '-',
},
recommendList: [{
goodsName: '-',
goodsType: '-',
}],
simpleComplexData: {},
chineseDictData: {},
//-------------input------------------- //-------------input-------------------
@ -343,6 +385,15 @@ export default {
forecastWeatherForm: { forecastWeatherForm: {
city: '' city: ''
}, },
garbageSortingForm: {
name: ''
},
simpleComplexForm: {
content: ''
},
chineseDictForm: {
content: ''
},
//----------------------------- //-----------------------------
@ -353,6 +404,9 @@ export default {
mobileBelongVisible: false, mobileBelongVisible: false,
nowWeatherVisible: false, nowWeatherVisible: false,
forecastWeatherVisible: false, forecastWeatherVisible: false,
garbageSortingVisible: false,
simpleComplexVisible: false,
chineseDictVisible: false,
//----------------------------------- //-----------------------------------
@ -380,7 +434,10 @@ export default {
], ],
city: [ city: [
{required: true, message: '请输入地名!!!', trigger: 'blur'}, {required: true, message: '请输入地名!!!', trigger: 'blur'},
] ],
name: [
{required: true, message: '请输入垃圾名称!!!', trigger: 'blur'},
],
}, },
@ -396,6 +453,32 @@ export default {
, ,
methods: { methods: {
//
getGarbageSorting(garbageSortingForm) {
this.$refs[garbageSortingForm].validate((valid) => {
this.aim = {}
this.recommendList = []
if (valid) {
this.loading8 = true
getGarbageSorting(this.garbageSortingForm.name).then(res => {
this.loading8 = false
this.garbageSortingVisible = true
if (res.data.aim !== null) {
this.aim = res.data.aim;
}
if (res.data.recommendList !== null) {
this.recommendList = res.data.recommendList;
}
}).catch(err => {
this.loading8 = false
})
} else {
return false
}
})
},
// //
getForecastWeather(forecastWeatherForm) { getForecastWeather(forecastWeatherForm) {
this.$refs[forecastWeatherForm].validate((valid) => { this.$refs[forecastWeatherForm].validate((valid) => {
@ -413,8 +496,6 @@ export default {
return false return false
} }
}) })
}, },
// //
@ -468,6 +549,9 @@ export default {
this.holidayVisible = false; this.holidayVisible = false;
this.nowWeatherVisible = false; this.nowWeatherVisible = false;
this.forecastWeatherVisible = false; this.forecastWeatherVisible = false;
this.garbageSortingVisible = false;
this.simpleComplexVisible = false;
this.chineseDictVisible = false;
}, },
// //

@ -130,7 +130,7 @@ public class ApiConst {
/** /**
* https://www.mxnzp.com/doc/detail?id=14 * https://www.mxnzp.com/doc/detail?id=14
*/ */
public static final String ROLL_GARBAGE_SORTING_URL = "http://www.mxnzp.com/api/rubbish/type"; public static final String ROLL_GARBAGE_SORTING_URL = "https://www.mxnzp.com/api/rubbish/type";
/** /**
* https://www.mxnzp.com/doc/detail?id=15 * https://www.mxnzp.com/doc/detail?id=15

@ -3,6 +3,7 @@ package com.xjs.apitools.domain;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -25,7 +26,7 @@ public class ApiGarbageSorting implements Serializable {
/** /**
* *
*/ */
private Map<String, String> recommendList; private List<Map<String, String>> recommendList;

@ -15,6 +15,7 @@ import static com.xjs.consts.ApiConst.*;
/** /**
* rollapi * rollapi
*
* @author xiejs * @author xiejs
* @since 2022-01-18 * @since 2022-01-18
*/ */
@ -36,7 +37,7 @@ public class RollForecastWeatherFactory implements ApiToolsFactory<ApiForecastWe
if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) { if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) {
JSONObject jsonData = jsonObject.getJSONObject("data"); JSONObject jsonData = jsonObject.getJSONObject("data");
return jsonData.toJavaObject(ApiForecastWeather.class); return jsonData.toJavaObject(ApiForecastWeather.class);
}else if (jsonObject.getInteger("code") == ROLL_CODE_ERROR.intValue()) { } else if (jsonObject.containsKey("code") && jsonObject.getInteger("code") == ROLL_CODE_ERROR.intValue()) {
throw new ApiException("未找到对应城市,请检查后重试"); throw new ApiException("未找到对应城市,请检查后重试");
} }
return null; return null;

@ -15,6 +15,7 @@ import static com.xjs.consts.ApiConst.*;
/** /**
* rollapi * rollapi
*
* @author xiejs * @author xiejs
* @since 2022-01-19 * @since 2022-01-19
*/ */
@ -36,7 +37,7 @@ public class RollGarbageSortingFactory implements ApiToolsFactory<ApiGarbageSort
if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) { if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) {
JSONObject jsonData = jsonObject.getJSONObject("data"); JSONObject jsonData = jsonObject.getJSONObject("data");
return jsonData.toJavaObject(ApiGarbageSorting.class); return jsonData.toJavaObject(ApiGarbageSorting.class);
} else if (jsonObject.getInteger("code") == ROLL_CODE_ERROR.intValue()) { } else if (jsonObject.containsKey("code") && jsonObject.getInteger("code") == ROLL_CODE_ERROR.intValue()) {
throw new ApiException("未搜索到相关物品垃圾分类信息,该关键词已上报,感谢您的使用"); throw new ApiException("未搜索到相关物品垃圾分类信息,该关键词已上报,感谢您的使用");
} }
return null; return null;

@ -15,6 +15,7 @@ import static com.xjs.consts.ApiConst.*;
/** /**
* rollapi * rollapi
*
* @author xiejs * @author xiejs
* @since 2022-01-18 * @since 2022-01-18
*/ */
@ -36,7 +37,7 @@ public class RollNowWeatherFactory implements ApiToolsFactory<ApiNowWeather, Req
if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) { if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) {
JSONObject jsonData = jsonObject.getJSONObject("data"); JSONObject jsonData = jsonObject.getJSONObject("data");
return jsonData.toJavaObject(ApiNowWeather.class); return jsonData.toJavaObject(ApiNowWeather.class);
}else if (jsonObject.getInteger("code") == ROLL_CODE_ERROR.intValue()) { } else if (jsonObject.containsKey("code") && jsonObject.getInteger("code") == ROLL_CODE_ERROR.intValue()) {
throw new ApiException("未找到对应城市,请检查后重试"); throw new ApiException("未找到对应城市,请检查后重试");
} }
return null; return null;

Loading…
Cancel
Save