brand对接接口
This commit is contained in:
@@ -4,6 +4,8 @@ import { useRouter } from "vue-router";
|
||||
import myEvent from '@/utils/myEvent'
|
||||
import scListNull from '@/views/shoppingCart/sc-list-null.vue'
|
||||
import brandItem from '@/views/brand/brand-item.vue'
|
||||
import { getDesignerList } from '@/api/brand'
|
||||
|
||||
|
||||
import img from '@/assets/images/collectionStory/Rectangle.png'
|
||||
//const props = defineProps({
|
||||
@@ -23,87 +25,89 @@ const getMerchantData = reactive({
|
||||
isShowMark:false,
|
||||
isNoData:false,
|
||||
})
|
||||
const list = ref([
|
||||
' 1',
|
||||
'Brand 2',
|
||||
'Brand 3',
|
||||
'1213123 4',
|
||||
'Brand 4',
|
||||
'2222 4',
|
||||
'B23rand 4',
|
||||
'Bran112222d 4',
|
||||
' 4',
|
||||
const searchHistory = ref([
|
||||
|
||||
])
|
||||
|
||||
let changeSearchBrandTime = null
|
||||
const changeSearchBrand = () => {
|
||||
clearTimeout(changeSearchBrandTime)
|
||||
changeSearchBrandTime = setTimeout(()=>{
|
||||
getMerchantData.pageNum = 1
|
||||
getDesignerList({
|
||||
keyword: searchBrand.value,
|
||||
}).then((res)=>{
|
||||
merchantList.value = []
|
||||
getMerchantData.isShowMark = false
|
||||
getMerchantData.isNoData = false
|
||||
},300)
|
||||
merchantList.value.push(...res)
|
||||
})
|
||||
// changeSearchBrandTime = setTimeout(()=>{
|
||||
// getMerchantData.pageNum = 1
|
||||
// getMerchantData.isShowMark = false
|
||||
// getMerchantData.isNoData = false
|
||||
// },300)
|
||||
}
|
||||
|
||||
const getBrandList = async () => {
|
||||
if(getMerchantData.isShowMark && !getMerchantData.isNoData)return
|
||||
getMerchantData.isShowMark = true
|
||||
let value = {
|
||||
pageSize: getMerchantData.pageSize,
|
||||
pageNum: getMerchantData.pageNum,
|
||||
status: 1,
|
||||
}
|
||||
setTimeout(()=>{
|
||||
if(merchantList.value.length >= 5){
|
||||
getMerchantData.isNoData = true
|
||||
merchantList.value = []
|
||||
return
|
||||
}
|
||||
getMerchantData.pageNum += 1
|
||||
merchantList.value.push({
|
||||
name:'Roaming Clouds',
|
||||
portrait: img,
|
||||
collectionsName:'by Lian Su ',
|
||||
collections:[
|
||||
img,img,img,
|
||||
],
|
||||
})
|
||||
getMerchantData.isShowMark = false
|
||||
},1000)
|
||||
// await getPublishList(value).then((res)=>{
|
||||
// if(res.content.length == 0)getMerchantData.isNoData = true
|
||||
// getMerchantData.pageNum += 1
|
||||
// list.value.push(...res.content)
|
||||
// })
|
||||
}
|
||||
const vObserve = {
|
||||
mounted (el,binding) {
|
||||
getMerchantData.isShowMark = false
|
||||
getMerchantData.isNoData = false
|
||||
new IntersectionObserver(
|
||||
(entries, observer) => {
|
||||
// 如果不是相交,则直接返回
|
||||
// console.log(entries[0]);
|
||||
if (!entries[0].intersectionRatio) return;
|
||||
getMerchantData.pageNum += 1
|
||||
binding.value()
|
||||
},
|
||||
// { root:worksPage }
|
||||
).observe(el);
|
||||
}
|
||||
}
|
||||
// const getBrandList = async () => {
|
||||
// if(getMerchantData.isShowMark && !getMerchantData.isNoData)return
|
||||
// getMerchantData.isShowMark = true
|
||||
// let value = {
|
||||
// pageSize: getMerchantData.pageSize,
|
||||
// pageNum: getMerchantData.pageNum,
|
||||
// status: 1,
|
||||
// }
|
||||
// setTimeout(()=>{
|
||||
// if(merchantList.value.length >= 5){
|
||||
// getMerchantData.isNoData = true
|
||||
// merchantList.value = []
|
||||
// return
|
||||
// }
|
||||
// getMerchantData.pageNum += 1
|
||||
// merchantList.value.push({
|
||||
// name:'Roaming Clouds',
|
||||
// portrait: img,
|
||||
// collectionsName:'by Lian Su ',
|
||||
// collections:[
|
||||
// img,img,img,
|
||||
// ],
|
||||
// })
|
||||
// getMerchantData.isShowMark = false
|
||||
// },1000)
|
||||
// // await getPublishList(value).then((res)=>{
|
||||
// // if(res.content.length == 0)getMerchantData.isNoData = true
|
||||
// // getMerchantData.pageNum += 1
|
||||
// // list.value.push(...res.content)
|
||||
// // })
|
||||
// }
|
||||
// const vObserve = {
|
||||
// mounted (el,binding) {
|
||||
// getMerchantData.isShowMark = false
|
||||
// getMerchantData.isNoData = false
|
||||
// new IntersectionObserver(
|
||||
// (entries, observer) => {
|
||||
// // 如果不是相交,则直接返回
|
||||
// // console.log(entries[0]);
|
||||
// if (!entries[0].intersectionRatio) return;
|
||||
// getMerchantData.pageNum += 1
|
||||
// binding.value()
|
||||
// },
|
||||
// // { root:worksPage }
|
||||
// ).observe(el);
|
||||
// }
|
||||
// }
|
||||
|
||||
const deleteHistory = (item) => {
|
||||
list.value = list.value.filter((i) => i != item)
|
||||
searchHistory.value = searchHistory.value.filter((i) => i != item)
|
||||
localStorage.setItem('brandSearchHistory', JSON.stringify(searchHistory.value));
|
||||
}
|
||||
const viewProfile = (item) => {
|
||||
if(!searchHistory.value.includes(searchBrand.value))searchHistory.value.push(searchBrand.value)
|
||||
localStorage.setItem('brandSearchHistory', JSON.stringify(searchHistory.value));
|
||||
router.push({
|
||||
path:'/brand/1',
|
||||
path:'/brand/'+item.sellerId,
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
const value = localStorage.getItem('brandSearchHistory');
|
||||
if(value)searchHistory.value = JSON.parse(value)
|
||||
})
|
||||
onUnmounted(()=>{
|
||||
})
|
||||
@@ -129,10 +133,10 @@ const {} = toRefs(data);
|
||||
<div class="merchantList" v-if="searchBrand.length > 0">
|
||||
<brand-item v-for="item in merchantList" :key="item.name" :item="item" @viewProfile="viewProfile"></brand-item>
|
||||
<div class="end" v-show="!getMerchantData.isNoData && !getMerchantData.isShowMark">- The End-</div>
|
||||
<div v-show="!getMerchantData.isNoData" class="material_content_list_loding">
|
||||
<!-- <div v-show="!getMerchantData.isNoData" class="material_content_list_loding">
|
||||
<span class="page_loading" v-show="!getMerchantData.isShowMark" v-observe="getBrandList"></span>
|
||||
<img v-if="getMerchantData.isShowMark" src="@/assets/images/brand/brandLoading.gif" alt="">
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="merchantListNull" v-if="getMerchantData.isNoData && searchBrand.length > 0">
|
||||
<sc-list-null
|
||||
@@ -151,7 +155,7 @@ const {} = toRefs(data);
|
||||
<span>Searching History</span>
|
||||
</div>
|
||||
<div class="history">
|
||||
<div v-for="item in list" :key="item" @click.stop="searchBrand = item" class="item">
|
||||
<div v-for="item in searchHistory" :key="item" @click.stop="searchBrand = item" class="item">
|
||||
<span>{{item}}</span>
|
||||
<div class="icon" @click.stop="deleteHistory(item)">
|
||||
<SvgIcon name="brand-delete" size="18" />
|
||||
|
||||
Reference in New Issue
Block a user