feat: 添加用户登录提示,未登录时显示登录按钮,已登录时显示提交按钮
This commit is contained in:
@@ -28,6 +28,8 @@ const tradingviewOptions: Partial<ChartingLibraryWidgetOptions> = {
|
||||
};
|
||||
const tradingViewInst = useTemplateRef<TradingViewInst>("tradingViewInst");
|
||||
const confirmModalInst = useTemplateRef<ModalInstance>("confirmModalInst");
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
|
||||
const [form] = useResetRef<SpotOrderBody & { amount: string }>({
|
||||
orderType: TradeWayValueEnum.LIMIT,
|
||||
@@ -81,6 +83,12 @@ async function handleSubmit() {
|
||||
}
|
||||
function gotoTokenized() {
|
||||
}
|
||||
function signIn() {
|
||||
router.push({
|
||||
path: "/auth/login",
|
||||
query: { redirect: router.currentRoute.value.fullPath },
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -134,9 +142,12 @@ function gotoTokenized() {
|
||||
</template>
|
||||
|
||||
<!-- <ion-range class="range" aria-label="Range with ticks" :pin="true" :ticks="true" :snaps="true" :min="0" :max="5" /> -->
|
||||
<ion-button expand="block" size="small" shape="round" :color="mode === TradeTypeEnum.BUY ? 'success' : 'danger'" @click="handleSubmit">
|
||||
<ion-button v-if="userStore.isAuthenticated" expand="block" size="small" shape="round" :color="mode === TradeTypeEnum.BUY ? 'success' : 'danger'" @click="handleSubmit">
|
||||
{{ mode === TradeTypeEnum.BUY ? '买入' : '卖出' }}
|
||||
</ion-button>
|
||||
<ion-button v-else expand="block" size="small" shape="round" color="success" @click="signIn">
|
||||
请先登录
|
||||
</ion-button>
|
||||
|
||||
<ion-modal ref="confirmModalInst" class="confirm-modal" :breakpoints="[0, 1]" :initial-breakpoint="1" :handle="false">
|
||||
<ConfirmOrder :form="form" />
|
||||
|
||||
Reference in New Issue
Block a user