提交 0d13cde2 编写于 作者: yma16's avatar yma16

perf:no cdn

上级 b8a42265
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<!-- >&nbsp;&nbsp;在线聊天室</i--> <!-- >&nbsp;&nbsp;在线聊天室</i-->
<!-- >--> <!-- >-->
<div style="float: right; overflow: hidden;display: flex;justify-items: center;align-items:center;word-spacing: 16px;"> <div style="float: right; overflow: hidden;display: flex;justify-items: center;align-items:center;word-spacing: 16px;">
<span style="cursor: pointer; width: 80px" v-if="currentUserName"> <span style="cursor: pointer;padding-right: 50px" v-if="currentUserName">
<el-popover <el-popover
trigger="click"> trigger="click">
<span @click="loginOut" style="cursor: pointer; height: 16px">注销</span> <span @click="loginOut" style="cursor: pointer; height: 16px">注销</span>
......
...@@ -98,169 +98,162 @@ export default { ...@@ -98,169 +98,162 @@ export default {
this.initOptionData() this.initOptionData()
}, },
initOptionData: function () { initOptionData: function () {
const echarts = this.$echarts // const echarts = this.$echarts
if (!echarts) return // if (!echarts) return
let that = this const that = this
// 置空 // 置空
that.linesCoord = [] that.linesCoord = []
function task1 () { async function task1 () {
let that = this
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(() => { that.$axios
console.log('第1个任务geojson获取') .get('https://yongma16.xyz/static/json/map/guizhou.json')
this.$axios .then(function (response) {
.get('https://yongma16.xyz/static/json/map/guizhou.json') let res = response.data
.then(function (response) { that.gisData = res
let res = response.data console.log('贵州数据', res)
that.gisData = res let itemData = res.features
console.log('贵州数据', res) let length = itemData.length
let itemData = res.features that.aimPointData = []
let length = itemData.length for (let loc = 0; loc < length; ++loc) {
that.aimPointData = [] let name = itemData[loc].properties.name
for (let loc = 0; loc < length; ++loc) { that.aimPointData.push({
let name = itemData[loc].properties.name value: name
that.aimPointData.push({ })
value: name let center = itemData[loc].properties.center
}) // 中心位置
let center = itemData[loc].properties.center if (name === that.focusCity) {
// 中心位置 that.centerLoction = center
if (name === that.focusCity) {
that.centerLoction = center
}
} }
for (let loc = 0; loc < length; ++loc) { }
let name = itemData[loc].properties.name for (let loc = 0; loc < length; ++loc) {
let number = (Math.random() * 100).toFixed(2) let name = itemData[loc].properties.name
let center = itemData[loc].properties.center let number = (Math.random() * 100).toFixed(2)
that.locationGis.push({ let center = itemData[loc].properties.center
value: center that.locationGis.push({
}) value: center
// eslint-disable-next-line eqeqeq })
if (name !== that.focusCity) { // eslint-disable-next-line eqeqeq
that.linesCoord.push([center, that.centerLoction]) if (name !== that.focusCity) {
} that.linesCoord.push([center, that.centerLoction])
// eslint-disable-next-line eqeqeq }
if (name && name !== '') { // eslint-disable-next-line eqeqeq
let temp = { if (name && name !== '') {
name: `${name}`, let temp = {
value: Number(number) name: `${name}`,
} value: Number(number)
that.airData.push(temp)
} }
continue that.airData.push(temp)
} }
console.log('测试热力处理', that.airData) continue
echarts.registerMap('geoJson', res) }
}) console.log('测试热力处理', that.airData)
resolve('第一个任务') echarts.registerMap('geoJson', res)
}, 1000) resolve('第一个任务')
}).catch((error) => { }).catch(r => {
throw Error(error) resolve(r)
})
}) })
} }
function task2 () { async function task2 () {
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(() => { that.option = {
console.log('第2个任务option配置') title: {
that.option = { text: '贵州省地图',
title: { subtext: 'geoJson'
text: '贵州省地图', },
subtext: 'geoJson' geo: {
}, // 经纬度中心
geo: { center: that.centerLoction,
// 经纬度中心 type: 'map',
center: that.centerLoction, map: 'geoJson', // 这里的值要和上面registerMap的第一个参数一致
roam: true, // 拖拽
nameProperty: 'name',
// 悬浮标签
label: {
type: 'map', type: 'map',
map: 'geoJson', // 这里的值要和上面registerMap的第一个参数一致 map: 'geoJson', // 这里的值要和上面registerMap的第一个参数一致
roam: true, // 拖拽 // roam: false, // 拖拽
nameProperty: 'name', nameProperty: 'name',
// 悬浮标签 show: true,
label: { color: '#fff',
type: 'map', backgroundColor: '#546de5',
map: 'geoJson', // 这里的值要和上面registerMap的第一个参数一致 align: 'center',
// roam: false, // 拖拽 fontSize: 10,
nameProperty: 'name', width: (function () {
show: true, // let n = parseInt(Math.random() * 10)
color: '#fff', return 110
backgroundColor: '#546de5', })(),
align: 'center', height: 50,
fontSize: 10, shadowColor: 'rgba(0,0,0,.7)',
width: (function () { borderRadius: 10
// let n = parseInt(Math.random() * 10) },
return 110 zoom: 1.2
})(), },
height: 50, series: [
shadowColor: 'rgba(0,0,0,.7)', // 坐标点的热力数据
borderRadius: 10 {
data: that.airData,
geoIndex: 0, // 将热力的数据和第0个geo配置关联在一起
type: 'map'
},
{
type: 'effectScatter',
// 渲染显示
zlevel: 2,
showEffectOn: 'render',
data: that.locationGis, // 配置散点的坐标数据
coordinateSystem: 'geo', // 指明散点使用的坐标系统
rippleEffect: {
// 缩放
scale: 4,
// 涟漪的颜色
color: '#cf6a87',
// 波纹数量
number: 2,
// 扩散方式 stroke(线条) fill(区域覆盖)
brushType: 'fill'
}, },
zoom: 1.2 // 形状
symbol: 'circle'
}, },
series: [ // 飞线层
// 坐标点的热力数据 {
{ // name: '贵阳市飞线',
data: that.airData, type: 'lines',
geoIndex: 0, // 将热力的数据和第0个geo配置关联在一起 coordinateSystem: 'geo',
type: 'map' polyline: true,
zlevel: 3,
effect: {
show: true,
period: 5,
trailLength: 0, // 拖尾
symbol: 'arrow', // 箭头
color: 'red', // 样式颜色
symbolSize: 5
}, },
{ lineStyle: {
type: 'effectScatter', color: '#000',
// 渲染显示 width: 2,
zlevel: 2, type: 'solid',
showEffectOn: 'render', dashOffset: 0
data: that.locationGis, // 配置散点的坐标数据 // cap: butt,
coordinateSystem: 'geo', // 指明散点使用的坐标系统 // join: bevel
rippleEffect: {
// 缩放
scale: 4,
// 涟漪的颜色
color: '#cf6a87',
// 波纹数量
number: 2,
// 扩散方式 stroke(线条) fill(区域覆盖)
brushType: 'fill'
},
// 形状
symbol: 'circle'
}, },
// 飞线层 // 飞线层数据
{ data: that.linesCoord
// name: '贵阳市飞线',
type: 'lines',
coordinateSystem: 'geo',
polyline: true,
zlevel: 3,
effect: {
show: true,
period: 5,
trailLength: 0, // 拖尾
symbol: 'arrow', // 箭头
color: 'red', // 样式颜色
symbolSize: 5
},
lineStyle: {
color: '#000',
width: 2,
type: 'solid',
dashOffset: 0
// cap: butt,
// join: bevel
},
// 飞线层数据
data: that.linesCoord
}
],
visualMap: {
min: 0,
max: 100,
inRange: {
color: ['white', '#0984e3'] // 控制颜色渐变的范围
},
calculable: false // 出现滑块
} }
],
visualMap: {
min: 0,
max: 100,
inRange: {
color: ['white', '#0984e3'] // 控制颜色渐变的范围
},
calculable: false // 出现滑块
} }
resolve('2') }
}, 1000) resolve('echarts options')
}) })
} }
async function allTasks () { async function allTasks () {
...@@ -274,7 +267,7 @@ export default { ...@@ -274,7 +267,7 @@ export default {
}) })
}, },
initMapGis: function (optionParams) { initMapGis: function (optionParams) {
let that = this const that = this
try { try {
// 基于准备好的dom,初始化echarts实例 // 基于准备好的dom,初始化echarts实例
console.log('echarts_map渲染') console.log('echarts_map渲染')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册