| | |
| | | import { useQuery } from '@tanstack/vue-query'; |
| | | import { useLifeRechargeContext, CreateEditPayChannelsInput } from '@life-payment/core-vue'; |
| | | import { |
| | | useLifeRechargeContext, |
| | | CreateEditPayChannelsInput, |
| | | GetShowingLifePayAnnouncementInput, |
| | | } from '@life-payment/core-vue'; |
| | | import { MaybeRef } from 'vue'; |
| | | import { Message } from '@/utils'; |
| | | |
| | | export function useOnlineService() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | |
| | | getChannlesNameByNum, |
| | | }; |
| | | } |
| | | |
| | | type UseShowingLifePayAnnouncementOptions = { |
| | | params?: MaybeRef<API.GetShowingLifePayAnnouncementInput>; |
| | | onSuccess?: (data: API.CreateEditLifePayAnnouncementOutput) => any; |
| | | }; |
| | | |
| | | export function useShowingLifePayAnnouncement(options: UseShowingLifePayAnnouncementOptions = {}) { |
| | | const { onSuccess, params = {} } = options; |
| | | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | const { |
| | | data: announcement, |
| | | isLoading, |
| | | refetch, |
| | | } = useQuery({ |
| | | queryKey: ['blLifeRecharge/getShowingLifePayAnnouncement', params], |
| | | queryFn: async () => { |
| | | return await blLifeRecharge.services.getShowingLifePayAnnouncement(unref(params), { |
| | | showLoading: false, |
| | | skipErrorHandler: true, |
| | | }); |
| | | }, |
| | | onSuccess: (data) => { |
| | | onSuccess?.(data); |
| | | }, |
| | | }); |
| | | |
| | | return { |
| | | announcement, |
| | | isLoading, |
| | | refetch, |
| | | }; |
| | | } |
| | | |
| | | export function useDialogShowingLifePayAnnouncement() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | useShowingLifePayAnnouncement({ |
| | | params: { |
| | | announcementType: blLifeRecharge.constants.AnnouncementTypeEnum.Dialog, |
| | | }, |
| | | onSuccess(data) { |
| | | Message.confirm({ |
| | | title: '公告', |
| | | message: data.announcementContent ?? '', |
| | | showCancelBtn: false, |
| | | }); |
| | | }, |
| | | }); |
| | | } |
New file |
| | |
| | | <template> |
| | | <nut-noticebar :left-icon="false" :text="text" v-if="!!text" /> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { BlLifeRecharge } from '@life-payment/core-vue'; |
| | | import { useShowingLifePayAnnouncement } from '@/hooks'; |
| | | |
| | | defineOptions({ |
| | | name: 'NormalAnnouncement', |
| | | }); |
| | | |
| | | // type Props = {}; |
| | | |
| | | // const props = withDefaults(defineProps<Props>(), {}); |
| | | |
| | | const text = ref(''); |
| | | |
| | | useShowingLifePayAnnouncement({ |
| | | params: { |
| | | announcementType: BlLifeRecharge.constants.AnnouncementTypeEnum.Normal, |
| | | }, |
| | | onSuccess(data) { |
| | | text.value = data.announcementContent; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | @import '@/styles/common.scss'; |
| | | </style> |
| | |
| | | <template #bg> |
| | | <img :src="OssAssets.common.HomePageBg" class="home-page-bg" /> |
| | | </template> |
| | | <NormalAnnouncement /> |
| | | <ContentView> |
| | | <div class="home-page-banner-wrapper"> |
| | | <div class="home-page-banner-left"> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { useAccessLogin } from '@/hooks'; |
| | | import { useAccessLogin, useDialogShowingLifePayAnnouncement } from '@/hooks'; |
| | | import { useUserStore } from '@/stores/modules/user'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { OrderInputType } from '@life-payment/constants'; |
| | |
| | | import IconBanner from '@/assets/home/icon-banner.png'; |
| | | import IconBannerLogo from '@/assets/home/icon-banner-logo.png'; |
| | | import IconBannerItem from '@/assets/home/icon-banner-item.png'; |
| | | import NormalAnnouncement from './components/NormalAnnouncement.vue'; |
| | | |
| | | const userStore = useUserStore(); |
| | | |
| | | const router = Taro.useRouter(); |
| | | |
| | | useDialogShowingLifePayAnnouncement(); |
| | | |
| | | const goPhoneBillRecharge = useAccessLogin(() => { |
| | | RouteHelper.navigateTo({ |
| | | url: `${RouterPath.phoneBillRecharge}`, |
| | |
| | | title?: string; |
| | | message?: string | VNode; |
| | | confirmText?: string; |
| | | showCancelBtn?: boolean; |
| | | }; |
| | | |
| | | export class Message { |
| | | static confirm(options: ConfirmOptions = {}) { |
| | | const { title = '提示', message = '确定要删除该数据吗?', confirmText = '确认' } = options; |
| | | const { |
| | | title = '提示', |
| | | message = '确定要删除该数据吗?', |
| | | confirmText = '确认', |
| | | showCancelBtn = true, |
| | | } = options; |
| | | return new Promise((resolve, reject) => { |
| | | Portal.add((key) => { |
| | | return ( |
| | |
| | | onClose(); |
| | | }} |
| | | confirmText={confirmText} |
| | | showCancelBtn={showCancelBtn} |
| | | ></Model> |
| | | ), |
| | | }} |
| | |
| | | /**弹窗公告 */ |
| | | Dialog = 20, |
| | | } |
| | | |
| | | export enum AnnouncementStatusEnum { |
| | | /**展示中 */ |
| | | Showing = 10, |
| | | /**待展示 */ |
| | | Wait = 20, |
| | | /**已停止 */ |
| | | Stop = 30, |
| | | } |
| | | } |
| | |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 获取当前展示中的公告 POST /api/LifePayAnnouncement/GetShowingLifePayAnnouncement */ |
| | | async getShowingLifePayAnnouncement( |
| | | body: GetShowingLifePayAnnouncementInput, |
| | | options?: RequestConfig |
| | | ) { |
| | | return this.request<CreateEditLifePayAnnouncementOutput>( |
| | | '/api/LifePayAnnouncement/GetShowingLifePayAnnouncement', |
| | | { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | } |
| | | ); |
| | | } |
| | | } |
| | | |
| | | export interface PhoneMesssageCodeLoginInput { |
| | |
| | | /** IdNumber */ |
| | | idNumber?: string; |
| | | } |
| | | |
| | | export interface GetShowingLifePayAnnouncementInput { |
| | | announcementType?: LifeRechargeConstants.AnnouncementTypeEnum; |
| | | } |
| | | |
| | | export interface CreateEditLifePayAnnouncementOutput { |
| | | id?: string; |
| | | announcementType: LifeRechargeConstants.AnnouncementTypeEnum; |
| | | /** 生效日期 */ |
| | | startTime: string; |
| | | /** 截止日期 */ |
| | | endTime: string; |
| | | /** 公告内容 */ |
| | | announcementContent: string; |
| | | creationTime?: string; |
| | | status?: LifeRechargeConstants.AnnouncementStatusEnum; |
| | | } |
| | |
| | | ); |
| | | } |
| | | |
| | | /** 获取当前展示中的公告 GET /api/LifePayAnnouncement/GetShowingLifePayAnnouncement */ |
| | | export async function getShowingLifePayAnnouncement(options?: API.RequestConfig) { |
| | | /** 获取当前展示中的公告 POST /api/LifePayAnnouncement/GetShowingLifePayAnnouncement */ |
| | | export async function getShowingLifePayAnnouncement( |
| | | body: API.GetShowingLifePayAnnouncementInput, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.CreateEditLifePayAnnouncementOutput>( |
| | | '/api/LifePayAnnouncement/GetShowingLifePayAnnouncement', |
| | | { |
| | | method: 'GET', |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | } |
| | | ); |
| | |
| | | queryCondition?: string; |
| | | } |
| | | |
| | | interface GetShowingLifePayAnnouncementInput { |
| | | announcementType?: AnnouncementTypeEnum; |
| | | } |
| | | |
| | | interface IanaTimeZone { |
| | | timeZoneName?: string; |
| | | } |
| | |
| | | interface RequestConfig extends GlobalType.RequestConfig { |
| | | showNavigationBarLoading?: boolean; |
| | | showLoading?: boolean; |
| | | skipErrorHandler?: boolean; |
| | | mock?: boolean; |
| | | customErrorHandler?: (error: any) => boolean; |
| | | } |