From ef37c59e055a990ce247b265b27d3fcef430a243 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期五, 15 八月 2025 10:19:18 +0800 Subject: [PATCH] first submit --- src/components/detail/serviceRelated.vue | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 169 insertions(+), 0 deletions(-) diff --git a/src/components/detail/serviceRelated.vue b/src/components/detail/serviceRelated.vue new file mode 100644 index 0000000..c319425 --- /dev/null +++ b/src/components/detail/serviceRelated.vue @@ -0,0 +1,169 @@ +<template> + <div class="relatedBox"> + <div class="headBox"> + <div class="titleBox">鐩稿叧鎺ㄨ崘</div> + </div> + <div class="bookBox" v-if="dataList.length > 0 && !loading"> + <div class="itemBox" v-for="(item, index) in dataList" :key="index" @click="toDetail(item)"> + <div class="imgBox"> + <img class="autoImg" :src="item.icon" alt="" /> + </div> + <div class="rightBox"> + <div class="bookName ellipsis" :title="item.name"> + {{ item.name }} + </div> + <div class="authorBox"> + <div>浣滆�咃細</div> + <div class="authorName" :title="item.caupress_author"> + {{ item.caupress_author }} + </div> + </div> + <div class="toDetail" @click="toDetail(item)">璇︽儏 >></div> + </div> + </div> + </div> + <el-empty + :image-size="100" + description="鏆傛棤璧勬簮" + v-if="dataList.length == 0 && !loading" + ></el-empty> + </div> +</template> + +<script> +export default { + props: ["recommendKey", "bookInfo"], + data() { + return { + dataList: [], + loading: true + }; + }, + created() { + // this.getData(); + }, + methods: { + getData(val) { + console.log(val); + let query = { + path: "caupress_teachingResource", // 涔﹀煄鐩稿叧鎺ㄨ崘 + queryType: "*", + paging: { + start: 0, + size: 7 // 澶氳幏鍙栦竴鏉★紝闃叉闅忔満鍒拌嚜韬� + }, + sort: { Random: "Asc" }, + fields: { + caupress_author: [], + "caupress_catalogue*": val ? val : [], + }, + coverSize: { + height: 200 + } + }; + this.MG.store.getProductList(query).then((res) => { + this.dataList = res.datas.filter((item) => item.id != this.bookInfo.id); + this.dataList = this.dataList.slice(0, 6); + this.loading = false; + }); + }, + toDetail(row) { + this.$router.replace({ + name: "teachingServices-detail", + query: { id: row.id, cmsPath: row.rootCmsItemId } + }); + this.$emit("reloadPage", row); + }, + }, + watch: { + recommendKey(key) { + if (key === "null") { + this.loading = false; + } else if (key) { + // this.getData(); + } + }, + bookInfo(key) { + // this.getData(); + } + } +}; +</script> + +<style scoped> +.relatedBox { + width: 813px; + background-color: #fff; + margin: 10px 0 0 10px; + border-top: 1px solid #00873c; + margin-bottom: 20px; + box-sizing: border-box; +} +.titleBox { + height: 60px; + background: #d8f7e6; + line-height: 60px; + padding: 0 40px; + font-weight: 700; + color: #00873c; + font-size: 18px; +} +.bookBox { + display: flex; + flex-wrap: wrap; + background-color: #fff; + padding: 10px; +} +.imgBox { + width: 100px; + height: 150px; + position: relative; + border: 1px solid #e6e6e6; +} +.rightBox { + flex: 1; + overflow: hidden; + margin-left: 10px; +} +.itemBox { + width: 50%; + display: flex; + padding: 10px; + box-sizing: border-box; +} +.bookName { + font-size: 16px !important; + line-height: 20px; + text-overflow: ellipsis; +} +.authorBox { + margin-top: 10px; + color: #666666; + position: relative; + display: flex; + line-height: 20px; +} +.toDetail { + cursor: pointer; + margin-top: 40px; + color: #00873c; +} +.authorName { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; +} +.headBox { + display: flex; + background: #d8f7e6; + justify-content: space-between; +} +.viewMore { + cursor: pointer; + padding: 20px; + color: #999; +} +</style> -- Gitblit v1.9.1