|
|
@@ -4,7 +4,9 @@
|
|
|
title="用户信息"
|
|
|
width="600px"
|
|
|
placement="right"
|
|
|
- @close="emits('close')"
|
|
|
+ :keyboard="false"
|
|
|
+ :maskClosable="false"
|
|
|
+ @close="handleClose"
|
|
|
>
|
|
|
<div class="drawer-box">
|
|
|
<a-card size="small" title="用户信息" style="margin-bottom: 15px;">
|
|
|
@@ -49,6 +51,17 @@
|
|
|
</a-card-grid>
|
|
|
</a-card>
|
|
|
</div>
|
|
|
+ <template #footer>
|
|
|
+ <div style="padding: 10px;">
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ danger
|
|
|
+ block
|
|
|
+ :disabled="mainData.disabled"
|
|
|
+ @click="handleLogout"
|
|
|
+ >{{ mainData.btnText }}</a-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<OrderModal
|
|
|
:open="mainData.openOrder"
|
|
|
:type="mainData.orderType"
|
|
|
@@ -74,7 +87,9 @@ import OrderModal from './OrderModal.vue';
|
|
|
import AddressModal from './AddressModal.vue';
|
|
|
import CreditModal from './CreditModal.vue';
|
|
|
import CreditRecordModal from './CreditRecordModal.vue';
|
|
|
-import { onMounted, reactive } from 'vue';
|
|
|
+import { Modal } from 'ant-design-vue';
|
|
|
+import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
|
|
+import { reactive, onMounted, createVNode } from 'vue';
|
|
|
import { useUserStore } from '@/store/user';
|
|
|
import { getOrderCount } from '@/api/order';
|
|
|
|
|
|
@@ -112,7 +127,9 @@ const mainData = reactive({
|
|
|
openOrder: false,
|
|
|
openAddress: false,
|
|
|
openCredit: false,
|
|
|
- openRecord: false
|
|
|
+ openRecord: false,
|
|
|
+ disabled: false,
|
|
|
+ btnText: '退出登录'
|
|
|
})
|
|
|
|
|
|
const fetchOrderCount = async () => {
|
|
|
@@ -135,6 +152,31 @@ const handleMoreMenus = menu => {
|
|
|
mainData[menu.key] = true;
|
|
|
}
|
|
|
|
|
|
+const handleClose = () => {
|
|
|
+ emits('close');
|
|
|
+}
|
|
|
+
|
|
|
+const handleLogout = () => {
|
|
|
+ Modal.confirm({
|
|
|
+ title: '退出登录',
|
|
|
+ icon: createVNode(ExclamationCircleOutlined),
|
|
|
+ centered: true,
|
|
|
+ content: '确定退出登录?',
|
|
|
+ okText: '确认',
|
|
|
+ cancelText: '取消',
|
|
|
+ onOk: () => {
|
|
|
+ mainData.btnText = '退出中...';
|
|
|
+ mainData.disabled = true;
|
|
|
+ userStore.logout().then(() => {
|
|
|
+ handleClose();
|
|
|
+ }).finally(() => {
|
|
|
+ mainData.btnText = '退出登录';
|
|
|
+ mainData.disabled = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
fetchOrderCount()
|
|
|
})
|