diff --git a/ruoyi-ui/src/api/business/openapi/ai.js b/ruoyi-ui/src/api/business/openapi/ai.js new file mode 100644 index 00000000..aafc22ed --- /dev/null +++ b/ruoyi-ui/src/api/business/openapi/ai.js @@ -0,0 +1,10 @@ +import request from '@/utils/request' + +//获取联想词汇 +export function getAssociation(content) { + return request({ + url: '/openapi/association/getAssociation', + method: 'get', + params: content + }) +} diff --git a/ruoyi-ui/src/assets/images/baidu_logo.png b/ruoyi-ui/src/assets/images/baidu_logo.png new file mode 100644 index 00000000..e6640941 Binary files /dev/null and b/ruoyi-ui/src/assets/images/baidu_logo.png differ diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 04f6f759..463be110 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -11,6 +11,29 @@
+ +
+ +
+ + +
+ + +
+
@@ -44,10 +67,23 @@ require('echarts/lib/component/tooltip'); require('echarts/lib/chart/gauge'); require('echarts/lib/component/title'); +import baiduLogo from "@/assets/images/baidu_logo.png" +import {getAssociation} from "@/api/business/openapi/ai"; + + export default { name: "Index", data() { - return {}; + return { + baiduLogo, + + //百度输入框内容 + searchContent: null, + + //联想词汇 + associationList: [], + + }; }, created() { @@ -56,10 +92,11 @@ export default { mounted() { this.initRenderers(); - }, + }, methods: { + //获取echarts图 initRenderers() { var myDate = new Date(); var s = myDate.getSeconds(); @@ -71,12 +108,12 @@ export default { }, title: { text: time, - textStyle:{ + textStyle: { color: '#541264', - fontWeight:'1000', - align:'center', + fontWeight: '1000', + align: 'center', }, - left:"center", + left: "center", }, series: [ { @@ -126,9 +163,56 @@ export default { }, - }, + //获取联想词汇 + getAssociation() { + if (this.searchContent === '' || this.searchContent === null || this.searchContent === undefined) { + return + } + let data = { + content: this.searchContent, + }; + getAssociation(data).then(res => { + this.associationList = res.data + }) + }, + + querySearchAsync(queryString, cb) { + + let list = this.handleAssociationList(this.associationList); + cb(list); + }, + + /** + * 处理返回的list + * @param restaurants + */ + handleAssociationList(restaurants) { + + let list = [] + + restaurants.forEach(s => { + let obj = {}; + let key = "value" + var value = s + obj[key] = value + list.push(obj) + }) + + return list; + }, + + //跳转到外部链接 + toRescue() { + // window.location.href = 'https://www.baidu.com/s?wd=' + this.searchContent + window.open('https://www.baidu.com/s?wd='+ this.searchContent) + }, + + handleSelect(item) { + console.log(item); + }, + }, }; @@ -136,6 +220,7 @@ export default {