|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <view class="searchTarget-container container">
|
|
|
+ <view class="search-container container">
|
|
|
<view class="searchTarget-header">
|
|
|
<input type="text" placeholder="请输入关键字" placeholder-class="sea_ipt_placeholder" class="sea_ipt" v-model="searchTxt" focus="true" confirm-type="search" @confirm="searchHandle" />
|
|
|
<icon type="search" size="15" class="sea_ico" />
|
|
@@ -9,81 +9,60 @@
|
|
|
<text @click="searchHandle" style="color: #3385ff">搜索</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="search-cont">
|
|
|
- <template v-if="!isResult">
|
|
|
- <view class="search-cont-top" v-if="historySearchList.length">
|
|
|
- <view class="cont-tit">
|
|
|
- <text>搜索历史</text>
|
|
|
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/empty_ico.png" class="empty_ico" @click="clearHistory"></image>
|
|
|
- </view>
|
|
|
- <view class="targetList">
|
|
|
- <view class="target-item" v-for="(item, index) in historySearchList" :key="index" @click="chooseTarget(item)">{{ item }}</view>
|
|
|
+ <view class="radio-content">
|
|
|
+ <van-radio-group :value="radioSelect" @change="onChangeRadio" direction="horizontal">
|
|
|
+ <van-radio icon-size="16" name="1">搜全部</van-radio>
|
|
|
+ <van-radio icon-size="16" name="2">搜纪要</van-radio>
|
|
|
+ <van-radio icon-size="16" name="3">搜图表</van-radio>
|
|
|
+ </van-radio-group>
|
|
|
+ </view>
|
|
|
+ <view class="tab-cont">
|
|
|
+ <scroll-view scroll-x="true" scroll-with-animation class="scroll-tab" :scroll-into-view="'_' + tabIndex">
|
|
|
+ <block v-for="item in tabBars" :key="item.mode">
|
|
|
+ <view class="scroll-tab-item" :class="{ active: orderColumn === item.mode }" @click.stop="toggleTab(item)">
|
|
|
+ {{ item.PermissionName }}
|
|
|
</view>
|
|
|
+ </block>
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
+ <view class="search-cont" v-if="!isResult">
|
|
|
+ <view class="search-cont-top">
|
|
|
+ <view class="cont-tit">
|
|
|
+ <text>热搜关键词:</text>
|
|
|
</view>
|
|
|
- <view class="search-cont-top">
|
|
|
- <view class="cont-tit">
|
|
|
- <text>弘则推荐</text>
|
|
|
- </view>
|
|
|
- <view class="targetList">
|
|
|
- <view class="target-item" v-for="(item, index) in keywordList" :key="index" @click="chooseTarget(item)">{{ item }}</view>
|
|
|
- </view>
|
|
|
+ <view class="targetList">
|
|
|
+ <view class="target-item" v-for="(item, index) in hotKeyWord" :key="index" @click="chooseTarget(item.KeyWord)"># {{ item.KeyWord }}</view>
|
|
|
</view>
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <block v-if="haveResult">
|
|
|
- <view class="tab-cont">
|
|
|
- <scroll-view scroll-x="true" scroll-with-animation class="scroll-tab" :scroll-into-view="'_' + tabIndex">
|
|
|
- <block v-for="(item, index) in tabBars" :key="item.ChartPermissionId">
|
|
|
- <view :id="'_' + index" class="scroll-tab-item" :class="{ active: tabAct_id === item.ChartPermissionId }" @click.stop="toggleTab(item, index)">
|
|
|
- {{ item.PermissionName }}
|
|
|
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/border_act.png" mode="" class="border_act" v-if="tabAct_id === item.ChartPermissionId"></image>
|
|
|
- </view>
|
|
|
- </block>
|
|
|
- </scroll-view>
|
|
|
- </view>
|
|
|
- <view class="result-data">
|
|
|
- <view class="report-ul">
|
|
|
- <view class="report-item" v-for="(report, index) in resultList" :key="index" v-if="index % 2 === 0" @click="goDetail(report)">
|
|
|
- <!-- <view class="item-content">{{report.content}}</view> -->
|
|
|
- <view class="item-content"><u-parse :html="report.Body[0] + '...'"></u-parse></view>
|
|
|
- <view class="line"></view>
|
|
|
- <view class="item-title"><u-parse :html="report.Title"></u-parse></view>
|
|
|
- <view class="item-abstract" v-if="report.abstract">
|
|
|
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/report_ico.png" class="report_ico"></image>
|
|
|
- {{ report.abstract }}
|
|
|
- </view>
|
|
|
- <text class="item-createtime">{{ report.PublishDate }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="report-ul">
|
|
|
- <view class="report-item" v-for="(report, index) in resultList" :key="index" v-if="index % 2 !== 0" @click="goDetail(report)">
|
|
|
- <view class="item-content"><u-parse :html="report.Body[0] + '...'"></u-parse></view>
|
|
|
- <view class="line"></view>
|
|
|
- <view class="item-title"><u-parse :html="report.Title"></u-parse></view>
|
|
|
- <view class="item-abstract" v-if="report.ExpertBackground">
|
|
|
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/report_ico.png" class="report_ico"></image>
|
|
|
- {{ report.ExpertBackground }}
|
|
|
- </view>
|
|
|
- <text class="item-createtime">{{ report.PublishDate }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <u-loadmore :status="status" icon-type="flower" :load-text="loadText" bg-color="#F7F7F7" padding-bottom="20rpx" />
|
|
|
- </block>
|
|
|
- <view class="nodata" v-else>
|
|
|
- <image src="@/static/img/nodata.png" mode="" class="nodata_ico"></image>
|
|
|
- <text>未找到您想搜索的内容</text>
|
|
|
+ </view>
|
|
|
+ <view class="search-cont-top">
|
|
|
+ <view class="cont-tit">
|
|
|
+ <text>弘则推荐:</text>
|
|
|
+ </view>
|
|
|
+ <view class="targetList">
|
|
|
+ <view class="target-item" v-for="(item, index) in keywordList" :key="index" @click="chooseTarget(item)"># {{ item }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="search-cont-top" v-if="historySearchList.length">
|
|
|
+ <view class="cont-tit">
|
|
|
+ <text>搜索历史:</text>
|
|
|
+ <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/empty_ico.png" class="empty_ico" @click="clearHistory"></image>
|
|
|
</view>
|
|
|
- </template>
|
|
|
+ <view class="targetList">
|
|
|
+ <block v-for="(item, index) in historySearchList" :key="index">
|
|
|
+ <view v-if="index < 8" class="target-item" @click="chooseTarget(item)"># {{ item }}</view>
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
|
|
|
+ <!-- 内容地方 -->
|
|
|
+ <view class="search-cont" v-else>123 </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { Search } from "@/config/api.js";
|
|
|
import { Debounce, Throttle } from "@/config/util.js";
|
|
|
-import freeCharge from "@/components/freeCharge";
|
|
|
+let app = getApp({ allowDefault: true });
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -94,65 +73,51 @@ export default {
|
|
|
historySearchList: [],
|
|
|
// 关键字列表
|
|
|
keywordList: [],
|
|
|
- targetList: [], //所有指标列表
|
|
|
// 搜索结果列表
|
|
|
resultList: [],
|
|
|
+ indList: [],
|
|
|
page_no: 1,
|
|
|
pageSize: 10,
|
|
|
totalPage: 0,
|
|
|
- orderColumn: "Matching",
|
|
|
- loadText: {
|
|
|
- loadmore: "上拉加载更多",
|
|
|
- loading: "加载中",
|
|
|
- nomore: "已经到底了",
|
|
|
- },
|
|
|
- status: "loadmore",
|
|
|
- tabAct_id: 1,
|
|
|
- isTabAct: true,
|
|
|
+ hotKeyWord: [],
|
|
|
+ radioSelect: "",
|
|
|
tabBars: [
|
|
|
{
|
|
|
PermissionName: "匹配度排序",
|
|
|
- ChartPermissionId: 1,
|
|
|
mode: "Matching",
|
|
|
},
|
|
|
{
|
|
|
PermissionName: "综合排序",
|
|
|
- ChartPermissionId: 2,
|
|
|
mode: "Comprehensive",
|
|
|
},
|
|
|
{
|
|
|
PermissionName: "发布时间排序",
|
|
|
- ChartPermissionId: 3,
|
|
|
mode: "PublishDate",
|
|
|
},
|
|
|
],
|
|
|
+ orderColumn: "Matching",
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
searchTxt(newVal) {
|
|
|
if (newVal.length <= 0) {
|
|
|
- this.tabAct_id = 1;
|
|
|
this.isResult = false;
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- components: {
|
|
|
- freeCharge,
|
|
|
- },
|
|
|
methods: {
|
|
|
- //tabs切换事件
|
|
|
- toggleTab(item, index) {
|
|
|
- this.orderColumn = item.mode;
|
|
|
- if (this.tabAct_id !== item.ChartPermissionId) {
|
|
|
- this.tabAct_id = item.ChartPermissionId;
|
|
|
- this.pageNum = 1;
|
|
|
- this.getDataList();
|
|
|
- uni.pageScrollTo({
|
|
|
- scrollTop: 0,
|
|
|
- duration: 0,
|
|
|
- });
|
|
|
+ //获取热搜关键词的请求
|
|
|
+ async researchHotKeyWord() {
|
|
|
+ const res = await Research.researchHotKeyWord();
|
|
|
+ if (res.Ret === 200) {
|
|
|
+ this.hotKeyWord = res.Data.List || [];
|
|
|
}
|
|
|
},
|
|
|
+ //点击了搜索的变化
|
|
|
+ onChangeRadio(value) {
|
|
|
+ this.radioSelect = value.detail;
|
|
|
+ this.clearIpt();
|
|
|
+ },
|
|
|
/* 获取关键词 */
|
|
|
getKeyWord() {
|
|
|
Search.getKeys().then((res) => {
|
|
@@ -166,24 +131,13 @@ export default {
|
|
|
this.searchTxt = item;
|
|
|
this.SecName = item;
|
|
|
this.resultList = [];
|
|
|
- this.page_no = 1;
|
|
|
+ this.indList = [];
|
|
|
+ if (!this.historySearchList.includes(this.searchTxt)) {
|
|
|
+ this.historySearchList.unshift(this.searchTxt);
|
|
|
+ this.$db.set("historySearchList", JSON.stringify(this.historySearchList));
|
|
|
+ }
|
|
|
this.getDataList();
|
|
|
},
|
|
|
- // 键盘输入过程中
|
|
|
- searchDoing() {
|
|
|
- this.isResult = false;
|
|
|
- //全部指标列表
|
|
|
- let arr = JSON.parse(JSON.stringify(this.targetList));
|
|
|
- let filterArr = [];
|
|
|
- // // 过滤出符合搜索条件的值
|
|
|
- arr.forEach((item, index) => {
|
|
|
- if (item.SecName.includes(this.searchTxt)) {
|
|
|
- item.SecName = this.join(item.SecName, this.searchTxt);
|
|
|
- filterArr.unshift(item);
|
|
|
- }
|
|
|
- });
|
|
|
- this.keywordList = filterArr;
|
|
|
- },
|
|
|
// 拼接
|
|
|
join(str, key) {
|
|
|
return str.replace(new RegExp(`${key}`, "g"), `%%${key}%%`).split("%%");
|
|
@@ -197,70 +151,37 @@ export default {
|
|
|
this.$db.set("historySearchList", JSON.stringify(this.historySearchList));
|
|
|
}
|
|
|
this.resultList = [];
|
|
|
- this.page_no = 1;
|
|
|
+ this.indList = [];
|
|
|
this.getDataList();
|
|
|
} else {
|
|
|
this.$util.toast("请输入关键字");
|
|
|
}
|
|
|
}),
|
|
|
// 查找数据
|
|
|
- getDataList() {
|
|
|
+ async getDataList() {
|
|
|
this.isResult = true;
|
|
|
- Search.getResult({
|
|
|
- KeyWord: this.searchTxt,
|
|
|
- // PageSize: this.pageSize,
|
|
|
- // CurrentIndex: this.page_no,
|
|
|
- OrderColumn: this.orderColumn,
|
|
|
- }).then((res) => {
|
|
|
- if (res.Ret === 200) {
|
|
|
- // this.status = this.page_no < res.Data.Paging.Pages ? 'loadmore' : 'nomore';
|
|
|
- this.status = "nomore";
|
|
|
- this.totalPage = res.Data.Paging.Pages; //总页数
|
|
|
- if (this.page_no === 1) {
|
|
|
- this.resultList = res.Data.List || [];
|
|
|
- this.haveResult = this.resultList.length ? true : false;
|
|
|
- } else {
|
|
|
- this.resultList = this.resultList.concat(res.Data.List);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // 点击数据列表修改数据
|
|
|
- itemClick(item) {
|
|
|
- let data = encodeURIComponent(JSON.stringify(item));
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/recordData/recordData?data=" + data,
|
|
|
- });
|
|
|
},
|
|
|
/* 表单清空 */
|
|
|
clearIpt() {
|
|
|
this.searchTxt = "";
|
|
|
this.isTabAct = false;
|
|
|
- this.orderColumn = "Matching";
|
|
|
- //
|
|
|
},
|
|
|
/* 历史搜索清空 */
|
|
|
clearHistory() {
|
|
|
this.historySearchList = [];
|
|
|
this.$db.del("historySearchList");
|
|
|
},
|
|
|
- /* 进入详情 校验是否有该品种权限 */
|
|
|
- goDetail(item) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId,
|
|
|
- });
|
|
|
+ //tabs切换事件
|
|
|
+ toggleTab(item) {
|
|
|
+ this.orderColumn = item.mode
|
|
|
},
|
|
|
},
|
|
|
- /* 触底 */
|
|
|
- onReachBottom: Throttle(function () {
|
|
|
- // this.status = 'nomore';
|
|
|
- if (this.isResult) {
|
|
|
- // if(this.status === 'nomore') return ;
|
|
|
- // this.page_no++;
|
|
|
- // this.getDataList();
|
|
|
+ onLoad(options) {
|
|
|
+ this.radioSelect = options.id == 31 ? "1" : "2";
|
|
|
+ if (options.text) {
|
|
|
+ this.searchTxt = options.text;
|
|
|
+ this.getDataList();
|
|
|
}
|
|
|
- }),
|
|
|
- onLoad() {
|
|
|
// 获取历史搜索记录
|
|
|
if (this.$db.get("historySearchList")) {
|
|
|
let historyList = JSON.parse(this.$db.get("historySearchList"));
|
|
@@ -270,18 +191,20 @@ export default {
|
|
|
onShow() {
|
|
|
this.$store.dispatch("statistics", { PageType: "SummarySearch" });
|
|
|
this.getKeyWord();
|
|
|
+ // this.researchHotKeyWord();
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-.searchTarget-container {
|
|
|
+.search-container {
|
|
|
background-color: #fff;
|
|
|
+ padding-bottom: 30rpx;
|
|
|
.searchTarget-header {
|
|
|
padding: 0 34rpx;
|
|
|
width: 100%;
|
|
|
background-color: #fff;
|
|
|
- position: fixed;
|
|
|
+ position: sticky;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
z-index: 99;
|
|
@@ -326,8 +249,18 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .radio-content {
|
|
|
+ width: 100%;
|
|
|
+ padding-left: 58rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ position: sticky;
|
|
|
+ height: 70rpx;
|
|
|
+ top: 128rpx;
|
|
|
+ left: 0;
|
|
|
+ z-index: 99;
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
.search-cont {
|
|
|
- padding-top: 130rpx;
|
|
|
.search-cont-top {
|
|
|
padding: 0 34rpx 0;
|
|
|
margin-bottom: 10rpx;
|
|
@@ -336,9 +269,9 @@ export default {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
.cont-tit {
|
|
|
- color: #666;
|
|
|
- font-size: 28rpx;
|
|
|
- margin-bottom: 30rpx;
|
|
|
+ font-size: 32rpx;
|
|
|
+ margin-bottom: 20rpx;
|
|
|
+ font-weight: 500;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
.empty_ico {
|
|
@@ -349,16 +282,10 @@ export default {
|
|
|
.targetList {
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
- // justify-content: space-between;
|
|
|
+ font-size: 28rpx;
|
|
|
.target-item {
|
|
|
- padding: 4rpx 18rpx;
|
|
|
- color: #4a4a4a;
|
|
|
- font-size: 26rpx;
|
|
|
- // border: 1rpx solid #3385ff;
|
|
|
- background-color: #f7f7f7;
|
|
|
- margin-bottom: 30rpx;
|
|
|
- margin-right: 30rpx;
|
|
|
- border-radius: 20rpx;
|
|
|
+ width: 50%;
|
|
|
+ margin-bottom: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -386,92 +313,29 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.result-data {
|
|
|
- margin-top: 80rpx;
|
|
|
+ // margin-top: 80rpx;
|
|
|
min-height: calc(100vh - 130rpx);
|
|
|
padding: 20rpx 34rpx 40rpx;
|
|
|
display: flex;
|
|
|
background-color: #f7f7f7;
|
|
|
- .report-ul {
|
|
|
- width: 50%;
|
|
|
- &:first-child {
|
|
|
- margin-right: 10rpx;
|
|
|
- }
|
|
|
- .report-item {
|
|
|
- padding: 20rpx 20rpx 24rpx 20rpx;
|
|
|
- margin-bottom: 20rpx;
|
|
|
- border-radius: 8rpx;
|
|
|
- box-shadow: 0 3rpx 6rpx rgba($color: #000000, $alpha: 0.16);
|
|
|
- background: #fff;
|
|
|
- .item-content {
|
|
|
- // height: 273rpx;
|
|
|
- font-size: 24rpx;
|
|
|
- line-height: 40rpx;
|
|
|
- color: #7f7f7f;
|
|
|
- display: -webkit-box;
|
|
|
- // text-overflow:ellipsis;
|
|
|
- // overflow: hidden;
|
|
|
- text {
|
|
|
- display: inline;
|
|
|
- }
|
|
|
- }
|
|
|
- .line {
|
|
|
- margin: 18rpx 0;
|
|
|
- content: "";
|
|
|
- width: 100%;
|
|
|
- height: 1px;
|
|
|
- padding: 0 32rpx;
|
|
|
- box-sizing: border-box;
|
|
|
- background-color: #e5e5e5;
|
|
|
- -webkit-transform: scale(1, 0.5);
|
|
|
- transform: scale(1, 0.5);
|
|
|
- -webkit-transform-origin: center bottom;
|
|
|
- transform-origin: center bottom;
|
|
|
- }
|
|
|
- .item-title {
|
|
|
- font-size: 28rpx;
|
|
|
- color: #4a4a4a;
|
|
|
- margin-bottom: 10rpx;
|
|
|
- text {
|
|
|
- display: inline;
|
|
|
- }
|
|
|
- }
|
|
|
- .item-abstract {
|
|
|
- font-size: 26rpx;
|
|
|
- color: #6a6a6a;
|
|
|
- margin-bottom: 10rpx;
|
|
|
- .report_ico {
|
|
|
- width: 32rpx;
|
|
|
- height: 26rpx;
|
|
|
- margin-right: 20rpx;
|
|
|
- display: inline-block;
|
|
|
- }
|
|
|
- }
|
|
|
- .item-createtime {
|
|
|
- color: #acacac;
|
|
|
- font-size: 24rpx;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
.tab-cont {
|
|
|
- position: fixed;
|
|
|
+ position: sticky;
|
|
|
top: 128rpx;
|
|
|
width: 100%;
|
|
|
padding: 0 26rpx;
|
|
|
background-color: #fff;
|
|
|
font-size: 32rpx;
|
|
|
- z-index: 99;
|
|
|
- box-shadow: 0 3rpx 6rpx rgba(187, 216, 255, 0.2);
|
|
|
.scroll-tab {
|
|
|
width: 100%;
|
|
|
white-space: nowrap;
|
|
|
}
|
|
|
.scroll-tab-item {
|
|
|
- // flex-grow: 1;
|
|
|
text-align: center;
|
|
|
display: inline-block;
|
|
|
- padding: 0 8rpx 30rpx 8rpx;
|
|
|
+ // padding: 0 8rpx 20rpx 8rpx;
|
|
|
+ padding-bottom: 20rpx;
|
|
|
margin-right: 40rpx;
|
|
|
border-bottom: 8rpx solid transparent;
|
|
|
position: relative;
|
|
@@ -482,6 +346,8 @@ export default {
|
|
|
border-bottom: none;
|
|
|
color: #2c83ff;
|
|
|
font-weight: 700;
|
|
|
+ border-bottom: 2px solid;
|
|
|
+ border-image: linear-gradient(to right, #2e85ff, #7eeaf6) 1;
|
|
|
}
|
|
|
.border_act {
|
|
|
width: 100%;
|