调整详情页面布局

This commit is contained in:
zhl 2021-12-16 10:30:38 +08:00
parent 96315a6f34
commit db28ffbcf6
8 changed files with 74 additions and 18 deletions

View File

@ -9,7 +9,7 @@
</view> </view>
<view class="cover-content"> <view class="cover-content">
<text class="uni-subtitle uni-white">{{gData.name}} </text> <text class="uni-subtitle uni-white">{{gData.name}} </text>
<text v-if="gData.subName">({{gData.subName}})</text> <!-- <text v-if="gData.subName">({{gData.subName}})</text>-->
</view> </view>
</view> </view>
</template> </template>

View File

@ -10,7 +10,8 @@
<text >{{data.name}}</text> <text >{{data.name}}</text>
</view> </view>
<view class="right-part"> <view class="right-part">
<view class="main-price">¥{{(~~data.price/100)}}</view> <view class="main-price" v-if="data.price">¥{{(data.price/100)}}</view>
<view class="main-price" v-if="!data.price">免费</view>
</view> </view>
</view> </view>
</template> </template>

View File

@ -3,7 +3,7 @@
<view class="peopleSwiper"> <view class="peopleSwiper">
<swiper class="bigImg" :current="current"> <swiper class="bigImg" :current="current">
<swiper-item v-for="(big,index) in images" :key="index"> <swiper-item v-for="(big,index) in images" :key="index">
<image :src="big" mode="scaleToFill"></image> <image :src="big" mode="scaleToFill" class="blurImage"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
<scroll-view class="smallImg" scroll-x="true" :show-scrollbar="false"> <scroll-view class="smallImg" scroll-x="true" :show-scrollbar="false">
@ -35,6 +35,7 @@ export default class extends Vue{
changeBigPic(index: number){ changeBigPic(index: number){
this.current = index; this.current = index;
this.$emit('imgChange', index)
} }
} }
</script> </script>
@ -51,4 +52,5 @@ scroll-view ::-webkit-scrollbar {
height: 0; height: 0;
background-color: transparent; background-color: transparent;
} }
.blurImage{}
</style> </style>

View File

@ -6,7 +6,7 @@
</view> </view>
<view class="center-part"> <view class="center-part">
<uni-tag type="error" v-if="data.discountOff" size="small" :text="'-'+data.discountOff+'%'" class="center-child"></uni-tag> <uni-tag type="error" v-if="data.discountOff" size="small" :text="'-'+data.discountOff+'%'" class="center-child"></uni-tag>
<uni-tag type="success" size="small" v-if="isLow" text="史低" class="center-child"></uni-tag> <uni-tag type="success" size="small" v-if="!!data.isLowestPrice" text="史低" class="center-child"></uni-tag>
<view class="time-rest center-child" v-if="data.leftTime"> <view class="time-rest center-child" v-if="data.leftTime">
<text >剩余{{data.leftTime}}</text> <text >剩余{{data.leftTime}}</text>
</view> </view>
@ -34,9 +34,7 @@ declare module 'vue/types/vue' {
props: ['data'], props: ['data'],
}) })
export default class extends Vue{ export default class extends Vue{
private isLow() {
return !!this.data.isLowestPrice
}
} }
</script> </script>
<style> <style>
@ -83,9 +81,11 @@ export default class extends Vue{
} }
.price-cell .right-part .price-tip { .price-cell .right-part .price-tip {
color: #666666; color: #666666;
font-size: 18rpx; font-size: 16rpx;
//#ifdef H5
-webkit-transform-origin-x: 0; -webkit-transform-origin-x: 0;
-webkit-transform: scale(0.80); -webkit-transform: scale(0.80);
// #endif
line-height: 10px; line-height: 10px;
text-align: right; text-align: right;
width: 100%; width: 100%;

View File

@ -36,7 +36,7 @@
"path": "pages/info/index", "path": "pages/info/index",
"style": { "style": {
"navigationBarTitleText": "游戏详情", "navigationBarTitleText": "游戏详情",
"enablePullDownRefresh": true, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },

View File

@ -114,7 +114,7 @@ export default class extends Vue{
let arr = data.chinese.split(';') let arr = data.chinese.split(';')
arr.forEach((o: string) => data.tags.push({name: o, type: 'error'})) arr.forEach((o: string) => data.tags.push({name: o, type: 'error'}))
} }
if (data.isLowest) data.tags.push({name: '史低', type: 'primary', fill: true}) if (data.isLowest) data.tags.push({name: '史低', type: 'success', fill: true})
this.games.push(data) this.games.push(data)
} }
this.more = 'more' this.more = 'more'

View File

