bug修复

This commit is contained in:
BAKEYi 2026-05-28 16:09:50 +08:00
parent 95f097f8c9
commit b67b581775
1 changed files with 29 additions and 15 deletions

View File

@ -68,24 +68,26 @@
></skill-card>
</view>
<view class="empty-state" v-else>
<image class="empty-icon" src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/da814ede-1adc-4f90-8cdf-5357a12fab27.png"></image>
<view v-else>
<noData></noData>
</view>
</view>
<view style="height: 60rpx;"></view>
</view>
</template>
<script>
import request from "@/utils/request"
import SkillCard from "@/pages/home/components/skill-card.vue"
import noData from "@/components/noData/noData.vue";
// true=false=使
const USE_REAL_API = true
export default {
components: { SkillCard },
components: { SkillCard, noData },
data() {
return {
navHeight: 0,
@ -170,6 +172,7 @@ export default {
this.fetchData(true);
},
// ()
// ()
async fetchData(isReset = false) {
if (isReset) {
@ -181,12 +184,21 @@ export default {
if (USE_REAL_API) {
uni.showLoading({ title: '加载中...' })
try {
// 1.
const params = {
page: this.page,
limit: this.limit,
order_type: this.orderType
limit: this.limit
}
// 2. orderType 0 order_type 500
if (this.orderType !== 0) {
params.order_type = this.orderType
}
// 3.
if (this.linkType !== '') {
params.link_type = this.linkType
}
if (this.linkType) params.link_type = this.linkType
const res = await request.post('/sj/skill/list', params)
if ((res.code === 200 || res.state === 1) && res.data && res.data.list) {
@ -210,18 +222,20 @@ export default {
let list = [...this.mockDatabase]
// 1.
if (this.linkType) {
if (this.linkType !== '') {
list = list.filter(item => item.link_type === this.linkType)
}
// 2.
list.sort((a, b) => {
if (this.orderType === 1) return b.timestamp - a.timestamp //
if (this.orderType === 2) return a.timestamp - b.timestamp //
if (this.orderType === 3) return b.views - a.views //
if (this.orderType === 4) return a.views - b.views //
return 0
})
// 2. ( orderType 0 )
if (this.orderType !== 0) {
list.sort((a, b) => {
if (this.orderType === 1) return b.timestamp - a.timestamp //
if (this.orderType === 2) return a.timestamp - b.timestamp //
if (this.orderType === 3) return b.views - a.views //
if (this.orderType === 4) return a.views - b.views //
return 0
})
}
// 3.
const start = (this.page - 1) * this.limit