|
|
@@ -4,11 +4,11 @@ import {
|
|
4
|
4
|
getUserSharePostersClassifyList,
|
|
5
|
5
|
getUserSharePostersImagesList,
|
|
6
|
6
|
} from "~/apis/user";
|
|
7
|
|
-import type {SharePosterImageResult, SharePostersClassify} from "~/apis/model/inviteFriendsModel";
|
|
|
7
|
+import type { SharePosterImageResult, SharePostersClassify } from "~/apis/model/inviteFriendsModel";
|
|
8
|
8
|
import ProductCard from "~/components/ProductCard/ProductCard.vue";
|
|
9
|
|
-import {call} from "dayjs";
|
|
|
9
|
+import { call } from "dayjs";
|
|
10
|
10
|
import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
|
|
11
|
|
-import {CDN_URL} from "~/config/app";
|
|
|
11
|
+import { CDN_URL } from "~/config/app";
|
|
12
|
12
|
const state = reactive<any>({
|
|
13
|
13
|
// 列表高度
|
|
14
|
14
|
scrollHeight: 0,
|
|
|
@@ -97,6 +97,9 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
|
|
97
|
97
|
|
|
98
|
98
|
getUserSharePostersImagesList(params).then(res => {
|
|
99
|
99
|
state.triggered = false
|
|
|
100
|
+ console.log(action);
|
|
|
101
|
+ console.log(res);
|
|
|
102
|
+ state.totalPage = Math.ceil(res.pageInfo.total / state.pageSize);
|
|
100
|
103
|
// sharePosterImageResult.value = res
|
|
101
|
104
|
if (action === 'page') {
|
|
102
|
105
|
state.list = state.list.concat(res.pageInfo.list)
|
|
|
@@ -104,8 +107,10 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
|
|
104
|
107
|
if (action === 'reload') {
|
|
105
|
108
|
state.list = res.pageInfo.list
|
|
106
|
109
|
}
|
|
|
110
|
+ setTimeout(() => {
|
|
|
111
|
+ state.triggered = false
|
|
|
112
|
+ }, 300)
|
|
107
|
113
|
|
|
108
|
|
- state.totalPage = Math.ceil(res.pageInfo.total / state.pageSize);
|
|
109
|
114
|
state.status = 'more'
|
|
110
|
115
|
if (callback) {
|
|
111
|
116
|
callback(res.pageInfo.list)
|
|
|
@@ -115,12 +120,13 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
|
|
115
|
120
|
|
|
116
|
121
|
function handleCategoryItemClick(item) {
|
|
117
|
122
|
state.currentCategoryId = item.id
|
|
|
123
|
+ state.scrollTop = 0
|
|
118
|
124
|
loadList('reload')
|
|
119
|
125
|
}
|
|
|
126
|
+// 下拉刷新被下拉
|
|
120
|
127
|
const onRefresherPulling = e => {
|
|
121
|
128
|
state.triggered = true;
|
|
122
|
129
|
loadList('reload')
|
|
123
|
|
-
|
|
124
|
130
|
};
|
|
125
|
131
|
// 下拉刷新被复位
|
|
126
|
132
|
const onRefresherRestore = e => {
|
|
|
@@ -140,7 +146,7 @@ function handleScrollToLower() {
|
|
140
|
146
|
|
|
141
|
147
|
state.status = 'loading';
|
|
142
|
148
|
state.currentPage += 1;
|
|
143
|
|
- if (state.currentPage >= state.totalPage) {
|
|
|
149
|
+ if (state.currentPage > state.totalPage) {
|
|
144
|
150
|
state.status = 'noMore';
|
|
145
|
151
|
} else {
|
|
146
|
152
|
// queryFavorites('page');
|
|
|
@@ -150,6 +156,7 @@ function handleScrollToLower() {
|
|
150
|
156
|
|
|
151
|
157
|
function loadAll() {
|
|
152
|
158
|
state.currentCategoryId = 0
|
|
|
159
|
+ state.scrollTop = 0
|
|
153
|
160
|
loadList('reload')
|
|
154
|
161
|
}
|
|
155
|
162
|
function handleItemClick(item) {
|
|
|
@@ -164,7 +171,7 @@ function handleItemClick(item) {
|
|
164
|
171
|
uid: userStore.uid,
|
|
165
|
172
|
imgId: item.id
|
|
166
|
173
|
}).then(res => {
|
|
167
|
|
- console.log('生成的二维码',res)
|
|
|
174
|
+ console.log('生成的二维码', res)
|
|
168
|
175
|
if (res && res.shareImgs) {
|
|
169
|
176
|
state.currentImg = res.shareImgs
|
|
170
|
177
|
}
|
|
|
@@ -206,26 +213,18 @@ function handleClose() {
|
|
206
|
213
|
<template>
|
|
207
|
214
|
<div class="flex">
|
|
208
|
215
|
<!-- 左侧 -->
|
|
209
|
|
- <scroll-view
|
|
210
|
|
- :scroll-y="true"
|
|
211
|
|
- :style="{ height: `${state.scrollHeight}px` }"
|
|
212
|
|
- class="flex w-25 h-full bg-[#f8f8f8]"
|
|
213
|
|
- >
|
|
214
|
|
- <div
|
|
215
|
|
- @tap="loadAll"
|
|
216
|
|
- :class="state.currentCategoryId == 0 ? 'bg-white font-bold' : ''"
|
|
217
|
|
- class="relative w-25 h-15 block text-sm flex justify-center items-center">
|
|
|
216
|
+ <scroll-view :scroll-y="true" :style="{ height: `${state.scrollHeight}px` }" class="flex w-25 h-full bg-[#f8f8f8]">
|
|
|
217
|
+ <div @tap="loadAll" :class="state.currentCategoryId == 0 ? 'bg-white font-bold' : ''"
|
|
|
218
|
+ class="relative w-25 h-15 block text-sm flex justify-center items-center">
|
|
218
|
219
|
<div class="flex items-center gap-1">
|
|
219
|
220
|
<div class="h-4 bg-primary w-1" v-if="state.currentCategoryId == 0"></div>
|
|
220
|
221
|
<div>推荐</div>
|
|
221
|
222
|
</div>
|
|
222
|
223
|
|
|
223
|
224
|
</div>
|
|
224
|
|
- <div v-for="(item, index) in categoryList" :key="index"
|
|
225
|
|
- @click="handleCategoryItemClick(item)"
|
|
226
|
|
- :class="state.currentCategoryId == item.id ? 'bg-white font-bold' : ''"
|
|
227
|
|
- class="relative h-15 block text-sm flex justify-center items-center"
|
|
228
|
|
- >
|
|
|
225
|
+ <div v-for="(item, index) in categoryList" :key="index" @click="handleCategoryItemClick(item)"
|
|
|
226
|
+ :class="state.currentCategoryId == item.id ? 'bg-white font-bold' : ''"
|
|
|
227
|
+ class="relative h-15 block text-sm flex justify-center items-center">
|
|
229
|
228
|
<div class="flex items-center gap-1">
|
|
230
|
229
|
<div class="h-4 bg-primary w-1" v-if="state.currentCategoryId == item.id"></div>
|
|
231
|
230
|
<div>{{ item.name }}</div>
|
|
|
@@ -233,34 +232,25 @@ function handleClose() {
|
|
233
|
232
|
|
|
234
|
233
|
</div>
|
|
235
|
234
|
</scroll-view>
|
|
236
|
|
- <scroll-view
|
|
237
|
|
- :scroll-top="true"
|
|
238
|
|
- :scroll-y="true"
|
|
239
|
|
- :style="{ height: `${state.scrollHeight}px` }"
|
|
240
|
|
- class="flex flex-1 flex-col h-full p-3 gap-3 pb-safe"
|
|
241
|
|
- :refresher-enabled="true"
|
|
242
|
|
- refresher-background="#f5f5f5"
|
|
243
|
|
- refresher-default-style="black"
|
|
244
|
|
- :refresher-triggered="state.triggered"
|
|
245
|
|
- @scrolltolower="handleScrollToLower"
|
|
246
|
|
- @refresherPulling="onRefresherPulling"
|
|
247
|
|
- @refresherRestore="onRefresherRestore"
|
|
248
|
|
- @refresherAbort="onRefresherAbort"
|
|
249
|
|
- @refresherrefresh="onRefresherRefresh"
|
|
250
|
|
- v-if="state.list && state.list.length > 0"
|
|
251
|
|
- >
|
|
252
|
|
- <grid-view
|
|
253
|
|
- type="masonry" cross-axis-count="2" cross-axis-gap="10px" main-axis-gap="10px"
|
|
254
|
|
- >
|
|
255
|
|
- <div v-for="(item, index) in state.list"
|
|
256
|
|
- :key="index"
|
|
257
|
|
- @click="handleItemClick(item)"
|
|
258
|
|
- >
|
|
259
|
|
- <image
|
|
260
|
|
- :src="item.image_fake"
|
|
261
|
|
- mode="widthFix" class="w-30 h-full rounded-lg"></image>
|
|
|
235
|
+ <scroll-view :scroll-y="true" :scroll-top="state.scrollTop" :style="{ height: `${state.scrollHeight}px` }"
|
|
|
236
|
+ class="flex flex-1 flex-col h-full p-3 gap-3 pb-safe" :refresher-enabled="true" refresher-background="#f5f5f5"
|
|
|
237
|
+ refresher-default-style="black" :refresher-triggered="state.triggered" @scrolltolower="handleScrollToLower"
|
|
|
238
|
+ @refresherPulling="onRefresherPulling" @refresherRestore="onRefresherRestore" @refresherAbort="onRefresherAbort"
|
|
|
239
|
+ @refresherrefresh="onRefresherRefresh" v-if="state.list && state.list.length > 0">
|
|
|
240
|
+ <grid-view type="masonry" cross-axis-count="2" cross-axis-gap="10px" main-axis-gap="10px">
|
|
|
241
|
+ <div v-for="(item, index) in state.list" :key="index" @click="handleItemClick(item)">
|
|
|
242
|
+ <image :src="item.image_fake" mode="widthFix" class="w-30 h-full rounded-lg"></image>
|
|
262
|
243
|
</div>
|
|
|
244
|
+ <!-- <div class=" flex justify-center items-center text-[12px] text-gray-500">
|
|
|
245
|
+ <div v-if="state.status === 'loading'">
|
|
|
246
|
+ 加载中...
|
|
|
247
|
+ </div>
|
|
|
248
|
+ <div v-if="state.status === 'noMore'">
|
|
|
249
|
+ 没有更多了~
|
|
|
250
|
+ </div>
|
|
|
251
|
+ </div> -->
|
|
263
|
252
|
</grid-view>
|
|
|
253
|
+
|
|
264
|
254
|
</scroll-view>
|
|
265
|
255
|
<div class="flex flex-col justify-center items-center w-full" v-else>
|
|
266
|
256
|
<CXBEmpty />
|
|
|
@@ -269,14 +259,13 @@ function handleClose() {
|
|
269
|
259
|
</div>
|
|
270
|
260
|
|
|
271
|
261
|
<nut-overlay v-model:visible="show" :lock-scroll="true">
|
|
272
|
|
-<!-- <image src="https://cdn.bjtdba.com/vod/image/2023-09-16/20230916070524825.png"-->
|
|
273
|
|
-<!-- mode="widthFix" class="absolute top-0 right-0"-->
|
|
274
|
|
-<!-- @tap.stop="handleClose"-->
|
|
275
|
|
-<!-- v-if="state.showTip"-->
|
|
276
|
|
-<!-- ></image>-->
|
|
277
|
|
-
|
|
278
|
|
- <div class="flex flex-col justify-center items-center w-full h-full"
|
|
279
|
|
- >
|
|
|
262
|
+ <!-- <image src="https://cdn.bjtdba.com/vod/image/2023-09-16/20230916070524825.png"-->
|
|
|
263
|
+ <!-- mode="widthFix" class="absolute top-0 right-0"-->
|
|
|
264
|
+ <!-- @tap.stop="handleClose"-->
|
|
|
265
|
+ <!-- v-if="state.showTip"-->
|
|
|
266
|
+ <!-- ></image>-->
|
|
|
267
|
+
|
|
|
268
|
+ <div class="flex flex-col justify-center items-center w-full h-full">
|
|
280
|
269
|
<div class="bg-white">
|
|
281
|
270
|
<image :src="state.currentImg" mode="widthFix" class="w-60"></image>
|
|
282
|
271
|
<div class="bg-white p-3 flex justify-around gap-3">
|
|
|
@@ -284,7 +273,7 @@ function handleClose() {
|
|
284
|
273
|
<image :src="wechatImg" mode="widthFix" class="w-8 h-8"></image>
|
|
285
|
274
|
<div>微信</div>
|
|
286
|
275
|
</div>
|
|
287
|
|
-<!-- <div class="flex flex-col text-[12px] justify-center items-center" @tap.stop="shareImage">
|
|
|
276
|
+ <!-- <div class="flex flex-col text-[12px] justify-center items-center" @tap.stop="shareImage">
|
|
288
|
277
|
<image :src="pyqImg" mode="widthFix" class="w-8 h-8"></image>
|
|
289
|
278
|
<div>朋友圈</div>
|
|
290
|
279
|
</div>-->
|
|
|
@@ -306,10 +295,11 @@ style:
|
|
306
|
295
|
|
|
307
|
296
|
</route>
|
|
308
|
297
|
<style>
|
|
309
|
|
-
|
|
310
|
298
|
page {
|
|
|
299
|
+ /* height: 100%; */
|
|
311
|
300
|
overflow: hidden;
|
|
312
|
301
|
}
|
|
|
302
|
+
|
|
313
|
303
|
image {
|
|
314
|
304
|
|
|
315
|
305
|
image-rendering: -moz-crisp-edges;
|