commit
41275b21ac
@ -1351,7 +1351,6 @@ export default {
|
|||||||
keydown(event) {
|
keydown(event) {
|
||||||
const { keyCode } = event
|
const { keyCode } = event
|
||||||
const isCmd = this.checkCmdKey(event)
|
const isCmd = this.checkCmdKey(event)
|
||||||
console.log('keydown', 'keyCode', keyCode, 'isCmd', isCmd)
|
|
||||||
|
|
||||||
const checkPreviewVisible = this.checkPreviewVisible()
|
const checkPreviewVisible = this.checkPreviewVisible()
|
||||||
// space
|
// space
|
||||||
@ -2595,7 +2594,7 @@ export default {
|
|||||||
child[1].iconClass = 'menu-empty'
|
child[1].iconClass = 'menu-empty'
|
||||||
}
|
}
|
||||||
if (child[2]) {
|
if (child[2]) {
|
||||||
if (localStorage.getItem('showFolderSize') === 'true') {
|
if (localStorage.getItem('showFolderSize') === '1') {
|
||||||
child[2].iconClass = 'duigou'
|
child[2].iconClass = 'duigou'
|
||||||
} else {
|
} else {
|
||||||
child[2].iconClass = 'menu-empty'
|
child[2].iconClass = 'menu-empty'
|
||||||
@ -3414,7 +3413,11 @@ export default {
|
|||||||
break
|
break
|
||||||
case 'show-folder-size':
|
case 'show-folder-size':
|
||||||
const showFolderSize = localStorage.getItem('showFolderSize')
|
const showFolderSize = localStorage.getItem('showFolderSize')
|
||||||
localStorage.setItem('showFolderSize', showFolderSize ? false : true)
|
if (showFolderSize === '1') {
|
||||||
|
localStorage.setItem('showFolderSize', '0')
|
||||||
|
} else {
|
||||||
|
localStorage.setItem('showFolderSize', '1')
|
||||||
|
}
|
||||||
this.getFileList()
|
this.getFileList()
|
||||||
break
|
break
|
||||||
case 'orderName':
|
case 'orderName':
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { generateUUID } from "ant-design-vue/lib/vc-select/util";
|
|||||||
|
|
||||||
let eventSource = null;
|
let eventSource = null;
|
||||||
let timer = null;
|
let timer = null;
|
||||||
|
let lastHeartbeat = new Date().getTime();
|
||||||
const uuid = generateUUID();
|
const uuid = generateUUID();
|
||||||
|
|
||||||
const throttledConnectSSE = _.throttle((username) => {
|
const throttledConnectSSE = _.throttle((username) => {
|
||||||
@ -31,11 +32,16 @@ function connectToSSE(username) {
|
|||||||
|
|
||||||
eventSource.addEventListener('message', handleMessage);
|
eventSource.addEventListener('message', handleMessage);
|
||||||
eventSource.addEventListener('error', handleError.bind(null, username));
|
eventSource.addEventListener('error', handleError.bind(null, username));
|
||||||
|
startHeartbeatCheck(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMessage(event) {
|
function handleMessage(event) {
|
||||||
const msg = JSON.parse(event.data);
|
if (event.data === 'h') {
|
||||||
onMessage(msg);
|
lastHeartbeat = new Date().getTime();
|
||||||
|
} else {
|
||||||
|
const msg = JSON.parse(event.data);
|
||||||
|
onMessage(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleError(username) {
|
function handleError(username) {
|
||||||
@ -49,6 +55,18 @@ function clearExistingTimer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startHeartbeatCheck(username) {
|
||||||
|
clearExistingTimer();
|
||||||
|
timer = setInterval(() => {
|
||||||
|
if (eventSource.readyState === 1 && new Date().getTime() - lastHeartbeat > 5000) {
|
||||||
|
eventSource.close();
|
||||||
|
}
|
||||||
|
if (eventSource.readyState === 2) {
|
||||||
|
throttledConnectSSE(username);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
function onMessage(msg) {
|
function onMessage(msg) {
|
||||||
const { url, body } = msg;
|
const { url, body } = msg;
|
||||||
const eventMapping = {
|
const eventMapping = {
|
||||||
|
|||||||
@ -209,7 +209,6 @@ const actions = {
|
|||||||
// update token
|
// update token
|
||||||
setToken({ commit }, jmalToken) {
|
setToken({ commit }, jmalToken) {
|
||||||
commit('SET_TOKEN', jmalToken)
|
commit('SET_TOKEN', jmalToken)
|
||||||
console.log('jmalToken', jmalToken)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// remove share token
|
// remove share token
|
||||||
|
|||||||
@ -34,7 +34,8 @@ export default {
|
|||||||
{
|
{
|
||||||
label: '查看', operation: 'viewMode', child: [
|
label: '查看', operation: 'viewMode', child: [
|
||||||
{ iconClass: this.grid ? '' : 'menu-point', label: '列表', operation: 'vmode-list' },
|
{ iconClass: this.grid ? '' : 'menu-point', label: '列表', operation: 'vmode-list' },
|
||||||
{ iconClass: this.grid ? 'menu-point' : '', label: '缩略图', operation: 'vmode-grid' }
|
{ iconClass: this.grid ? 'menu-point' : '', label: '缩略图', operation: 'vmode-grid' },
|
||||||
|
{ label: '显示文件夹大小', operation: 'show-folder-size'},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user