diff --git a/.env.development b/.env.development
index 0818f48..30c4513 100644
--- a/.env.development
+++ b/.env.development
@@ -3,8 +3,8 @@ ENV = 'development'
# 接口地址
# 许镇-本地服地址
-VUE_APP_BASE_API = 'http://192.168.99.67:8080/'
-VUE_APP_WS_API = 'ws://192.168.99.67:8081/'
+VUE_APP_BASE_API = 'http://192.168.99.67:8080'
+VUE_APP_LIB_API = 'http://118.253.150.248:8099'
# 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true
diff --git a/package.json b/package.json
index 8a5d944..00aba97 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
"element-ui": "^2.15.10",
"jquery": "^3.7.1",
"svg-sprite-loader": "^6.0.11",
+ "TagCloud": "^2.5.0",
"vue": "^2.6.11",
"vue-awesome": "^4.0.2",
"vue-count-to": "^1.0.13",
diff --git a/src/api/library.js b/src/api/library.js
index 106adad..8781791 100644
--- a/src/api/library.js
+++ b/src/api/library.js
@@ -1,19 +1,30 @@
import request from '@/utils/request'
import qs from 'qs'
-// 获取初始化数据
-export function FetchInitSetting(params) {
+// 获取token
+export function FetchInitToken(params) {
return request({
- url: '/qyzt/initSetting' + '?' + qs.stringify(params, { indices: false }),
- method: 'get'
+ url: '/openlib/service/barcode/token' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'interlib'
})
}
-// page1 云标签
-export function FetchHotSearch(params) {
+// 馆藏量
+export function FetchLibBookTotal(params) {
return request({
- url: '/qyzt/getHotSearch' + '?' + qs.stringify(params, { indices: false }),
- method: 'get'
+ url: '/qyzt/sync35' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'local'
+ })
+}
+
+// 办证量统计
+export function FetchUsertotal(params) {
+ return request({
+ url: '/qyzt/usertotal' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'local'
})
}
@@ -21,94 +32,74 @@ export function FetchHotSearch(params) {
export function FetchFansCount(params) {
return request({
url: '/qyzt/getfansCount' + '?' + qs.stringify(params, { indices: false }),
- method: 'get'
+ method: 'get',
+ urlType: 'local'
})
}
-// page1 新书推荐
-export function FetchNewBook(params) {
+// page1 累计借出
+export function FetchLendingTotal(params) {
return request({
- url: '/qyzt/getNewBook' + '?' + qs.stringify(params, { indices: false }),
- method: 'get'
+ url: '/qyzt/sync82' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'local'
})
}
-// // 借阅排行榜
-// export function FetchBorrowRank(params) {
-// return request({
-// url: '/dxhtsg/borrowRank',
-// method: 'get',
-// params: params
-// })
-// }
-
-// // 阅读之星
-// export function FetchBorrowStar(params) {
-// return request({
-// url: '/dxhtsg/borrowStar',
-// method: 'get',
-// params: params
-// })
-// }
-
-// // 新书推荐
-// export function FetchNewBookRecommend(params) {
-// return request({
-// url: '/dxhtsg/newBookRecommend',
-// method: 'get',
-// params: params
-// })
-// }
-
-// // 通知公告
-// export function FetchInitNotice(params) {
-// return request({
-// url: '/dxhtsg/initNotice',
-// method: 'get',
-// params: params
-// })
-// }
+// 获取初始化数据
+export function FetchInitSetting(params) {
+ return request({
+ url: '/qyzt/initSetting' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'local'
+ })
+}
-// // 进馆人数
-// export function FetchInitIntoNum(params) {
-// return request({
-// url: '/dxhtsg/initIntoNum',
-// method: 'get',
-// params: params
-// })
-// }
+// page1 云标签
+export function FetchHotSearch(params) {
+ return request({
+ url: '/qyzt/getHotSearch' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'local'
+ })
+}
-// // 24小时借还量
-// export function FetchHalfYearBRNum(params) {
-// return request({
-// url: '/dxhtsg/getHalfYearBRNum',
-// method: 'get',
-// params: params
-// })
-// }
+// page1 新书推荐
+export function FetchNewBook(params) {
+ return request({
+ url: '/qyzt/getNewBook' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'local'
+ })
+}
-// // 大屏幕播放文件
-// export function FetchShowFileList(params) {
-// return request({
-// url: '/dxhtsg/showFileList',
-// method: 'get',
-// params: params
-// })
-// }
+// page2 获取分馆显示内容
+export function FetchLibcodeDetails(params) {
+ return request({
+ url: '/qyzt/getLibcodeDetails' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'local'
+ })
+}
-// // 通过isbn获取图书封面
-// export function FetchCoverByISBN(params) {
-// return request({
-// url: '/dxhtsg/getCoverByISBN',
-// method: 'get',
-// params: params
-// // responseType: 'blob'
-// })
-// }
+// page2 读者借阅排行榜
+export function FetchReadRanking(params) {
+ return request({
+ url: '/qyzt/sync37' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ urlType: 'local'
+ })
+}
export default {
+ FetchInitToken,
+ FetchLibBookTotal,
+ FetchUsertotal,
+ FetchFansCount,
+ FetchLendingTotal,
FetchInitSetting,
FetchHotSearch,
- FetchFansCount,
- FetchNewBook
+ FetchNewBook,
+ FetchReadRanking,
+ FetchLibcodeDetails
}
diff --git a/src/assets/js/tagcloud-2.2.js b/src/assets/js/tagcloud-2.2.js
deleted file mode 100644
index 1cb1112..0000000
--- a/src/assets/js/tagcloud-2.2.js
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
-* 3d标签云
-* 功能:鼠标移入标签,当前标签静止放大
-* 说明:radius 控制滚动区域(横椭圆、纵椭圆、正圆)
-* 版本:2.2
-* */
-
-window.tagCloud = (function(win, doc) {
- // 判断对象
- function isObject(obj) {
- return Object.prototype.toString.call(obj) === '[object Object]'
- }
-
- // 构造函数
- function TagCloud(options) {
- var self = this
- self.config = TagCloud._getConfig(options)
- self.box = self.config.element // 组件元素
- self.fontsize = self.config.fontsize // 平均字体大小
-
- if (Number.isInteger(self.config.radius)) {
- self._radiusX = self._radiusY = self.config.radius
- } else if (self.config.radius instanceof Array) {
- if (self.config.radius.length === 1) {
- self._radiusX = self._radiusY = self.config.radius[0]
- } else {
- self._radiusX = self.config.radius[0]
- self._radiusY = self.config.radius[1]
- }
- }
-
- self.radius = self._radiusX // 滚动半径
-
- _ratio = Math.round(self._radiusX * 10 / self._radiusY) / 10 // 滚动区域比例,保留一位小数
- if (_ratio < 1) { // 焦点在Y轴的椭圆
- self.ratioX = _ratio
- self.ratioY = 1
- self.radius = self._radiusY // 滚动半径,选择长半径
- } else if (_ratio > 1) { // 焦点在X轴的椭圆
- self.ratioX = 1
- self.ratioY = _ratio
- } else {
- self.ratioX = self.ratioY = 1 // 正圆
- }
-
- self.depth = 2 * self.radius // 滚动深度
- self.size = 2 * self.radius // 随鼠标滚动变速作用区域
- self.mspeed = TagCloud._getMsSpeed(self.config.mspeed)
- self.ispeed = TagCloud._getIsSpeed(self.config.ispeed)
- self.items = self._getItems()
-
- self.direction = self.config.direction // 初始滚动方向
- self.keep = self.config.keep // 鼠标移出后是否保持之前滚动
-
- // 初始化
- self.active = false // 是否为激活状态
- self.lasta = 1
- self.lastb = 1
- self.mouseX0 = self.ispeed * Math.sin(self.direction * Math.PI / 180) // 鼠标与滚动圆心x轴初始距离
- self.mouseY0 = -self.ispeed * Math.cos(self.direction * Math.PI / 180) // 鼠标与滚动圆心y轴初始距离
- self.mouseX = self.mouseX0 // 鼠标与滚动圆心x轴距离
- self.mouseY = self.mouseY0 // 鼠标与滚动圆心y轴距离
- self.index = -1
-
- // 鼠标移入
- TagCloud._on(self.box, 'mouseover', function() {
- self.active = true
- })
- // 鼠标移出
- TagCloud._on(self.box, 'mouseout', function() {
- self.active = false
- })
-
- // 鼠标在内移动
- TagCloud._on(self.keep ? win : self.box, 'mousemove', function(ev) {
- var oEvent = win.event || ev
- var boxPosition = self.box.getBoundingClientRect()
- self.mouseX = (oEvent.clientX - (boxPosition.left + self.box.offsetWidth / 2)) / 5
- self.mouseY = (oEvent.clientY - (boxPosition.top + self.box.offsetHeight / 2)) / 5
- })
-
- for (var j = 0, len = self.items.length; j < len; j++) {
- self.items[j].element.index = j
- // 鼠标移出子元素,当前元素静止放大
- self.items[j].element.onmouseover = function() {
- self.index = this.index
- }
- // 鼠标移出子元素,当前元素继续滚动
- self.items[j].element.onmouseout = function() {
- self.index = -1
- }
- }
-
- // 定时更新
- TagCloud.boxs.push(self.box)
- self.update(self) // 初始更新
- self.box.style.visibility = 'visible'
- self.box.style.position = 'relative'
- for (var j = 0, len = self.items.length; j < len; j++) {
- self.items[j].element.style.position = 'absolute'
- self.items[j].element.style.zIndex = j + 1
- }
- self.up = setInterval(function() {
- self.update(self)
- }, 30)
- }
-
- // 实例
- TagCloud.boxs = [] // 实例元素数组
- // 静态方法们
- TagCloud._set = function(element) {
- if (TagCloud.boxs.indexOf(element) === -1) { // ie8不支持数组的indexOf方法,所以自定义indexOf
- return true
- }
- }
-
- // 添加数组IndexOf方法
- if (!Array.prototype.indexOf) {
- // Array.prototype.indexOf = function (elt /*, from*/) {
- Array.prototype.indexOf = function(elt) {
- var len = this.length >>> 0
- var from = Number(arguments[1]) || 0
- from = (from < 0)
- ? Math.ceil(from)
- : Math.floor(from)
- if (from < 0) { from += len }
-
- for (; from < len; from++) {
- if (from in this && this[from] === elt) { return from }
- }
- return -1
- }
- }
-
- TagCloud._getConfig = function(config) {
- var defaultConfig = { // 默认值
- fontsize: 16, // 基本字体大小, 单位px
- radius: 60, // 滚动纵轴半径, 默认60, 单位px,取值60,[60],[60, 60]
- mspeed: 'normal', // 滚动最大速度, 取值: slow, normal(默认), fast
- ispeed: 'normal', // 滚动初速度, 取值: slow, normal(默认), fast
- direction: 135, // 初始滚动方向, 取值角度(顺时针360): 0对应top, 90对应left, 135对应right-bottom(默认)...
- keep: true, // 鼠标移出组件后是否继续随鼠标滚动, 取值: false, true(默认) 对应 减速至初速度滚动, 随鼠标滚动
- multicolour: true // 是否为彩色字体,颜色随机,取值:true(默认),false
- }
-
- if (isObject(config)) {
- for (var i in config) {
- if (config.hasOwnProperty(i)) { // hasOwnProperty()用来判断一个属性是定义在对象本身而不是继承自原型链
- defaultConfig[i] = config[i] // 用户配置
- }
- }
- }
-
- return defaultConfig// 配置 Merge
- }
-
- TagCloud._getMsSpeed = function(mspeed) { // 滚动最大速度
- var speedMap = {
- slow: 1.5,
- normal: 3,
- fast: 5
- }
- return speedMap[mspeed] || 3
- }
- TagCloud._getIsSpeed = function(ispeed) { // 滚动初速度
- var speedMap = {
- slow: 10,
- normal: 25,
- fast: 50
- }
- return speedMap[ispeed] || 25
- }
- TagCloud._getSc = function(a, b) {
- var l = Math.PI / 180
- // 数组顺序0,1,2,3表示asin,acos,bsin,bcos
- return [
- Math.sin(a * l),
- Math.cos(a * l),
- Math.sin(b * l),
- Math.cos(b * l)
- ]
- }
-
- TagCloud._on = function(ele, eve, handler, cap) {
- if (ele.addEventListener) {
- ele.addEventListener(eve, handler, cap)
- } else if (ele.attachEvent) {
- ele.attachEvent('on' + eve, handler)
- } else {
- ele['on' + eve] = handler
- }
- }
-
- // 原型方法
- TagCloud.prototype = {
- constructor: TagCloud, // 反向引用构造器
-
- update: function() {
- var self = this; var a; var b
-
- if (!self.active && !self.keep) {
- self.mouseX = Math.abs(self.mouseX - self.mouseX0) < 1 ? self.mouseX0 : (self.mouseX + self.mouseX0) / 2 // 重置鼠标与滚动圆心x轴距离
- self.mouseY = Math.abs(self.mouseY - self.mouseY0) < 1 ? self.mouseY0 : (self.mouseY + self.mouseY0) / 2 // 重置鼠标与滚动圆心y轴距离
- }
-
- a = -(Math.min(Math.max(-self.mouseY, -self.size), self.size) * 2 / self.radius) * self.mspeed
- b = (Math.min(Math.max(-self.mouseX, -self.size), self.size) * 2 / self.radius) * self.mspeed
-
- if (Math.abs(a) <= 0.01 && Math.abs(b) <= 0.01) { return }
-
- self.lasta = a
- self.lastb = b
-
- var sc = TagCloud._getSc(a, b)
-
- for (var j = 0, len = self.items.length; j < len; j++) {
- var rx1 = self.items[j].x
- var ry1 = self.items[j].y * sc[1] + self.items[j].z * (-sc[0])
- var rz1 = self.items[j].y * sc[0] + self.items[j].z * sc[1]
-
- var rx2 = rx1 * sc[3] + rz1 * sc[2]
- var ry2 = ry1
- var rz2 = rz1 * sc[3] - rx1 * sc[2]
-
- if (self.index == j) {
- self.items[j].scale = 1 // 取值范围0.6 ~ 3
- self.items[j].fontsize = 18
- self.items[j].alpha = 1
- self.items[j].element.style.zIndex = 99
- } else {
- var per = self.depth / (self.depth + rz2)
- self.items[j].x = rx2
- self.items[j].y = ry2
- self.items[j].z = rz2
-
- self.items[j].scale = per // 取值范围0.6 ~ 3
- self.items[j].fontsize = Math.ceil(per * 2) + self.fontsize - 6
- self.items[j].alpha = 1.5 * per - 0.5
- self.items[j].element.style.zIndex = Math.ceil(per * 10 - 5)
- }
- self.items[j].element.style.fontSize = self.items[j].fontsize + 'px'
- self.items[j].element.style.left = self.items[j].x * self.ratioX + (self.box.offsetWidth - self.items[j].offsetWidth) / 2 + 'px'
- self.items[j].element.style.top = self.items[j].y / self.ratioY + (self.box.offsetHeight - self.items[j].offsetHeight) / 2 + 'px'
- self.items[j].element.style.filter = 'alpha(opacity=' + 100 * self.items[j].alpha + ')'
- self.items[j].element.style.opacity = self.items[j].alpha
- }
- },
-
- _getItems: function() {
- var self = this
- var items = []
- var element = self.box.children // children 全部是Element
- var length = element.length
- var item
-
- for (var i = 0; i < length; i++) {
- item = {}
- item.angle = {}
- item.angle.phi = Math.acos(-1 + (2 * i + 1) / length)
- item.angle.theta = Math.sqrt((length + 1) * Math.PI) * item.angle.phi
- item.element = element[i]
- item.offsetWidth = item.element.offsetWidth
- item.offsetHeight = item.element.offsetHeight
- item.x = self.radius / 2 * 1.5 * Math.cos(item.angle.theta) * Math.sin(item.angle.phi)
- item.y = self.radius / 2 * 1.5 * Math.sin(item.angle.theta) * Math.sin(item.angle.phi)
- item.z = self.radius / 2 * 1.5 * Math.cos(item.angle.phi)
- item.element.style.left = item.x * self.ratioX + (self.box.offsetWidth - item.offsetWidth) / 2 + 'px'
- item.element.style.top = item.y / self.ratioY + (self.box.offsetHeight - item.offsetHeight) / 2 + 'px'
- if (self.config.multicolour) { // 初始化文字颜色为彩色
- _color = self._randomNumBoth(0, 360) // 定义色相 (0 到 360) - 0 (或 360) 红,120绿,180青,240蓝,300紫
- _light = self._randomNumBoth(30, 60) // 定义亮度 0% 为暗, 50% 为普通, 100% 为白
- item.element.style.color = 'hsl(' + _color + ', 100%, ' + _light + '%)' // 中间值为饱和度; 0%灰色,100%全色
- // item.element.style.color = 'rgb(' + parseInt(Math.random() * 255) + ',' + parseInt(Math.random() * 255) + ',' + parseInt(Math.random() * 255) + ')';
- }
- items.push(item)
- }
- return items // 单元素数组
- },
-
- // 取随机值,Min ≤ num ≤ Max
- _randomNumBoth: function(Min, Max) {
- var Range = Max - Min
- var Rand = Math.random()
- var num = Min + Math.round(Rand * Range) // 四舍五入
- return num
- }
- }
-
- if (!doc.querySelectorAll) { // ie7不支持querySelectorAll,所以要重新定义
- doc.querySelectorAll = function(selectors) {
- var style = doc.createElement('style'); var elements = []; var element
- doc.documentElement.firstChild.appendChild(style)
- doc._qsa = []
-
- style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}'
- window.scrollBy(0, 0)
- style.parentNode.removeChild(style)
-
- while (doc._qsa.length) {
- element = doc._qsa.shift()
- element.style.removeAttribute('x-qsa')
- elements.push(element)
- }
- doc._qsa = null
- return elements
- }
- }
-
- return function(options) { // factory
- options = options || {} // 短路语法
- var selector = options.selector || '.tagcloud' // 默认选择class为tagcloud的元素
- var elements = doc.querySelectorAll(selector)
- var instance = []
- for (var index = 0, len = elements.length; index < len; index++) {
- options.element = elements[index]
- if (TagCloud._set(options.element)) {
- instance.push(new TagCloud(options))
- }
- }
- return instance
- }
-})(window, document)
diff --git a/src/assets/js/tagscloud.js b/src/assets/js/tagscloud.js
index 17a444b..6d0795c 100644
--- a/src/assets/js/tagscloud.js
+++ b/src/assets/js/tagscloud.js
@@ -1,150 +1,336 @@
-// JavaScript Document
-
-var radius = 160
-var d = 200
-var dtr = Math.PI / 180
-var mcList = []
-var lasta = 1
-var lastb = 1
-var distr = true
-var tspeed = 4
-var size = 200
-var mouseX = 0
-var mouseY = 20
-var howElliptical = 1
-var aA = null
-var oDiv = null
-window.onload = function() {
- var i = 0
- var oTag = null
- oDiv = document.getElementById('tagscloud')
- aA = oDiv.getElementsByTagName('a')
- for (i = 0; i < aA.length; i++) {
- oTag = {}
- aA[i].onmouseover = (function(obj) {
- return function() {
- obj.on = true
- this.style.zIndex = 9999
- this.style.color = '#fff'
- this.style.padding = '5px 5px'
- this.style.filter = 'alpha(opacity=100)'
- this.style.opacity = 1
- }
- })(oTag)
- aA[i].onmouseout = (function(obj) {
- return function() {
- obj.on = false
- this.style.zIndex = obj.zIndex
- this.style.color = '#fff'
- this.style.padding = '5px'
- this.style.filter = 'alpha(opacity=' + 100 * obj.alpha + ')'
- this.style.opacity = obj.alpha
- this.style.zIndex = obj.zIndex
- }
- })(oTag)
- oTag.offsetWidth = aA[i].offsetWidth
- oTag.offsetHeight = aA[i].offsetHeight
- mcList.push(oTag)
+/**
+ * TagCloud.js (c) 2016-2019 @ Cong Min
+ * MIT License - https://github.com/cong-min/TagCloud
+ */
+
+class TagCloud {
+ /* constructor */
+ constructor(container = document.body, texts, options) {
+ const self = this
+ if (!container || container.nodeType !== 1) return new Error('Incorrect element type')
+
+ // params
+ self.$container = container
+ self.texts = texts || []
+ self.config = { ...TagCloud._defaultConfig, ...options || {}}
+
+ // calculate config
+ self.radius = self.config.radius // rolling radius
+ self.depth = 2 * self.radius // rolling depth
+ self.size = 1.5 * self.radius // rolling area size with mouse
+ self.maxSpeed = TagCloud._getMaxSpeed(self.config.maxSpeed) // rolling max speed
+ self.initSpeed = TagCloud._getInitSpeed(self.config.initSpeed) // rolling init speed
+ self.direction = self.config.direction // rolling init direction
+ self.keep = self.config.keep // whether to keep rolling after mouse out area
+ self.paused = false // keep state to pause the animation
+
+ // create element
+ self._createElment()
+ // init
+ self._init()
+ // set elements and instances
+ TagCloud.list.push({ el: self.$el, container, instance: self })
}
- sineCosine(0, 0, 0)
- positionAll();
- (function() {
- update()
- setTimeout(arguments.callee, 40)
- })()
-}
-function update() {
- var a; var b; var c = 0
- a = (Math.min(Math.max(-mouseY, -size), size) / radius) * tspeed
- b = (-Math.min(Math.max(-mouseX, -size), size) / radius) * tspeed
- lasta = a
- lastb = b
- if (Math.abs(a) <= 0.01 && Math.abs(b) <= 0.01) {
- return
+
+ /* static method */
+ // all TagCloud list
+ static list = [];
+
+ // default config
+ static _defaultConfig = {
+ radius: 100, // rolling radius, unit `px`
+ maxSpeed: 'normal', // rolling max speed, optional: `slow`, `normal`(default), `fast`
+ initSpeed: 'normal', // rolling init speed, optional: `slow`, `normal`(default), `fast`
+ direction: 135, // rolling init direction, unit clockwise `deg`, optional: `0`(top) , `90`(left), `135`(right-bottom)(default)...
+ keep: true, // whether to keep rolling after mouse out area, optional: `false`, `true`(default)(decelerate to rolling init speed, and keep rolling with mouse)
+ reverseDirection: false,
+ useContainerInlineStyles: true,
+ useItemInlineStyles: true,
+ containerClass: 'tagcloud',
+ itemClass: 'tagcloud--item',
+ useHTML: false
+ };
+
+ // speed value
+ static _getMaxSpeed = (name) => ({ slow: 0.5, normal: 1, fast: 2 })[name] || 1;
+
+ static _getInitSpeed = (name) => ({ slow: 16, normal: 32, fast: 80 })[name] || 32;
+
+ // event listener
+ static _on(el, ev, handler, cap) {
+ if (el.addEventListener) {
+ el.addEventListener(ev, handler, cap)
+ } else if (el.attachEvent) {
+ el.attachEvent(`on${ev}`, handler)
+ } else {
+ el[`on${ev}`] = handler
+ }
}
- sineCosine(a, b, c)
- for (var i = 0; i < mcList.length; i++) {
- if (mcList[i].on) {
- continue
+
+ /* instance property method */
+ // create elment
+ _createElment() {
+ const self = this
+
+ // create container
+ const $el = document.createElement('div')
+ $el.className = self.config.containerClass
+ if (self.config.useContainerInlineStyles) {
+ $el.style.position = 'relative'
+ $el.style.width = `${2 * self.radius}px`
+ $el.style.height = `${2 * self.radius}px`
}
- var rx1 = mcList[i].cx
- var ry1 = mcList[i].cy * ca + mcList[i].cz * (-sa)
- var rz1 = mcList[i].cy * sa + mcList[i].cz * ca
-
- var rx2 = rx1 * cb + rz1 * sb
- var ry2 = ry1
- var rz2 = rx1 * (-sb) + rz1 * cb
-
- var rx3 = rx2 * cc + ry2 * (-sc)
- var ry3 = rx2 * sc + ry2 * cc
- var rz3 = rz2
-
- mcList[i].cx = rx3
- mcList[i].cy = ry3
- mcList[i].cz = rz3
-
- per = d / (d + rz3)
-
- mcList[i].x = (howElliptical * rx3 * per) - (howElliptical * 2)
- mcList[i].y = ry3 * per
- mcList[i].scale = per
- var alpha = per
- alpha = (alpha - 0.6) * (10 / 6)
- mcList[i].alpha = alpha * alpha * alpha - 0.2
- mcList[i].zIndex = Math.ceil(100 - Math.floor(mcList[i].cz))
+
+ // create texts
+ self.items = []
+ self.texts.forEach((text, index) => {
+ const item = self._createTextItem(text, index)
+ $el.appendChild(item.el)
+ self.items.push(item)
+ })
+ self.$container.appendChild($el)
+ self.$el = $el
}
- doPosition()
-}
-function positionAll() {
- var phi = 0
- var theta = 0
- var max = mcList.length
- for (var i = 0; i < max; i++) {
- if (distr) {
- phi = Math.acos(-1 + (2 * (i + 1) - 1) / max)
- theta = Math.sqrt(max * Math.PI) * phi
+
+ // create a text
+ _createTextItem(text, index = 0) {
+ const self = this
+ const itemEl = document.createElement('span')
+ itemEl.className = self.config.itemClass
+ if (self.config.useItemInlineStyles) {
+ itemEl.style.willChange = 'transform, opacity, filter'
+ itemEl.style.position = 'absolute'
+ itemEl.style.top = '50%'
+ itemEl.style.left = '50%'
+ itemEl.style.zIndex = index + 1
+ itemEl.style.filter = 'alpha(opacity=0)'
+ itemEl.style.opacity = 0
+ const transformOrigin = '50% 50%'
+ itemEl.style.WebkitTransformOrigin = transformOrigin
+ itemEl.style.MozTransformOrigin = transformOrigin
+ itemEl.style.OTransformOrigin = transformOrigin
+ itemEl.style.transformOrigin = transformOrigin
+ const transform = 'translate3d(-50%, -50%, 0) scale(1)'
+ itemEl.style.WebkitTransform = transform
+ itemEl.style.MozTransform = transform
+ itemEl.style.OTransform = transform
+ itemEl.style.transform = transform
+ }
+ if (self.config.useHTML) {
+ itemEl.innerHTML = text
} else {
- phi = Math.random() * (Math.PI)
- theta = Math.random() * (2 * Math.PI)
+ itemEl.innerText = text
}
- // 坐标变换
- mcList[i].cx = radius * Math.cos(theta) * Math.sin(phi)
- mcList[i].cy = radius * Math.sin(theta) * Math.sin(phi)
- mcList[i].cz = radius * Math.cos(phi)
+ return {
+ el: itemEl,
+ ...self._computePosition(index) // distributed in appropriate place
+ }
+ }
- aA[i].style.left = mcList[i].cx + oDiv.offsetWidth / 2 - mcList[i].offsetWidth / 2 + 'px'
- aA[i].style.top = mcList[i].cy + oDiv.offsetHeight / 2 - mcList[i].offsetHeight / 2 + 'px'
+ // calculate appropriate place
+ _computePosition(index, random = false) {
+ const self = this
+ const textsLength = self.texts.length
+ // if random `true`, It means that a random appropriate place is generated, and the position will be independent of `index`
+ if (random) index = Math.floor(Math.random() * (textsLength + 1))
+ const phi = Math.acos(-1 + (2 * index + 1) / textsLength)
+ const theta = Math.sqrt((textsLength + 1) * Math.PI) * phi
+ return {
+ x: (self.size * Math.cos(theta) * Math.sin(phi)) / 2,
+ y: (self.size * Math.sin(theta) * Math.sin(phi)) / 2,
+ z: (self.size * Math.cos(phi)) / 2
+ }
}
-}
-function doPosition() {
- var l = oDiv.offsetWidth / 2
- var t = oDiv.offsetHeight / 2
- for (var i = 0; i < mcList.length; i++) {
- if (mcList[i].on) {
- continue
+
+ _requestInterval(fn, delay) {
+ const requestAnimFrame = ((() => window.requestAnimationFrame) || ((callback, element) => {
+ window.setTimeout(callback, 1000 / 60)
+ }))()
+ let start = new Date().getTime()
+ const handle = {}
+ function loop() {
+ handle.value = requestAnimFrame(loop)
+ const current = new Date().getTime()
+ const delta = current - start
+ if (delta >= delay) {
+ fn.call()
+ start = new Date().getTime()
+ }
}
- var aAs = aA[i].style
- if (mcList[i].alpha > 0.1) {
- if (aAs.display !== '') { aAs.display = '' }
- } else {
- if (aAs.display !== 'none') { aAs.display = 'none' }
- continue
+ handle.value = requestAnimFrame(loop)
+ return handle
+ }
+
+ // init
+ _init() {
+ const self = this
+
+ self.active = false // whether the mouse is activated
+
+ self.mouseX0 = self.initSpeed * Math.sin(self.direction * (Math.PI / 180)) // init distance between the mouse and rolling center x axis
+ self.mouseY0 = -self.initSpeed * Math.cos(self.direction * (Math.PI / 180)) // init distance between the mouse and rolling center y axis
+
+ self.mouseX = self.mouseX0 // current distance between the mouse and rolling center x axis
+ self.mouseY = self.mouseY0 // current distance between the mouse and rolling center y axis
+
+ const isTouchDevice = window.matchMedia('(hover: hover)')
+ if (!isTouchDevice || isTouchDevice.matches) {
+ // mouseover
+ TagCloud._on(self.$el, 'mouseover', () => { self.active = true })
+ // mouseout
+ TagCloud._on(self.$el, 'mouseout', () => { self.active = false })
+ // mousemove
+ TagCloud._on(self.keep ? window : self.$el, 'mousemove', (ev) => {
+ ev = ev || window.event
+ const rect = self.$el.getBoundingClientRect()
+ self.mouseX = (ev.clientX - (rect.left + rect.width / 2)) / 5
+ self.mouseY = (ev.clientY - (rect.top + rect.height / 2)) / 5
+ })
}
- aAs.left = mcList[i].cx + l - mcList[i].offsetWidth / 2 + 'px'
- aAs.top = mcList[i].cy + t - mcList[i].offsetHeight / 2 + 'px'
- // aAs.fontSize=Math.ceil(12*mcList[i].scale/2)+8+'px';
- // aAs.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+100*mcList[i].alpha+")";
- aAs.filter = 'alpha(opacity=' + 100 * mcList[i].alpha + ')'
- aAs.zIndex = mcList[i].zIndex
- aAs.opacity = mcList[i].alpha
+
+ // update state regularly
+ self._next() // init update state
+ self.interval = self._requestInterval(() => {
+ self._next.call(self)
+ }, 10)
+ }
+
+ // calculate the next state
+ _next() {
+ const self = this
+
+ if (self.paused) {
+ return
+ }
+
+ // if keep `false`, pause rolling after moving mouse out area
+ if (!self.keep && !self.active) {
+ self.mouseX = Math.abs(self.mouseX - self.mouseX0) < 1
+ ? self.mouseX0 : (self.mouseX + self.mouseX0) / 2 // reset distance between the mouse and rolling center x axis
+ self.mouseY = Math.abs(self.mouseY - self.mouseY0) < 1
+ ? self.mouseY0 : (self.mouseY + self.mouseY0) / 2 // reset distance between the mouse and rolling center y axis
+ }
+
+ let a = -(Math.min(Math.max(-self.mouseY, -self.size), self.size) / self.radius) *
+ self.maxSpeed
+ let b = (Math.min(Math.max(-self.mouseX, -self.size), self.size) / self.radius) *
+ self.maxSpeed
+
+ // inverse direction if enabled
+ if (self.config.reverseDirection) {
+ a = -a
+ b = -b
+ }
+
+ if (Math.abs(a) <= 0.01 && Math.abs(b) <= 0.01) return // pause
+
+ // calculate offset
+ const l = Math.PI / 180
+ const sc = [
+ Math.sin(a * l),
+ Math.cos(a * l),
+ Math.sin(b * l),
+ Math.cos(b * l)
+ ]
+
+ self.items.forEach(item => {
+ const rx1 = item.x
+ const ry1 = item.y * sc[1] + item.z * (-sc[0])
+ const rz1 = item.y * sc[0] + item.z * sc[1]
+
+ const rx2 = rx1 * sc[3] + rz1 * sc[2]
+ const ry2 = ry1
+ const rz2 = rz1 * sc[3] - rx1 * sc[2]
+
+ const per = (2 * self.depth) / (2 * self.depth + rz2) // todo
+
+ item.x = rx2
+ item.y = ry2
+ item.z = rz2
+ item.scale = per.toFixed(3)
+ let alpha = per * per - 0.25
+ alpha = (alpha > 1 ? 1 : alpha).toFixed(3)
+
+ const itemEl = item.el
+ const left = (item.x - itemEl.offsetWidth / 2).toFixed(2)
+ const top = (item.y - itemEl.offsetHeight / 2).toFixed(2)
+ const transform = `translate3d(${left}px, ${top}px, 0) scale(${item.scale})`
+ itemEl.style.WebkitTransform = transform
+ itemEl.style.MozTransform = transform
+ itemEl.style.OTransform = transform
+ itemEl.style.transform = transform
+ itemEl.style.filter = `alpha(opacity=${100 * alpha})`
+ itemEl.style.opacity = alpha
+ })
+ }
+
+ /* export instance properties and methods */
+ // update
+ update(texts) {
+ const self = this
+ // params
+ self.texts = texts || []
+ // judging and processing items based on texts
+ self.texts.forEach((text, index) => {
+ let item = self.items[index]
+ if (!item) { // if not had, then create
+ item = self._createTextItem(text, index)
+ Object.assign(item, self._computePosition(index, true)) // random place
+ self.$el.appendChild(item.el)
+ self.items.push(item)
+ }
+ // if had, replace text
+ if (self.config.useHTML) {
+ item.el.innerHTML = text
+ } else {
+ item.el.innerText = text
+ }
+ })
+ // remove redundant self.items
+ const textsLength = self.texts.length
+ const itemsLength = self.items.length
+ if (textsLength < itemsLength) {
+ const removeList = self.items.splice(textsLength, itemsLength - textsLength)
+ removeList.forEach(item => {
+ self.$el.removeChild(item.el)
+ })
+ }
+ }
+
+ // destroy
+ destroy() {
+ const self = this
+ self.interval = null
+ // clear in TagCloud.list
+ const index = TagCloud.list.findIndex(e => e.el === self.$el)
+ if (index !== -1) TagCloud.list.splice(index, 1)
+ // clear element
+ if (self.$container && self.$el) {
+ self.$container.removeChild(self.$el)
+ }
+ }
+
+ pause() {
+ const self = this
+
+ self.paused = true
+ }
+
+ resume() {
+ const self = this
+
+ self.paused = false
}
-}
-function sineCosine(a, b, c) {
- sa = Math.sin(a * dtr)
- ca = Math.cos(a * dtr)
- sb = Math.sin(b * dtr)
- cb = Math.cos(b * dtr)
- sc = Math.sin(c * dtr)
- cc = Math.cos(c * dtr)
}
+export default (els, texts, options) => {
+ if (typeof els === 'string') els = document.querySelectorAll(els)
+ if (!els.forEach) els = [els]
+ const instances = []
+ els.forEach(el => {
+ if (el) {
+ instances.push(new TagCloud(el, texts, options))
+ }
+ })
+ return instances.length <= 1 ? instances[0] : instances
+}
diff --git a/src/assets/styles/font-some.css b/src/assets/styles/font-some.css
index 6bd9ea3..1f88709 100644
--- a/src/assets/styles/font-some.css
+++ b/src/assets/styles/font-some.css
@@ -1,7 +1,7 @@
.chartNum{
display: flex;
justify-content: flex-start;
- padding-left: .575rem;
+ padding-left: .425rem;
}
.box-items {
position: relative;
@@ -11,6 +11,7 @@
}
/*滚动数字设置*/
.number-item {
+ position: relative;
display: flex;
justify-content: center;
text-align: center;
@@ -18,7 +19,7 @@
height: .5rem;
line-height: .4rem;
}
-.number-item span{
+.number-item span.items-int{
position: relative;
display: inline-block;
width: 100%;
@@ -27,7 +28,7 @@
text-orientation: upright;
overflow: hidden;
}
-.number-item span i{
+.number-item span.items-int i{
font-style: normal;
position: absolute;
top: 0;
@@ -42,7 +43,4 @@
background-clip: text;
-webkit-text-fill-color: transparent; */
text-shadow: 0 2px 8px rgba(5,28,55,0.42);
-}
-.number-item:last-child {
- margin-right: 0;
-}
+}
\ No newline at end of file
diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss
index 33a26ac..aebb12d 100644
--- a/src/assets/styles/index.scss
+++ b/src/assets/styles/index.scss
@@ -353,7 +353,7 @@
display: block;
font-size: .175rem;
color: #CCDEFF;
- padding-left: .125rem;
+ padding-left: .0625rem;
margin-top: .125rem;
}
}
@@ -370,12 +370,12 @@
background: url('~@/assets/images/pageOne-1.png') no-repeat top left;
background-size: cover;
p{
- padding-left: .575rem;
+ padding-left: .45rem;
}
}
&.lendingNum{
top: 3.3rem;
- right: .3625rem;
+ right: 19px;
}
&.cardNum{
top: 1.1625rem;
@@ -387,10 +387,10 @@
background-size: cover;
p{
text-align: right;
- padding-right: .575rem;
+ padding-right: .45rem;
}
.middle-num{
- padding-right: .575rem;
+ padding-right: .275rem;
justify-content: flex-end;
.chartNum{
justify-content: flex-end;
@@ -766,50 +766,52 @@
text-shadow: 0 2px 8px rgba(5,28,55,0.42);
}
}
- .pageLeft-flop-box {
- position: relative;
+
+}
+
+.pageLeft-flop-box {
+ position: relative;
+ height: .325rem;
+ margin-top: .125rem;
+ overflow: hidden;
+ & div:first-child {
height: .325rem;
- margin-top: .125rem;
overflow: hidden;
- & div:first-child {
- height: .325rem;
- overflow: hidden;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- }
- .flop-figure {
- width: 26px;
- i {
- font-size: .3rem;
- font-weight: bold;
- }
- }
- .flop-comma {
- margin-left: -0.025rem;
- span {
- left: 0;
- font-size: .275rem;
- color: #fff;
- // background: -webkit-linear-gradient(90deg, rgba(14,197,236,1) 10%,rgba(239,252,254,1) 100%);
- // background: linear-gradient(90deg, rgba(14,197,236,1) 10%,rgba(239,252,254,1) 100%);
- // -webkit-background-clip: text;
- // background-clip: text;
- // -webkit-text-fill-color: transparent;
- text-shadow: 0 2px 8px rgba(5,28,55,0.42);
- }
- }
- & em{
- font-style: normal;
- font-size: .175rem;
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ }
+ .flop-figure {
+ width: 26px;
+ i {
+ font-size: .3rem;
font-weight: bold;
- color: #A8CBF6;
- height: .375rem;
}
}
- .flop-item-name{
- font-size: .225rem;
+ .flop-comma {
+ margin-left: -0.025rem;
+ span {
+ left: 0;
+ font-size: .275rem;
+ color: #fff;
+ // background: -webkit-linear-gradient(90deg, rgba(14,197,236,1) 10%,rgba(239,252,254,1) 100%);
+ // background: linear-gradient(90deg, rgba(14,197,236,1) 10%,rgba(239,252,254,1) 100%);
+ // -webkit-background-clip: text;
+ // background-clip: text;
+ // -webkit-text-fill-color: transparent;
+ text-shadow: 0 2px 8px rgba(5,28,55,0.42);
+ }
}
+ & em{
+ font-style: normal;
+ font-size: .175rem;
+ font-weight: bold;
+ color: #A8CBF6;
+ height: .375rem;
+ }
+}
+.flop-item-name{
+ font-size: .225rem;
}
// 左边进度条
@@ -928,6 +930,11 @@
margin: 0 auto .3rem auto;
text-align: center;
line-height: 1.9rem;
+ overflow: hidden;
+ img{
+ display: block;
+ width: 100%;
+ }
}
span{
display: block;
@@ -1524,6 +1531,11 @@
margin-right: .475rem;
text-align: center;
line-height: 1.35rem;
+ overflow: hidden;
+ img{
+ display: block;
+ width: 100%;
+ }
}
span{
display: block;
diff --git a/src/utils/request.js b/src/utils/request.js
index 8d4a6f7..71c1c0d 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -4,7 +4,7 @@ import axios from 'axios'
// 创建axios实例
const service = axios.create({
// baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', // api 的 base_url
- baseURL: process.env.VUE_APP_BASE_API, // api 的 base_url
+ // baseURL: process.env.VUE_APP_BASE_API, // api 的 base_url
timeout: 1000 * 30, // 请求超时时间
headers: {
'Content-Type': 'application/json'
@@ -17,6 +17,14 @@ service.interceptors.request.use(
// if (getToken()) {
// config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
// }
+ switch (config.urlType) {
+ case 'local':
+ config.url = process.env.VUE_APP_BASE_API + config.url
+ break
+ case 'interlib':
+ config.url = process.env.VUE_APP_LIB_API + config.url
+ break
+ }
const token = '' // 登录后生成用于识别用户身份,项目不需要直接去掉
config.headers['Authorization'] = token || ''
return config
diff --git a/src/views/index.vue b/src/views/index.vue
index 28578e9..c35ce93 100644
--- a/src/views/index.vue
+++ b/src/views/index.vue
@@ -4,15 +4,22 @@