Merge branch 'dev-wangyiming'

This commit is contained in:
wlikett 2023-12-09 17:03:53 +08:00
commit 1ac52e029e
4 changed files with 112 additions and 64 deletions

View File

@ -3,3 +3,7 @@ import { get, post } from '../../index'
export const getGoodsClassListApi = () => { export const getGoodsClassListApi = () => {
return get('/zlpt-home/maType/getEquipmentType', {}) return get('/zlpt-home/maType/getEquipmentType', {})
} }
export const apiGetCollect = (params = {}) => {
return post('/zlpt-equip/dev/userCollectList',params)
}

View File

@ -1,74 +1,81 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import {apiGetCollect} from "@/http/api/home";
import {ref} from "vue";
import {equipCollect} from "@/http/api/equip";
import {ElMessage} from "element-plus";
import NavMenu from "@/components/Navmenu/index.vue"
const router = useRouter() const router = useRouter()
const getImg = (imgUrl: string) => { const getImg = (imgUrl: string) => {
return new URL(imgUrl, import.meta.url).href return new URL(imgUrl, import.meta.url).href
} }
const collectList = ref([
{ const pageData = ref({
v_collect_name: '出租17内燃式叉车', pageSize:6,
v_collect_price: '12000元/月', pageNum:1,
v_collect_adress: '浙江省嘉兴市', total:0
v_collect_imgsrc: '../../assets/img/home/2023_12_01_beijing2/left_bg.png' })
},
{ const collectList = ref([])
v_collect_name: '出租17内燃式叉车',
v_collect_price: '12000元/月',
v_collect_adress: '浙江省嘉兴市',
v_collect_imgsrc: '../../assets/img/home/2023_12_01_beijing2/left_bg.png'
},
{
v_collect_name: '出租17内燃式叉车',
v_collect_price: '12000元/月',
v_collect_adress: '浙江省嘉兴市',
v_collect_imgsrc: '../../assets/img/home/2023_12_01_beijing2/left_bg.png'
},
{
v_collect_name: '出租17内燃式叉车',
v_collect_price: '12000元/月',
v_collect_adress: '浙江省嘉兴市',
v_collect_imgsrc: '../../assets/img/home/2023_12_01_beijing2/left_bg.png'
},
{
v_collect_name: '出租17内燃式叉车',
v_collect_price: '12000元/月',
v_collect_adress: '浙江省嘉兴市',
v_collect_imgsrc: '../../assets/img/home/2023_12_01_beijing2/left_bg.png'
},
{
v_collect_name: '出租17内燃式叉车',
v_collect_price: '12000元/月',
v_collect_adress: '浙江省嘉兴市',
v_collect_imgsrc: '../../assets/img/home/2023_12_01_beijing2/left_bg.png'
},
{
v_collect_name: '出租17内燃式叉车',
v_collect_price: '12000元/月',
v_collect_adress: '浙江省嘉兴市',
v_collect_imgsrc: '../../assets/img/home/2023_12_01_beijing2/left_bg.png'
}
])
// //
const previewCollectBtn = () => { const previewCollectBtn = (id) => {
router.push('/equipDetail/4') router.push(`/equipDetail/${id}`)
} }
// //
const deleteCollect = (indx: any) => { const deleteCollect = async (id: any) => {
collectList.value.splice(indx, 1) const params = {
maId: id,
isCollect: false
}
const res = await equipCollect(params)
if (res.code == '200') {
ElMessage({
type: 'success',
duration: 1000,
message: `装备已取消收藏`
})
getList()
}
} }
const getList = async () => {
const params = {
pageNum:pageData.value.pageNum,
pageSize:pageData.value.pageSize
}
const res = await apiGetCollect(params)
pageData.value.total = res.total
collectList.value = (res.rows || []).map(item => {
return {
v_collect_name: `${item.modelName}${item.deviceName}`,
v_collect_price: item.monthLeasePrice,
v_collect_adress: item.cityStr,
v_collect_imgsrc: item.picUrl,
...item
}
})
}
const init = () => {
getList()
}
init()
</script> </script>
<template> <template>
<NavMenu></NavMenu>
<!-- 收藏设备页面 --> <!-- 收藏设备页面 -->
<div class="my-collect"> <div class="my-collect">
<div class="collect" v-for="(item, index) in collectList" :key="item.v_collect_name"> <div class="collect" v-for="(item, index) in collectList" :key="index" v-show="pageData.total > 0">
<!-- 商品图片 --> <!-- 商品图片 -->
<img :src="getImg(item.v_collect_imgsrc)" alt="" /> <img :src="item.v_collect_imgsrc" alt="" />
<div class="lifting-info"> <div class="lifting-info">
<i>起重量5</i> <i></i>
<i>起重量5</i> <i>{{ item.specification }}</i>
</div> </div>
<div class="collect-price">{{ item.v_collect_price }}</div> <div class="collect-price">{{ item.v_collect_price }}</div>
<div class="collect-name">{{ item.v_collect_name }}</div> <div class="collect-name">{{ item.v_collect_name }}</div>
@ -77,16 +84,30 @@
<!-- 遮罩层 --> <!-- 遮罩层 -->
<div class="collect-mask"> <div class="collect-mask">
<div class="collect-mask-btn"> <div class="collect-mask-btn">
<button @click="previewCollectBtn">查看设备</button> <button @click="previewCollectBtn(item.maId)">查看设备</button>
<button @click="deleteCollect(index)">删除收藏</button> <button @click="deleteCollect(item.maId)">删除收藏</button>
</div> </div>
</div> </div>
</div> </div>
</div>
<el-empty v-show="pageData.total == 0" :image-size="200" />
<div class="pagination" v-if="pageData.total > 0">
<el-pagination
v-model:current-page="pageData.pageNum"
:page-size="pageData.pageSize"
@current-change="pageChange"
:pager-count="5"
layout="prev, pager, next"
:total="pageData.total"
/>
</div> </div>
</template> </template>
<style lang="scss"> <style lang="scss" scoped>
.my-collect { .my-collect {
margin-top: 20px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.collect { .collect {
@ -187,11 +208,17 @@
&:hover { &:hover {
transform: scale(1.03); transform: scale(1.03);
transition: 2s all; transition: 1s all;
.collect-mask { .collect-mask {
display: block; display: block;
} }
} }
} }
}
.pagination {
margin-top: 20px;
display: flex;
justify-content: flex-end;
} }
</style> </style>

