实验面板拖拽

openf12
yujialong 1 year ago
parent 2599f0e6f3
commit f37c144e46
  1. 80
      src/components/TestPanel.vue
  2. 8
      src/config/index.js
  3. 2
      src/views/Home.vue

@ -2,7 +2,7 @@
<div :class="['panel', {active: pannelVisible}]" <div :class="['panel', {active: pannelVisible}]"
id="panel"> id="panel">
<el-container class="scrollbar" <el-container class="scrollbar"
v-if="pannelVisible"> v-show="pannelVisible">
<el-header id="header"> <el-header id="header">
<div class="panel-header"> <div class="panel-header">
<div class="project"> <div class="project">
@ -194,8 +194,10 @@
</el-container> </el-container>
</el-container> </el-container>
<div :class="['toggle-panel', {active: pannelVisible}]"> <div :class="['toggle-panel', {active: pannelVisible}]"
<div @click="togglePannel"> id="toggle">
<!-- <div @click="togglePannel"> -->
<div>
<img :src="require(`@/assets/images/system/${$config.defaultSystem}/left.png`)" <img :src="require(`@/assets/images/system/${$config.defaultSystem}/left.png`)"
alt alt
class="c-p" class="c-p"
@ -919,26 +921,68 @@ export default {
const el = document.querySelector('#panel') const el = document.querySelector('#panel')
let gap = 10 // let gap = 10 //
let parent = document.body let parent = document.body
document.querySelector('#header').onmousedown = e => { const drag = e => {
console.log("🚀 ~ file: TestPanel.vue:746 ~ document.querySelector ~ e:", e) e.stopPropagation && e.stopPropagation()
var x = e.clientX - el.offsetLeft e.preventDefault && e.preventDefault()
var y = e.clientY - el.offsetTop e.cancelBubble = true
var left = 0 e.returnValue = false
var top = 0 let x = e.clientX - el.offsetLeft
let y = e.clientY - el.offsetTop
let left = 0
let top = 0
document.onmousemove = function (eve) { document.onmousemove = function (eve) {
left = eve.clientX - x left = eve.clientX - x
top = eve.clientY - y top = eve.clientY - y
// // //
if (left <= gap) { // if (left <= gap) {
left = 0 // left = 0
} // }
if (left >= parent.offsetWidth - el.offsetWidth - gap - 35) { //- // if (left >= parent.offsetWidth - el.offsetWidth - gap - 35) { //-
left = parent.offsetWidth - el.offsetWidth - 35 // left = parent.offsetWidth - el.offsetWidth - 35
// }
// //
// if (top <= gap) top = 0
el.style.left = left + 'px'
el.style.top = top + 'px'
}
document.onmouseup = e => {
document.onmousemove = null
document.onmouseup = null
} }
}
document.querySelector('#header').onmousedown = drag
const toggle = document.querySelector('#toggle')
const drag1 = e => {
e.stopPropagation && e.stopPropagation()
e.preventDefault && e.preventDefault()
e.cancelBubble = true
e.returnValue = false
let timer = setTimeout(this.togglePannel, 200)
let x = e.clientX - el.offsetLeft
let y = e.clientY - el.offsetTop
let left = 0
let top = 0
document.onmousemove = function (eve) {
clearTimeout(timer)
left = eve.clientX - x
top = eve.clientY - y
//
// if (left <= gap) left = 0
// const offsetWidth = this.pannelVisible ? el.offsetWidth : 0
// if (left >= parent.offsetWidth - offsetWidth - gap - 35) { //-
// left = parent.offsetWidth - offsetWidth - 35
// }
// //
if (top <= gap) top = 0 // if (top <= gap) top = 0
el.style.left = left + 'px' el.style.left = left + 'px'
el.style.top = top + 'px' el.style.top = top + 'px'
} }
@ -947,6 +991,7 @@ export default {
document.onmouseup = null document.onmouseup = null
} }
} }
document.querySelector('#toggle').onmousedown = drag1
} }
} }
}; };
@ -1158,7 +1203,7 @@ export default {
top: 200px; top: 200px;
bottom: 20px; bottom: 20px;
left: 0; left: 0;
width: 85%; width: 0;
height: 0; height: 0;
.toggle-panel { .toggle-panel {
position: absolute; position: absolute;
@ -1172,6 +1217,7 @@ export default {
} }
&.active { &.active {
position: fixed; position: fixed;
width: 85%;
height: 70%; height: 70%;
.toggle-panel { .toggle-panel {
top: 38%; top: 38%;

@ -5,7 +5,7 @@ const isDev = process.env.NODE_ENV === 'development' //是否本地
const isHh = url.includes('10.196.131.73') //是否是河海版本 const isHh = url.includes('10.196.131.73') //是否是河海版本
const isPro = url.includes('occupationlab.com') //是否职站生产 const isPro = url.includes('occupationlab.com') //是否职站生产
const isZxy = url.includes('izhixinyun.com') //是否智信云 const isZxy = url.includes('izhixinyun.com') //是否智信云
let vscodeUrl = 'https://vscode.izhixinyun.com'
let host = location.origin + '/' let host = location.origin + '/'
let bankPath = `${location.origin}/banksystem` // 银行系统 let bankPath = `${location.origin}/banksystem` // 银行系统
// 121.37.12.51 | 192.168.31.151 // 121.37.12.51 | 192.168.31.151
@ -15,9 +15,11 @@ if (isDev) {
host = 'http://121.37.12.51:9000/' host = 'http://121.37.12.51:9000/'
// host = 'https://occupationlab.com/' // host = 'https://occupationlab.com/'
bankPath = `http://${location.hostname}:8093` bankPath = `http://${location.hostname}:8093`
vscodeUrl = 'http://121.37.12.51:8088/?folder=/home/coder'
} else if (isPro) { } else if (isPro) {
host = 'https://occupationlab.com/' host = 'https://occupationlab.com/'
bankPath = `https://www.huorantech.cn/banksystem` bankPath = `https://www.huorantech.cn/banksystem`
vscodeUrl = 'https://vscode.occupationlab.com/'
} }
const systemId = Cookie.get('admin-systemId') const systemId = Cookie.get('admin-systemId')
export default { export default {
@ -50,6 +52,10 @@ export default {
* 银行系统 * 银行系统
**/ **/
bankPath, bankPath,
/**
* vscode地址
**/
vscodeUrl,
/** /**
* @description 长时间未操作自动退出登录时间 * @description 长时间未操作自动退出登录时间
*/ */

@ -62,7 +62,7 @@
@cache="leavePage"></codemirror> @cache="leavePage"></codemirror>
<iframe v-else <iframe v-else
class="vscode" class="vscode"
:src="Config.isPro ? 'https://vscode.occupationlab.com/' : 'http://121.37.12.51:8088/?folder=/home/coder'" :src="Config.vscodeUrl"
frameborder="0" frameborder="0"
width="100%"></iframe> width="100%"></iframe>
</el-tab-pane> </el-tab-pane>

Loading…
Cancel
Save