1404/10/28-base

This commit is contained in:
2026-01-18 13:01:46 +03:30
parent f95b0cef95
commit 9d96ae106b
455 changed files with 58164 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import { computed, ref } from 'vue'
// import { get } from 'lodash'
import { defineStore } from 'pinia'
import { getMe } from '@/api/me'
import type { User } from '@/models/login'
import { useWalletStore } from '@/store/walletStore'
import {authenticateWithFingerprint, setFingerPrint} from '@/utils'
import type { PWallet } from '@/models/wallet'
import {getConfig} from "@/api/config";
export const useConfigStore = defineStore('config', () => {
const config=ref()
async function getConfigData(){
let temp=await getConfig()
config.value=temp.user
console.log(config.value)
}
return {
config,
getConfigData
}
})
+39
View File
@@ -0,0 +1,39 @@
import { type ComputedRef, ref } from 'vue'
// import { get } from 'lodash'
import {defineStore} from "pinia";
import {getMe} from "@/api/me";
import {getFundTable} from "@/api/fund";
import type {Fund} from "@/models/fund";
import type {TableOutput} from "@/models/table";
import { getProductInventory } from '@/api/products'
export const useFundUserStore = defineStore('fund', () => {
const myFunds = ref<TableOutput<Fund> | undefined>(undefined)
async function getMyFund() {
try {
console.log('fff')
myFunds.value = await getProductInventory()
return myFunds.value
} catch (e) {
console.log(e)
}
}
/* const permissions: ComputedRef<string[]> = computed(() => {
const permissions: string[] = get(userInfo.value, 'permission', [])
const excludes: string[] = get(userInfo.value, 'exclude', [])
return permissions.filter((item) => !excludes.includes(item))
})*/
/*
function canAccess(permissionKey: string) {
if (isAdmin.value) return true
return permissions.value.includes(permissionKey)
}
*/
/*
const isAdmin = computed(() => {
return userInfo.value?.is_admin
})*/
return { getMyFund, myFunds/* permissions, canAccess, isAdmin*/ }
})
+12
View File
@@ -0,0 +1,12 @@
import { defineStore } from 'pinia'
export const useAuthStore = defineStore('auth', {
state: () => ({
loading: false,
}),
actions: {
setLoading(isLoading) {
this.loading = isLoading
}
}
})
+60
View File
@@ -0,0 +1,60 @@
import { computed, ref } from 'vue'
// import { get } from 'lodash'
import { defineStore } from 'pinia'
import { getMe } from '@/api/me'
import type { User } from '@/models/login'
import { useWalletStore } from '@/store/walletStore'
import { setFingerPrint } from '@/utils'
import type { PWallet } from '@/models/wallet'
export const useUserStore = defineStore('user', () => {
const userInfo = ref<User | undefined>(undefined)
const walletStore = useWalletStore()
const productWallet = ref<PWallet[] | undefined>(undefined)
let isFirst = true
async function getMyInfo() {
try {
userInfo.value = await getMe()
setFingerPrint(userInfo.value.finger_print.toString())
productWallet.value = userInfo.value.pwallet
// return userInfo.value
walletStore.walletInfo = userInfo.value.wallet
} catch (e) {
console.log(e)
}
}
function removeInformation() {
userInfo.value = undefined
}
const isSingle = computed(() => userInfo.value?.type === 2)
/* const permissions: ComputedRef<string[]> = computed(() => {
const permissions: string[] = get(userInfo.value, 'permission', [])
const excludes: string[] = get(userInfo.value, 'exclude', [])
return permissions.filter((item) => !excludes.includes(item))
})*/
/*
function canAccess(permissionKey: string) {
if (isAdmin.value) return true
return permissions.value.includes(permissionKey)
}
*/
/*
const isAdmin = computed(() => {
return userInfo.value?.is_admin
})*/
return {
userInfo,
getMyInfo,
removeInformation,
isSingle,
isFirst,
productWallet/* permissions, canAccess, isAdmin*/
}
})
+58
View File
@@ -0,0 +1,58 @@
import { type ComputedRef, ref } from 'vue'
import {defineStore} from "pinia";
import {getMe} from "@/api/me";
import type {User} from "@/models/login";
import type {Wallet} from "@/models/wallet";
import {getWallet} from "@/api/wallet";
import type {Const} from "@/models/const";
import {getConstByKey} from "@/api/const";
export const useWalletStore = defineStore('wallet', () => {
const walletInfo = ref<Wallet | undefined>(undefined)
const limitedPrice = ref<Const[]>()
const limitedBuyGold = ref<Const[]>()
async function getMyWallet() {
try {
walletInfo.value = await getWallet()
return walletInfo.value
} catch (e) {
console.log(e)
}
}
async function getLimitedPrice(){
try {
limitedPrice.value = await getConstByKey('limited_price')
return limitedPrice.value
}catch (e) {
console.log(e)
}
}
async function getLimitedBuyGold(){
try {
limitedBuyGold.value = await getConstByKey('first_customer_wallet_value')
return limitedBuyGold.value
}catch (e) {
console.log(e)
}
}
/* const permissions: ComputedRef<string[]> = computed(() => {
const permissions: string[] = get(userInfo.value, 'permission', [])
const excludes: string[] = get(userInfo.value, 'exclude', [])
return permissions.filter((item) => !excludes.includes(item))
})*/
/*
function canAccess(permissionKey: string) {
if (isAdmin.value) return true
return permissions.value.includes(permissionKey)
}
*/
/*
const isAdmin = computed(() => {
return userInfo.value?.is_admin
})*/
return { walletInfo, getMyWallet, getLimitedPrice, getLimitedBuyGold, limitedPrice, limitedBuyGold/* permissions, canAccess, isAdmin*/ }
})