feat: 更新环境配置,添加 API 地址,优化数据获取逻辑,支持振动反馈功能
This commit is contained in:
1
.env.development
Normal file
1
.env.development
Normal file
@@ -0,0 +1 @@
|
|||||||
|
VITE_API_URL=http://192.168.1.33:9528
|
||||||
1
.env.production
Normal file
1
.env.production
Normal file
@@ -0,0 +1 @@
|
|||||||
|
VITE_API_URL=http://192.168.1.33:9527
|
||||||
1
.github/copilot-instructions.md
vendored
1
.github/copilot-instructions.md
vendored
@@ -69,6 +69,7 @@ API 集成:
|
|||||||
使用 TypeScript 严格模式,避免 any 类型
|
使用 TypeScript 严格模式,避免 any 类型
|
||||||
组件命名使用 PascalCase,文件名使用 PascalCase 或 kebab-case
|
组件命名使用 PascalCase,文件名使用 PascalCase 或 kebab-case
|
||||||
使用 @/ 作为 src 目录的别名
|
使用 @/ 作为 src 目录的别名
|
||||||
|
颜色主题使用ion-color 变量,支持深色模式和浅色模式
|
||||||
2. 项目结构
|
2. 项目结构
|
||||||
```
|
```
|
||||||
src/
|
src/
|
||||||
|
|||||||
5
auto-imports.d.ts
vendored
5
auto-imports.d.ts
vendored
@@ -199,6 +199,7 @@ declare global {
|
|||||||
const useFullscreen: typeof import('@vueuse/core').useFullscreen
|
const useFullscreen: typeof import('@vueuse/core').useFullscreen
|
||||||
const useGamepad: typeof import('@vueuse/core').useGamepad
|
const useGamepad: typeof import('@vueuse/core').useGamepad
|
||||||
const useGeolocation: typeof import('@vueuse/core').useGeolocation
|
const useGeolocation: typeof import('@vueuse/core').useGeolocation
|
||||||
|
const useHaptics: typeof import('./src/composables/useVibrate').useHaptics
|
||||||
const useI18n: typeof import('vue-i18n').useI18n
|
const useI18n: typeof import('vue-i18n').useI18n
|
||||||
const useId: typeof import('vue').useId
|
const useId: typeof import('vue').useId
|
||||||
const useIdle: typeof import('@vueuse/core').useIdle
|
const useIdle: typeof import('@vueuse/core').useIdle
|
||||||
@@ -333,6 +334,9 @@ declare global {
|
|||||||
export type { Series, TData, WeightChartOptions, TradingViewData, TradingViewOptions } from './src/composables/useTradingView'
|
export type { Series, TData, WeightChartOptions, TradingViewData, TradingViewOptions } from './src/composables/useTradingView'
|
||||||
import('./src/composables/useTradingView')
|
import('./src/composables/useTradingView')
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
export type { HapticsOptions } from './src/composables/useVibrate'
|
||||||
|
import('./src/composables/useVibrate')
|
||||||
|
// @ts-ignore
|
||||||
export type { PageInstance, InputInstance, ModalInstance, FormInstance } from './src/utils/ionic-helper'
|
export type { PageInstance, InputInstance, ModalInstance, FormInstance } from './src/utils/ionic-helper'
|
||||||
import('./src/utils/ionic-helper')
|
import('./src/utils/ionic-helper')
|
||||||
}
|
}
|
||||||
@@ -535,6 +539,7 @@ declare module 'vue' {
|
|||||||
readonly useFullscreen: UnwrapRef<typeof import('@vueuse/core')['useFullscreen']>
|
readonly useFullscreen: UnwrapRef<typeof import('@vueuse/core')['useFullscreen']>
|
||||||
readonly useGamepad: UnwrapRef<typeof import('@vueuse/core')['useGamepad']>
|
readonly useGamepad: UnwrapRef<typeof import('@vueuse/core')['useGamepad']>
|
||||||
readonly useGeolocation: UnwrapRef<typeof import('@vueuse/core')['useGeolocation']>
|
readonly useGeolocation: UnwrapRef<typeof import('@vueuse/core')['useGeolocation']>
|
||||||
|
readonly useHaptics: UnwrapRef<typeof import('./src/composables/useVibrate')['useHaptics']>
|
||||||
readonly useI18n: UnwrapRef<typeof import('vue-i18n')['useI18n']>
|
readonly useI18n: UnwrapRef<typeof import('vue-i18n')['useI18n']>
|
||||||
readonly useId: UnwrapRef<typeof import('vue')['useId']>
|
readonly useId: UnwrapRef<typeof import('vue')['useId']>
|
||||||
readonly useIdle: UnwrapRef<typeof import('@vueuse/core')['useIdle']>
|
readonly useIdle: UnwrapRef<typeof import('@vueuse/core')['useIdle']>
|
||||||
|
|||||||
14
components.d.ts
vendored
14
components.d.ts
vendored
@@ -20,11 +20,15 @@ declare module 'vue' {
|
|||||||
IonBackButton: typeof import('@ionic/vue')['IonBackButton']
|
IonBackButton: typeof import('@ionic/vue')['IonBackButton']
|
||||||
IonButton: typeof import('@ionic/vue')['IonButton']
|
IonButton: typeof import('@ionic/vue')['IonButton']
|
||||||
IonButtons: typeof import('@ionic/vue')['IonButtons']
|
IonButtons: typeof import('@ionic/vue')['IonButtons']
|
||||||
|
IonCol: typeof import('@ionic/vue')['IonCol']
|
||||||
IonContent: typeof import('@ionic/vue')['IonContent']
|
IonContent: typeof import('@ionic/vue')['IonContent']
|
||||||
IonDatetime: typeof import('@ionic/vue')['IonDatetime']
|
IonDatetime: typeof import('@ionic/vue')['IonDatetime']
|
||||||
IonDatetimeButton: typeof import('@ionic/vue')['IonDatetimeButton']
|
IonDatetimeButton: typeof import('@ionic/vue')['IonDatetimeButton']
|
||||||
|
IonGrid: typeof import('@ionic/vue')['IonGrid']
|
||||||
IonHeader: typeof import('@ionic/vue')['IonHeader']
|
IonHeader: typeof import('@ionic/vue')['IonHeader']
|
||||||
IonIcon: typeof import('@ionic/vue')['IonIcon']
|
IonIcon: typeof import('@ionic/vue')['IonIcon']
|
||||||
|
IonInfiniteScroll: typeof import('@ionic/vue')['IonInfiniteScroll']
|
||||||
|
IonInfiniteScrollContent: typeof import('@ionic/vue')['IonInfiniteScrollContent']
|
||||||
IonInputOtp: typeof import('@ionic/vue')['IonInputOtp']
|
IonInputOtp: typeof import('@ionic/vue')['IonInputOtp']
|
||||||
IonItem: typeof import('@ionic/vue')['IonItem']
|
IonItem: typeof import('@ionic/vue')['IonItem']
|
||||||
IonLabel: typeof import('@ionic/vue')['IonLabel']
|
IonLabel: typeof import('@ionic/vue')['IonLabel']
|
||||||
@@ -34,7 +38,10 @@ declare module 'vue' {
|
|||||||
IonPage: typeof import('@ionic/vue')['IonPage']
|
IonPage: typeof import('@ionic/vue')['IonPage']
|
||||||
IonRadio: typeof import('@ionic/vue')['IonRadio']
|
IonRadio: typeof import('@ionic/vue')['IonRadio']
|
||||||
IonRadioGroup: typeof import('@ionic/vue')['IonRadioGroup']
|
IonRadioGroup: typeof import('@ionic/vue')['IonRadioGroup']
|
||||||
|
IonRefresher: typeof import('@ionic/vue')['IonRefresher']
|
||||||
|
IonRefresherContent: typeof import('@ionic/vue')['IonRefresherContent']
|
||||||
IonRouterOutlet: typeof import('@ionic/vue')['IonRouterOutlet']
|
IonRouterOutlet: typeof import('@ionic/vue')['IonRouterOutlet']
|
||||||
|
IonRow: typeof import('@ionic/vue')['IonRow']
|
||||||
IonSearchbar: typeof import('@ionic/vue')['IonSearchbar']
|
IonSearchbar: typeof import('@ionic/vue')['IonSearchbar']
|
||||||
IonSelect: typeof import('@ionic/vue')['IonSelect']
|
IonSelect: typeof import('@ionic/vue')['IonSelect']
|
||||||
IonSelectOption: typeof import('@ionic/vue')['IonSelectOption']
|
IonSelectOption: typeof import('@ionic/vue')['IonSelectOption']
|
||||||
@@ -70,11 +77,15 @@ declare global {
|
|||||||
const IonBackButton: typeof import('@ionic/vue')['IonBackButton']
|
const IonBackButton: typeof import('@ionic/vue')['IonBackButton']
|
||||||
const IonButton: typeof import('@ionic/vue')['IonButton']
|
const IonButton: typeof import('@ionic/vue')['IonButton']
|
||||||
const IonButtons: typeof import('@ionic/vue')['IonButtons']
|
const IonButtons: typeof import('@ionic/vue')['IonButtons']
|
||||||
|
const IonCol: typeof import('@ionic/vue')['IonCol']
|
||||||
const IonContent: typeof import('@ionic/vue')['IonContent']
|
const IonContent: typeof import('@ionic/vue')['IonContent']
|
||||||
const IonDatetime: typeof import('@ionic/vue')['IonDatetime']
|
const IonDatetime: typeof import('@ionic/vue')['IonDatetime']
|
||||||
const IonDatetimeButton: typeof import('@ionic/vue')['IonDatetimeButton']
|
const IonDatetimeButton: typeof import('@ionic/vue')['IonDatetimeButton']
|
||||||
|
const IonGrid: typeof import('@ionic/vue')['IonGrid']
|
||||||
const IonHeader: typeof import('@ionic/vue')['IonHeader']
|
const IonHeader: typeof import('@ionic/vue')['IonHeader']
|
||||||
const IonIcon: typeof import('@ionic/vue')['IonIcon']
|
const IonIcon: typeof import('@ionic/vue')['IonIcon']
|
||||||
|
const IonInfiniteScroll: typeof import('@ionic/vue')['IonInfiniteScroll']
|
||||||
|
const IonInfiniteScrollContent: typeof import('@ionic/vue')['IonInfiniteScrollContent']
|
||||||
const IonInputOtp: typeof import('@ionic/vue')['IonInputOtp']
|
const IonInputOtp: typeof import('@ionic/vue')['IonInputOtp']
|
||||||
const IonItem: typeof import('@ionic/vue')['IonItem']
|
const IonItem: typeof import('@ionic/vue')['IonItem']
|
||||||
const IonLabel: typeof import('@ionic/vue')['IonLabel']
|
const IonLabel: typeof import('@ionic/vue')['IonLabel']
|
||||||
@@ -84,7 +95,10 @@ declare global {
|
|||||||
const IonPage: typeof import('@ionic/vue')['IonPage']
|
const IonPage: typeof import('@ionic/vue')['IonPage']
|
||||||
const IonRadio: typeof import('@ionic/vue')['IonRadio']
|
const IonRadio: typeof import('@ionic/vue')['IonRadio']
|
||||||
const IonRadioGroup: typeof import('@ionic/vue')['IonRadioGroup']
|
const IonRadioGroup: typeof import('@ionic/vue')['IonRadioGroup']
|
||||||
|
const IonRefresher: typeof import('@ionic/vue')['IonRefresher']
|
||||||
|
const IonRefresherContent: typeof import('@ionic/vue')['IonRefresherContent']
|
||||||
const IonRouterOutlet: typeof import('@ionic/vue')['IonRouterOutlet']
|
const IonRouterOutlet: typeof import('@ionic/vue')['IonRouterOutlet']
|
||||||
|
const IonRow: typeof import('@ionic/vue')['IonRow']
|
||||||
const IonSearchbar: typeof import('@ionic/vue')['IonSearchbar']
|
const IonSearchbar: typeof import('@ionic/vue')['IonSearchbar']
|
||||||
const IonSelect: typeof import('@ionic/vue')['IonSelect']
|
const IonSelect: typeof import('@ionic/vue')['IonSelect']
|
||||||
const IonSelectOption: typeof import('@ionic/vue')['IonSelectOption']
|
const IonSelectOption: typeof import('@ionic/vue')['IonSelectOption']
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"run:ios": "ionic capacitor run ios -l --external",
|
"run:ios": "ionic capacitor run ios -l --external",
|
||||||
"run:android": "ionic capacitor run android -l --external",
|
"run:android": "ionic capacitor run android -l --external",
|
||||||
|
"proxy": "ionic config set -g proxy http://192.168.1.36:9527",
|
||||||
"test:e2e": "cypress run",
|
"test:e2e": "cypress run",
|
||||||
"test:unit": "vitest",
|
"test:unit": "vitest",
|
||||||
"lint": "eslint",
|
"lint": "eslint",
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
"@elysiajs/eden": "^1.4.5",
|
"@elysiajs/eden": "^1.4.5",
|
||||||
"@ionic/vue": "^8.7.11",
|
"@ionic/vue": "^8.7.11",
|
||||||
"@ionic/vue-router": "^8.7.11",
|
"@ionic/vue-router": "^8.7.11",
|
||||||
"@riwa/api-types": "http://192.168.1.36:9527/api/riwa-api-types-0.0.29.tgz",
|
"@riwa/api-types": "http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz",
|
||||||
"@tailwindcss/vite": "^4.1.18",
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
"@vee-validate/yup": "^4.15.1",
|
"@vee-validate/yup": "^4.15.1",
|
||||||
"@vueuse/core": "^14.1.0",
|
"@vueuse/core": "^14.1.0",
|
||||||
|
|||||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -45,8 +45,8 @@ importers:
|
|||||||
specifier: ^8.7.11
|
specifier: ^8.7.11
|
||||||
version: 8.7.11(@stencil/core@4.39.0)(vue-router@4.6.3(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3))
|
version: 8.7.11(@stencil/core@4.39.0)(vue-router@4.6.3(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3))
|
||||||
'@riwa/api-types':
|
'@riwa/api-types':
|
||||||
specifier: http://192.168.1.36:9527/api/riwa-api-types-0.0.29.tgz
|
specifier: http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz
|
||||||
version: http://192.168.1.36:9527/api/riwa-api-types-0.0.29.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
version: http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
||||||
'@tailwindcss/vite':
|
'@tailwindcss/vite':
|
||||||
specifier: ^4.1.18
|
specifier: ^4.1.18
|
||||||
version: 4.1.18(vite@7.2.7(@types/node@24.10.2)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(yaml@2.8.2))
|
version: 4.1.18(vite@7.2.7(@types/node@24.10.2)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(yaml@2.8.2))
|
||||||
@@ -1302,9 +1302,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==}
|
resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==}
|
||||||
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
|
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
|
||||||
|
|
||||||
'@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.29.tgz':
|
'@riwa/api-types@http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz':
|
||||||
resolution: {tarball: http://192.168.1.36:9527/api/riwa-api-types-0.0.29.tgz}
|
resolution: {tarball: http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz}
|
||||||
version: 0.0.29
|
version: 0.0.30
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@elysiajs/eden': ^1.4.5
|
'@elysiajs/eden': ^1.4.5
|
||||||
|
|
||||||
@@ -6341,7 +6341,7 @@ snapshots:
|
|||||||
|
|
||||||
'@pkgr/core@0.2.9': {}
|
'@pkgr/core@0.2.9': {}
|
||||||
|
|
||||||
'@riwa/api-types@http://192.168.1.36:9527/api/riwa-api-types-0.0.29.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
'@riwa/api-types@http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@elysiajs/eden': 1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))
|
'@elysiajs/eden': 1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { App } from "@riwa/api-types";
|
import type { App } from "@riwa/api-types";
|
||||||
import type { Awaitable } from "@vueuse/core";
|
import type { WatchSource } from "vue";
|
||||||
import { treaty } from "@elysiajs/eden";
|
import { treaty } from "@elysiajs/eden";
|
||||||
import { toastController } from "@ionic/vue";
|
import { toastController } from "@ionic/vue";
|
||||||
|
|
||||||
@@ -12,26 +12,42 @@ const client = treaty<App>(window.location.origin, {
|
|||||||
export interface SafeClientOptions {
|
export interface SafeClientOptions {
|
||||||
silent?: boolean;
|
silent?: boolean;
|
||||||
immediate?: boolean;
|
immediate?: boolean;
|
||||||
|
watchSource?: WatchSource; // 用于监听的响应式数据源
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SafeClientReturn<T, E> {
|
export interface SafeClientReturn<T, E> {
|
||||||
data: Ref<T | null>;
|
data: Ref<T | null>;
|
||||||
error: Ref<E | null>;
|
error: Ref<E | null>;
|
||||||
refresh: () => Promise<void>;
|
isPending: Ref<boolean>;
|
||||||
|
execute: () => Promise<void>;
|
||||||
onFetchResponse: (callback: (data: T, error: E) => void) => void;
|
onFetchResponse: (callback: (data: T, error: E) => void) => void;
|
||||||
|
stopWatching?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function safeClient<T, E>(
|
export function safeClient<T, E>(
|
||||||
requestPromise: () => Promise<{ data: T; error: E }>,
|
requestPromise: (() => Promise<{ data: T; error: E }>) | Promise<{ data: T; error: E }>,
|
||||||
options: SafeClientOptions = {},
|
options: SafeClientOptions = {},
|
||||||
): SafeClientReturn<T, E> & Promise<SafeClientReturn<T, E>> {
|
): SafeClientReturn<T, E> & Promise<SafeClientReturn<T, E>> {
|
||||||
const { immediate = true } = options;
|
const { immediate = true, watchSource } = options;
|
||||||
const data = ref<T | null>(null);
|
const data = ref<T | null>(null);
|
||||||
const error = ref<E | null>(null);
|
const error = ref<E | null>(null);
|
||||||
|
const isPending = ref(false);
|
||||||
let responseCallback: ((data: T, error: E) => void) | null = null;
|
let responseCallback: ((data: T, error: E) => void) | null = null;
|
||||||
|
let stopWatcher: (() => void) | undefined;
|
||||||
|
|
||||||
const execute = async () => {
|
const execute = async () => {
|
||||||
const res = await requestPromise();
|
isPending.value = true;
|
||||||
|
let request: () => Promise<{ data: T; error: E }>;
|
||||||
|
if (typeof requestPromise !== "function") {
|
||||||
|
request = () => Promise.resolve(requestPromise);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
request = requestPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await request().finally(() => {
|
||||||
|
isPending.value = false;
|
||||||
|
});
|
||||||
|
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
@@ -44,6 +60,7 @@ export function safeClient<T, E>(
|
|||||||
else if (res.error && "value" in (res.error as unknown as object)) {
|
else if (res.error && "value" in (res.error as unknown as object)) {
|
||||||
errMsg = String((res.error as unknown as { value: string }).value);
|
errMsg = String((res.error as unknown as { value: string }).value);
|
||||||
}
|
}
|
||||||
|
// if(res.error && typeof res.error === 'object' && 'err' in res.error) {
|
||||||
if (!options.silent) {
|
if (!options.silent) {
|
||||||
const toast = await toastController.create({
|
const toast = await toastController.create({
|
||||||
message: errMsg,
|
message: errMsg,
|
||||||
@@ -69,17 +86,35 @@ export function safeClient<T, E>(
|
|||||||
responseCallback = callback;
|
responseCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stopWatching() {
|
||||||
|
if (stopWatcher) {
|
||||||
|
stopWatcher();
|
||||||
|
stopWatcher = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果提供了 watchSource,则监听其变化
|
||||||
|
if (watchSource) {
|
||||||
|
stopWatcher = watch(
|
||||||
|
watchSource,
|
||||||
|
() => {
|
||||||
|
execute();
|
||||||
|
},
|
||||||
|
{ immediate: false }, // 不立即执行,避免与 immediate 选项冲突
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const result: SafeClientReturn<T, E> = {
|
const result: SafeClientReturn<T, E> = {
|
||||||
data: data as Ref<T | null>,
|
data: data as Ref<T | null>,
|
||||||
error: error as Ref<E | null>,
|
error: error as Ref<E | null>,
|
||||||
refresh: execute,
|
isPending,
|
||||||
|
execute,
|
||||||
onFetchResponse,
|
onFetchResponse,
|
||||||
|
stopWatching,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 创建一个 Promise 并在其上添加属性
|
|
||||||
const promise = immediate ? execute().then(() => result) : Promise.resolve(result);
|
const promise = immediate ? execute().then(() => result) : Promise.resolve(result);
|
||||||
|
|
||||||
// 将 result 的属性添加到 promise 上
|
|
||||||
Object.assign(promise, result);
|
Object.assign(promise, result);
|
||||||
|
|
||||||
return promise as SafeClientReturn<T, E> & Promise<SafeClientReturn<T, E>>;
|
return promise as SafeClientReturn<T, E> & Promise<SafeClientReturn<T, E>>;
|
||||||
|
|||||||
@@ -45,3 +45,5 @@ export type SupportBanksData = Treaty.Data<typeof client.api.bank_account.banks.
|
|||||||
export type AvailableSubscriptionData = Treaty.Data<typeof client.api.rwa.subscription.available_editions.get>;
|
export type AvailableSubscriptionData = Treaty.Data<typeof client.api.rwa.subscription.available_editions.get>;
|
||||||
|
|
||||||
export type AvailableSubscriptionBody = TreatyQuery<typeof client.api.rwa.subscription.available_editions.get>;
|
export type AvailableSubscriptionBody = TreatyQuery<typeof client.api.rwa.subscription.available_editions.get>;
|
||||||
|
|
||||||
|
export type RwaData = Treaty.Data<typeof client.api.rwa.subscription.available_editions.get>;
|
||||||
|
|||||||
@@ -3,14 +3,20 @@ import type { FieldBindingObject } from "vee-validate";
|
|||||||
|
|
||||||
interface Props extends FieldBindingObject {
|
interface Props extends FieldBindingObject {
|
||||||
label?: string;
|
label?: string;
|
||||||
|
formatterValue?: (value: string) => string;
|
||||||
|
format?: (value: string) => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
function handleChange(value: string) {
|
function handleChange(value: string) {
|
||||||
const formattedValue = useDateFormat(value, "YYYY/MM/DD").value;
|
const formattedValue = props.formatterValue ? props.formatterValue(value) : new Date(value).toISOString();
|
||||||
props.onChange(formattedValue);
|
props.onChange(formattedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatDisplay(value: string) {
|
||||||
|
return props.format ? props.format(value) : useDateFormat(value, "YYYY/MM/DD").value;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -20,7 +26,7 @@ function handleChange(value: string) {
|
|||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-datetime-button datetime="datetime" color="primary">
|
<ion-datetime-button datetime="datetime" color="primary">
|
||||||
<div slot="date-target">
|
<div slot="date-target">
|
||||||
{{ props.value }}
|
{{ formatDisplay(props.value) }}
|
||||||
</div>
|
</div>
|
||||||
</ion-datetime-button>
|
</ion-datetime-button>
|
||||||
<ion-modal :keep-contents-mounted="true">
|
<ion-modal :keep-contents-mounted="true">
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
--border-radius: 8px;
|
--border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ui-header {
|
||||||
|
background: var(--ion-color-primary-contrast);
|
||||||
|
}
|
||||||
|
|
||||||
ion-datetime.ui-datetime {
|
ion-datetime.ui-datetime {
|
||||||
--background: rgb(255 255 255);
|
--background: rgb(255 255 255);
|
||||||
--background-rgb: 255, 255, 255;
|
--background-rgb: 255, 255, 255;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import Done from "./done.vue";
|
|||||||
import IssuePeriod from "./issue-period.vue";
|
import IssuePeriod from "./issue-period.vue";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const now = useNow();
|
|
||||||
const { data: categories, onFetchResponse } = await safeClient(() => client.api.rwa.issuance.categories.get());
|
const { data: categories, onFetchResponse } = await safeClient(() => client.api.rwa.issuance.categories.get());
|
||||||
|
|
||||||
const step = useRouteQuery<number>("step", 1, { transform: v => Number(v), mode: "push" });
|
const step = useRouteQuery<number>("step", 1, { transform: v => Number(v), mode: "push" });
|
||||||
@@ -22,9 +21,9 @@ const initialData: RwaIssuanceProductBody = {
|
|||||||
editions: [
|
editions: [
|
||||||
{
|
{
|
||||||
editionName: "",
|
editionName: "",
|
||||||
launchDate: useDateFormat(now.value, "YYYY/MM/DD").value,
|
launchDate: new Date(),
|
||||||
perUserLimit: "",
|
perUserLimit: "",
|
||||||
subscriptionDeadline: useDateFormat(now.value, "YYYY/MM/DD").value,
|
subscriptionDeadline: new Date(),
|
||||||
totalSupply: "",
|
totalSupply: "",
|
||||||
unitPrice: "",
|
unitPrice: "",
|
||||||
dividendRate: "",
|
dividendRate: "",
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ const now = useNow();
|
|||||||
|
|
||||||
const initialIssuePeriod: RwaIssuanceProductBody["editions"][0] = {
|
const initialIssuePeriod: RwaIssuanceProductBody["editions"][0] = {
|
||||||
editionName: "",
|
editionName: "",
|
||||||
launchDate: useDateFormat(now.value, "YYYY/MM/DD").value,
|
launchDate: new Date(),
|
||||||
perUserLimit: "",
|
perUserLimit: "",
|
||||||
subscriptionDeadline: useDateFormat(now.value, "YYYY/MM/DD").value,
|
subscriptionDeadline: new Date(),
|
||||||
totalSupply: "",
|
totalSupply: "",
|
||||||
unitPrice: "",
|
unitPrice: "",
|
||||||
dividendRate: "",
|
dividendRate: "",
|
||||||
@@ -47,6 +47,11 @@ const schema = toTypedSchema(yup.object({
|
|||||||
function handleSubmit(values: GenericObject) {
|
function handleSubmit(values: GenericObject) {
|
||||||
emit("submit", values.editions);
|
emit("submit", values.editions);
|
||||||
}
|
}
|
||||||
|
function handleChange(event: Event) {
|
||||||
|
debugger;
|
||||||
|
const input = event.target as HTMLInputElement;
|
||||||
|
return new Date(input.value);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -71,6 +76,7 @@ function handleSubmit(values: GenericObject) {
|
|||||||
<ui-datetime
|
<ui-datetime
|
||||||
v-bind="field"
|
v-bind="field"
|
||||||
:label="t('asset.issue.apply.launchDate')"
|
:label="t('asset.issue.apply.launchDate')"
|
||||||
|
:formatter-value="(val) => new Date(val).toISOString()"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Field>
|
</Field>
|
||||||
@@ -113,6 +119,7 @@ function handleSubmit(values: GenericObject) {
|
|||||||
<ui-datetime
|
<ui-datetime
|
||||||
v-bind="field"
|
v-bind="field"
|
||||||
:label="t('asset.issue.apply.subscriptionDeadline')"
|
:label="t('asset.issue.apply.subscriptionDeadline')"
|
||||||
|
:formatter-value="(val) => new Date(val).toISOString()"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Field>
|
</Field>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const { data: categories } = await safeClient(() => client.api.rwa.issuance.cate
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ion-content :scroll-x="true" :scroll-y="false" class="w-full h-10">
|
<ion-content :scroll-x="true" :scroll-y="false" class="w-full h-6">
|
||||||
<div class="flex items-center whitespace-nowrap space-x-4">
|
<div class="flex items-center whitespace-nowrap space-x-4">
|
||||||
<div class="item" :class="{ active: model === '' }" @click="model = ''">
|
<div class="item" :class="{ active: model === '' }" @click="model = ''">
|
||||||
全部
|
全部
|
||||||
|
|||||||
71
src/views/market/components/rwa-list.vue
Normal file
71
src/views/market/components/rwa-list.vue
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<script lang='ts' setup>
|
||||||
|
import type { RwaData } from "@/api/types";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: RwaData["data"];
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ion-list lines="none" class="space-y-2">
|
||||||
|
<ion-item>
|
||||||
|
<ion-grid>
|
||||||
|
<ion-row class="ion-align-items-center text-xs">
|
||||||
|
<ion-col size="6">
|
||||||
|
<div>名称/代码</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col>
|
||||||
|
<div class="text-right">
|
||||||
|
阶段
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col>
|
||||||
|
<div class="text-right">
|
||||||
|
发行日期
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col>
|
||||||
|
<div class="text-right">
|
||||||
|
申购单价
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
||||||
|
</ion-grid>
|
||||||
|
</ion-item>
|
||||||
|
<ion-item v-for="item in data" :key="item.id">
|
||||||
|
<ion-grid>
|
||||||
|
<ion-row class="ion-align-items-center space-y-5">
|
||||||
|
<ion-col size="6">
|
||||||
|
<div>
|
||||||
|
<div class="font-semibold mb-1 truncate">
|
||||||
|
{{ item.product?.name }}
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-text-500 font-bold">
|
||||||
|
{{ item.product?.code }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col>
|
||||||
|
<div class="text-xs text-right">
|
||||||
|
{{ item.editionName }}
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col>
|
||||||
|
<div class="text-xs text-right">
|
||||||
|
{{ useDateFormat(item.launchDate!, 'MM/DD') }}
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
<ion-col>
|
||||||
|
<div v-if="item.unitPrice" class="text-right">
|
||||||
|
<div class="text-lg font-bold text-primary">
|
||||||
|
${{ Number(item.unitPrice) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
||||||
|
</ion-grid>
|
||||||
|
</ion-item>
|
||||||
|
</ion-list>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang='css' scoped></style>
|
||||||
@@ -1,80 +1,86 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { AvailableSubscriptionBody } from "@/api/types";
|
import type { InfiniteScrollCustomEvent, RefresherCustomEvent } from "@ionic/vue";
|
||||||
|
import type { AvailableSubscriptionBody, RwaData } from "@/api/types";
|
||||||
import { client, safeClient } from "@/api";
|
import { client, safeClient } from "@/api";
|
||||||
import Category from "./components/category.vue";
|
import Category from "./components/category.vue";
|
||||||
|
import RwaList from "./components/rwa-list.vue";
|
||||||
|
|
||||||
const [query] = useResetRef<AvailableSubscriptionBody>({
|
const [query] = useResetRef<AvailableSubscriptionBody>({
|
||||||
pageIndex: 1,
|
limit: 20,
|
||||||
pageSize: 20,
|
offset: 0,
|
||||||
categoryId: "",
|
categoryId: "",
|
||||||
});
|
});
|
||||||
const { data, refresh } = safeClient(() => client.api.rwa.subscription.available_editions.get({
|
const rwaData = ref<RwaData["data"]>([]);
|
||||||
|
const isFinished = ref(false);
|
||||||
|
|
||||||
|
async function fetchRwaData() {
|
||||||
|
const { data } = await safeClient(() => client.api.rwa.subscription.available_editions.get({
|
||||||
query: query.value,
|
query: query.value,
|
||||||
}));
|
}));
|
||||||
const tradingViewContainer = useTemplateRef<HTMLDivElement>("tradingViewContainer");
|
rwaData.value.push(...(data.value?.data || []));
|
||||||
|
isFinished.value = (data.value?.data.length || 0) < query.value.limit!;
|
||||||
|
}
|
||||||
|
function resetRwaData() {
|
||||||
|
query.value.offset = 0;
|
||||||
|
rwaData.value = [];
|
||||||
|
isFinished.value = false;
|
||||||
|
}
|
||||||
|
async function handleRefresh(event: RefresherCustomEvent) {
|
||||||
|
resetRwaData();
|
||||||
|
await fetchRwaData();
|
||||||
|
setTimeout(() => {
|
||||||
|
event.target.complete();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
const tradingViewData = ref<any[]>([{ open: 10, high: 10.63, low: 9.49, close: 9.55, time: 1642427876 }, { open: 9.55, high: 10.30, low: 9.42, close: 9.94, time: 1642514276 }, { open: 9.94, high: 10.17, low: 9.92, close: 9.78, time: 1642600676 }, { open: 9.78, high: 10.59, low: 9.18, close: 9.51, time: 1642687076 }, { open: 9.51, high: 10.46, low: 9.10, close: 10.17, time: 1642773476 }, { open: 10.17, high: 10.96, low: 10.16, close: 10.47, time: 1642859876 }, { open: 10.47, high: 11.39, low: 10.40, close: 10.81, time: 1642946276 }, { open: 10.81, high: 11.60, low: 10.30, close: 10.75, time: 1643032676 }, { open: 10.75, high: 11.60, low: 10.49, close: 10.93, time: 1643119076 }, { open: 10.93, high: 11.53, low: 10.76, close: 10.96, time: 1643205476 }]);
|
async function handleInfinite(event: InfiniteScrollCustomEvent) {
|
||||||
|
if (isFinished.value) {
|
||||||
setInterval(() => {
|
event.target.complete();
|
||||||
const lastData = tradingViewData.value[tradingViewData.value.length - 1];
|
event.target.disabled = true;
|
||||||
const lastClose = lastData.close;
|
return;
|
||||||
const lastTime = lastData.time;
|
|
||||||
|
|
||||||
const changePercent = (Math.random() - 0.5) * 0.04;
|
|
||||||
const open = lastClose;
|
|
||||||
const close = open * (1 + changePercent);
|
|
||||||
|
|
||||||
const volatility = Math.random() * 0.02;
|
|
||||||
const high = Math.max(open, close) * (1 + volatility);
|
|
||||||
const low = Math.min(open, close) * (1 - volatility);
|
|
||||||
|
|
||||||
const newTime = lastTime + 60;
|
|
||||||
|
|
||||||
const newData = {
|
|
||||||
open: Number(open.toFixed(2)),
|
|
||||||
high: Number(high.toFixed(2)),
|
|
||||||
low: Number(low.toFixed(2)),
|
|
||||||
close: Number(close.toFixed(2)),
|
|
||||||
time: newTime,
|
|
||||||
};
|
|
||||||
|
|
||||||
tradingViewData.value.push(newData);
|
|
||||||
|
|
||||||
if (tradingViewData.value.length > 50) {
|
|
||||||
tradingViewData.value.shift();
|
|
||||||
}
|
}
|
||||||
}, 1000);
|
query.value.offset! += query.value.limit!;
|
||||||
|
await fetchRwaData();
|
||||||
|
setTimeout(() => {
|
||||||
|
event.target.complete();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
const { resize } = useTradingView(tradingViewContainer, {
|
watch(() => query.value.categoryId, async () => {
|
||||||
data: tradingViewData,
|
resetRwaData();
|
||||||
|
await fetchRwaData();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(query, () => {
|
onBeforeMount(() => {
|
||||||
refresh();
|
fetchRwaData();
|
||||||
}, { deep: true });
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<IonPage>
|
<IonPage>
|
||||||
<IonHeader>
|
<IonHeader class="ion-padding ui-header">
|
||||||
<IonToolbar class="ui-toolbar">
|
<ion-searchbar placeholder=" Search" />
|
||||||
<ion-title>Market</ion-title>
|
<Category v-model="query!.categoryId" />
|
||||||
</IonToolbar>
|
|
||||||
<ion-toolbar class="ui-toolbar">
|
|
||||||
<ion-searchbar />
|
|
||||||
</ion-toolbar>
|
|
||||||
</IonHeader>
|
</IonHeader>
|
||||||
<IonContent :fullscreen="true" class="ion-padding">
|
<IonContent :fullscreen="true" class="ion-padding">
|
||||||
<ui-tabs sticky>
|
<ion-refresher slot="fixed" @ion-refresh="handleRefresh($event)">
|
||||||
<ui-tab-pane name="spot" title="Digital Products" class="py-5">
|
<ion-refresher-content />
|
||||||
<Category v-model="query!.categoryId" />
|
</ion-refresher>
|
||||||
<ion-content :scroll-y="true" />
|
|
||||||
<div ref="tradingViewContainer" class="w-full h-80" />
|
<RwaList :data="rwaData" />
|
||||||
</ui-tab-pane>
|
|
||||||
<ui-tab-pane name="futures" title="Tokenized Products" class="py-5">
|
<ion-infinite-scroll threshold="100px" @ion-infinite="handleInfinite">
|
||||||
<div>Futures Market Content</div>
|
<ion-infinite-scroll-content
|
||||||
</ui-tab-pane>
|
loading-spinner="bubbles"
|
||||||
</ui-tabs>
|
loading-text="加载更多..."
|
||||||
|
/>
|
||||||
|
</ion-infinite-scroll>
|
||||||
</IonContent>
|
</IonContent>
|
||||||
</IonPage>
|
</IonPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
ion-searchbar {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const { t } = useI18n();
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { updateBankAccounts } = useWalletStore();
|
const { updateBankAccounts } = useWalletStore();
|
||||||
|
|
||||||
const { data, refresh, onFetchResponse } = await safeClient(() => client.api.bank_account.get());
|
const { data, execute, onFetchResponse } = await safeClient(() => client.api.bank_account.get());
|
||||||
const bankCards = computed(() => data.value?.data || []);
|
const bankCards = computed(() => data.value?.data || []);
|
||||||
|
|
||||||
onFetchResponse((data) => {
|
onFetchResponse((data) => {
|
||||||
@@ -64,7 +64,7 @@ async function handleSetDefault(card: any) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await toast.present();
|
await toast.present();
|
||||||
refresh();
|
execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除银行卡
|
// 删除银行卡
|
||||||
@@ -89,7 +89,7 @@ async function handleDeleteCard(card: any) {
|
|||||||
color: "success",
|
color: "success",
|
||||||
});
|
});
|
||||||
await toast.present();
|
await toast.present();
|
||||||
refresh();
|
execute();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -99,7 +99,7 @@ async function handleDeleteCard(card: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onUpdated(() => {
|
onUpdated(() => {
|
||||||
refresh();
|
execute();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ onUpdated(() => {
|
|||||||
<IonContent :fullscreen="true">
|
<IonContent :fullscreen="true">
|
||||||
<div class="min-h-full">
|
<div class="min-h-full">
|
||||||
<div v-if="bankCards?.length === 0" class="flex flex-col items-center justify-center min-h-[60vh] p-8 text-center">
|
<div v-if="bankCards?.length === 0" class="flex flex-col items-center justify-center min-h-[60vh] p-8 text-center">
|
||||||
<div class="w-20 h-20 rounded-full bg-linear-to-br from-indigo-500 to-purple-600 flex items-center justify-center mb-6 shadow-lg shadow-indigo-500/30">
|
<div class="w-20 h-20 rounded-full bg-[#171717] flex items-center justify-center mb-6 shadow-lg">
|
||||||
<ion-icon :icon="cardOutline" class="text-4xl text-white" />
|
<ion-icon :icon="cardOutline" class="text-4xl text-white" />
|
||||||
</div>
|
</div>
|
||||||
<h3 class="text-xl font-semibold text-#151515 dark:text-white mb-2">
|
<h3 class="text-xl font-semibold text-#151515 dark:text-white mb-2">
|
||||||
@@ -126,7 +126,7 @@ onUpdated(() => {
|
|||||||
</p>
|
</p>
|
||||||
<ion-button
|
<ion-button
|
||||||
expand="block"
|
expand="block"
|
||||||
class="h-12 font-semibold"
|
color="success"
|
||||||
@click="handleAddCard"
|
@click="handleAddCard"
|
||||||
>
|
>
|
||||||
<ion-icon slot="start" :icon="addOutline" />
|
<ion-icon slot="start" :icon="addOutline" />
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { RefresherCustomEvent } from "@ionic/vue";
|
||||||
import { notificationsOutline, scanOutline, settingsOutline } from "ionicons/icons";
|
import { notificationsOutline, scanOutline, settingsOutline } from "ionicons/icons";
|
||||||
import Asset from "./components/asset.vue";
|
import Asset from "./components/asset.vue";
|
||||||
import IssuingAsset from "./components/issuing-asset.vue";
|
import IssuingAsset from "./components/issuing-asset.vue";
|
||||||
@@ -6,6 +7,17 @@ import MyRevenue from "./components/my-revenue.vue";
|
|||||||
import TradeSettings from "./components/trade-settings.vue";
|
import TradeSettings from "./components/trade-settings.vue";
|
||||||
import UserInfo from "./components/user-info.vue";
|
import UserInfo from "./components/user-info.vue";
|
||||||
import WalletCard from "./components/wallet-card.vue";
|
import WalletCard from "./components/wallet-card.vue";
|
||||||
|
|
||||||
|
const { vibrate } = useHaptics();
|
||||||
|
const walletStore = useWalletStore();
|
||||||
|
|
||||||
|
async function handleRefresh(event: RefresherCustomEvent) {
|
||||||
|
vibrate();
|
||||||
|
await walletStore.initializeWallet();
|
||||||
|
setTimeout(() => {
|
||||||
|
event.target.complete();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -26,6 +38,10 @@ import WalletCard from "./components/wallet-card.vue";
|
|||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<IonContent :fullscreen="true" class="ion-padding">
|
<IonContent :fullscreen="true" class="ion-padding">
|
||||||
|
<ion-refresher slot="fixed" @ion-refresh="handleRefresh($event)">
|
||||||
|
<ion-refresher-content />
|
||||||
|
</ion-refresher>
|
||||||
|
|
||||||
<div class="flex flex-col space-y-5">
|
<div class="flex flex-col space-y-5">
|
||||||
<UserInfo />
|
<UserInfo />
|
||||||
<WalletCard />
|
<WalletCard />
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import process from "node:process";
|
||||||
import tailwindcss from "@tailwindcss/vite";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
import legacy from "@vitejs/plugin-legacy";
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
@@ -11,9 +12,7 @@ import { IonicResolver } from "unplugin-vue-components/resolvers";
|
|||||||
import components from "unplugin-vue-components/vite";
|
import components from "unplugin-vue-components/vite";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
const env = dotenv.config({ path: `.env` }).parsed as Record<string, string>;
|
dotenv.config({ path: `.env.${process.env.NODE_ENV}` });
|
||||||
|
|
||||||
console.log("🚀 ~ file: vite.config.ts ~ env:", env);
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@@ -45,7 +44,7 @@ export default defineConfig({
|
|||||||
host: true,
|
host: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: env.VITE_API_URL,
|
target: process.env.VITE_API_URL,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user