Browse Source

优化代码

master-xiaowang
mk 3 months ago
parent
commit
9fb624056c
  1. 2
      .env.production
  2. 2
      components.d.ts
  3. 4
      index.html
  4. 2
      package.json
  5. BIN
      public/favicon.ico
  6. 282
      src/components/MusicPlayer.vue
  7. 65
      src/components/NavigationBar.vue
  8. 1
      src/i18n/modules/base/en.ts
  9. 7
      src/i18n/modules/base/zh-cn.ts
  10. 21
      src/router/index.ts
  11. 6
      src/router/routerBeforeEach.ts
  12. 2
      src/utils/http.ts
  13. 205
      src/view/podcast/index.vue
  14. 24
      src/view/policy/index.vue
  15. 3
      vite.config.ts

2
.env.production

@ -1,6 +1,6 @@
#环境标识
VITE_ENV="生产环境"
#基础服务
VITE_BASE_URL="http://localhost:7001/api/v1"
VITE_BASE_URL="http://219.146.91.110:30801/mz-api"
#每日一言服务
VITE_BASE_URL_YIYAN_SERVICE="https://tenapi.cn"

2
components.d.ts

@ -11,8 +11,6 @@ declare module 'vue' {
Faqs: typeof import('./src/components/Faqs.vue')['default']
FooterBg: typeof import('./src/components/FooterBg.vue')['default']
IconGroup: typeof import('./src/components/IconGroup.vue')['default']
IconList: typeof import('./src/components/IconList.vue')['default']
MusicPlayer: typeof import('./src/components/MusicPlayer.vue')['default']
NavigationBar: typeof import('./src/components/NavigationBar.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']

4
index.html

@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" href="/public/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Insurance</title>
<title>青岛市免租金住房保障平台</title>
</head>
<body>
<div id="app"></div>

2
package.json

@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc -b && vite build",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {

BIN
public/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

282
src/components/MusicPlayer.vue

@ -1,282 +0,0 @@
<template>
<!-- 音频播放器 -->
<div v-if="isShowAudioPlayer"
class="fixed md:bottom-0 bottom-6 left-0 right-0 bg-[#757779] w-full md:h-[90px] h-[49px]">
<div class="md:w-[1330px] w-[414px] m-auto h-full flex items-center">
<!-- left播放控制 -->
<div class="md:w-[170px] w-[100px] h-full flex items-center justify-around">
<icon-skip-previous-fill @click="handlePrevSong" style="color: white" :size="isMobile ? 25 : 35" />
<icon-pause style="color: white" v-if="isPlaying" @click="handlePlay" :size="isMobile ? 30 : 40" />
<icon-play-arrow-fill v-else @click="handlePlay" style="color: white" :size="isMobile ? 30 : 40" />
<icon-skip-next-fill @click="handleNextSong" style="color: white" :size="isMobile ? 25 : 35" />
</div>
<!-- center播放进度条 -->
<div class="flex-1 h-full bg-[#757779] flex items-center">
<img class="md:ml-10 ml-2 md:w-[68px] md:h-[68px] w-8 h-8" src="@/assets/images/pubo.png" />
<div>
<div class="flex justify-between text-white md:ml-7 ml-4">
<div class="md:text-sm text-xs font-medium mr-1">
<span v-if="isPlaying">{{ currentSong.title }}</span>
</div>
<div>
<span class="text-xs font-medium mr-1">{{ formatTime(currentTime) }}</span>
<span class="text-xs font-medium">/</span>
<span class="text-xs font-medium ml-1">{{ formatTime(duration) }}</span>
</div>
</div>
<a-slider v-model="currentTime" @change="handleSeek" :show-tooltip="false" :max="duration"
class="md:ml-7 ml-4" :step="0.1" :default-value="currentTime"
:style="{ width: isMobile ? '240px' : '700px' }" />
</div>
</div>
<!-- right 功能按钮 -->
<div
class="md:w-[250px] w-[120px] md:mr-0 mr-1 text-xs md:text-sm h-full relative flex md:justify-around justify-end items-center text-white hover:cursor-pointer">
<div class="md:w-[170px] justify-around items-center md:flex hidden">
<span>文稿</span>
<span @click="handlePlayMultiplier">倍速</span>
<span @click="handlePlayList">列表</span>
</div>
<icon-close-circle-fill @click="handleCloseAudioPlayer" style="color: #000" :size="isMobile ? 25 : 35" />
<!--播放倍数选择-->
<div v-if="showPlayMultiplier"
class="absolute -top-[160px] right-[120px] w-[73px] h-[162px] bg-[#222222] flex flex-col justify-around text-syGreyBg">
<div v-for="(item, index) in multipleList" class="w-full h-[30px] flex items-center justify-center"
:key="index">
<span :class="item.id === currentRate ? 'font-bold text-base text-white' : ''" class="text-grey text-sm"
@click="handleSelectPlayMultiplier(item)">{{ item.rate === 1.0 ? '正常语速' : `${item.rate}x` }}</span>
</div>
</div>
<!-- 播放列表 -->
<div v-if="showPlayList"
class="absolute -top-[149px] pt-5 pr-6 pl-5 right-[50px] w-[612px] max-h-[149px] bg-[#222222] text-syGreyBg overflow-y-auto">
<div class="flex justify-end w-full">
<icon-close @click="closePlaylist" size="26" style="color: #a3a3a3ff" />
</div>
<div class="mt-2 flex justify-between items-center">
<span class="text-sm">播放列表{{ playlist.length }}</span>
<button class="w-[50px] h-[26px] border rounded-[40px] border-gray-400 flex justify-center items-center">
清空
</button>
</div>
<div class="mt-2 mb-2">
<div v-for="(item, index) in playlist" :key="index" class="flex justify-between items-center">
<div :data-key="item" class="truncate w-[300px] mb-2 text-xs">{{ item.title }}</div>
<div class="hover:cursor-pointer text-grey text-xs mr-2">删除</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
interface Song {
title: string
src: string
}
const props = defineProps({
isShowAudioPlayer: { type: Boolean, default: false },
isMobile: { type: Boolean, default: false },
playlist: { type: Array as () => Song[], default: () => [] },
})
const emit = defineEmits(['closeAudioPlayer'])
//
const currentSongIndex = ref(0)
//
const isPlaying = ref(false)
//
const currentTime = ref(0)
//
const duration = ref(0)
//
const volume = ref(1)
// Audio
const audioElement = ref<any>(null)
//
const currentSong = computed(() => props.playlist[currentSongIndex.value])
//
const handlePlay = () => {
//audioElement
if (!audioElement.value) return
if (isPlaying.value) {
audioElement.value.pause()
} else {
audioElement.value.play()
}
isPlaying.value = !isPlaying.value
}
//
const handleNextSong = () => {
currentSongIndex.value = (currentSongIndex.value + 1) % props.playlist.length
//
audioElement.value.play()
}
//
const handlePrevSong = () => {
currentSongIndex.value = (currentSongIndex.value - 1 + props.playlist.length) % props.playlist.length
//
audioElement.value.play()
}
//
const handleSeek = (value: number) => {
console.log('%c [ 拖动结束 ]-253', 'font-size:13px; background:pink; color:#bf2c9f;')
if (audioElement.value) {
audioElement.value.currentTime = value
if (isPlaying.value) audioElement.value.play()
}
}
//
const formatTime = (seconds: number) => {
const mins = Math.floor(seconds / 60)
const secs = seconds % 60
return `${mins}:${secs.toFixed(1).padStart(4, '0')}` // 1
}
//
watch(currentSong, (newSong) => {
if (audioElement.value) {
audioElement.value.pause()
audioElement.value.src = newSong.src
audioElement.value.load()
if (isPlaying.value) {
audioElement.value.play()
}
}
})
//
watch(volume, (newVolume) => {
if (audioElement.value) {
audioElement.value.volume = newVolume
}
})
//
onMounted(() => {
//
audioElement.value = new Audio(currentSong.value.src)
//()
audioElement.value.addEventListener('timeupdate', () => {
//UI
currentTime.value = audioElement.value.currentTime
})
//
audioElement.value.addEventListener('loadedmetadata', () => {
//
duration.value = audioElement.value.duration
})
//
audioElement.value.addEventListener('ended', handleNextSong)
//
//initHeight()
})
//
onUnmounted(() => {
if (audioElement.value) {
audioElement.value.removeEventListener('timeupdate', currentTime)
audioElement.value.removeEventListener('ended', handleNextSong)
audioElement.value.pause()
audioElement.value = null
}
})
//
const showPlayMultiplier = ref(false)
const currentRate = ref(2)
const multipleList = reactive([
{
id: 1,
rate: 0.7,
},
{
id: 2,
rate: 1.0,
},
{
id: 3,
rate: 1.25,
},
{
id: 4,
rate: 2.0,
},
])
//
const handleSelectPlayMultiplier = (item: any) => {
console.log(item)
currentRate.value = item.id
if (audioElement.value) {
audioElement.value.playbackRate = item.rate
}
}
//
const handlePlayMultiplier = () => {
showPlayMultiplier.value = !showPlayMultiplier.value
showPlayList.value = false
}
//
const showPlayList = ref(false)
//
const handlePlayList = () => {
showPlayList.value = !showPlayList.value
showPlayMultiplier.value = false
}
const closePlaylist = () => {
//
if (showPlayList.value) {
showPlayList.value = false
}
}
//
const isShowAudioPlayer = ref(false)
//
const playAudio = async (item: any) => {
if (audioElement.value) {
isShowAudioPlayer.value = true
try {
await audioElement.value.play()
//true
isPlaying.value = true
console.log('音频开始自动播放', item)
} catch (error) {
console.error('自动播放被阻止:', error)
}
}
}
//
const handleCloseAudioPlayer = () => {
isShowAudioPlayer.value = false
if (audioElement.value) {
audioElement.value.pause()
isPlaying.value = false
}
}
//
defineExpose({
playAudio,
})
</script>
<style scoped>
/* 滚动条 样式 */
:deep(.arco-slider-track::before) {
@apply h-[3px];
}
/* 前置样式 */
:deep(.arco-slider-bar) {
@apply h-[3px] bg-red-600;
}
/* 进度条的点 */
:deep(.arco-slider-btn::after) {
@apply border border-red-500;
}
</style>

65
src/components/NavigationBar.vue

@ -8,7 +8,8 @@
class="text-[16px] font-medium hidden md:block hover:cursor-pointer text-white">
<ul class="flex justify-evenly">
<template v-for="(item, index) in navList" :key="index">
<li class="mr-[48px] nav-item" :data="index" @click="handleMenuClick(item, 1)"
<!-- item, 1 -->
<li class="mr-[48px] nav-item" :data="index" @click="handleMenuClick()"
:class="currentKey === index ? 'nav-item-active nav-item-active-text ' : ''">
{{ $t(`base.nav.${item.name}`) }}
</li>
@ -60,8 +61,9 @@
</template>
<div>
<ul class="flex justify-evenly flex-col">
<!-- item, 2 -->
<template v-for="(item, index) in navList" :key="index">
<li class="mt-[48px] nav-item ml-1 h-[24px] leading-[24px]" :data="index" @click="handleMenuClick(item, 2)"
<li class="mt-[48px] nav-item ml-1 h-[24px] leading-[24px]" :data="index" @click="handleMenuClick()"
:class="currentKey === index ? 'nav-item-active-h5 nav-item-active-text ' : ''">
{{ $t(`base.nav.${item.name}`) }}
</li>
@ -86,25 +88,25 @@
</template>
<script setup lang="ts">
import { IconMenu } from '@arco-design/web-vue/es/icon'
import { computed, reactive, ref, watchEffect } from 'vue'
import { reactive, ref, watchEffect } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import type { Locale } from 'vue-i18n'
const route = useRouter()
const currentKey = ref(0)
const switchTheme = ref(false)
const currentKey = ref(1)
import { Message } from '@arco-design/web-vue'
//
const handleSwitchTheme = (ev: Event) => {
switchTheme.value = !switchTheme.value
if (switchTheme.value) {
//
document.body.setAttribute('arco-theme', 'dark')
console.log(ev)
} else {
//
document.body.setAttribute('arco-theme', 'light')
}
}
// const handleSwitchTheme = (ev: Event) => {
// switchTheme.value = !switchTheme.value
// if (switchTheme.value) {
// //
// document.body.setAttribute('arco-theme', 'dark')
// console.log(ev)
// } else {
// //
// document.body.setAttribute('arco-theme', 'light')
// }
// }
const navList = reactive([
{
id: 0,
@ -126,16 +128,6 @@ const navList = reactive([
name: 'FAQ',
path: '/layout/faq',
},
{
id: 4,
name: 'Contact',
path: '/layout/contact',
},
{
id: 5,
name: 'PodCast',
path: '/layout/podcast',
},
])
const visible = ref(false)
const handleShowMenu = () => {
@ -148,16 +140,17 @@ const handleOk = () => {
const handleCancel = () => {
visible.value = false
}
//nav
const handleMenuClick = (e: any, type: number) => {
if (type === 2) {
currentKey.value = e.id
visible.value = false
route.push(e.path)
} else {
currentKey.value = e.id
route.push(e.path)
}
//nav e: any, type: number
const handleMenuClick = () => {
Message.info('功能开发中')
// if (type === 2) {
// currentKey.value = e.id
// visible.value = false
// route.push(e.path)
// } else {
// currentKey.value = e.id
// route.push(e.path)
// }
}
//
const handleLogin = () => {

1
src/i18n/modules/base/en.ts

@ -5,7 +5,6 @@ export default {
About: 'About',
FAQ: 'FAQ',
Contact: 'Contact',
PodCast: 'PodCast',
},
languageSwitcher: {
title: 'Language',

7
src/i18n/modules/base/zh-cn.ts

@ -2,10 +2,9 @@ export default {
nav: {
Home: '首页',
Policy: '政策资讯',
About: '关于',
FAQ: '问答',
Contact: '联系',
PodCast: '播客',
About: '看房选房',
FAQ: '续期申请',
},
languageSwitcher: {
title: '语言',

21
src/router/index.ts

@ -7,25 +7,25 @@ const routes: Array<RouteRecordRaw> = [
component: () => import('@/view/layout/index.vue'),
children: [],
redirect: () => {
return { path: '/layout/home' }
return { path: '/layout/policy' }
},
},
{
path: '/layout',
component: () => import('@/view/layout/index.vue'),
children: [
{
path: 'home',
component: () => import('@/view/home/index.vue'),
meta: { title: 'home' },
},
{
path: 'Policy',
component: () => import('@/view/policy/index.vue'),
meta: { title: 'policy' },
},
{
path: 'about',
path: 'home2',
component: () => import('@/view/home/index.vue'),
meta: { title: 'home' },
},
{
path: 'about3',
component: () => import('@/view/about/index.vue'),
meta: { title: 'about' },
},
@ -48,12 +48,7 @@ const routes: Array<RouteRecordRaw> = [
path: 'articleDetail',
component: () => import('@/view/latestArticle/detail.vue'),
meta: { title: 'latestArticleDetail' },
},
{
path: 'podcast',
component: () => import('@/view/podcast/index.vue'),
meta: { title: 'podcast' },
},
}
],
},
{

6
src/router/routerBeforeEach.ts

@ -1,16 +1,16 @@
import router from './index'
router.beforeEach((to, from, next) => {
//console.log('beforeEach', to, from)
console.log('beforeEach', to, from)
next()
})
router.beforeResolve(async (to) => {
//console.log('%c [ 全局解析守卫 ]-11', 'font-size:13px; background:pink; color:#bf2c9f;', to)
console.log('%c [ 全局解析守卫 ]-11', 'font-size:13px; background:pink; color:#bf2c9f;', to)
})
router.afterEach((to, from) => {
//console.log('%c [ 全局后置守卫 ]-27', 'font-size:13px; background:pink; color:#bf2c9f;', to, from)
console.log('%c [ 全局后置守卫 ]-27', 'font-size:13px; background:pink; color:#bf2c9f;', to, from)
})
router.onError((error) => {
if (error.name === 'NavigationDuplicated') {

2
src/utils/http.ts

@ -1,5 +1,5 @@
import axios from 'axios'
import type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
import type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse} from 'axios' //, InternalAxiosRequestConfig
import { Message } from '@arco-design/web-vue'
import serviceUrls from '@/config/baseUrlConfig'
// 数据返回的接口

205
src/view/podcast/index.vue

@ -1,205 +0,0 @@
<template>
<div class="md:w-full bg-syGreyBg overflow-hidden">
<div class="md:w-[1200px] w-[350px] m-auto md:mt-20 h-full mt-10">
<div class="pt-6 flex w-full items-center">
<img class="w-6 h-4 mr-2" src="@/assets/images/update-icon.png" alt=" 图标" />
<span class="md:text-xl text-base font-bold">最近更新</span>
</div>
<div
class="md:mt-4 mt-6 grid md:grid-cols-4 md:grid-rows-2 gap-x-1 grid-cols-2 grid-rows-4 md:gap-y-2 gap-y-4 w-full h-[230px]">
<div class="md:w-[280px] md:h-[90px] w-[181px] h-[46px] flex" v-for="(item, index) in 8" :key="index">
<div class="md:w-[199px] w-[138px] h-full">
<div class="md:text-lg text-xs tracking-widest overflow-hidden line-clamp-2 text-left md:mb-2">
聊科技机器人跑马拉松意义何在
</div>
<span class="text-xs text-gray-400">更新/播客</span>
</div>
</div>
</div>
<!-- 瀑布流 -->
<div class="md:columns-4 columns-2 md:gap-8 gap-4 space-y-8 mt-20">
<template v-for="(item, index) in items" :key="index">
<!-- 每个项目 -->
<div class="break-inside-avoid hover:cursor-pointer" :data-key="index">
<div class="bg-white rounded-l shadow-md">
<div class="md:w-[278px] w-[166px] pt-4 md:pl-5 pl-2 md:pr-4 pr-2"
:style="{ height: `${item.height}px` }">
<div class="relative md:h-[238px] h-[141px]">
<img class="md:w-[238px] md:h-[238px] w-[164px] h-[141px] text-center" :src="item.img" alt=" 图标"
fit="cover" />
<div class="absolute bottom-0 left-0 right-0 text-white flex">
<div v-if="item.type === 2"
class="w-[48px] h-[28px] text-xs flex items-center justify-center bg-gray-600 text-white">
课程
</div>
<template v-else>
<div class="w-[68px] h-[28px] text-xs bg-gray-400 flex justify-center items-center">精选电台</div>
<div @click="handlePlayAudio(item)"
class="w-[54px] h-[28px] text-xs flex items-center bg-black text-white">
<icon-play-arrow-fill size="20" />音频
</div>
</template>
</div>
</div>
<!-- 文字 -->
<div class="md:text-lg text-xs mt-4 mb-2">{{ item.title }}</div>
<div class="text-xs text-gray-400">
{{ item.desc }}
</div>
<div class="flex items-center justify-between mt-4">
<div class="flex text-xs items-center text-gray-400">
作者 ·<span class="ml-2">{{ item.auther }}</span>
</div>
<div class="text-xs text-gray-400 flex justify-center items-center">
<icon-fire class="text-red-500" size="14" /><span class="ml-1">73.2</span>
</div>
</div>
<div v-if="item.type === 2"
class="flex justify-center items-center md:text-sm text-xs mt-8 bg-syGreyBg text-gray-400 md:w-[238px] md:h-[34px] w-[150px] h-[22px]">
{{ item.course }} <icon-right size="16" class="ml-1" />
</div>
</div>
</div>
</div>
</template>
</div>
</div>
</div>
<MusicPlayer ref="musicPlayerRef" :playlist="playlist" :is-mobile="isMobile" />
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue'
import MusicPlayer from '@/components/MusicPlayer.vue'
import listImg from '@/assets/images/pubo.png'
import song1 from '@/assets/周杰伦-不能说的秘密.mp3'
import song2 from '@/assets/周杰伦-退后.mp3'
import song3 from '@/assets/周杰伦-最长的电影.mp3'
//import router from '@/router'
const musicPlayerRef = ref<InstanceType<typeof MusicPlayer> | null>(null)
///
const items = ref([
{
id: 1,
title: '史蒂夫说424期 - 凉意 - 世界一流的亲密关系是什么样的?',
desc: '史蒂夫说',
type: 1,
auther: '史蒂夫',
img: listImg,
height: 443,
},
{
id: 2,
type: 1,
title: 'No.31 对话瑞哥:我带“甲亢哥”逛重庆',
desc: '我有一个朋友|董晨宇·',
auther: '董晨宇',
img: listImg,
height: 443,
},
{
id: 3,
type: 2,
title: '101.【聊科技】机器人跑马拉松,意义何在?',
desc: '请思考人形机器人在半马比赛中,可能出现哪些问题?为什么说这场半马比赛是一个难得的试验场?机器人跑马拉',
img: listImg,
course: '给孩子的365天新闻课',
auther: '馒头星球',
height: 520,
},
{
id: 4,
title: '【导读】苗德岁:生命演化的历史与奥妙',
desc: '大家好,我是苗德岁。很高兴担任这门《给孩子的365天文化课》的“生命简史”导师。欢迎大家选听这门课!',
type: 2,
auther: '苗德岁',
course: '给孩子的365天文化课',
img: listImg,
height: 520,
},
{
id: 5,
type: 1,
title: '133.中产返贫:情绪、数据与事实|青沙龙',
desc: '问题青年',
auther: '问题青年',
img: listImg,
height: 443,
},
{
id: 6,
type: 1,
title: '图拉斯|腾讯出手投资育碧,市值腰斩的法国游戏巨头有何吸引力?',
desc: '声动早咖啡',
auther: '声动早咖啡',
img: listImg,
height: 500,
},
{
id: 7,
title: '钱不是被大风刮来的,但是被大风刮走的!',
desc: '逃班威龙',
auther: '逃班威龙',
type: 1,
img: listImg,
height: 443,
},
{
id: 8,
title: 'vol.700 钢门组合大战西城男孩',
desc: '日谈公园',
auther: '日谈公园',
type: 1,
img: listImg,
height: 500,
},
])
//
const playlist = reactive([
{
title: '周杰伦-不能说的秘密',
artist: '艺术家1',
src: song1,
},
{
title: '周杰伦-退后',
artist: '艺术家1',
src: song2,
},
{
title: '周杰伦-最长的电影',
artist: '艺术家1',
src: song3,
},
])
const handlePlayAudio = (item: any) => {
//
console.log('%c [ ]-179', 'font-size:13px; background:pink; color:#bf2c9f;', item)
if (musicPlayerRef.value) {
musicPlayerRef.value.playAudio(item)
} else {
console.error('MusicPlayer 组件未加载')
}
}
const isMobile = ref(false)
//
const initHeight = () => {
//
isMobile.value = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
if (isMobile.value) {
//items
console.log('%c [ 移动端 ]-449', 'font-size:13px; background:pink; color:#bf2c9f;')
items.value.forEach((item) => {
//item.type 1 50px, 100px
if (item.type === 1) {
item.height = 300
} else {
item.height = 388
}
})
}
}
initHeight()
</script>
<style scoped></style>

24
src/view/policy/index.vue

@ -107,6 +107,19 @@ const tabList = reactive([
},
]);
const active = ref("0");
//
interface PolicyItem {
//
coverImg: string;
title: string;
detail: string;
dictLabel: string;
createTime: string;
id: string;
}
interface PolicyResponse {
data: PolicyItem[];
}
const showDetail = ref(false);
const handleClickTab = (item: any) => {
active.value = item.dictValue;
@ -125,14 +138,15 @@ const policyInfo = ref<any>({});
let lastScrollTime = 0;
const throttleDelay = 500; //
//
const list = ref([]);
const list = ref<PolicyItem[]>([]);
//
const isLoading = ref(true);
// getList
const getList = async () => {
try {
if (!isLoading.value) return;
const res = await gePolicytList(joinIn);
//
const res:PolicyResponse = await gePolicytList(joinIn);
list.value = [...list.value, ...res.data];
if (res.data.length < joinIn.pageSize) {
isLoading.value = false;
@ -156,8 +170,10 @@ const handleScroll = (event: Event) => {
lastScrollTime = now;
}
};
const toPolicyDetail = async (item) => {
const res = await getPolicyInfo(item.id);
// PolicyItem
const toPolicyDetail = async (item: PolicyItem) => {
// PolicyResponse
const res: PolicyResponse = await getPolicyInfo(item.id);
policyInfo.value = res.data;
showDetail.value = true;
};

3
vite.config.ts

@ -26,6 +26,9 @@ export default defineConfig({
],
}),
],
build:{
target:['edge90','chrome90','firefox90','safari15']
},
resolve: {
//配置路径别名
alias: [

Loading…
Cancel
Save