祁阳图书馆智慧大屏
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

893 lines
32 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <div class="map-wrapper">
  3. <div class="map-content">
  4. <div class="lib-info">
  5. <div class="database-title">{{ libCurrent && libCurrent.name }}</div>
  6. <div class="lib-content">
  7. <swiper v-if="swiperOption" :key="swiperKey" ref="mySwiper" class="swiperLib" :options="swiperOption">
  8. <swiper-slide v-for="(item,index) in displayedImages" :key="index">
  9. <div class="book-img" style="width: 100%; height: 3rem;">
  10. <img :src="item.cover" :onerror="defaultImg" style="width: 100%;">
  11. </div>
  12. </swiper-slide>
  13. <!-- 标页码 -->
  14. <div slot="pagination" class="swiper-pagination" />
  15. </swiper>
  16. <ul class="lib-cont-item lib-cont01">
  17. <li>
  18. <img src="@/assets/images/map_18.png" alt="">
  19. <p>
  20. <span>藏书量</span>
  21. <span>4787<i></i></span>
  22. </p>
  23. </li>
  24. <li>
  25. <img src="@/assets/images/map_20.png" alt="">
  26. <p>
  27. <span>办证量</span>
  28. <span>74<i></i></span>
  29. </p>
  30. </li>
  31. </ul>
  32. <ul class="lib-cont-item lib-cont02">
  33. <li>
  34. <img src="@/assets/images/map_28.png" alt="">
  35. <p>
  36. <span>占地面积</span>
  37. <span>45<i>平方米</i></span>
  38. </p>
  39. </li>
  40. </ul>
  41. <div class="scroll-container">
  42. <div ref="marquee" class="lib-text" :style="{ top: position + 'px' }">关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通知关于XXX的通</div>
  43. </div>
  44. </div>
  45. </div>
  46. <div ref="chart" style="flex: 1; margin:0 .125rem; z-index: 9999;" />
  47. <div class="map-hx-bg">
  48. <div class="map-hx-small" />
  49. <div class="map-hx-big" />
  50. </div>
  51. <div class="read-num">
  52. <div class="database-title">读者统计</div>
  53. <div class="online">
  54. <p>累计办证人数</p>
  55. <p class="num"><span>156</span><i></i></p>
  56. </div>
  57. <div class="lending-ranking">
  58. <h5>借阅Top10</h5>
  59. <div class="ranking-cont">
  60. <ul class="ranking-title">
  61. <li style="width: 0.8rem;">排名</li>
  62. <li style="width: 1.5rem; text-align: left; padding-left: 0.25rem;">姓名</li>
  63. <li style="flex:1;" />
  64. <li style="width: 1.75rem; text-align: right; padding-right: .375rem;">借阅次数</li>
  65. </ul>
  66. <ul class="ranking-list">
  67. <li v-for="(item,index) in rankingWithPercentage" :key="index" :class="{ 'hovered': index === currentHover }">
  68. <div style="width: 1rem; color: #79B8FF;" :class="[{'ranking-num1':index===0},{'ranking-num2':index===1},{'ranking-num3':index===2}]">{{ index>=3 ? index+1 : null }}</div>
  69. <div style="width: 1.5rem; text-align: left; padding-left: .25rem;">{{ item.name }}</div>
  70. <div class="ranking-progress" style="flex:1; align-self: center;">
  71. <el-progress :percentage="item.percentage" :stroke-width="8" :show-text="false" color="#009afb" />
  72. </div>
  73. <div style="width: 1.75rem; text-align: right; padding-right: .375rem;">{{ item.num }}<i></i></div>
  74. </li>
  75. </ul>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. import mapJson from '@/assets/json/qy.json'
  84. import libJson from '@/assets/json/lib2.json'
  85. import libJsonData from '@/assets/json/lib.json'
  86. import { debounce } from 'lodash' // js工具类,按需加载
  87. import { swiper, swiperSlide } from 'vue-awesome-swiper'
  88. import 'swiper/dist/css/swiper.css'
  89. export default {
  90. name: 'Map',
  91. components: {
  92. swiper, swiperSlide
  93. },
  94. data() {
  95. return {
  96. currentHover: -1,
  97. timeTicket: null,
  98. defaultImg: 'this.src="' + require('@/assets/images/default-img.png') + '"',
  99. count: 0,
  100. len: 0, // 轮播数组的长度, 通过 count % len 可以得到[0, len-1] 数组下标
  101. headerTitle: '祁阳图书馆',
  102. libInfoData: [],
  103. libImg: [
  104. {
  105. 'id': 1,
  106. 'cover': require('../../assets/images/lib.jpg')
  107. },
  108. {
  109. 'id': 2,
  110. 'cover': require('../../assets/images/lib2.jpg')
  111. },
  112. {
  113. 'id': 3,
  114. 'cover': require('../../assets/images/lib3.jpg')
  115. },
  116. {
  117. 'id': 4,
  118. 'cover': require('../../assets/images/lib4.jpg')
  119. },
  120. {
  121. 'id': 5,
  122. 'cover': require('../../assets/images/lib5.jpg')
  123. }
  124. ],
  125. libIndex: 0,
  126. libCurrent: null,
  127. swiperKey: 1,
  128. currentIndex: 0,
  129. displayedImages: [],
  130. swiperOption: null,
  131. seriesData: [],
  132. mapImg: require('../../assets/images/map-bg2.png'),
  133. rankingData: [
  134. { id: 1, num: 718, name: '胡图图' },
  135. { id: 2, num: 447, name: '张三三' },
  136. { id: 3, num: 261, name: '李晓明' },
  137. { id: 4, num: 242, name: '胡图图' },
  138. { id: 5, num: 165, name: '胡图图' },
  139. { id: 6, num: 140, name: '胡图图' },
  140. { id: 7, num: 120, name: '胡图图' },
  141. { id: 8, num: 100, name: '胡图图' },
  142. { id: 9, num: 70, name: '胡1' },
  143. { id: 10, num: 60, name: '胡图图' }
  144. ],
  145. rankingWithPercentage: [],
  146. timer: null,
  147. position: 0,
  148. speed: 2 // 滚动速度,可根据需要调整
  149. }
  150. },
  151. computed: {
  152. swiper() {
  153. return this.$refs.mySwiper.swiper
  154. }
  155. },
  156. beforeDestroy() {
  157. clearTimeout(this.timeTicket)
  158. window.removeEventListener('resize', this.resize)
  159. this.stopScrolling()
  160. },
  161. created() {
  162. this.libInfoData = libJsonData
  163. },
  164. mounted() {
  165. this.count = 0
  166. this.initChart() // 初始化
  167. setTimeout(() => {
  168. this.updateChart() // 更新数据,散点轮播显示
  169. // this.mouseMove() // 鼠标移入移出效果
  170. window.addEventListener('resize', debounce(this.resize, 2000)) // 使用事件捕获,由外层向内
  171. }, 300)
  172. this.rankingDataComputed()
  173. if (document.getElementsByClassName('scroll-container')[0]) {
  174. this.startScrolling()
  175. }
  176. setInterval(() => {
  177. this.currentHover = (this.currentHover + 1) % this.rankingData.length
  178. }, 1000)
  179. },
  180. methods: {
  181. escapeHtml(str) {
  182. var arrEntities = {
  183. 'lt': '<',
  184. 'gt': '>',
  185. 'nbsp': ' ',
  186. 'amp': '&',
  187. 'quot': '"'
  188. }
  189. return str.replace(/&(lt|gt|nbsp|amp|quot|pre);/ig, function(all, t) {
  190. return arrEntities[t]
  191. })
  192. },
  193. startScrolling() {
  194. this.timer = setInterval(() => {
  195. this.position -= this.speed
  196. // 当文字完全滚出容器时,重置位置
  197. const containerHeight = document.getElementsByClassName('scroll-container')[0].offsetHeight
  198. const contentHeight = this.$refs.marquee.offsetHeight
  199. if (contentHeight <= containerHeight) {
  200. this.position = 20
  201. } else if (Math.abs(this.position) >= contentHeight) {
  202. this.position = containerHeight
  203. }
  204. }, 40)
  205. },
  206. stopScrolling() {
  207. if (this.timer) {
  208. clearInterval(this.timer)
  209. }
  210. },
  211. rankingDataComputed() {
  212. const firstPlaceNum = this.rankingData[0].num
  213. this.rankingWithPercentage = this.rankingData.map(item => {
  214. if (item.name.length === 2) {
  215. // 截取name 字符串截取第一个字符,
  216. item.name = item.name.substring(0, 1) + ' * '
  217. } else if (item.name.length === 3) {
  218. // 截取第一个和第三个字符
  219. item.name = item.name.substring(0, 1) + ' * ' + item.name.substring(2, 3)
  220. } else if (item.name.length > 3) {
  221. // 截取第一个和大于第4个字符
  222. item.name = item.name.substring(0, 1) + ' * ' + ' * ' + item.name.substring(3, item.name.length)
  223. }
  224. const percentage = (item.num / firstPlaceNum) * 100
  225. return { ...item, percentage }
  226. })
  227. },
  228. initChart() {
  229. this.$echarts.registerMap('qiyang', mapJson) // 注册map
  230. this.myChart = this.$echarts.init(this.$refs.chart) // echarts容器实例化
  231. var mapImg = document.createElement('img')
  232. mapImg.style.height = mapImg.height = mapImg.width = mapImg.style.width = '1px'
  233. mapImg.src = require('../../assets/images/map-bg2.png')
  234. var XAData = [
  235. [{ name: '陶铸图书馆' }, { name: '陶铸图书馆', value: '陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸陶铸' }],
  236. [{ name: '陶铸图书馆' }, { name: '龙山街道分馆', value: '龙山街道龙山街道龙山街道龙山街道龙山街道龙山街道' }],
  237. [{ name: '陶铸图书馆' }, { name: '黎家坪分馆', value: '龙山街道龙山街道龙山街道龙山街道龙山街道龙山街道' }],
  238. [{ name: '陶铸图书馆' }, { name: '大村甸分馆', value: '龙山街道龙山街道龙山街道龙山街道龙山街道' }],
  239. [{ name: '陶铸图书馆' }, { name: '邵家岭自助馆', value: '邵家岭' }],
  240. [{ name: '陶铸图书馆' }, { name: '下马渡分馆', value: '下马渡' }],
  241. [{ name: '陶铸图书馆' }, { name: '复兴路自助馆', value: '复兴路' }],
  242. [{ name: '陶铸图书馆' }, { name: '七里桥分馆', value: '七里桥' }],
  243. [{ name: '陶铸图书馆' }, { name: '少儿馆', value: '少儿馆' }],
  244. [{ name: '陶铸图书馆' }, { name: '茅竹镇分馆', value: '祁阳县茅竹镇' }],
  245. [{ name: '陶铸图书馆' }, { name: '观音滩镇分馆', value: '观音滩镇' }],
  246. [{ name: '陶铸图书馆' }, { name: '凯俊盛科城分馆', value: '凯俊盛科城' }],
  247. [{ name: '陶铸图书馆' }, { name: '进宝塘镇分馆', value: '进宝塘镇' }],
  248. [{ name: '陶铸图书馆' }, { name: '三口塘镇分馆', value: '三口塘镇' }],
  249. [{ name: '陶铸图书馆' }, { name: '肖家镇分馆', value: '肖家镇' }],
  250. [{ name: '陶铸图书馆' }, { name: '潘市镇分馆', value: '潘市镇' }],
  251. [{ name: '陶铸图书馆' }, { name: '大忠桥镇分馆', value: '大忠桥镇' }],
  252. [{ name: '陶铸图书馆' }, { name: '浯溪街道分馆', value: '浯溪街道' }],
  253. [{ name: '陶铸图书馆' }, { name: '长虹街道分馆', value: '长虹街道' }],
  254. [{ name: '陶铸图书馆' }, { name: '白水镇分馆', value: '白水镇' }],
  255. [{ name: '陶铸图书馆' }, { name: '白竹湖自助馆', value: '白竹湖' }]
  256. ]
  257. var convertData = function(data) {
  258. var res = []
  259. for (var i = 0; i < data.length; i++) {
  260. var dataItem = data[i]
  261. var fromCoord = libJson[dataItem[0].name]
  262. var toCoord = libJson[dataItem[1].name]
  263. if (fromCoord && toCoord) {
  264. res.push({
  265. fromName: dataItem[0].name,
  266. toName: dataItem[1].name,
  267. coords: [fromCoord, toCoord],
  268. value: dataItem[1].value
  269. })
  270. }
  271. }
  272. return res
  273. }
  274. var series = [];
  275. [
  276. ['陶铸图书馆', XAData]
  277. ].forEach(function(item, i) {
  278. series.push(
  279. {
  280. name: item[0],
  281. type: 'effectScatter',
  282. symbol: 'image://' + require('@/assets/images/map_10.png'),
  283. symbolSize: [26, 20],
  284. coordinateSystem: 'geo',
  285. zlevel: 3,
  286. selectedMode: false,
  287. rippleEffect: {
  288. // brushType: 'stroke',
  289. color: 'transparent'
  290. // scale: 1.5
  291. },
  292. label: {
  293. normal: {
  294. show: true,
  295. position: 'right',
  296. formatter: ''
  297. }
  298. },
  299. itemStyle: {
  300. normal: {
  301. color: 'transparent',
  302. areaColor: 'transparent'
  303. },
  304. emphasis: {
  305. areaColor: '#2B91B7'
  306. }
  307. },
  308. tooltip: {
  309. show: true
  310. },
  311. data: item[1].map(function(dataItem) {
  312. return {
  313. name: dataItem[1].name,
  314. value: libJson[dataItem[1].name].concat([dataItem[1].value]),
  315. place: dataItem[1].value
  316. }
  317. })
  318. },
  319. {
  320. name: item[0],
  321. type: 'lines',
  322. zlevel: 1,
  323. effect: {
  324. show: true,
  325. period: 6,
  326. trailLength: 0.7,
  327. color: 'red', // arrow箭头的颜色
  328. symbolSize: 3
  329. },
  330. lineStyle: {
  331. normal: {
  332. color: '#fff',
  333. width: 0,
  334. curveness: 0.2
  335. }
  336. },
  337. tooltip: {
  338. show: false
  339. },
  340. data: convertData(item[1])
  341. },
  342. {
  343. name: item[0],
  344. type: 'lines',
  345. zlevel: 2,
  346. symbol: ['none', 'arrow'],
  347. symbolSize: 10, // 固定箭头大小
  348. effect: {
  349. show: true,
  350. period: 6,
  351. trailLength: 0,
  352. symbol: 'arrow',
  353. symbolSize: 10 // 动态箭头大小
  354. },
  355. lineStyle: {
  356. normal: {
  357. color: '#fff',
  358. width: 1,
  359. opacity: 0.6,
  360. curveness: 0.2
  361. }
  362. },
  363. tooltip: {
  364. show: false
  365. },
  366. data: convertData(item[1])
  367. }
  368. )
  369. })
  370. this.seriesData = series
  371. const initOption = {
  372. // {a}<br/>
  373. // 提示框
  374. tooltip: {
  375. trigger: 'item',
  376. triggerOn: 'click',
  377. showContent: true, // 是否显示提示框浮层
  378. alwaysShowContent: true, // 是否一直显示提示框内容
  379. // hideDelay: 100, // 浮层隐藏的延迟
  380. enterable: 'mousemove|click',
  381. padding: [0, 0, 0, 0],
  382. backgroundColor: null,
  383. position: function(point, params, dom, rect, size) {
  384. // console.log('point', point)
  385. // console.log('params', params)
  386. // console.log('dom', dom)
  387. // console.log('rect', rect)
  388. // console.log('size', size)
  389. return [point[0] + 14, point[1] - 164]
  390. },
  391. formatter: (params, ticket, callback) => {
  392. if (params.seriesType === 'effectScatter') {
  393. return `<div class='tooltip-main' >
  394. <div class='tooltip-line'></div>
  395. <div class='tooltip-content'>
  396. <div class='title'>${params.data.name}</div>
  397. <div class='place'>地址${params.data.place}</div>
  398. </div>
  399. </div>`
  400. } else if (params.seriesType === 'lines') {
  401. return (
  402. params.data.fromName +
  403. '>' +
  404. params.data.toName +
  405. '<br />' +
  406. params.data.value
  407. )
  408. } else {
  409. return params.name
  410. }
  411. }
  412. // // formatter: '{b}<br/>{c}',
  413. // // position: 'top'
  414. // show: true,
  415. // // 鼠标是否可以进入悬浮框
  416. // enterable: 'mousemove|click',
  417. // // 触发方式 mousemove, click, none, mousemove|click
  418. // triggerOn: 'none',
  419. // // 浮层隐藏的延迟
  420. // hideDelay: 100,
  421. // // 背景色
  422. // backgroundColor: 'rgba(0,0,0,0)',
  423. // // 提示框浮层的边框颜色。
  424. // borderColor: 'rgba(0,0,0,0)',
  425. // // 位置
  426. // // position: 'top',
  427. // position: function(point, params, dom, rect, size) {
  428. // console.log('point', point)
  429. // console.log('params', params)
  430. // console.log('dom', dom)
  431. // console.log('rect', rect)
  432. // console.log('size', size)
  433. // return [point[0] - 100, point[1] - 100]
  434. // },
  435. // formatter: function(params) {
  436. // return `<div style="padding:20px; background:rgba(0,0,0,.2); border-radius:4px;">
  437. // <div class=title>${params.name}</div>
  438. // <div>地址:${params.data.place}</div>
  439. // </div>`
  440. // }
  441. },
  442. // 设置geo坐标系
  443. geo: [
  444. {
  445. map: 'qiyang',
  446. aspectScale: 1,
  447. zoom: 1.1,
  448. top: '6%', // 距离顶部的位置,每层向下一个百分比
  449. left: '11%',
  450. roam: false, // 是否开启平游或缩放
  451. z: 6, // 可以看成是css的z-index,数字越大图层越高,我这里设置了5个,然后页面有点卡,根据实际需要来添加,3个其实就能看出效果了
  452. itemStyle: {
  453. areaColor: {
  454. type: 'linear',
  455. x: 0,
  456. y: 0,
  457. x2: 1,
  458. y2: 1,
  459. colorStops: [{
  460. offset: 0, color: 'rgba(0,0,0,.1)'
  461. }, {
  462. offset: 0.8, color: 'rgba(59,143,248,.6)'
  463. }],
  464. global: false
  465. },
  466. borderColor: '#9ffcff',
  467. borderWidth: 1
  468. },
  469. emphasis: {
  470. itemStyle: {
  471. areaColor: {
  472. type: 'linear',
  473. x: 0,
  474. y: 0,
  475. x2: 1,
  476. y2: 1,
  477. colorStops: [{
  478. offset: 0, color: 'rgba(0,0,0,.1)'
  479. }, {
  480. offset: 0.8, color: 'rgba(59,143,248,.6)'
  481. }],
  482. global: false
  483. } // 鼠标移上去时区域的颜色
  484. }
  485. },
  486. label: {
  487. emphasis: {
  488. show: false,
  489. color: '#fff'
  490. }
  491. },
  492. tooltip: {
  493. show: true
  494. }
  495. },
  496. {
  497. map: 'qiyang',
  498. aspectScale: 1,
  499. zoom: 1.1,
  500. top: '6%', // 距离顶部的位置,每层向下一个百分比
  501. left: '11%',
  502. roam: false, // 是否开启平游或缩放
  503. z: 5, // 可以看成是css的z-index,数字越大图层越高,我这里设置了5个,然后页面有点卡,根据实际需要来添加,3个其实就能看出效果了
  504. itemStyle: {
  505. areaColor: {
  506. type: 'pattern',
  507. image: mapImg,
  508. repeat: 'repeat'
  509. }, // 每个图层的背景色,根据需要来调,由亮变暗,下面的几个颜色也一样
  510. borderColor: '#9ffcff',
  511. borderWidth: 3,
  512. shadowColor: '#4cd4eb',
  513. shadowOffsetX: 0,
  514. shadowOffsetY: 0,
  515. shadowBlur: 0,
  516. emphasis: { // 地图悬停高亮样式
  517. areaColor: {
  518. type: 'pattern',
  519. image: mapImg,
  520. repeat: 'repeat'
  521. }
  522. }
  523. },
  524. emphasis: {
  525. disabled: true,
  526. areaColor: '#01215c'
  527. },
  528. label: {
  529. emphasis: {
  530. show: false,
  531. color: '#fff'
  532. }
  533. },
  534. tooltip: {
  535. show: false
  536. }
  537. },
  538. {
  539. map: 'qiyang',
  540. aspectScale: 1,
  541. zoom: 1.1,
  542. top: '7%', // 根据自己需要来设置
  543. left: '10%',
  544. roam: false, // 是否开启平游或缩放
  545. z: 4, // 变小,也就是被压在下面
  546. itemStyle: {
  547. areaColor: '#05498f', // 记得改颜色
  548. borderColor: '#0296cf',
  549. borderWidth: 2,
  550. shadowColor: '#0296cf',
  551. shadowOffsetX: 0,
  552. shadowOffsetY: 0,
  553. shadowBlur: 0,
  554. emphasis: { // 地图悬停高亮样式
  555. disabled: true,
  556. areaColor: '#05498f'
  557. }
  558. },
  559. tooltip: {
  560. show: false
  561. }
  562. },
  563. {
  564. map: 'qiyang',
  565. aspectScale: 1,
  566. zoom: 1.1,
  567. top: '9%', // 根据自己需要来设置
  568. left: '9%',
  569. roam: false,
  570. z: 3, // 变小,也就是被压在下面
  571. itemStyle: {
  572. areaColor: 'rgba(3,106,183,.5)', // 记得改颜色
  573. borderColor: '#025792',
  574. borderWidth: 2,
  575. shadowColor: '#025792',
  576. shadowOffsetX: 0,
  577. shadowOffsetY: 0,
  578. shadowBlur: 0,
  579. emphasis: { // 地图悬停高亮样式
  580. areaColor: 'rgba(3,106,183,.5)'
  581. }
  582. },
  583. tooltip: {
  584. show: false
  585. }
  586. },
  587. {
  588. map: 'qiyang',
  589. aspectScale: 1,
  590. zoom: 1.1,
  591. top: '11%', // 根据自己需要来设置
  592. left: '8%',
  593. roam: false,
  594. z: 2, // 变小,也就是被压在下面
  595. itemStyle: {
  596. areaColor: 'rgba(3,106,183,.2)', // 记得改颜色
  597. borderColor: '#195175',
  598. borderWidth: 1,
  599. shadowColor: '#0f4c74',
  600. shadowOffsetX: 0,
  601. shadowOffsetY: 4,
  602. shadowBlur: 10,
  603. emphasis: { // 地图悬停高亮样式
  604. areaColor: 'rgba(3,106,183,.2)'
  605. }
  606. },
  607. tooltip: {
  608. show: false
  609. }
  610. },
  611. {
  612. map: 'qiyang',
  613. aspectScale: 1,
  614. zoom: 1.1,
  615. top: '12%', // 根据自己需要来设置
  616. left: '10%',
  617. roam: false,
  618. z: 1, // 变小,也就是被压在下面
  619. itemStyle: {
  620. areaColor: 'rgba(0,0,0,.6)', // 记得改颜色
  621. borderColor: 'rgba(0,0,0,.6)',
  622. borderWidth: 2,
  623. shadowColor: 'rgba(0,0,0,.6)',
  624. shadowOffsetX: 0,
  625. shadowOffsetY: 4,
  626. shadowBlur: 10,
  627. emphasis: { // 地图悬停高亮样式
  628. areaColor: 'rgba(0,0,0,.6)'
  629. }
  630. },
  631. tooltip: {
  632. show: false
  633. }
  634. }
  635. ],
  636. series: series
  637. }
  638. setTimeout(() => {
  639. this.myChart.setOption(initOption)
  640. }, 200)
  641. },
  642. updateChart() {
  643. // 地图数据
  644. // const mapData = mapJson.features.map((item) => {
  645. // return {
  646. // name: item.properties.name,
  647. // value: Math.round(Math.random() * 100),
  648. // centroid: item.properties.centroid,
  649. // adcode: item.properties.adcode
  650. // }
  651. // })
  652. // 散点数据
  653. // const scatterData = libJsonData
  654. // const scatterData = mapData.map((item) => {
  655. // return {
  656. // name: item.name,
  657. // value: item.centroid
  658. // ? item.centroid.concat(item.value)
  659. // : item.centroid, // [经, 纬度, 值]
  660. // itemStyle: {
  661. // color: 'red'
  662. // }
  663. // // adcode: item.adcode,
  664. // }
  665. // })
  666. // const updateOption = {
  667. // series: [
  668. // {
  669. // data: mapData // type: 'map'
  670. // },
  671. // {
  672. // data: mapData // type: 'map'
  673. // },
  674. // {
  675. // data: scatterData // type: 'effectScatter'
  676. // }
  677. // ]
  678. // }
  679. this.len = this.seriesData[0].data.length // 此处设置的是需要轮播的次数
  680. console.log('this.len', this.seriesData[0].data)
  681. // this.myChart.setOption(updateOption)
  682. this.libIndex = this.count % this.len
  683. this.libCurrent = this.libInfoData[this.libIndex]
  684. console.log('this.libIndex', this.libIndex)
  685. console.log('this.libCurrent', this.libCurrent)
  686. this.initSwiper()
  687. this.updatePageWithData()
  688. this.autohover()
  689. },
  690. mouseMove() {
  691. // 当鼠标移入,终止轮播,高亮显示当前区域
  692. this.myChart.on('mouseover', (params) => {
  693. clearInterval(this.timeTicket)
  694. this.myChart.dispatchAction({
  695. type: 'downplay'
  696. // seriesIndex: 0
  697. })
  698. this.myChart.dispatchAction({
  699. type: 'highlight',
  700. seriesIndex: 0,
  701. dataIndex: params.dataIndex
  702. })
  703. this.myChart.dispatchAction({
  704. type: 'showTip',
  705. seriesIndex: 0,
  706. dataIndex: params.dataIndex
  707. })
  708. })
  709. // 当鼠标移出,轮播继续开始
  710. this.myChart.on('mouseout', this.autohover)
  711. },
  712. autohover() {
  713. // clearInterval(this.timeTicket)
  714. // this.timeTicket = setInterval(() => {
  715. // 1. 取消上次的高亮
  716. this.myChart.dispatchAction({
  717. type: 'downplay',
  718. seriesIndex: 0
  719. })
  720. // 2. 显示当前高亮
  721. this.myChart.dispatchAction({
  722. type: 'highlight',
  723. seriesIndex: 0,
  724. dataIndex: this.count % this.len
  725. })
  726. // 3. 显示提示框中的信息
  727. this.myChart.dispatchAction({
  728. type: 'showTip',
  729. seriesIndex: 0,
  730. dataIndex: this.count % this.len
  731. })
  732. // }, 2000)
  733. },
  734. resize() {
  735. this.myChart.resize()
  736. },
  737. updatePageWithData() {
  738. // 生成一个随机数来确定要显示的图片数量
  739. const displayCountOptions = [1, 2, 3, 5]
  740. const displayCount = displayCountOptions[Math.floor(Math.random() * displayCountOptions.length)]
  741. // 从 libImg 中随机选择要显示的图片对象
  742. const shuffledLibImg = this.libImg.slice().sort(() => Math.random() - 0.5) // 随机打乱数组顺序
  743. this.displayedImages = shuffledLibImg.slice(0, displayCount)
  744. this.currentIndex = 20
  745. this.swiperKey += 1
  746. if (this.displayedImages.length === 1) {
  747. setTimeout(() => {
  748. this.count++
  749. this.libIndex = this.count % this.len
  750. this.libCurrent = this.libInfoData[this.libIndex]
  751. console.log('updatePageWithData-libIndex', this.libIndex)
  752. console.log('updatePageWithData-libCurrent', this.libCurrent)
  753. this.updatePageWithData()
  754. this.autohover()
  755. }, 5000)
  756. }
  757. },
  758. initSwiper() {
  759. const _self = this
  760. this.swiperOption = {
  761. // loop: true,
  762. // initialSlide: 0,
  763. notNextTick: false, // notNextTick是一个组件自有属性,如果notNextTick设置为true,组件则不会通过NextTick来实例化swiper,也就意味着你可以在第一时间获取到swiper对象,假如你需要刚加载遍使用获取swiper对象来做什么事,那么这个属性一定要是true
  764. // slidesPerView: 3, // 数量
  765. // spaceBetween: 30, // 间距
  766. // slidesPerGroup: 1, // 分几组
  767. // 禁止滑动
  768. noSwiping: true,
  769. observer: true, // 开启动态检查器
  770. direction: 'horizontal', // 设置水平还是垂直vertical
  771. // grabCursor: true, //光标样式
  772. // setWrapperSize: true,
  773. // autoHeight: true,
  774. // centeredSlides: true,
  775. // paginationClickable: true,
  776. // keyboard: true, //键盘控制
  777. // mousewheelControl: true, //鼠标轮控制
  778. autoplay: {
  779. delay: 3000, // 自动切换的时间间隔,单位ms
  780. stopOnLastSlide: false, // 当切换到最后一个slide时停止自动切换
  781. disableOnInteraction: false // 用户操作swiper之后,是否禁止autoplay
  782. // reverseDirection: false, //开启反向自动轮播
  783. // waitForTransition: true, //等待过渡完毕。自动切换会在slide过渡完毕后才开始计时
  784. },
  785. // 显示分页
  786. pagination: {
  787. el: '.swiper-pagination',
  788. type: 'progressbar'
  789. // progressbarOpposite: true,
  790. // clickable: true // 允许分页点击跳转
  791. },
  792. on: {
  793. slideChangeTransitionEnd() {
  794. _self.currentIndex = this.activeIndex
  795. if (_self.currentIndex === _self.displayedImages.length - 1) {
  796. setTimeout(() => {
  797. if (_self.count === _self.libInfoData.length - 1) {
  798. _self.count = 0
  799. // _self.$parent.autoPagination(3)
  800. } else {
  801. _self.count++
  802. }
  803. _self.libIndex = _self.count % _self.len
  804. _self.libCurrent = _self.libInfoData[_self.libIndex]
  805. console.log('_self.count', _self.count)
  806. console.log('_self.libIndex', _self.libIndex)
  807. console.log('_self.libCurrent', _self.libCurrent)
  808. _self.updatePageWithData()
  809. _self.autohover()
  810. _self.currentIndex = 0
  811. }, 3000)
  812. }
  813. }
  814. }
  815. }
  816. }
  817. }
  818. }
  819. </script>
  820. <style lang="scss">
  821. @import "~@/assets/styles/index.scss";
  822. </style>
  823. <!--
  824. {
  825. type: 'map',
  826. map: 'qiyang',
  827. roam: false,
  828. silent: true,
  829. // geoIndex: 0, geoIndex 指定一个 geo 组件。这样的话,map 和 其他 series(例如散点图)就可以共享一个 geo 组件了。
  830. data: null,
  831. label: {
  832. show: false,
  833. fontSize: 0
  834. }
  835. },
  836. {
  837. name: item[0] + ' Top3',
  838. type: 'lines',
  839. zlevel: 1,
  840. effect: {
  841. show: true,
  842. period: 6,
  843. trailLength: 0.7,
  844. color: 'red', // arrow箭头的颜色
  845. symbolSize: 3
  846. },
  847. lineStyle: {
  848. normal: {
  849. color: color[i],
  850. width: 0,
  851. curveness: 0.2
  852. }
  853. },
  854. data: convertData(item[1])
  855. },
  856. {
  857. type: 'effectScatter',
  858. coordinateSystem: 'geo', // 注意坐标系的设置
  859. // symbol: 'image://' + require('../../assets/images/default-img.png'),
  860. data: null,
  861. symbolSize: [8, 4],
  862. showEffectOn: 'render',
  863. rippleEffect: {
  864. brushType: 'stroke',
  865. color: '#9ffcff',
  866. period: 9,
  867. scale: 5
  868. },
  869. label: {
  870. show: true,
  871. color: '#FFF',
  872. formatter: '',
  873. offset: [0, -12]
  874. },
  875. emphasis: {
  876. // 设置高亮显示的状态
  877. scale: 8,
  878. itemStyle: {
  879. color: 'pink'
  880. }
  881. }
  882. } -->