You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
3.5 KiB
173 lines
3.5 KiB
<template>
|
|
<view class="bg">
|
|
<view class="search-box">
|
|
<view class="search">
|
|
<image src="https://static.ticket.sz-trip.com/taizhou/images/search.png" mode="widthFix"></image>
|
|
<input type="text" v-model="keywords" @confirm="getList" placeholder="请输入搜索关键词" />
|
|
</view>
|
|
<view class="text" @click="goBack">取消</view>
|
|
</view>
|
|
|
|
<view class="box flex-between" v-if="list && list.length > 0">
|
|
<view v-for="(item,index) in list" :key="index" class="item" v-if="item.search_data" @click="gotoDetail(item)">
|
|
<image :src="showImg(item.search_data.image)" mode="aspectFill" class="headimg"></image>
|
|
<view class="content flex-column">
|
|
<view class="title text-overflowRows">{{item.title}}</view>
|
|
<view class="price" v-if="type == 'goods'">{{item.search_data.money / 100}}</view>
|
|
<view class="user-info" v-if="type == 'article'">
|
|
<image :src="showImg(item.search_data.author_img)" mode="aspectFill" class="userImg"></image>
|
|
{{item.search_data.author}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-else class="noData">暂无数据</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
keywords: '',
|
|
list: [],
|
|
type: ''
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
if(option.type) this.type = option.type
|
|
},
|
|
methods: {
|
|
getList() {
|
|
this.Post({
|
|
name: this.keywords.trim(),
|
|
offset: 0,
|
|
type: this.type,
|
|
limit: 100,
|
|
}, '/api/search/search').then(res => {
|
|
this.list = res.data
|
|
})
|
|
},
|
|
gotoDetail(item) {
|
|
if(this.type == 'goods') {
|
|
uni.navigateTo({
|
|
url: `/subPackages/techan/detail?id=${item.search_data.id}`
|
|
})
|
|
}else if(this.type == 'article') {
|
|
this.gotoUrlNew(item.search_data)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.bg {
|
|
min-height: 100vh;
|
|
background-color: #f7f7f7;
|
|
}
|
|
|
|
.search-box {
|
|
width: 100%;
|
|
padding: 20rpx;
|
|
border-bottom: 1rpx solid #ccc;
|
|
display: flex;
|
|
align-items: center;
|
|
background-color: #fff;
|
|
|
|
.search {
|
|
flex: 1;
|
|
padding: 0 20rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
height: 65rpx;
|
|
border-radius: 33rpx;
|
|
background-color: rgb(245, 245, 245);
|
|
|
|
image {
|
|
display: block;
|
|
width: 35rpx;
|
|
margin-right: 30rpx;
|
|
}
|
|
|
|
input {
|
|
flex: 1;
|
|
}
|
|
}
|
|
|
|
.text {
|
|
font-size: 30rpx;
|
|
color: #b9b9b9;
|
|
margin-left: 20rpx;
|
|
}
|
|
}
|
|
|
|
.box {
|
|
flex-wrap: wrap;
|
|
padding: 30rpx 20rpx;
|
|
|
|
.item {
|
|
width: 342rpx;
|
|
height: 498rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 11rpx;
|
|
margin-bottom: 20rpx;
|
|
|
|
.headimg {
|
|
width: 343rpx;
|
|
height: 327rpx;
|
|
border-radius: 11rpx 11rpx 0rpx 0rpx;
|
|
}
|
|
|
|
.content {
|
|
height: 170rpx;
|
|
justify-content: space-between;
|
|
padding: 15rpx 15rpx 20rpx 15rpx;
|
|
|
|
.title {
|
|
font-weight: bold;
|
|
font-size: 30rpx;
|
|
color: #000000;
|
|
}
|
|
|
|
.price {
|
|
font-weight: bold;
|
|
font-size: 33rpx;
|
|
color: #FF2D3B;
|
|
margin-left: auto;
|
|
}
|
|
.price::before {
|
|
font-size: 20rpx;
|
|
content: '¥';
|
|
}
|
|
.price::after {
|
|
font-size: 20rpx;
|
|
content: '起';
|
|
color: rgba(153, 153, 153, 1);
|
|
}
|
|
|
|
.user-info {
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
color: #999999;
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.userImg {
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
border-radius: 50%;
|
|
margin-right: 10rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.noData {
|
|
padding: 30rpx 0;
|
|
text-align: center;
|
|
font-size: 30rpx;
|
|
color: #ccc;
|
|
}
|
|
</style>
|