|
@@ -0,0 +1,170 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div class="flex justify-between items-center mt-10px px-10px bread">
|
|
|
+ <div class="">
|
|
|
+ 学生优秀作业<span> - </span>
|
|
|
+ {{ detailData.ks_name }}
|
|
|
+ </div>
|
|
|
+ <div class="back" @click="handleBack">返回</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <van-search v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="handleSearch" @clear="handleSearch" />
|
|
|
+
|
|
|
+ <van-empty v-if="listData.length==0 && !loading" description="无数据" />
|
|
|
+ <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
|
|
+ <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="initData" class="grid grid-cols-2">
|
|
|
+ <van-cell v-for="(item, index) in listData" :key="index" @click="lookDetail(item.yz_id)">
|
|
|
+ <van-image :src="getFullUrl(item.yz_img)" />
|
|
|
+ <div class="p-2">
|
|
|
+ <div class="van-ellipsis title">{{item.yz_name}}</div>
|
|
|
+ <van-rate class="my-2" v-model="item.yz_star_num" color="#ffd21e" void-icon="star" void-color="#eee" size="16px" readonly allow-half />
|
|
|
+ <div class="flex space-x-4 tip">
|
|
|
+ <div>
|
|
|
+ <van-icon name="good-job-o" />
|
|
|
+ <span>{{item.yz_like_num}}</span>
|
|
|
+ </div>
|
|
|
+ <div class="icon-item">
|
|
|
+ <van-icon name="like-o" />
|
|
|
+ <span>{{item.yz_fav_num}}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-cell>
|
|
|
+ </van-list>
|
|
|
+ </van-pull-refresh>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { getFullUrl } from '~/utils/helper';
|
|
|
+import { ysgc_list, xskc_detail } from "./api.js";
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+const router = useRouter();
|
|
|
+const loading = ref(false);
|
|
|
+const finished = ref(false);
|
|
|
+const refreshing = ref(false);
|
|
|
+const keyword = ref("");
|
|
|
+const listData = ref([]);
|
|
|
+
|
|
|
+const handleSearch = () => {
|
|
|
+ listData.value = [];
|
|
|
+ currentPage.value = 1;
|
|
|
+ onRefresh();
|
|
|
+}
|
|
|
+
|
|
|
+const total = ref(0);
|
|
|
+const limit = ref(12);
|
|
|
+const currentPage = ref(1);
|
|
|
+// initData();
|
|
|
+function initData() {
|
|
|
+ if (refreshing.value) {
|
|
|
+ listData.value = [];
|
|
|
+ refreshing.value = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ let obj = {
|
|
|
+ page: currentPage.value,
|
|
|
+ limit: limit.value,
|
|
|
+ keyword: keyword.value,
|
|
|
+ yz_type: '1',
|
|
|
+ ks_id: router.currentRoute.value.params.id
|
|
|
+ }
|
|
|
+ loading.value = true;
|
|
|
+ ysgc_list(obj).then((res) => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ listData.value = listData.value.concat(res.data.page_data);
|
|
|
+ total.value = parseInt(res.data.total_rows);
|
|
|
+ loading.value = false;
|
|
|
+
|
|
|
+ currentPage.value++;
|
|
|
+ if (listData.value.length >= total.value) {
|
|
|
+ finished.value = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+function onRefresh() {
|
|
|
+ // 清空列表数据
|
|
|
+ finished.value = false;
|
|
|
+ currentPage.value = 1;
|
|
|
+
|
|
|
+ // 重新加载数据
|
|
|
+ // 将 loading 设置为 true,表示处于加载状态
|
|
|
+ loading.value = true;
|
|
|
+ initData();
|
|
|
+};
|
|
|
+
|
|
|
+const detailData = ref({});
|
|
|
+initDetailInfo();
|
|
|
+function initDetailInfo() {
|
|
|
+ let data = {
|
|
|
+ ks_id: router.currentRoute.value.params.id,
|
|
|
+ };
|
|
|
+ xskc_detail(data).then((res) => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ detailData.value = res.data.one_info;
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+const handleBack = () => {
|
|
|
+ router.back();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+const lookDetail = (id) => {
|
|
|
+ router.push({ name: 'ysgc_detail', params: { id } })
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.bread {
|
|
|
+ background: #f6fcff;
|
|
|
+ // height: 40px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #646566;
|
|
|
+ padding: 10px;
|
|
|
+}
|
|
|
+.back {
|
|
|
+ color: #00a3ff;
|
|
|
+ border: 1px solid;
|
|
|
+ border-radius: 30px;
|
|
|
+ white-space: nowrap;
|
|
|
+ padding: 3px 10px;
|
|
|
+ margin-left: 8px;
|
|
|
+}
|
|
|
+:deep(.van-search__content--round) {
|
|
|
+ box-shadow: 0px 1px 2px 0px rgba(153, 160, 168, 0.18);
|
|
|
+ background: #fff;
|
|
|
+}
|
|
|
+:deep(.van-list) {
|
|
|
+ .van-cell {
|
|
|
+ padding: 10px 8px;
|
|
|
+ }
|
|
|
+ .van-cell__value {
|
|
|
+ border-radius: 6px;
|
|
|
+ box-shadow: 0px 5px 12px 0px rgba(153, 160, 168, 0.18);
|
|
|
+ text-align: left;
|
|
|
+ .van-image {
|
|
|
+ display: block;
|
|
|
+ .van-image__img {
|
|
|
+ border-radius: 6px 6px 0 0;
|
|
|
+ height: 98px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .van-list__finished-text {
|
|
|
+ -ms-grid-column-span: 1 / -1;
|
|
|
+ grid-column: 1 / -1;
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+}
|
|
|
+.title {
|
|
|
+ font-size: 14px;
|
|
|
+}
|
|
|
+.tip {
|
|
|
+ color: #9a9a9a;
|
|
|
+ font-size: 12px;
|
|
|
+}
|
|
|
+</style>
|