成都SKP导视横版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
869 B

import { useRouter } from 'vue-router'
import { storeToRefs } from 'pinia'
import { useRootStore } from '@/store/root'
import Brand from '@/utils/Class/Brand'
export const useActivityNav = () => {
const router = useRouter()
const store = useRootStore()
const { shopList } = storeToRefs(store)
const NO_POINT_TYPE = -1
function nav(activity: Activity) {
let shop
if (activity.shopCode.length) {
shop = shopList.value.find(item => item.shopCode === activity?.shopCode)
} else if (activity.point > NO_POINT_TYPE) {
const { activityName, floorOrder, floor, point, fileUrl, activityId } = activity
shop = new Brand({ shopName: activityName, floorOrder, floor, logoUrl: fileUrl, yaxis: point, shopCode: activityId })
}
if (!shop) {
return
}
store.SET_SHOP(shop)
router.push('/nav')
}
return { nav }
}