From 4ef2dee4b3727e192984e37c58c512a7eefab035 Mon Sep 17 00:00:00 2001 From: liyongle Date: Mon, 8 May 2023 14:54:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=9A=80=20=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E3=80=81=E6=B4=BB=E5=8A=A8=E3=80=81=E5=AD=A6=E9=99=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/offline/JSON/getArtList.json | 138 ++++++++++++++++++++ src/components/Carousel/Carousel.vue | 5 +- src/composables/useActivityNav.ts | 27 ---- src/composables/useInitConfigAndMallInfo.ts | 35 +++-- src/enums/index.ts | 12 ++ src/http/api/activity/index.ts | 10 -- src/http/api/base/index.ts | 4 + src/http/api/member/index.ts | 3 - src/store/root/actions.ts | 5 + src/store/root/state.ts | 5 +- src/types/activity.d.ts | 8 ++ src/views/Activity/Activity.vue | 16 ++- src/views/Member/Member.vue | 47 +++++-- src/views/School/School.vue | 16 ++- 14 files changed, 254 insertions(+), 77 deletions(-) create mode 100644 public/static/offline/JSON/getArtList.json delete mode 100644 src/composables/useActivityNav.ts delete mode 100644 src/http/api/activity/index.ts delete mode 100644 src/http/api/member/index.ts diff --git a/public/static/offline/JSON/getArtList.json b/public/static/offline/JSON/getArtList.json new file mode 100644 index 0000000..1344af9 --- /dev/null +++ b/public/static/offline/JSON/getArtList.json @@ -0,0 +1,138 @@ +{ + "code": 200, + "msg": "操作成功", + "data": [ + { + "fileCode": "U7L-31evFSZcHT-Cx_afU", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/U7L-31evFSZcHT-Cx_afU.jpg", + "flag": 2, + "artType": 2 + }, + { + "fileCode": "8eaU9Xr1gng_VA_J93wY4", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/8eaU9Xr1gng_VA_J93wY4.jpg", + "flag": 2, + "artType": 2 + }, + { + "fileCode": "waeW0L9rBMK2cgKfYq9p6", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/waeW0L9rBMK2cgKfYq9p6.jpg", + "flag": 2, + "artType": 2 + }, + { + "fileCode": "XWzK3bNnd4G7ZqvP3jKVC", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/XWzK3bNnd4G7ZqvP3jKVC.png", + "flag": 1, + "artType": 2 + }, + { + "fileCode": "wmDoGzz91VdkWXk21w3vc", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/wmDoGzz91VdkWXk21w3vc.png", + "flag": 1, + "artType": 2 + }, + { + "fileCode": "Tbbv6-r31zJ-nb_IwuCni", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/Tbbv6-r31zJ-nb_IwuCni.png", + "flag": 2, + "artType": 4 + }, + { + "fileCode": "rKqs6tfSx-YE9mVRs6jRH", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/rKqs6tfSx-YE9mVRs6jRH.png", + "flag": 1, + "artType": 4 + }, + { + "fileCode": "WeRFpcfjtc6se7VVlulv9", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/WeRFpcfjtc6se7VVlulv9.png", + "flag": 1, + "artType": 4 + }, + { + "fileCode": "9BB20uH7LsAUCs9G5bLn1", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/9BB20uH7LsAUCs9G5bLn1.jpeg", + "flag": 1, + "artType": 1 + }, + { + "fileCode": "xyU-DUq-t_RrrDIuzsVaA", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/xyU-DUq-t_RrrDIuzsVaA.png", + "flag": 2, + "artType": 1 + }, + { + "fileCode": "sp9psNqTdHdvB_Hrjkoi_", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/sp9psNqTdHdvB_Hrjkoi_.png", + "flag": 1, + "artType": 1 + }, + { + "fileCode": "PDUU-eWClnBaf75GvkLtl", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230505/PDUU-eWClnBaf75GvkLtl.png", + "flag": 1, + "artType": 3 + }, + { + "fileCode": "Gb1NiXqSAxQkdd2izaPJO", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/Gb1NiXqSAxQkdd2izaPJO.png", + "flag": 2, + "artType": 1 + }, + { + "fileCode": "Fmk6kcf07YcAJp7sw2ZQb", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/Fmk6kcf07YcAJp7sw2ZQb.png", + "flag": 2, + "artType": 1 + }, + { + "fileCode": "4oeWRq44Yib1ZLJv--7XX", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/4oeWRq44Yib1ZLJv--7XX.png", + "flag": 2, + "artType": 1 + }, + { + "fileCode": "WO3JKVPWJ_y82uNR-p2nA", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/WO3JKVPWJ_y82uNR-p2nA.png", + "flag": 2, + "artType": 1 + }, + { + "fileCode": "MRSnm9ILLTcU5R_ILNipY", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/MRSnm9ILLTcU5R_ILNipY.png", + "flag": 2, + "artType": 1 + }, + { + "fileCode": "KtAw80_3z8nCffxts0eGB", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/KtAw80_3z8nCffxts0eGB.png", + "flag": 2, + "artType": 1 + }, + { + "fileCode": "Z-KsfCiytrn3_5cj__5KY", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/Z-KsfCiytrn3_5cj__5KY.png", + "flag": 2, + "artType": 1 + }, + { + "fileCode": "Hve3AxoPDuLx42ObwtW76", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/Hve3AxoPDuLx42ObwtW76.png", + "flag": 2, + "artType": 2 + }, + { + "fileCode": "u-LrcbOriATjX4QeX2FJq", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/u-LrcbOriATjX4QeX2FJq.png", + "flag": 1, + "artType": 2 + }, + { + "fileCode": "PMUBs8-cvNM9FqzO1Ozyx", + "fileUrl": "/iotFile/project-bffju2pfalsylhcfcuzgaa/20230506/PMUBs8-cvNM9FqzO1Ozyx.png", + "flag": 1, + "artType": 2 + } + ] +} diff --git a/src/components/Carousel/Carousel.vue b/src/components/Carousel/Carousel.vue index f519c40..27dfa64 100644 --- a/src/components/Carousel/Carousel.vue +++ b/src/components/Carousel/Carousel.vue @@ -12,7 +12,7 @@ :dynamic-bullets="true" class="myswiper" > - + @@ -25,8 +25,9 @@ import { Swiper, SwiperSlide } from 'swiper/vue' import { Autoplay, Pagination } from 'swiper' import 'swiper/css' import 'swiper/css/pagination' +import type { Picture } from '@/types/activity' type AcType = { - acList: any + acList: Picture[] } defineProps() const modules = ref([Autoplay, Pagination]) diff --git a/src/composables/useActivityNav.ts b/src/composables/useActivityNav.ts deleted file mode 100644 index 2912b15..0000000 --- a/src/composables/useActivityNav.ts +++ /dev/null @@ -1,27 +0,0 @@ -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) - - function nav(activity: Activity) { - let shop - if (activity.shopCode.length) { - shop = shopList.value.find(item => item.shopCode === activity?.shopCode) - } else if (activity.point > -1) { - 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 } -} diff --git a/src/composables/useInitConfigAndMallInfo.ts b/src/composables/useInitConfigAndMallInfo.ts index 112d8fe..4baa7c9 100644 --- a/src/composables/useInitConfigAndMallInfo.ts +++ b/src/composables/useInitConfigAndMallInfo.ts @@ -1,5 +1,5 @@ import { useRootStore } from '@/store/root' -import { getConfig, getFacilitiesList, getWeather } from '@/http/api/base' +import { getConfig, getFacilitiesList, getWeather, getArtList } from '@/http/api/base' import { getShopAndBuildingList } from '@/http/api/shop' import { getDeviceInfo } from '@/http/api/building' import { getShopListByFloor, getShopListByIndustry, getBrandInfo } from '@/http/api/brand' @@ -12,17 +12,27 @@ export const useInitConfigAndMallInfo = async () => { const store = useRootStore() store.SET_CONFIG(_config.data) - const [_DeviceInfo, _shopAndBuilding, _facilityList, _weather, _shopListByFloor, _shopListByIndustry, _brandInfo, _menuList] = - await Promise.all([ - getDeviceInfo(), - getShopAndBuildingList(), - getFacilitiesList(), - getWeather(), - getShopListByFloor(), - getShopListByIndustry(), - getBrandInfo(), - getModuleList() - ]) + const [ + _DeviceInfo, + _shopAndBuilding, + _facilityList, + _weather, + _shopListByFloor, + _shopListByIndustry, + _brandInfo, + _menuList, + _pictureList + ] = await Promise.all([ + getDeviceInfo(), + getShopAndBuildingList(), + getFacilitiesList(), + getWeather(), + getShopListByFloor(), + getShopListByIndustry(), + getBrandInfo(), + getModuleList(), + getArtList() + ]) const { shopList, buildingList } = _shopAndBuilding.data store.SET_DEVICE(_DeviceInfo.data) @@ -34,6 +44,7 @@ export const useInitConfigAndMallInfo = async () => { store.SET_FACILITY_LIST(_facilityList.data) store.SET_WEATHER(_weather.data) store.SET_MENU_LIST(_menuList.data) + store.SET_PICTURE_LIST(_pictureList.data) } catch (error) { Message({ text: '初始化数据失败', type: 'success' }) } diff --git a/src/enums/index.ts b/src/enums/index.ts index d31218f..f6773e9 100644 --- a/src/enums/index.ts +++ b/src/enums/index.ts @@ -25,3 +25,15 @@ export enum HTTP_CODE { ERR_NULL = 401, //未识别到语音 ERR_DISCERNING = 201 //语音识别中 } + +export enum PictureStatus { + SCHOOL = 1, // 文化学院 + GOLD = 2, // 金卡会员 + BLACK = 3, // 黑卡会员 + ACTIVITY = 4 // 活动 +} + +export enum PictureType { + H = 1, // 横版图片 + V = 2 // 竖版图片 +} diff --git a/src/http/api/activity/index.ts b/src/http/api/activity/index.ts deleted file mode 100644 index e711930..0000000 --- a/src/http/api/activity/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { request } from '@/http/http' - -type AcType = { - activityList: Activity[] -} - -//获取商场活动 -export const getMallActivity = () => request({ url: `/JSON/getActivityList1.json` }) -//获取店铺活动 -export const getShopActivity = () => request({ url: `/JSON/getActivityList2.json` }) diff --git a/src/http/api/base/index.ts b/src/http/api/base/index.ts index 12d5b80..a0e4b27 100644 --- a/src/http/api/base/index.ts +++ b/src/http/api/base/index.ts @@ -1,4 +1,5 @@ import { request } from '@/http/http' +import type { Picture } from '@/types/activity' import type { WrittenQuery } from './types' //获取配置项 @@ -21,3 +22,6 @@ export const getHandWriting = (data: WrittenQuery) => request({ url: ' // 获取首页数据 export const getIndexJson = () => request({ url: `/JSON/index.json` }) + +// 获取活动、会员卡等 +export const getArtList = () => request({ url: `/JSON/getArtList.json` }) diff --git a/src/http/api/member/index.ts b/src/http/api/member/index.ts deleted file mode 100644 index b4edd34..0000000 --- a/src/http/api/member/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { request } from '../../http' -// 获取会员信息 -export const getMemberInfo = () => request({ url: `/JSON/getMemberInterests.json` }) diff --git a/src/store/root/actions.ts b/src/store/root/actions.ts index 40dcefa..17faa74 100644 --- a/src/store/root/actions.ts +++ b/src/store/root/actions.ts @@ -3,6 +3,7 @@ import type { State } from './state' import type { Root } from '../key' import type { CreateActions } from '../types' import { BrandRes, GroupList } from '@/http/api/brand/types' +import { Picture } from '@/types/activity' export interface Actions { SET_SHOP_LIST_BY_INDUSTRY(list: GroupList): void @@ -20,6 +21,7 @@ export interface Actions { SET_SHOW_DETAIL(flag: boolean): void SET_SHOW_SEARCH(flag: boolean): void SET_MENU_LIST(list: MenuType[]): void + SET_PICTURE_LIST(list: Picture[]): void } export type GenActions = CreateActions @@ -72,5 +74,8 @@ export const actions: GenActions = { }, SET_MENU_LIST(list) { this.menuList = list + }, + SET_PICTURE_LIST(list) { + this.pictureList = list } } diff --git a/src/store/root/state.ts b/src/store/root/state.ts index 3b99096..4fa4875 100644 --- a/src/store/root/state.ts +++ b/src/store/root/state.ts @@ -1,4 +1,5 @@ import type { GroupList, BrandRes } from '@/http/api/brand/types' +import { Picture } from '@/types/activity' export interface State { shopList: Readonly //店铺列表 @@ -16,6 +17,7 @@ export interface State { device: Device //当前设备信息 shop: Shop //店铺信息 menuList: MenuType[] // 菜单信息 + pictureList: Picture[] // 图片列表 } export const state = (): State => ({ @@ -33,5 +35,6 @@ export const state = (): State => ({ mapStatus: false, device: {} as Device, shop: {} as Shop, - menuList: [] + menuList: [], + pictureList: [] }) diff --git a/src/types/activity.d.ts b/src/types/activity.d.ts index 5c67634..497282d 100644 --- a/src/types/activity.d.ts +++ b/src/types/activity.d.ts @@ -1,3 +1,4 @@ +import { PictureStatus, PictureType } from '@/enums' declare interface Activity { activityAddress: string //活动地址 activityAddressEn: string //活动地址英文 @@ -20,3 +21,10 @@ declare interface Activity { point: number // 导航点 shopCode: string //关联店铺code } + +declare interface Picture { + fileCode: string // 图片编码 + fileUrl: string // 图片地址 + flag: PictureType // 图片横竖 + artType: PictureStatus // 图片类型 +} diff --git a/src/views/Activity/Activity.vue b/src/views/Activity/Activity.vue index b6ae4d0..2792136 100644 --- a/src/views/Activity/Activity.vue +++ b/src/views/Activity/Activity.vue @@ -8,12 +8,18 @@ diff --git a/src/views/Member/Member.vue b/src/views/Member/Member.vue index 4f9517c..ee85281 100644 --- a/src/views/Member/Member.vue +++ b/src/views/Member/Member.vue @@ -1,15 +1,20 @@