Author SHA1 Message Date
zlong 24814b7dee add:新增轮播图展示 2024-12-06 14:40:57 +08:00
ilhamtahir cd7a77c6e4 fix: request 2024-12-04 21:50:09 +08:00
ilhamtahir 90864a4a8c fix: video style 2024-12-04 21:26:23 +08:00
ilhamtahir b6febf2df9 Merge branch 'feature/wx-login' of 1-bright/frontend-uniapp into main 2024-12-04 21:15:55 +08:00
8 changed files with 40 additions and 23 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
VITE_ENABLE_MOCK=false VITE_ENABLE_MOCK=false
VITE_API_PREFIX=/api VITE_API_PREFIX=/api
VITE_PROXY_ENDPOINT=https://bright.yilibili.com VITE_PROXY_ENDPOINT=https://bright.yilibili.com/api
+2 -2
View File
@@ -1,7 +1,7 @@
import { get } from '@/api/request' import httpClient from '@/api/httpClient'
function getCarousalList() { function getCarousalList() {
return get('https://bright.yilibili.com/api/carousals/active-list') return httpClient.get('/carousals/active-list')
} }
export default { export default {
+1 -1
View File
@@ -3,7 +3,7 @@ import { createUniAppAxiosAdapter } from '@uni-helper/axios-adapter'
import axios from 'axios' import axios from 'axios'
const instance = axios.create({ const instance = axios.create({
baseURL: import.meta.env.VITE_API_URL, baseURL: import.meta.env.VITE_PROXY_ENDPOINT,
adapter: createUniAppAxiosAdapter(), adapter: createUniAppAxiosAdapter(),
}) })
+2 -3
View File
@@ -1,6 +1,5 @@
import type { CreateTokenRequest } from '@/model/token'
import httpClient from './httpClient' import httpClient from './httpClient'
export function createToken(createTokenRequest: CreateTokenRequest) { export function createToken(code: string) {
return httpClient.post<{ token: string }>('/tokens', createTokenRequest) return httpClient.post<{ token: string }>(`/we-chat/tokens/${code}`)
} }
+6
View File
@@ -0,0 +1,6 @@
export interface CreateCarousalsRequest {
imageUrl: string
targetType: string
targetUrl?: string
targetId?: string
}
-1
View File
@@ -37,6 +37,5 @@
"navigationBarTitleText": "Vitesse-Uni", "navigationBarTitleText": "Vitesse-Uni",
"navigationStyle": "custom" "navigationStyle": "custom"
}, },
"__esModule": true,
"subPackages": [] "subPackages": []
} }
+4 -3
View File
@@ -18,13 +18,13 @@ const videoSrc = ref(
> >
<view class="container"> <view class="container">
<video <video
class="video-player min-h-80 max-w-full" class="absolute top-0 left-0 w-screen h-screen"
:src="videoSrc" :src="videoSrc"
autoplay autoplay
loop loop
object-fit="cover"
muted muted
:controls="false" :controls="false"
objectFit="fill"
/> />
<view class="content"> <view class="content">
<image :src="left_top_logo" class="left-3 w-48 h-6" /> <image :src="left_top_logo" class="left-3 w-48 h-6" />
@@ -73,7 +73,8 @@ const videoSrc = ref(
width: 100% width: 100%
height: 100% height: 100%
controlslist: none controlslist: none
objectfit: cover /* 修改适应方式为覆盖 */ aspect-ratio: 16 / 9
object-fit: cover
.content .content
position: absolute position: absolute
+24 -12
View File
@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CreateCarousalsRequest } from '@/model/carousals'
import carousalApi from '@/api/carousal' import carousalApi from '@/api/carousal'
import CardList from '@/pages/pet-manual/components/CardList.vue' import CardList from '@/pages/pet-manual/components/CardList.vue'
// const searchValue = ref('') // const searchValue = ref('')
@@ -13,9 +14,9 @@ interface ListItem {
desc: string desc: string
time: string time: string
} }
interface Item { // interface Item {
content: string // content: string
} // }
interface DotStyle { interface DotStyle {
backgroundColor: string backgroundColor: string
selectedBackgroundColor: string selectedBackgroundColor: string
@@ -74,10 +75,13 @@ const listModel = ref<ListItem[]>([
const safeHeight = ToolApi.getSafeHeight() const safeHeight = ToolApi.getSafeHeight()
const searchValue = ref<string>('') const searchValue = ref<string>('')
const info = ref<Item[]>([ const info = ref<CreateCarousalsRequest[] | null>([
{ content: '内容 A' }, {
{ content: '内容 B' }, imageUrl: '',
{ content: '内容 C' }, targetId: '',
targetType: '',
targetUrl: '',
},
]) ])
const current = ref<number>(0) const current = ref<number>(0)
@@ -121,8 +125,16 @@ const findList = ref<{ name: string }[]>([
{ name: '宠物吃饭慢' }, { name: '宠物吃饭慢' },
{ name: '猫咪尿闭怎么办' }, { name: '猫咪尿闭怎么办' },
]) ])
function onLoad() { async function onLoad() {
carousalApi.getCarousalList() const getCarousalListApi = await carousalApi.getCarousalList()
info.value = getCarousalListApi
}
function handleJumpUrl(item: CreateCarousalsRequest) {
if (item.targetType === 'url') {
uni.navigateTo({
url: item.targetUrl,
})
}
} }
onLoad() onLoad()
</script> </script>
@@ -176,9 +188,9 @@ onLoad()
<view class="mx-4 mt-4"> <view class="mx-4 mt-4">
<uni-swiper-dot :info="info" :current="current" field="content" mode="dot" :dots-styles="dotStyle"> <uni-swiper-dot :info="info" :current="current" field="content" mode="dot" :dots-styles="dotStyle">
<swiper class="swiper-box" @change="change"> <swiper class="swiper-box" @change="change">
<swiper-item v-for="(item, index) in info" :key="index" style="background: rgba(0, 0, 0, 0.20)"> <swiper-item v-for="(item, index) in info" :key="index">
<view class="swiper-item"> <view class="swiper-item w-full h-full flex items-center justify-center">
{{ item.content }} <image :src="item.imageUrl" mode="heightFix" class="w-full h-full" @tap="handleJumpUrl(item)" />
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>