2022-01-07 09:21:08 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
2022-01-26 16:44:31 +08:00
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<div>
|
|
|
|
|
<el-card shadow="hover" class="card" ref="renderersChart">
|
2022-01-09 15:46:16 +08:00
|
|
|
|
2022-01-26 16:44:31 +08:00
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<div>
|
|
|
|
|
<el-card shadow="hover" class="card">
|
2022-02-25 11:27:59 +08:00
|
|
|
<!--logo -->
|
|
|
|
|
<div style="width: 500px;margin: 0 auto;margin-top: 20px">
|
|
|
|
|
<el-image
|
|
|
|
|
style="width: 272px; height: 72px;margin-left: 120px"
|
|
|
|
|
:src="baiduLogo"
|
|
|
|
|
></el-image>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!--输入框 -->
|
|
|
|
|
<div style="margin-top: 30px">
|
|
|
|
|
<el-autocomplete
|
|
|
|
|
style="width: 92%"
|
|
|
|
|
v-model="searchContent"
|
|
|
|
|
@input="getAssociation()"
|
2022-02-26 15:35:20 +08:00
|
|
|
@keydown.enter.n.native="toRescue"
|
|
|
|
|
clearable
|
2022-02-25 11:27:59 +08:00
|
|
|
@select="handleSelect"
|
|
|
|
|
:fetch-suggestions="querySearchAsync"
|
|
|
|
|
placeholder="请输入你想要搜索的内容"></el-autocomplete>
|
|
|
|
|
<el-button
|
|
|
|
|
style="width: 8%"
|
|
|
|
|
|
|
|
|
|
type="primary" icon="el-icon-search" @click="toRescue"></el-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
2022-01-09 15:46:16 +08:00
|
|
|
|
2022-01-26 16:44:31 +08:00
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<div>
|
|
|
|
|
<el-card shadow="hover" class="card">
|
|
|
|
|
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<div>
|
|
|
|
|
<el-card shadow="hover" class="card">
|
|
|
|
|
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
2022-01-07 09:21:08 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-01-09 15:46:16 +08:00
|
|
|
|
2022-01-26 16:44:31 +08:00
|
|
|
// 引入echarts
|
|
|
|
|
var echarts = require('echarts/lib/echarts');
|
|
|
|
|
require('echarts/lib/component/tooltip');
|
|
|
|
|
require('echarts/lib/chart/gauge');
|
2022-01-27 13:57:31 +08:00
|
|
|
require('echarts/lib/component/title');
|
2022-01-09 15:46:16 +08:00
|
|
|
|
2022-02-25 11:27:59 +08:00
|
|
|
import baiduLogo from "@/assets/images/baidu_logo.png"
|
|
|
|
|
import {getAssociation} from "@/api/business/openapi/ai";
|
|
|
|
|
|
|
|
|
|
|
2022-01-07 09:21:08 +08:00
|
|
|
export default {
|
|
|
|
|
name: "Index",
|
|
|
|
|
data() {
|
2022-02-25 11:27:59 +08:00
|
|
|
return {
|
|
|
|
|
baiduLogo,
|
|
|
|
|
|
|
|
|
|
//百度输入框内容
|
2022-02-26 15:35:20 +08:00
|
|
|
searchContent: '',
|
2022-02-25 11:27:59 +08:00
|
|
|
|
|
|
|
|
//联想词汇
|
|
|
|
|
associationList: [],
|
|
|
|
|
|
|
|
|
|
};
|
2022-01-07 09:21:08 +08:00
|
|
|
},
|
|
|
|
|
|
2022-01-09 15:46:16 +08:00
|
|
|
created() {
|
2022-01-27 13:57:31 +08:00
|
|
|
|
2022-01-09 15:46:16 +08:00
|
|
|
},
|
|
|
|
|
|
2022-01-26 16:44:31 +08:00
|
|
|
mounted() {
|
|
|
|
|
this.initRenderers();
|
2022-02-25 11:27:59 +08:00
|
|
|
},
|
2022-01-26 16:44:31 +08:00
|
|
|
|
|
|
|
|
|
2022-01-09 15:46:16 +08:00
|
|
|
methods: {
|
2022-02-25 11:27:59 +08:00
|
|
|
//获取echarts图
|
2022-01-26 16:44:31 +08:00
|
|
|
initRenderers() {
|
|
|
|
|
var myDate = new Date();
|
|
|
|
|
var s = myDate.getSeconds();
|
2022-01-27 13:57:31 +08:00
|
|
|
let time = myDate.toLocaleTimeString();
|
2022-01-26 16:44:31 +08:00
|
|
|
let renderersChart = echarts.init(this.$refs.renderersChart.$el)
|
|
|
|
|
renderersChart.setOption({
|
|
|
|
|
tooltip: {
|
|
|
|
|
formatter: '单位:{a} <br/>当前 : {c}s'
|
|
|
|
|
},
|
2022-01-27 13:57:31 +08:00
|
|
|
title: {
|
|
|
|
|
text: time,
|
2022-02-25 11:27:59 +08:00
|
|
|
textStyle: {
|
2022-01-27 13:57:31 +08:00
|
|
|
color: '#541264',
|
2022-02-25 11:27:59 +08:00
|
|
|
fontWeight: '1000',
|
|
|
|
|
align: 'center',
|
2022-01-27 13:57:31 +08:00
|
|
|
},
|
2022-02-25 11:27:59 +08:00
|
|
|
left: "center",
|
2022-01-27 13:57:31 +08:00
|
|
|
},
|
2022-01-26 16:44:31 +08:00
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
name: '秒',
|
|
|
|
|
type: 'gauge',
|
|
|
|
|
progress: {
|
|
|
|
|
show: true
|
|
|
|
|
},
|
|
|
|
|
detail: {
|
|
|
|
|
valueAnimation: true,
|
|
|
|
|
formatter: '{value}'
|
|
|
|
|
},
|
|
|
|
|
data: [
|
|
|
|
|
{
|
|
|
|
|
value: s,
|
|
|
|
|
name: '单位:秒',
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
min: 0,
|
|
|
|
|
max: 60,
|
|
|
|
|
splitNumber: 6,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//定时获取秒数定时执行
|
|
|
|
|
setInterval(function () {
|
2022-01-27 13:57:31 +08:00
|
|
|
let myDate = new Date();
|
|
|
|
|
let s = myDate.getSeconds();
|
|
|
|
|
let time = myDate.toLocaleTimeString();
|
2022-01-26 16:44:31 +08:00
|
|
|
renderersChart.setOption({
|
2022-01-27 13:57:31 +08:00
|
|
|
title: {
|
|
|
|
|
text: time,
|
|
|
|
|
},
|
2022-01-26 16:44:31 +08:00
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
data: [
|
|
|
|
|
{
|
2022-01-27 13:57:31 +08:00
|
|
|
value: s,
|
|
|
|
|
name: '单位:秒',
|
2022-01-26 16:44:31 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
},
|
2022-01-17 16:25:50 +08:00
|
|
|
|
2022-02-25 11:27:59 +08:00
|
|
|
//获取联想词汇
|
|
|
|
|
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);
|
2022-01-09 15:46:16 +08:00
|
|
|
|
2022-02-25 11:27:59 +08:00
|
|
|
cb(list);
|
2022-01-26 16:44:31 +08:00
|
|
|
|
2022-02-25 11:27:59 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 处理返回的list
|
|
|
|
|
* @param restaurants
|
|
|
|
|
*/
|
|
|
|
|
handleAssociationList(restaurants) {
|
|
|
|
|
|
|
|
|
|
let list = []
|
|
|
|
|
|
2022-02-26 15:35:20 +08:00
|
|
|
if (restaurants === null || restaurants === undefined || restaurants === []) {
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-25 11:27:59 +08:00
|
|
|
restaurants.forEach(s => {
|
|
|
|
|
let obj = {};
|
|
|
|
|
let key = "value"
|
|
|
|
|
var value = s
|
|
|
|
|
obj[key] = value
|
|
|
|
|
list.push(obj)
|
2022-02-26 15:35:20 +08:00
|
|
|
});
|
2022-02-25 11:27:59 +08:00
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//跳转到外部链接
|
|
|
|
|
toRescue() {
|
2022-02-25 11:52:32 +08:00
|
|
|
//当前页面跳转
|
2022-02-25 11:27:59 +08:00
|
|
|
// window.location.href = 'https://www.baidu.com/s?wd=' + this.searchContent
|
2022-02-25 11:52:32 +08:00
|
|
|
//打开新标签跳转
|
2022-02-25 11:27:59 +08:00
|
|
|
window.open('https://www.baidu.com/s?wd='+ this.searchContent)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleSelect(item) {
|
|
|
|
|
console.log(item);
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-01-26 16:44:31 +08:00
|
|
|
|
|
|
|
|
|
2022-01-07 09:21:08 +08:00
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2022-01-26 16:44:31 +08:00
|
|
|
.card {
|
2022-02-25 11:27:59 +08:00
|
|
|
width: 100%;
|
2022-01-26 16:44:31 +08:00
|
|
|
height: 410px;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
2022-01-07 09:21:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|