Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
company_app
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
毛细亚
company_app
Commits
aa97780b
提交
aa97780b
authored
6月 07, 2025
作者:
毛细亚
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'release' into 1.1
上级
294da21b
d262915c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
90 行增加
和
16 行删除
+90
-16
debug.vue
src/components/debug.vue
+38
-4
devMode.js
src/utils/devMode.js
+51
-11
login.vue
src/views/login.vue
+1
-1
没有找到文件。
src/components/debug.vue
浏览文件 @
aa97780b
<
template
>
<!-- 开发模式触发区域 - 隐藏的点击区域 -->
<div
class=
"dev-mode-trigger"
@
click=
"handleDevModeClick"
title=
"开发模式触发区域"
></div>
<div
class=
"debug-container"
>
<div
class=
"dev-mode-trigger"
@
click=
"handleDevModeClick"
title=
"开发模式触发区域"
></div>
<div
class=
"dev-mode-cookie"
@
click=
"cleanCookie"
title=
"清除所有 cookie"
></div>
</div>
</
template
>
<
script
>
import
devModeManager
from
'@/utils/devMode'
import
Cookies
from
'js-cookie'
export
default
{
name
:
'Debug'
,
methods
:
{
handleDevModeClick
()
{
devModeManager
.
handleClick
()
},
cleanCookie
()
{
// 清除所有 cookie
Cookies
.
remove
(
'token'
)
Cookies
.
remove
(
'userid'
)
Cookies
.
remove
(
'corp_id'
)
Cookies
.
remove
(
'cser_id'
)
Cookies
.
remove
(
'accountSelect'
)
Cookies
.
remove
(
'signData'
)
this
.
$message
.
success
(
'清除所有 cookie 成功'
)
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.debug-container
{
width
:
100%
;
height
:
5px
;
position
:
absolute
;
top
:
0
;
left
:
0
;
z-index
:
999
;
}
/* 开发模式触发区域 */
.dev-mode-trigger
{
position
:
absolute
;
top
:
5
px
;
left
:
5
px
;
top
:
0
px
;
left
:
0
px
;
width
:
50px
;
height
:
5
0px
;
height
:
2
0px
;
background
:
transparent
;
cursor
:
pointer
;
z-index
:
999
;
...
...
@@ -33,4 +55,15 @@ export default {
background
:
rgba
(
0
,
191
,
138
,
0.1
);
border-radius
:
4px
;
}
.dev-mode-cookie
{
position
:
absolute
;
top
:
0px
;
right
:
0px
;
width
:
50px
;
height
:
20px
;
}
.dev-mode-cookie
:hover
{
background
:
rgba
(
138
,
2
,
162
,
0.1
);
border-radius
:
4px
;
}
</
style
>
\ No newline at end of file
src/utils/devMode.js
浏览文件 @
aa97780b
...
...
@@ -8,6 +8,7 @@ class DevModeManager {
this
.
maxClicks
=
7
// 连续点击7次开启
this
.
resetTime
=
3000
// 3秒内无点击则重置
this
.
isDevMode
=
this
.
getDevModeFromStorage
()
this
.
isDestroyingVConsole
=
false
// 标记VConsole正在销毁中
// 自动初始化逻辑
this
.
autoInit
()
...
...
@@ -44,6 +45,12 @@ class DevModeManager {
// 处理点击事件
handleClick
()
{
// 如果正在销毁VConsole,忽略点击事件
if
(
this
.
isDestroyingVConsole
)
{
console
.
log
(
'VConsole正在关闭中,请稍候...'
)
return
}
this
.
clickCount
++
console
.
log
(
`开发模式激活进度:
${
this
.
clickCount
}
/
${
this
.
maxClicks
}
`
)
...
...
@@ -91,18 +98,26 @@ class DevModeManager {
try
{
// 防止重复初始化
if
(
!
this
.
vConsole
)
{
// 如果上次销毁未完成,等待一段时间
if
(
this
.
isDestroyingVConsole
)
{
console
.
log
(
'正在等待上次的VConsole销毁完成...'
)
setTimeout
(()
=>
this
.
enableDevMode
(),
500
)
return
}
this
.
vConsole
=
new
VConsole
()
console
.
log
(
'🎉 开发模式已开启!'
)
console
.
log
(
'💡 提示:再次连续点击7次可关闭开发模式'
)
this
.
isDevMode
=
true
this
.
saveDevModeToStorage
(
true
)
}
else
{
console
.
log
(
'📱 开发模式已经处于开启状态'
)
}
this
.
isDevMode
=
true
this
.
saveDevModeToStorage
(
true
)
}
catch
(
error
)
{
console
.
error
(
'开启开发模式失败:'
,
error
)
this
.
vConsole
=
null
this
.
isDevMode
=
false
this
.
isDestroyingVConsole
=
false
}
}
...
...
@@ -110,17 +125,41 @@ class DevModeManager {
disableDevMode
()
{
try
{
if
(
this
.
vConsole
)
{
this
.
vConsole
.
destroy
()
this
.
vConsole
=
null
console
.
log
(
'👋 开发模式已关闭!'
)
// 设置标志,表示正在销毁
this
.
isDestroyingVConsole
=
true
// 在销毁前保存引用
const
vConsoleInstance
=
this
.
vConsole
;
// 先将实例引用设置为null,防止后续调用
this
.
vConsole
=
null
;
// 使用setTimeout延迟一点点销毁操作,以确保事件循环中的其他任务已完成
setTimeout
(()
=>
{
// 使用try-catch单独包装destroy调用,防止异常影响状态设置
try
{
vConsoleInstance
.
destroy
();
}
catch
(
destroyError
)
{
console
.
error
(
'VConsole销毁时出错:'
,
destroyError
);
}
// 销毁完成后,清除标志
this
.
isDestroyingVConsole
=
false
;
console
.
log
(
'👋 开发模式已关闭!'
);
},
100
);
this
.
isDevMode
=
false
;
this
.
saveDevModeToStorage
(
false
);
}
else
{
this
.
isDevMode
=
false
;
this
.
isDestroyingVConsole
=
false
;
this
.
saveDevModeToStorage
(
false
);
}
this
.
isDevMode
=
false
this
.
saveDevModeToStorage
(
false
)
}
catch
(
error
)
{
console
.
error
(
'关闭开发模式失败:'
,
error
)
console
.
error
(
'关闭开发模式失败:'
,
error
)
;
// 强制重置状态
this
.
vConsole
=
null
this
.
isDevMode
=
false
this
.
vConsole
=
null
;
this
.
isDevMode
=
false
;
this
.
isDestroyingVConsole
=
false
;
}
}
...
...
@@ -136,7 +175,8 @@ class DevModeManager {
environment
:
process
.
env
.
NODE_ENV
,
clickCount
:
this
.
clickCount
,
maxClicks
:
this
.
maxClicks
,
hasVConsole
:
!!
this
.
vConsole
hasVConsole
:
!!
this
.
vConsole
,
isDestroyingVConsole
:
this
.
isDestroyingVConsole
}
}
...
...
src/views/login.vue
浏览文件 @
aa97780b
...
...
@@ -3,7 +3,7 @@
<div
class=
"loginContent"
>
<div
v-if=
"!token"
>
<div>
当前组织:
<span
class=
"current-org"
>
{{
currentOrg
.
name
}}
</span>
当前
选中
组织:
<span
class=
"current-org"
>
{{
currentOrg
.
name
}}
</span>
<el-button
type=
"text"
@
click=
"showOrgDialog = true"
>
切换组织
</el-button>
</div>
<div
class=
"qr-contain"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论