@ -1,10 +1,11 @@
<template> <template>
<view class="container"> <view class="container">
<image class="bgImg" :src="bgImg" ></image>
<navigator class="nav-bar" :style="{ top: iStatusBarHeight + 'px'}" open-type="navigateBack"> <navigator class="nav-bar" :style="{ top: iStatusBarHeight + 'px'}" open-type="navigateBack">
<uni-icons type="left" size="30"></uni-icons> <uni-icons type="left" size="30" class="back-icon"></uni-icons>
</navigator> </navigator>
<!-- 幻灯 --> <!-- 幻灯 -->
<image-swiper :images="imgSwiperData"></image-swiper> <image-swiper @imgChange="bigImgChange" :images="imgSwiperData"></image-swiper>
<view class="game-info"> <view class="game-info">
<uni-title type ="h1" :title="name"></uni-title> <uni-title type ="h1" :title="name"></uni-title>
<uni-title type="h2" :title="subName"></uni-title> <uni-title type="h2" :title="subName"></uni-title>
@ -36,6 +37,7 @@
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
</view> </view>
<view class="bottom-area"></view>
</view> </view>
</template> </template>
@ -51,7 +53,7 @@ import { getGameInfo, getGamePrice } from '@/api/game_data'
components: { components: {
ImageSwiper, ImageSwiper,
PriceCell, PriceCell,
DlcCell DlcCell,
} }
}) })
export default class extends Vue{ export default class extends Vue{
@ -64,6 +66,8 @@ export default class extends Vue{
private name: string = '' private name: string = ''
private subName: string = '' private subName: string = ''
private desc: string = '' private desc: string = ''
private params: any = {}
private bgImg = ''
onLoad(options: any) { onLoad(options: any) {
this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight || 0 this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight || 0
@ -72,6 +76,11 @@ export default class extends Vue{
this.fetchGameInfo() this.fetchGameInfo()
this.fetchGamePrice() this.fetchGamePrice()
} }
this.params = {
width: '100%',
height: '100%',
blur:"m"
}
} }
async created() { async created() {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
@ -97,6 +106,7 @@ export default class extends Vue{
for (let u of arr) { for (let u of arr) {
this.imgSwiperData.push(u) this.imgSwiperData.push(u)
} }
this.bgImg = this.imgSwiperData[0]
} }
this.desc = data.jumpGameExt?.longDesc || '' this.desc = data.jumpGameExt?.longDesc || ''
if (data.dlcList) { if (data.dlcList) {
@ -110,6 +120,10 @@ export default class extends Vue{
} }
} }
private bigImgChange(index: number) {
this.bgImg = this.imgSwiperData[index]
}
private async fetchGamePrice() { private async fetchGamePrice() {
let data: any = await getGamePrice(this.gameId, 3) let data: any = await getGamePrice(this.gameId, 3)
console.log(data) console.log(data)
@ -123,6 +137,7 @@ export default class extends Vue{
<style> <style>
.game-info{ .game-info{
padding: 5px 8px; padding: 5px 8px;
z-index: 2;
} }
.tab-list .uni-tag { .tab-list .uni-tag {
margin-right: 5px; margin-right: 5px;
@ -131,6 +146,13 @@ export default class extends Vue{
font-size: 14px; font-size: 14px;
padding: 5px 0; padding: 5px 0;
} }
.bg-img{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.tag-list { .tag-list {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -170,4 +192,22 @@ dlc-cell {
.game-tag text { .game-tag text {
padding: 2px 5px!important; padding: 2px 5px!important;
} }
.back-icon{
text-shadow: white 0.1em 0.1em 0.2em
}
.bgImg{
position: absolute;
left: 0;
top: 0;
width: 150%;
height: 100%;
filter: blur(50px);
opacity: 0.2;
z-index: 10;
pointer-events:none;
}
.bottom-area{
height: 24px;
}
</style> </style>

View File

@ -1,5 +1,6 @@
<template> <template>
<view class="container"> <view class="container">
<uni-search-bar :radius="100" @confirm="search"></uni-search-bar>
<uni-list> <uni-list>
<uni-list-item v-for="item in games" > <uni-list-item v-for="item in games" >
<game-small-cell :g-data="item" v-on:cellClicked = 'onClick'></game-small-cell> <game-small-cell :g-data="item" v-on:cellClicked = 'onClick'></game-small-cell>
@ -25,9 +26,10 @@ export default class extends Vue{
private games: IGameInfo[] = [] private games: IGameInfo[] = []
private more = 'more' private more = 'more'
private moreCfg = {contentdown: "点击加载更多",contentrefresh: "正在加载...",contentnomore: "没有更多数据了"} private moreCfg = {contentdown: "点击加载更多",contentrefresh: "正在加载...",contentnomore: "没有更多数据了"}
private key = ''
async onLoad() { async onLoad() {
await this.fetchGames() await this.fetchGames({})
} }
onClick(e: any) { onClick(e: any) {
@ -40,12 +42,23 @@ export default class extends Vue{
private async loadMore(e: any) { private async loadMore(e: any) {
if (this.more === 'more') { if (this.more === 'more') {
this.more = 'loading' this.more = 'loading'
await this.fetchGames(this.games.length) await this.fetchGames({skip: this.games.length})
} }
console.log(e) console.log(e)
} }
private async fetchGames(start: number = 0) { private search(e: any) {
let res: any = await searchGames({skip: start}) console.log('search: ', e)
this.key = e.value
this.games.length = 0
this.fetchGames({})
}
private async fetchGames(param: any) {
let searchParam: any = {skip: 0}
if (this.key) {
searchParam.name = this.key
}
Object.assign(searchParam, param)
let res: any = await searchGames(searchParam)
if (res.length === 0) { if (res.length === 0) {
this.more = 'noMore' this.more = 'noMore'
return return
@ -57,7 +70,7 @@ export default class extends Vue{
let arr = data.chinese.split(';') let arr = data.chinese.split(';')
arr.forEach((o: string) => data.tags.push({name: o, type: 'error'})) arr.forEach((o: string) => data.tags.push({name: o, type: 'error'}))
} }
if (data.isLowest) data.tags.push({name: '史低', type: 'primary', fill: true}) if (data.isLowest) data.tags.push({name: '史低', type: 'success', fill: true})
this.games.push(data) this.games.push(data)
} }
this.more = 'more' this.more = 'more'