mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 11:13:26 +00:00
优化数据结构
This commit is contained in:
parent
d9562e6b33
commit
be8cd95ae4
@ -273,17 +273,13 @@ export default {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("needHome").then(data => {
|
||||||
url: "system/get/starthome",
|
if (this.userId === 0 || this.$route.query.action === 'index') {
|
||||||
}).then(({data}) => {
|
this.needStartHome = true;
|
||||||
const homeFooter = data.home_footer
|
this.homeFooter = data.home_footer;
|
||||||
const needStart = !!data.need_start
|
} else {
|
||||||
if (needStart && (this.userId === 0 || this.$route.query.action === 'index')) {
|
|
||||||
this.homeFooter = homeFooter;
|
|
||||||
this.needStartHome = needStart;
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.goNext();
|
this.goNext();
|
||||||
|
}
|
||||||
}).catch(_ => {
|
}).catch(_ => {
|
||||||
this.needStartHome = false;
|
this.needStartHome = false;
|
||||||
this.goNext();
|
this.goNext();
|
||||||
|
|||||||
@ -204,9 +204,6 @@ export default {
|
|||||||
this.privacyShow = !!this.$isEEUiApp && (await $A.IDBString("cachePrivacyShow")) !== "no";
|
this.privacyShow = !!this.$isEEUiApp && (await $A.IDBString("cachePrivacyShow")) !== "no";
|
||||||
this.email = await $A.IDBString("cacheLoginEmail") || ''
|
this.email = await $A.IDBString("cacheLoginEmail") || ''
|
||||||
//
|
//
|
||||||
this.getDemoAccount();
|
|
||||||
this.getNeedStartHome();
|
|
||||||
//
|
|
||||||
if (this.isSoftware) {
|
if (this.isSoftware) {
|
||||||
this.chackServerUrl().catch(_ => {});
|
this.chackServerUrl().catch(_ => {});
|
||||||
} else {
|
} else {
|
||||||
@ -231,6 +228,9 @@ export default {
|
|||||||
activated() {
|
activated() {
|
||||||
this.loginType = 'login'
|
this.loginType = 'login'
|
||||||
//
|
//
|
||||||
|
this.getDemoAccount();
|
||||||
|
this.getNeedStartHome();
|
||||||
|
//
|
||||||
if (this.$Electron) {
|
if (this.$Electron) {
|
||||||
this.$Electron.sendMessage('subWindowDestroyAll')
|
this.$Electron.sendMessage('subWindowDestroyAll')
|
||||||
}
|
}
|
||||||
@ -339,15 +339,13 @@ export default {
|
|||||||
|
|
||||||
getNeedStartHome() {
|
getNeedStartHome() {
|
||||||
if (this.isNotServer()) {
|
if (this.isNotServer()) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("needHome").then(_ => {
|
||||||
url: "system/get/starthome",
|
this.needStartHome = true
|
||||||
}).then(({data}) => {
|
|
||||||
this.needStartHome = !!data.need_start;
|
|
||||||
}).catch(_ => {
|
}).catch(_ => {
|
||||||
this.needStartHome = false;
|
this.needStartHome = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getNeedInvite() {
|
getNeedInvite() {
|
||||||
|
|||||||
93
resources/assets/js/store/actions.js
vendored
93
resources/assets/js/store/actions.js
vendored
@ -230,6 +230,26 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用首页
|
||||||
|
* @param dispatch
|
||||||
|
* @param state
|
||||||
|
* @returns {Promise<unknown>}
|
||||||
|
*/
|
||||||
|
needHome({dispatch, state}) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
dispatch("call", {
|
||||||
|
url: "system/get/starthome",
|
||||||
|
}).then(({data}) => {
|
||||||
|
if (!!data.need_start) {
|
||||||
|
resolve(data)
|
||||||
|
} else {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
}).catch(reject);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载文件
|
* 下载文件
|
||||||
* @param state
|
* @param state
|
||||||
@ -347,12 +367,19 @@ export default {
|
|||||||
*/
|
*/
|
||||||
getBasicData({state, dispatch}, timeout) {
|
getBasicData({state, dispatch}, timeout) {
|
||||||
if (typeof timeout === "number") {
|
if (typeof timeout === "number") {
|
||||||
window.__getBasicData && clearTimeout(window.__getBasicData)
|
window.__getBasicDataTimer && clearTimeout(window.__getBasicDataTimer)
|
||||||
if (timeout > -1) {
|
if (timeout > -1) {
|
||||||
window.__getBasicData = setTimeout(dispatch("getBasicData", null), timeout)
|
window.__getBasicDataTimer = setTimeout(dispatch("getBasicData", null), timeout)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
const tmpKey = state.userId + $A.Time()
|
||||||
|
if (window.__getBasicDataKey === tmpKey) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.__getBasicDataKey = tmpKey
|
||||||
|
//
|
||||||
dispatch("getProjects").catch(() => {});
|
dispatch("getProjects").catch(() => {});
|
||||||
dispatch("getDialogs").catch(() => {});
|
dispatch("getDialogs").catch(() => {});
|
||||||
dispatch("getReportUnread", 1000);
|
dispatch("getReportUnread", 1000);
|
||||||
@ -834,19 +861,16 @@ export default {
|
|||||||
reject({msg: 'Parameter error'});
|
reject({msg: 'Parameter error'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const request = $A.isJson(callData) ? callData : {
|
if ($A.isJson(callData)) {
|
||||||
deleted_at: state.projectDeletedAt || getters.getProjectLastAt
|
typeof callData.deleted_at !== "undefined" && delete callData.deleted_at
|
||||||
};
|
} else {
|
||||||
let showLoad = true;
|
callData = {deleted_at: state.projectDeletedAt || getters.getProjectLastAt}
|
||||||
if (typeof request.hideLoad !== "undefined") {
|
|
||||||
showLoad = !request.hideLoad;
|
|
||||||
delete request.hideLoad;
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
showLoad && state.loadProjects++;
|
!callData.hideLoad && state.loadProjects++;
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'project/lists',
|
url: 'project/lists',
|
||||||
data: request
|
data: callData
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
state.projectTotal = data.total_all;
|
state.projectTotal = data.total_all;
|
||||||
dispatch("saveProject", data.data);
|
dispatch("saveProject", data.data);
|
||||||
@ -861,7 +885,7 @@ export default {
|
|||||||
console.warn(e);
|
console.warn(e);
|
||||||
reject(e)
|
reject(e)
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
showLoad && state.loadProjects--;
|
!callData.hideLoad && state.loadProjects--;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -2104,47 +2128,46 @@ export default {
|
|||||||
* @param data
|
* @param data
|
||||||
* @returns {Promise<unknown>}
|
* @returns {Promise<unknown>}
|
||||||
*/
|
*/
|
||||||
getDialogs({state, dispatch, getters}, data) {
|
getDialogs({state, dispatch, getters}, callData) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
if (state.userId === 0) {
|
if (state.userId === 0) {
|
||||||
state.cacheDialogs = [];
|
state.cacheDialogs = [];
|
||||||
reject({msg: 'Parameter error'});
|
reject({msg: 'Parameter error'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = $A.isJson(data) ? data : {
|
if ($A.isJson(callData)) {
|
||||||
deleted_at: state.dialogDeletedAt || getters.getDialogLastAt
|
typeof callData.deleted_at !== "undefined" && delete callData.deleted_at
|
||||||
|
} else {
|
||||||
|
callData = {deleted_at: state.dialogDeletedAt || getters.getDialogLastAt}
|
||||||
}
|
}
|
||||||
if (data.hideLoad !== true) {
|
if (typeof callData.pagesize === "undefined") {
|
||||||
state.loadDialogs++;
|
callData.pagesize = 20
|
||||||
}
|
}
|
||||||
if (typeof data.pagesize === "undefined") {
|
if (typeof callData.page === "undefined") {
|
||||||
data.pagesize = 20
|
callData.page = 1
|
||||||
}
|
|
||||||
if (typeof data.page === "undefined") {
|
|
||||||
data.page = 1
|
|
||||||
if (state.cacheDialogs.length > 0) {
|
if (state.cacheDialogs.length > 0) {
|
||||||
const tmpList = state.cacheDialogs.sort((a, b) => {
|
const tmpList = state.cacheDialogs.sort((a, b) => {
|
||||||
return $A.Date(b.last_at) - $A.Date(a.last_at);
|
return $A.Date(b.last_at) - $A.Date(a.last_at);
|
||||||
})
|
})
|
||||||
data.at_after = tmpList[0].last_at;
|
callData.at_after = tmpList[0].last_at;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
!callData.hideLoad && state.loadDialogs++;
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'dialog/lists',
|
url: 'dialog/lists',
|
||||||
data,
|
data: callData,
|
||||||
}).then(result => {
|
}).then(({data}) => {
|
||||||
const resData = result.data;
|
dispatch("saveDialog", data.data);
|
||||||
dispatch("saveDialog", resData.data);
|
|
||||||
//
|
//
|
||||||
resData.deleted_at && $A.IDBSet("dialogDeletedAt", resData.deleted_at).then(_ => {
|
data.deleted_at && $A.IDBSet("dialogDeletedAt", data.deleted_at).then(_ => {
|
||||||
state.dialogDeletedAt = resData.deleted_at
|
state.dialogDeletedAt = data.deleted_at
|
||||||
resData.deleted_data.some(id => dispatch("forgetDialog", id))
|
data.deleted_data.some(id => dispatch("forgetDialog", id))
|
||||||
});
|
});
|
||||||
//
|
//
|
||||||
if (resData.next_page_url && resData.current_page < 5) {
|
if (data.next_page_url && data.current_page < 5) {
|
||||||
data.page++
|
callData.page++
|
||||||
dispatch("getDialogs", data).then(resolve).catch(reject)
|
dispatch("getDialogs", callData).then(resolve).catch(reject)
|
||||||
} else {
|
} else {
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
@ -2152,9 +2175,7 @@ export default {
|
|||||||
console.warn(e);
|
console.warn(e);
|
||||||
reject(e)
|
reject(e)
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
if (data.hideLoad !== true) {
|
!callData.hideLoad && state.loadDialogs--;
|
||||||
state.loadDialogs--;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<b>ID | 名称 | 清理时间 | Webhook</b>
|
<b>ID | 名称 | 清理时间 | Webhook</b>
|
||||||
@foreach($data as $item)
|
@foreach($data as $item)
|
||||||
{{$item->userid}} | {{$item->nickname}} | {{$item->clear_day}} | {{$item->webhook_url ?: '-'}}
|
{{$item->userid}} | {{$item->nickname}} | {{$item->clear_day}} | {{$item->webhook_url ? '✅' : '-'}}
|
||||||
@endforeach
|
@endforeach
|
||||||
@elseif ($type === '/info')
|
@elseif ($type === '/info')
|
||||||
<b>机器人详情。</b>
|
<b>机器人详情。</b>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user