no message

This commit is contained in:
kuaifan 2022-04-20 06:39:30 +08:00
parent a6be0dc079
commit 81f8a01cc1
6 changed files with 70 additions and 9 deletions

6
cmd
View File

@ -126,6 +126,10 @@ run_electron() {
if [ "$argv" != "dev" ] && [ "$argv" != "--nobuild" ]; then
npx mix --production -- --env --electron
fi
if [ "$argv" == "dev" ]; then
run_exec php "php bin/run --mode=$argv"
supervisorctl_restart php
fi
node ./electron/build.js $argv
}
@ -293,7 +297,7 @@ if [ $# -gt 0 ]; then
[[ -z "$(env_get APP_KEY)" ]] && run_exec php "php artisan key:generate"
run_exec php "php bin/run --mode=prod"
# 检查数据库
remaining=10
remaining=20
while [ ! -f "${cur_path}/docker/mysql/data/$(env_get DB_DATABASE)/db.opt" ]; do
((remaining=$remaining-1))
if [ $remaining -lt 0 ]; then

View File

@ -7,6 +7,7 @@
</transition>
<Spinner/>
<RightBottom/>
<NetworkException/>
<PreviewImageState/>
</div>
</template>
@ -16,9 +17,10 @@ import Spinner from "./components/Spinner";
import RightBottom from "./components/RightBottom";
import PreviewImageState from "./components/PreviewImage/state";
import {mapState} from "vuex";
import NetworkException from "./components/NetworkException";
export default {
components: {PreviewImageState, RightBottom, Spinner},
components: {NetworkException, PreviewImageState, RightBottom, Spinner},
data() {
return {

View File

@ -0,0 +1,47 @@
<template>
<Modal
v-model="show"
:width="416"
:closable="false"
:footer-hide="true"
class-name="common-network-exception">
<div class="ivu-modal-confirm">
<div class="ivu-modal-confirm-head">
<div class="ivu-modal-confirm-head-icon ivu-modal-confirm-head-icon-error"><Icon type="ios-close-circle"/></div><div class="ivu-modal-confirm-head-title">{{$L('温馨提示')}}</div>
</div>
<div class="ivu-modal-confirm-body">
<div>{{$L('网络连接失败,请检查网络设置。')}}</div>
</div>
<div class="ivu-modal-confirm-footer">
<Button type="primary" @click="show = false">{{$L('确定')}}</Button>
</div>
</div>
</Modal>
</template>
<script>
import {mapState} from "vuex";
export default {
name: 'NetworkException',
data() {
return {
show: false,
}
},
computed: {
...mapState([ 'ajaxNetworkException' ]),
},
watch: {
ajaxNetworkException: {
handler(v) {
this.show = v;
},
immediate: true
}
}
};
</script>

View File

@ -937,11 +937,15 @@ export default {
getReportUnread(timeout) {
this.reportUnreadTimeout && clearTimeout(this.reportUnreadTimeout)
this.reportUnreadTimeout = setTimeout(() => {
this.$store.dispatch("call", {
url: 'report/unread',
}).then(({data}) => {
this.reportUnreadNumber = data.total || 0;
}).catch(() => {});
if (this.userId === 0) {
this.reportUnreadNumber = 0;
} else {
this.$store.dispatch("call", {
url: 'report/unread',
}).then(({data}) => {
this.reportUnreadNumber = data.total || 0;
}).catch(() => {});
}
}, typeof timeout === "number" ? timeout : 1000)
},

View File

@ -33,6 +33,7 @@ export default {
}
//
params.success = (result, status, xhr) => {
state.ajaxNetworkException = false;
if (!$A.isJson(result)) {
console.log(result, status, xhr);
reject({ret: -1, data: {}, msg: "Return error"})
@ -47,6 +48,7 @@ export default {
dispatch("logout")
}
});
reject(result)
return;
}
if (ret === -2 && params.checkNick !== false) {
@ -75,8 +77,9 @@ export default {
}
};
params.error = (xhr, status) => {
if (window.navigator.onLine === false || (status === 0 && xhr.readyState === 4)) {
reject({ret: -1, data: {}, msg: $A.L('网络异常,请稍后再试!')})
state.ajaxNetworkException = window.navigator.onLine === false || (status === 0 && xhr.readyState === 4);
if (state.ajaxNetworkException) {
reject({ret: -1001, data: {}, msg: "Network exception"})
} else {
reject({ret: -1, data: {}, msg: "System error"})
}

View File

@ -37,6 +37,7 @@ const stateData = {
// Ajax
ajaxWsReady: false,
ajaxWsListener: [],
ajaxNetworkException: false,
// Websocket
ws: null,