forked from github/dataease
feat: 根据设备信息自动识别终端类型
This commit is contained in:
parent
db242ba72b
commit
3222f645a1
@ -123,10 +123,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const terminalInfo = this.$route.query.terminal
|
|
||||||
if (terminalInfo) {
|
|
||||||
this.terminal = terminalInfo
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
customStyle() {
|
customStyle() {
|
||||||
@ -178,6 +174,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this._isMobile()
|
||||||
const _this = this
|
const _this = this
|
||||||
const erd = elementResizeDetectorMaker()
|
const erd = elementResizeDetectorMaker()
|
||||||
// 监听主div变动事件
|
// 监听主div变动事件
|
||||||
@ -206,6 +203,11 @@ export default {
|
|||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
_isMobile() {
|
||||||
|
console.log('navigator.userAgent:' + navigator.userAgent)
|
||||||
|
const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
|
||||||
|
this.terminal = flag ? 'mobile' : 'pc'
|
||||||
|
},
|
||||||
canvasStyleDataInit() {
|
canvasStyleDataInit() {
|
||||||
// 数据刷新计时器
|
// 数据刷新计时器
|
||||||
this.searchCount = 0
|
this.searchCount = 0
|
||||||
|
@ -299,7 +299,6 @@ export default {
|
|||||||
// 监控缩放比例
|
// 监控缩放比例
|
||||||
previewCanvasScale: {
|
previewCanvasScale: {
|
||||||
handler(newVal, oldVal) {
|
handler(newVal, oldVal) {
|
||||||
console.log('previewCanvasScale:' + JSON.stringify(this.previewCanvasScale))
|
|
||||||
this.destroyScaleTimeMachine()
|
this.destroyScaleTimeMachine()
|
||||||
this.changeScaleIndex++
|
this.changeScaleIndex++
|
||||||
this.chartScale(this.changeScaleIndex)
|
this.chartScale(this.changeScaleIndex)
|
||||||
@ -317,7 +316,6 @@ export default {
|
|||||||
// 根据仪表板的缩放比例,修改视图内部参数
|
// 根据仪表板的缩放比例,修改视图内部参数
|
||||||
mergeScale() {
|
mergeScale() {
|
||||||
const scale = Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient
|
const scale = Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient
|
||||||
console.log('scale:' + scale + ';this.previewCanvasScale:' + JSON.stringify(this.previewCanvasScale))
|
|
||||||
const customAttrChart = JSON.parse(this.sourceCustomAttrStr)
|
const customAttrChart = JSON.parse(this.sourceCustomAttrStr)
|
||||||
const customStyleChart = JSON.parse(this.sourceCustomStyleStr)
|
const customStyleChart = JSON.parse(this.sourceCustomStyleStr)
|
||||||
recursionTransObj(customAttrTrans, customAttrChart, scale, this.scaleCoefficientType)
|
recursionTransObj(customAttrTrans, customAttrChart, scale, this.scaleCoefficientType)
|
||||||
|
Loading…
Reference in New Issue
Block a user