2023-12-16 13:00:23 +00:00
|
|
|
<!-- 错误界面 -->
|
2022-11-22 07:45:36 +00:00
|
|
|
<template>
|
|
|
|
<view class="error-page">
|
|
|
|
<s-empty
|
|
|
|
v-if="errCode === 'NetworkError'"
|
|
|
|
icon="/static/internet-empty.png"
|
|
|
|
text="网络连接失败"
|
|
|
|
showAction
|
|
|
|
actionText="重新连接"
|
|
|
|
@clickAction="onReconnect"
|
|
|
|
buttonColor="#ff3000"
|
2023-12-16 13:00:23 +00:00
|
|
|
/>
|
2022-11-22 07:45:36 +00:00
|
|
|
<s-empty
|
|
|
|
v-else-if="errCode === 'TemplateError'"
|
|
|
|
icon="/static/internet-empty.png"
|
|
|
|
text="未找到模板"
|
|
|
|
showAction
|
|
|
|
actionText="重新加载"
|
|
|
|
@clickAction="onReconnect"
|
|
|
|
buttonColor="#ff3000"
|
2023-12-16 13:00:23 +00:00
|
|
|
/>
|
2022-11-22 07:45:36 +00:00
|
|
|
<s-empty
|
|
|
|
v-else-if="errCode !== ''"
|
|
|
|
icon="/static/internet-empty.png"
|
|
|
|
:text="errMsg"
|
|
|
|
showAction
|
|
|
|
actionText="重新加载"
|
|
|
|
@clickAction="onReconnect"
|
|
|
|
buttonColor="#ff3000"
|
2023-12-16 13:00:23 +00:00
|
|
|
/>
|
2022-11-22 07:45:36 +00:00
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { onLoad } from '@dcloudio/uni-app';
|
|
|
|
import { ref } from 'vue';
|
|
|
|
import { ShoproInit } from '@/sheep';
|
|
|
|
|
|
|
|
const errCode = ref('');
|
|
|
|
const errMsg = ref('');
|
2023-12-16 13:00:23 +00:00
|
|
|
|
2022-11-22 07:45:36 +00:00
|
|
|
onLoad((options) => {
|
|
|
|
errCode.value = options.errCode;
|
|
|
|
errMsg.value = options.errMsg;
|
|
|
|
});
|
2023-12-16 13:00:23 +00:00
|
|
|
|
2022-11-22 07:45:36 +00:00
|
|
|
// 重新连接
|
|
|
|
async function onReconnect() {
|
|
|
|
uni.reLaunch({
|
|
|
|
url: '/pages/index/index',
|
|
|
|
});
|
2023-12-16 13:00:23 +00:00
|
|
|
await ShoproInit();
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.error-page {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
</style>
|