<template>
|
<view>
|
<view>
|
<view class="search-block" style="height: 35px">
|
<view class="search-ico-wapper">
|
<image src="../../../static/images/search/search.png" class="search-ico" mode=""></image>
|
</view>
|
<input type="text" v-on:input="getKeyword" v-model="keyword" placeholder="搜索" class="search-text"
|
maxlength="10" focus />
|
</view>
|
</view>
|
<scroll-view id="articleBox" :style="{ height: swiperHeight + 'px' }" class="article-content" scroll-y
|
style="width: 100%; margin-top: 15rpx;">
|
<view v-for="(i, index) in data" class="advisory-model">
|
<u-cell-group :title="i.company">
|
<u-cell-item icon="order" @click="goDetail(index)" :title="i.policy"
|
:label="i.time.substring(0,11)"></u-cell-item>
|
</u-cell-group>
|
</view>
|
</scroll-view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
data: [],
|
swiperHeight: 0,
|
keyword: '',
|
}
|
},
|
onLoad() {
|
//行业数据
|
this.getData();
|
},
|
methods: {
|
goDetail(index) {
|
uni.navigateTo({
|
url: './industry_detail?data=' + this.data[index].id
|
})
|
},
|
onReady() {
|
let that = this;
|
uni.getSystemInfo({
|
success(e) {
|
console.log(e);
|
let {
|
windowWidth,
|
windowHeight,
|
safeArea
|
} = e;
|
const query = uni.createSelectorQuery().in(that);
|
query
|
.select('#articleBox')
|
.boundingClientRect(data => {
|
|
that.swiperHeight = (safeArea.bottom - data.top - 50);
|
|
})
|
.exec();
|
}
|
});
|
},
|
getData() {
|
var that = this;
|
uni.request({
|
url: that.$store.state.piAPI + 'policy/page',
|
method: 'GET',
|
success: (res) => {
|
that.data = res.data.data.records;
|
}
|
});
|
},
|
//on input 通过 keyword 关键字查询
|
getKeyword() {
|
this.getIndutry();
|
},
|
getIndutry() {
|
var that = this;
|
uni.request({
|
url: that.$store.state.piAPI + 'policy/page',
|
method: 'GET',
|
data: {
|
policy: this.keyword,
|
},
|
success: (res) => {
|
that.data = res.data.data.records;
|
}
|
});
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
/* 搜索框 */
|
.search-ico,
|
.search-ico-1 {
|
width: 40upx;
|
height: 40upx;
|
}
|
|
.search-block {
|
width: 94%;
|
margin: 0 auto;
|
// background-color: #007AFF;
|
display: flex;
|
flex-direction: row;
|
position: relative;
|
top: 0.55rem;
|
|
.search-ico-wapper {
|
background-color: #F1F1F1;
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
padding: 0upx 0upx 0upx 15upx;
|
border-bottom-left-radius: 7px;
|
border-top-left-radius: 7px;
|
}
|
|
.search-text {
|
font-size: 14px;
|
background-color: #F1F1F1;
|
height: 70upx;
|
width: 100%;
|
padding-left: 0.5rem;
|
}
|
|
.search-ico-wapper1 {
|
background-color: #F1F1F1;
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
padding: 0upx 15upx 0upx 0upx;
|
border-bottom-right-radius: 7px;
|
border-top-right-radius: 7px;
|
}
|
}
|
|
.u-cell_title {
|
width: 250rpx;
|
float: left;
|
letter-spacing: 1px;
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
display: -webkit-box;
|
-webkit-line-clamp: 1;
|
-webkit-box-orient: vertical;
|
// background-color:#0078A8;
|
}
|
</style>
|