Skip to content

Commit 49eed2d

Browse files
author
zhusha
committed
fix:小屏尺寸下的部分问题修复
1 parent 8795ca7 commit 49eed2d

5 files changed

Lines changed: 60 additions & 14 deletions

File tree

src/assets/css/furniture/pc/index.less

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@
242242

243243
.m-furniture-set {
244244
.w(calc(calc(100% - 140px) / 8));
245+
min-width: 120px;
245246
}
246247

247248
.u-img {
@@ -257,6 +258,34 @@
257258
}
258259
}
259260

261+
@media screen and (max-width: @ipad) {
262+
.p-furniture {
263+
.m-furniture-wrap {
264+
.u-set-item {
265+
.u-furniture-list {
266+
.m-furniture-set {
267+
.w(calc(calc(100% - 100px) / 6));
268+
}
269+
}
270+
}
271+
}
272+
}
273+
}
274+
275+
@media screen and (max-width: @ipad-y) {
276+
.p-furniture {
277+
.m-furniture-wrap {
278+
.u-set-item {
279+
.u-furniture-list {
280+
.m-furniture-set {
281+
.w(calc(calc(100% - 60px) / 4));
282+
}
283+
}
284+
}
285+
}
286+
}
287+
}
288+
260289
@media screen and (max-width: @phone) {
261290
.p-furniture {
262291
margin-top: 0px;
@@ -287,11 +316,19 @@
287316
padding: 5px;
288317
flex-wrap: nowrap;
289318
overflow-x: auto;
319+
320+
.m-furniture-set {
321+
.w(140px);
322+
min-width: 140px;
323+
flex-shrink: 0;
324+
}
290325
}
291326
}
292327
}
293328

294329
.m-furniture-list {
330+
grid-template-columns: repeat(2, 1fr) !important;
331+
295332
.m-furniture-set {
296333
width: 100%;
297334

@@ -300,7 +337,6 @@
300337

301338
.u-image {
302339
width: 100%;
303-
304340
}
305341
}
306342
}

src/components/common/card_banner_list.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
<slot name="action"> </slot>
99
</div>
1010
</div>
11-
<div class="m-card-banner-list_box" :count="count" :minw="minw" :isPhone="isPhone()">
12-
<div class="m-cardlist-items" :style="`grid-template-columns: repeat( ${isPhone() ? 8 : count}, ${isPhone() ? minw + 'px' : '1fr'
13-
} )`">
11+
<div class="m-card-banner-list_box" :count="count" :minw="minw">
12+
<div class="m-cardlist-items" :style="`grid-template-columns: repeat(${count}, 1fr)`">
1413
<div class="m-cardlist-item" v-for="(item, index) in list" :key="index">
1514
<!-- 调用渲染函数来渲染子元素 -->
1615
<slot :item="item" :index="index">
@@ -27,8 +26,6 @@
2726
</template>
2827

2928
<script>
30-
import { isPhone } from "@/utils";
31-
3229
export default {
3330
name: "CardBannerList",
3431
props: ["data", "count", "items", "minw"],
@@ -37,7 +34,6 @@ export default {
3734
return {
3835
fill: "#E1E1E1",
3936
number: 0,
40-
isPhone,
4137
};
4238
},
4339
computed: {

src/service/adventure/treasure/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export function getAdventures(params) {
4343

4444
export function getAchievements() {
4545
return $node().get(`/serendipity/achievements`, {
46-
client,
46+
params: {
47+
client,
48+
},
4749
});
4850
}

src/views/adventure/AdventureList.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import CardBannerList from "@/components/common/card_banner_list.vue";
4545
import AdventureTabs from "@/components/adventure/tabs.vue";
4646
import AdventureItem from "@/components/adventure/item.vue";
4747
import { getAdventures } from "@/service/adventure/adventure";
48-
import { isPhone } from "@/utils/index";
4948
import dayjs from "@/utils/day";
5049
export default {
5150
name: "adventureList",
@@ -168,13 +167,21 @@ export default {
168167
this.showCount();
169168
},
170169
showCount() {
171-
if (isPhone()) {
172-
this.per = 8;
173-
return;
174-
}
175170
const listWidth = this.$refs.listRef?.clientWidth || 1200;
176171
const cardWidth = Number(this.itemData.width);
177172
const gridGap = 12;
173+
174+
if (listWidth <= 520) {
175+
this.count = 1;
176+
this.per = 8;
177+
return;
178+
}
179+
if (listWidth <= 1024) {
180+
this.count = 2;
181+
this.per = 16;
182+
return;
183+
}
184+
178185
if (this.active === "all") {
179186
const availableWidth = listWidth - 120;
180187
this.count = Math.max(Math.floor(availableWidth / (cardWidth + gridGap)), 1);

src/views/adventure/treasure/miniprogram/Portrait.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ export default {
164164
}
165165
},
166166
mounted() {
167+
if (!this.isLogin) return;
167168
getUserRoles().then((res) => {
168169
if (res.data.data.list.length) {
169170
this.noRole = false;
@@ -176,7 +177,11 @@ export default {
176177
}
177178
} else {
178179
this.noRole = true;
179-
this.$message.error("未获取到角色信息");
180+
try {
181+
this.$message.error("未获取到角色信息");
182+
} catch (e) {
183+
console.log(e);
184+
}
180185
}
181186
});
182187
},

0 commit comments

Comments
 (0)