This commit is contained in:
liuyuan
2025-10-17 18:15:48 +08:00
parent 39e5105cb2
commit 192f00c069
11 changed files with 7414 additions and 5752 deletions

View File

@@ -1,8 +1,11 @@
<template>
<view style=" height: 100vh; background: #f7faf9;">
<view style=" height: 100vh; background: #f7faf9;" :style="`background:${show==1?'#f4f7ff':''}`">
<z-nav-bar>
<u-search :clearabled="true" bgColor="#fff" borderColor="#54a966" focus v-model="bookScreen.bookName"
@custom='souBook' @clear="clear"></u-search>
<div style="width: 480rpx">
<u-search :clearabled="true" bgColor="#fff" borderColor="#54a966" focus v-model="bookScreen.bookName"
@custom='souBook' @clear="clear" style="width: 100%;"></u-search>
</div>
</z-nav-bar>
<view class="sear_ch" v-if="this.show==0">
<view class="sear_ch_tit">
@@ -13,8 +16,8 @@
</view>
</view>
<view class="sear_list" v-if="this.show==1">
<view class="flexbox" style="display: flex; flex-wrap: wrap;">
<commonSearchFor :prouctList="bookList" :courseList="courseList"></commonSearchFor>
<!-- <view class="flexbox" style="display: flex; flex-wrap: wrap;">
<view class="bl_tioa" v-for="(item,index) in bookList" @click="onpageJump(item)">
<view class="bl_tioa_bg">
<image :src="item.productImages"></image>
@@ -23,7 +26,7 @@
</view>
</view>
</view>
</view>
</view> -->
<view style="height: 1px;"></view>
<view>
@@ -49,6 +52,8 @@
</template>
<script>
import $http from "@/config/requestConfig.js";
import commonSearchFor from './commonSearchFor.vue'
import musicPlay from '@/components/music.vue'
export default {
data() {
@@ -59,6 +64,7 @@
status: 3,
show: 0,
bookList: [],
courseList: [],
historyList: [],
bookScreen: {
authorName: '', //作者
@@ -104,23 +110,12 @@
// 下拉刷新
onReachBottom() {
this.status = 0
if (this.bookScreen.page < this.totalPage) {
this.bookScreen.page = this.bookScreen.page + 1
setTimeout(() => {
this.$http
// .post('book/book/list', this.bookScreen)
.post('book/shopproduct/selectList?limit=8&page=1&key='+this.bookScreen.bookName)
.then(res => {
this.totalPage = res.page.totalPage
for (let i in res.page.list) {
this.bookList.push(res.page.list[i])
}
});
this.getData()
}, 1000)
} else {
this.status = 1
}
},
@@ -135,31 +130,56 @@
this.getHistory()
},
components:{
musicPlay
musicPlay,
commonSearchFor
},
//方法
methods: {
// 获取缓存
getHistory() {
this.historyList = uni.getStorageSync('hisRecords')
if (this.historyList.length > 10) {
this.historyList.splice(10, this.historyList.length)
var historyList = uni.getStorageSync('hisRecords')? uni.getStorageSync('hisRecords'):[]
historyList=[...new Set(historyList)]
if (historyList.length > 10) {
historyList= historyList.splice(10, historyList.length)
}
this.historyList=historyList
uni.setStorageSync('hisRecords', this.historyList);
}
},
// 获取列表数据
getData() {
this.$http
// .post('book/book/list', this.bookScreen)
.post('book/shopproduct/selectList?limit=8&page=1&key='+ this.bookScreen.bookName)
$http
.request({
url: "common/homeSearch/searchData",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
keyWord:this.bookScreen.bookName,
"appName":"wmys",
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(res => {
console.log(res)
this.bookList = res.page.list
this.totalPage = res.page.totalPage
this.status = 3
if(res.code==0){
this.bookList = res.shopProductList
this.courseList = res.courseEntities
this.status = 3
this.show = 1
});
}else{
this.bookList=[]
this.courseList=[]
}
}).catch(err=>{
})
},
// 清空
@@ -277,7 +297,7 @@
}
.sear_list {
margin: 50rpx 30rpx 0 30rpx;
margin: 50rpx 24rpx 0 24rpx;
.bl_tioa {
width: 33.3%;