View File

@ -61,7 +61,7 @@
</div> </div>
</div> </div>
<div class="showList" v-if="pageData.total > 0"> <div class="showList" v-show="pageData.total > 0">
<equip-card <equip-card
class="card" class="card"
v-for="(v,i) in equipList" v-for="(v,i) in equipList"
@ -75,11 +75,11 @@
time-unit="月" time-unit="月"
@on-click="toDetail"></equip-card> @on-click="toDetail"></equip-card>
</div> </div>
<div class="noData" v-else> <div class="noData" v-show="pageData.total == 0">
<el-empty :image-size="200"/> <el-empty :image-size="200"/>
</div> </div>
<div class="pagination" v-if="pageData.total > 0"> <div class="pagination" v-show="pageData.total > 0">
<el-pagination <el-pagination
v-model:current-page="pageData.pageNum" v-model:current-page="pageData.pageNum"
:page-size="pageData.pageSize" :page-size="pageData.pageSize"

View File

@ -4,12 +4,19 @@
import { getGoodsClassListApi } from 'http/api/home' import { getGoodsClassListApi } from 'http/api/home'
import { useStore } from 'store/main' import { useStore } from 'store/main'
import { getHotList } from 'http/api/equip' import { getHotList } from 'http/api/equip'
import {reactive} from "vue"; import {reactive, ref} from "vue";
import baseData from "@/assets/baseInformation.json" import baseData from "@/assets/baseInformation.json"
const router = useRouter() const router = useRouter()
const leftNavList = ref([]) const leftNavList = ref([])
const loopList = ref([
'https://zlpt-1259760603.cos.ap-nanjing.myqcloud.com/488bab245180ebf9f1f3d7db5301be4.png',
'https://hzgyp-prod-1259451974.cos.ap-guangzhou.myqcloud.com/41cd93cefd76c28c967f07ad33b5e6fe1575746850588196864475.jpg',
'https://hzgyp-prod-1259451974.cos.ap-guangzhou.myqcloud.com/11800b353f4d1332b73f18bf0f2133a31575743878894452736462.jpg',
'https://hzgyp-prod-1259451974.cos.ap-guangzhou.myqcloud.com/85a09403e4328a37b2686d20b2fe717e20220728085635540.jpg'
])
// //
const getGoodsClassList = async () => { const getGoodsClassList = async () => {
const res = await getGoodsClassListApi() const res = await getGoodsClassListApi()
@ -72,6 +79,7 @@
const onClick = (val: any) => { const onClick = (val: any) => {
router.push(`/equipDetail/${val.id}`) router.push(`/equipDetail/${val.id}`)
} }
</script> </script>
<template> <template>
@ -105,12 +113,12 @@
<NavMenu /> <NavMenu />
<!-- 轮播图 --> <!-- 轮播图 -->
<div class="swpier-img"> <div class="swpier-img">
<el-carousel :interval="5000" arrow="always" height="437px"> <el-carousel :interval="5000" arrow="always" height="437px" :autoplay="false">
<el-carousel-item v-for="item in 4" :key="item"> <el-carousel-item v-for="(item,index) in loopList" :key="index">
<!-- <h3 text="2xl" justify="center">{{ item }}</h3> --> <!-- <h3 text="2xl" justify="center">{{ item }}</h3> -->
<el-image <el-image
style="width: 100%" style="width: 100%"
src="https://zlpt-1259760603.cos.ap-nanjing.myqcloud.com/488bab245180ebf9f1f3d7db5301be4.png" :src="item"
fit="cover" /> fit="cover" />
</el-carousel-item> </el-carousel-item>
</el-carousel> </el-carousel>
@ -184,7 +192,16 @@
</div> </div>
</template> </template>
<style lang="scss"> <style lang="scss" scoped>
:deep(.el-carousel__container){
.el-carousel__item{
.el-image{
height: 100%;
img{
}
}
}
}
.home-index-banner { .home-index-banner {
background-color: #fff; background-color: #fff;
padding: 20px 15px; padding: 20px 15px;