游戏劣表增加显示游戏类别

This commit is contained in:
zhl 2019-03-05 15:18:26 +08:00
parent cdbcd7e8d0
commit b606bc086a
5 changed files with 25 additions and 5 deletions

View File

@ -10,6 +10,7 @@
<view class="content-view"> <view class="content-view">
<view class="title">{{item.name}}</view> <view class="title">{{item.name}}</view>
<view class="content">{{item.introduce}}</view> <view class="content">{{item.introduce}}</view>
<view class="zan-label zan-label--primary zan-label--small zan-label--plain" aria-label="">{{item.category}}</view>
</view> </view>
<view class="left-btn {{showAll ? '' : 'hidden'}}"> <view class="left-btn {{showAll ? '' : 'hidden'}}">
<view wx:if="{{item.owned}}" class="zan-btn zan-btn--mini zan-btn--plain zan-btn--primary "> <view wx:if="{{item.owned}}" class="zan-btn zan-btn--mini zan-btn--plain zan-btn--primary ">

View File

@ -247,6 +247,7 @@
if (this.record.taglist) { if (this.record.taglist) {
this.tagList = this.record.taglist.split(','); this.tagList = this.record.taglist.split(',');
} }
this.tagList.unshift(this.record.category.toUpperCase());
wepy.setNavigationBarTitle({ wepy.setNavigationBarTitle({
title: this.record.name title: this.record.name
}) })

View File

@ -22,6 +22,11 @@
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消</view> <view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消</view>
</view> </view>
<view class="filter-bar"> <view class="filter-bar">
<view class="search-btn">
<picker @change="categoryChange" value="{{category}}" range="{{categoryArr}}">
{{category}} <i class="icon-love"></i>
</picker>
</view>
<view class="search-btn"> <view class="search-btn">
<picker @change="languageChange" value="{{language}}" range="{{languageArr}}"> <picker @change="languageChange" value="{{language}}" range="{{languageArr}}">
{{language}} <i class="icon-love"></i> {{language}} <i class="icon-love"></i>
@ -81,7 +86,9 @@
languageArr: ['所有语言', '中文', '简体中文', '繁体中文', '英文', '日文', '多国语言', '德文', '法文', '欧洲', '其他'], languageArr: ['所有语言', '中文', '简体中文', '繁体中文', '英文', '日文', '多国语言', '德文', '法文', '欧洲', '其他'],
typeArr: g.gameTypes, typeArr: g.gameTypes,
typeName: '所有类型', typeName: '所有类型',
showAll: false showAll: false,
category: '所有',
categoryArr: ['所有', 'FC', 'GBA']
}; };
methods = { methods = {
@ -111,6 +118,11 @@
this.initPageParam(); this.initPageParam();
this.getRecords(); this.getRecords();
}, },
categoryChange(e) {
this.category = this.categoryArr[e.detail.value];
this.initPageParam();
this.getRecords();
},
gameTap(gid, e) { gameTap(gid, e) {
wepy.navigateTo({ wepy.navigateTo({
url: '/pages/gameInfo?id=' + gid url: '/pages/gameInfo?id=' + gid
@ -171,6 +183,9 @@
if (this.type > 0) { if (this.type > 0) {
data.type = this.type; data.type = this.type;
} }
if (this.category !== '所有') {
data.category = this.category.toLowerCase();
}
let res = await http.post(`/api/emulated/games`, data); let res = await http.post(`/api/emulated/games`, data);
wepy.stopPullDownRefresh(); wepy.stopPullDownRefresh();
if (res.errcode === 0) { if (res.errcode === 0) {
@ -180,7 +195,7 @@
self.current += 10; self.current += 10;
for (let obj of res.records) { for (let obj of res.records) {
(obj.open) && (obj.owned = true); (obj.open) && (obj.owned = true);
obj.icon = `${global.cdnBase}${obj.gid}/1.png`; obj.icon = `${g.cdnBase}images/${obj.gid}/1.png`;
self.records.push(obj); self.records.push(obj);
} }
self.loading = false; self.loading = false;

View File

@ -1,14 +1,13 @@
.game-cell { .game-cell {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
padding: 15px; padding: 15px 15px 5px 15px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
width: 750rpx; width: 750rpx;
} }
.game-cell .game-icon { .game-cell .game-icon {
margin-right:0.8em; margin-right:0.8em;
width:60px; width:60px;
height:60px;
line-height:60px; line-height:60px;
text-align:center; text-align:center;
margin-left: 15px; margin-left: 15px;
@ -63,3 +62,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.zan-label{
text-transform:uppercase;
font-size: 9px;
}

View File

@ -84,7 +84,7 @@
white-space: nowrap; white-space: nowrap;
} }
.filter-bar .search-btn{ .filter-bar .search-btn{
width: 50%; width: 33%;
text-align: center; text-align: center;
margin: 10rpx; margin: 10rpx;
font-size: 30rpx; font-size: 30rpx;