1、前端工具模块简繁转换和汉语字典功能实现
This commit is contained in:
parent
70e51bee88
commit
9f208c4df1
|
|
@ -299,23 +299,72 @@
|
|||
</div>
|
||||
|
||||
<div class="table2_col_div">
|
||||
<el-form :inline="true" class="">
|
||||
<el-form-item label="简繁转换" label-width="100px">
|
||||
<el-input placeholder="请输入简体中文"></el-input>
|
||||
<el-form :inline="true" :rules="rules" :model="simpleComplexForm" ref="simpleComplexForm">
|
||||
<el-form-item label="简繁转换" label-width="100px" prop="content">
|
||||
<el-input v-model="simpleComplexForm.content" placeholder="请输入简体中文"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary">搜索</el-button>
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
width="300"
|
||||
trigger="manual"
|
||||
v-model="simpleComplexVisible">
|
||||
<div>
|
||||
<el-card shadow="hover">
|
||||
<span>简体:{{ simpleComplexData.originContent }}</span>
|
||||
</el-card>
|
||||
<el-card shadow="hover">
|
||||
<span>繁体:{{ simpleComplexData.convertContent }}</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="loading9" type="primary" slot="reference"
|
||||
@click="getSimpleComplex('simpleComplexForm')">搜索
|
||||
</el-button>
|
||||
</el-popover>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="table2_col_div">
|
||||
<el-form :inline="true" class="">
|
||||
<el-form-item label="汉语字典" label-width="100px">
|
||||
<el-input placeholder="请输入单个中文"></el-input>
|
||||
<el-form :inline="true" :rules="rules" :model="chineseDictForm" ref="chineseDictForm">
|
||||
<el-form-item label="汉语字典" label-width="100px" prop="dict">
|
||||
<el-input v-model="chineseDictForm.dict" placeholder="请输入单个中文"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary">搜索</el-button>
|
||||
<el-popover
|
||||
placement="left"
|
||||
width="560"
|
||||
trigger="manual"
|
||||
v-model="chineseDictVisible">
|
||||
<div>
|
||||
<el-card shadow="hover">
|
||||
<span>原内容:{{ chineseDictData.word }}</span>
|
||||
</el-card>
|
||||
<el-card shadow="hover">
|
||||
<span>繁体:{{ chineseDictData.traditional }}</span>
|
||||
</el-card>
|
||||
<el-card shadow="hover">
|
||||
<span>拼音:{{ chineseDictData.pinyin }}</span>
|
||||
</el-card>
|
||||
<el-card shadow="hover">
|
||||
<span>笔画数:{{ chineseDictData.strokes }}</span>
|
||||
</el-card>
|
||||
<el-card shadow="hover">
|
||||
<span>偏旁部首:{{ chineseDictData.radicals }}</span>
|
||||
</el-card>
|
||||
<el-card shadow="hover">
|
||||
<span>汉字释义:{{ chineseDictData.explanation }}</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="loading10" type="primary" slot="reference"
|
||||
@click="getChineseDict('chineseDictForm')">搜索
|
||||
</el-button>
|
||||
</el-popover>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
|
@ -371,7 +420,6 @@ export default {
|
|||
simpleComplexData: {},
|
||||
chineseDictData: {},
|
||||
|
||||
|
||||
//-------------input框数据-------------------
|
||||
idCardForm: {
|
||||
idCard: ''
|
||||
|
|
@ -395,7 +443,6 @@ export default {
|
|||
content: ''
|
||||
},
|
||||
|
||||
|
||||
//------------控制弹出显示隐藏-----------------
|
||||
holidayVisible: false,
|
||||
beautyPictureVisible: false,
|
||||
|
|
@ -408,7 +455,6 @@ export default {
|
|||
simpleComplexVisible: false,
|
||||
chineseDictVisible: false,
|
||||
|
||||
|
||||
//----------------遮罩层-------------------
|
||||
loading1: false,
|
||||
loading2: false,
|
||||
|
|
@ -421,7 +467,6 @@ export default {
|
|||
loading9: false,
|
||||
loading10: false,
|
||||
|
||||
|
||||
//---------------校验规则--------------------
|
||||
rules: {
|
||||
idCard: [
|
||||
|
|
@ -438,21 +483,63 @@ export default {
|
|||
name: [
|
||||
{required: true, message: '请输入垃圾名称!!!', trigger: 'blur'},
|
||||
],
|
||||
dict: [
|
||||
{required: true, message: '请输入简体中文!!!', trigger: 'blur'},
|
||||
{min: 1, max: 1, message: '长度在 1 个字符', trigger: 'blur'}
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
|
||||
//----------------其他参数-------------------
|
||||
weather,
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
}
|
||||
,
|
||||
|
||||
methods: {
|
||||
//获取汉语字典信息
|
||||
getChineseDict(chineseDictForm) {
|
||||
this.$refs[chineseDictForm].validate((valid) => {
|
||||
this.chineseDictData = {}
|
||||
if (valid) {
|
||||
this.loading10 = true
|
||||
getChineseDict(this.chineseDictForm.dict).then(res => {
|
||||
this.loading10 = false
|
||||
this.chineseDictVisible = true
|
||||
this.chineseDictData = res.data
|
||||
}).catch(err => {
|
||||
this.loading10 = false
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
//获取简繁转换信息
|
||||
getSimpleComplex(simpleComplexForm) {
|
||||
this.$refs[simpleComplexForm].validate((valid) => {
|
||||
this.simpleComplexData = {}
|
||||
if (valid) {
|
||||
this.loading9 = true
|
||||
getSimpleComplex(this.simpleComplexForm.content).then(res => {
|
||||
this.loading9 = false
|
||||
this.simpleComplexVisible = true
|
||||
this.simpleComplexData = res.data
|
||||
}).catch(err => {
|
||||
this.loading9 = false
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
,
|
||||
|
||||
//获取垃圾分类信息
|
||||
getGarbageSorting(garbageSortingForm) {
|
||||
this.$refs[garbageSortingForm].validate((valid) => {
|
||||
|
|
|
|||
|
|
@ -6,11 +6,16 @@ import com.ruoyi.common.security.annotation.RequiresPermissions;
|
|||
import com.xjs.apitools.domain.*;
|
||||
import com.xjs.apitools.service.ApiToolsService;
|
||||
import com.xjs.utils.ChineseUtils;
|
||||
import com.xjs.weather.domain.IPInfoVo;
|
||||
import com.xjs.weather.service.IPService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -32,6 +37,8 @@ public class ApiToolsController {
|
|||
|
||||
@Autowired
|
||||
private ApiToolsService apiToolsService;
|
||||
@Autowired
|
||||
private IPService ipService;
|
||||
|
||||
|
||||
@GetMapping("holiday")
|
||||
|
|
@ -135,7 +142,14 @@ public class ApiToolsController {
|
|||
return R.ok(apiToolsService.getIdcardQuery(idcard));
|
||||
}
|
||||
return R.fail("请输入正确的身份证号!!!");
|
||||
}
|
||||
|
||||
@GetMapping("ipinfo/{ip}")
|
||||
@ApiOperation("获取IP信息")
|
||||
@Log(title = "获取IP")
|
||||
@RequiresPermissions("open:apitools:ipinfo")
|
||||
public R<IPInfoVo> getIPApiData(@PathVariable("ip")String ip) {
|
||||
return R.ok(ipService.getIPApiData());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ import com.xjs.apitools.domain.RequestBody;
|
|||
import com.xjs.apitools.factory.ApiToolsFactory;
|
||||
import com.xjs.common.client.api.roll.RollChineseDictFeignClient;
|
||||
import com.xjs.config.RollProperties;
|
||||
import com.xjs.exception.ApiException;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
|
||||
import static com.xjs.consts.ApiConst.ROLL_CODE_SUCCESS;
|
||||
import static com.xjs.consts.ApiConst.*;
|
||||
|
||||
/**
|
||||
* roll平台获取汉语字典api工厂实现
|
||||
|
|
@ -39,6 +39,8 @@ public class RollChineseDictFactory implements ApiToolsFactory<ApiChineseDict, R
|
|||
JSONArray jsonArrayData = jsonObject.getJSONArray("data");
|
||||
JSONObject jsonData = jsonArrayData.getJSONObject(0);
|
||||
return jsonData.toJavaObject(ApiChineseDict.class);
|
||||
}else if (jsonObject.containsKey("code") && jsonObject.getInteger("code") == ROLL_CODE_ERROR.intValue()) {
|
||||
throw new ApiException("未查询到相关内容");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
package com.xjs.weather.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.security.annotation.RequiresLogin;
|
||||
import com.xjs.weather.domain.IPInfoVo;
|
||||
import com.xjs.weather.service.IPService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
|
@ -28,12 +22,6 @@ public class IPController {
|
|||
private IPService ipService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("获取IP信息")
|
||||
@Log(title = "获取IP")
|
||||
@RequiresLogin
|
||||
public R<IPInfoVo> getIPApiData() {
|
||||
return R.ok(ipService.getIPApiData());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue