123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657 |
- <template>
- <view class="searchTarget-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" />
- <view class="ipt-right">
- <icon type="clear" size="16" color="#E0E0E0" v-show="searchTxt" @click="clearIpt" />
- <text class="line">|</text>
- <text @click="searchHandle" style="color: #3385ff">搜索</text>
- </view>
- </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-group>
- </view>
- <view class="search-cont">
- <template v-if="!isResult">
- <view class="search-cont-top">
- <view class="cont-tit">
- <text>热搜关键词:</text>
- </view>
- <view class="targetList">
- <view class="target-item" v-for="(item, index) in hotKeyWord" :key="index" @click="chooseTarget(item.KeyWord)"># {{ item.KeyWord }}</view>
- </view>
- </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>
- <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>
- </template>
- <template v-else>
- <block v-if="haveResult">
- <view class="content-list" v-if="radioSelect == '2'">
- <block v-if="ListHz.length">
- <view class="resource">
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/zybico.jpg"></image>
- <text>弘则资源包</text>
- </view>
- <text style="height: 1rpx; background: #ececec"></text>
- <view class="list-ui" v-for="item in ListHz" :key="item.IndustrialManagementId" @click="themeDetails(item)">
- <view class="item-title">
- <text>
- {{ item.IndustryName }}
- </text>
- <view class="publish">
- {{ item.PublishDate }}更新
- <u-icon name="arrow-right" color="#BDBDBD" size="34"></u-icon>
- </view>
- </view>
- <view class="read-more" v-if="item.IndustrialSubjectList">
- <text class="text-box text_oneLine" v-for="val in item.IndustrialSubjectList" :key="val.IndustrialSubjectId">
- {{ val.SubjectName }}
- </text>
- </view>
- </view>
- </block>
- <block v-if="ListYx.length">
- <text style="height: 10rpx; background: #ececec"></text>
- <view class="resource">
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/zybico.jpg"></image>
- <text>研选主题</text>
- </view>
- <text style="height: 1rpx; background: #ececec"></text>
- <view class="list-ui" v-for="item in ListYx" :key="item.IndustrialManagementId" @click="themeDetails(item)">
- <view class="item-title">
- <text>
- {{ item.IndustryName }}
- </text>
- <view class="publish">
- {{ item.PublishDate }}更新
- <u-icon name="arrow-right" color="#BDBDBD" size="34"></u-icon>
- </view>
- </view>
- <view class="read-more" @click="themeDetails(item)" v-if="item.IndustrialSubjectList">
- <text class="text-box text_oneLine" v-for="val in item.IndustrialSubjectList" :key="val.IndustrialSubjectId">
- {{ val.SubjectName }}
- </text>
- </view>
- </view>
- </block>
- </view>
- <view class="content-report" v-if="radioSelect == '1'">
- <block v-if="ListYx.length">
- <view class="resource">
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/report_Yx.png"></image>
- <text>研选报告</text>
- </view>
- <text style="height: 1rpx; background: #ececec"></text>
- <view class="content-item" v-for="item in ListYx" :key="item.ArticleId">
- <view class="item-user">
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
- <text> {{ item.NickName }}</text>
- </view>
- <view class="item-title">
- <text style="display: inline" @click="goDetailReport(item)">
- {{ item.Title }}
- </text>
- <text class="item-industry" v-if="item.IndustryName" @click="themeDetails(item)"> #{{ item.IndustryName }}</text>
- </view>
- <view class="item-more">
- <text>{{ item.PublishDate }}</text>
- <view class="pv-ollect">
- <view>
- <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
- {{ item.Pv }}
- </view>
- <view @click="collectClick(item)">
- <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
- <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
- {{ item.CollectNum }}人收藏
- </view>
- </view>
- </view>
- </view>
- </block>
- <block v-if="ListHz.length">
- <text style="height: 10rpx; background: #ececec"></text>
- <view class="resource">
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/report_Hz.png"></image>
- <text>弘则报告</text>
- </view>
- <text style="height: 1rpx; background: #ececec"></text>
- <view class="content-item" v-for="item in ListHz" :key="item.ArticleId">
- <!-- <view class="item-user">
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
- <text> {{ item.NickName }}</text>
- </view> -->
- <view class="item-title">
- <text style="display: inline" @click="goDetailReport(item)">
- {{ item.Title }}
- </text>
- <text class="item-industry" @click="themeDetails(item)" v-if="item.IndustryName"> #{{ item.IndustryName }}</text>
- </view>
- <view class="item-more">
- <text>{{ item.PublishDate }}</text>
- <view class="pv-ollect">
- <view>
- <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
- {{ item.Pv }}
- </view>
- <view @click="collectClick(item)">
- <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
- <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
- {{ item.CollectNum }}人收藏
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
- </block>
- <view class="nodata" v-else>
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_img"></image>
- <text>未找到您想搜索的内容</text>
- <text> 正式客户可联系销售免费发起新调研主题 </text>
- </view>
- </template>
- </view>
- <u-modal
- v-model="goFollowShow"
- :content-style="{ fontSize: '32rpx' }"
- @confirm="goFollowShowBtn"
- :show-cancel-button="isCancelBtn"
- :confirm-text="confirmText"
- @cancel="isCancelBtn = false"
- :show-title="false"
- :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
- :confirm-style="{ fontWeight: '700' }"
- >
- <view class="slot-content">
- <rich-text :nodes="accounts"></rich-text>
- </view>
- </u-modal>
- <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
- </view>
- </template>
- <script>
- import { Search, Reports, Research, Report } 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 {
- searchTxt: "", //搜索关键字
- isResult: false, //显示搜索结果
- haveResult: true, //是否有搜索数据
- // 历史搜索列表
- historySearchList: [],
- // 关键字列表
- keywordList: [],
- targetList: [], //所有指标列表
- // 搜索结果列表
- resultList: [],
- indList: [],
- page_no: 1,
- pageSize: 10,
- totalPage: 0,
- hotKeyWord: [],
- loadText: {
- loadmore: "上拉加载更多",
- loading: "加载中",
- nomore: "",
- },
- status: "loadmore",
- shadowStyle: {
- backgroundImage: "none",
- },
- radioSelect: "",
- ListHz: [],
- ListYx: [],
- goFollowShow: false,
- confirmText: "知道了",
- isCancelBtn: false,
- accounts: "",
- };
- },
- watch: {
- searchTxt(newVal) {
- if (newVal.length <= 0) {
- this.isResult = false;
- }
- },
- },
- components: {
- freeCharge,
- },
- methods: {
- 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) => {
- if (res.Ret === 200) {
- this.keywordList = res.Data.Item.ConfigValue ? res.Data.Item.ConfigValue.split(",") : [];
- }
- });
- },
- // 选择历史搜索
- chooseTarget(item) {
- this.searchTxt = item;
- this.SecName = item;
- this.resultList = [];
- this.indList = [];
- if (!this.historySearchList.includes(this.searchTxt)) {
- this.historySearchList.unshift(this.searchTxt);
- this.$db.set("historySearchListReport", 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("%%");
- },
- // 搜索数据
- searchHandle: Debounce(function () {
- if (this.searchTxt) {
- //添加搜索记录
- if (!this.historySearchList.includes(this.searchTxt)) {
- this.historySearchList.unshift(this.searchTxt);
- this.$db.set("historySearchListReport", JSON.stringify(this.historySearchList));
- }
- this.resultList = [];
- this.indList = [];
- this.getDataList();
- } else {
- this.$util.toast("请输入关键字");
- }
- }),
- // 查找数据
- async getDataList() {
- this.isResult = true;
- const res =
- this.radioSelect == 2
- ? await Reports.getIndustryAndArticle({
- KeyWord: this.searchTxt,
- })
- : await Reports.getReportSearchReport({
- KeyWord: this.searchTxt,
- });
- if (res.Ret === 200) {
- this.ListHz = res.Data.ListHz || [];
- this.ListYx = res.Data.ListYx || [];
- console.log(this.ListHz, this.ListYx);
- this.haveResult = this.ListHz.length > 0 || this.ListYx.length > 0;
- }
- },
- // 点击数据列表修改数据
- itemClick(item) {
- let data = encodeURIComponent(JSON.stringify(item));
- uni.navigateTo({
- url: "/pages/recordData/recordData?data=" + data,
- });
- },
- /* 表单清空 */
- clearIpt() {
- this.searchTxt = "";
- this.isTabAct = false;
- },
- /* 历史搜索清空 */
- clearHistory() {
- this.historySearchList = [];
- this.$db.del("historySearchListReport");
- },
- //去往文章详情页面
- goDetailReport(item) {
- this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
- },
- /* 进入详情 校验是否有该品种权限 */
- goDetail(item) {
- uni.navigateTo({
- url: "/reportPages/IndustryReport/IndustryReport?id=" + item.IndustrialManagementId,
- });
- },
- goDetailIndust(id) {
- this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + id);
- },
- //去往主题详情
- themeDetails(item) {
- this.$store.dispatch("checkHandle", "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId);
- },
- //收藏
- async collectClick(item) {
- const res = await Report.collectRpt({ ArticleId: item.ArticleId });
- if (res.Ret === 200) {
- item.IsCollect = !item.IsCollect;
- item.IsCollect
- ? (item.CollectNum += 1) &&
- uni.showToast({
- title: "收藏成功",
- icon: "none",
- duration: 2000,
- })
- : (item.CollectNum -= 1);
- !item.IsCollect &&
- uni.showToast({
- title: "已取消收藏",
- icon: "none",
- duration: 2000,
- });
- }
- },
- //点击了去关注
- goFollowShowBtn() {
- if (this.confirmText == "去关注") {
- uni.navigateTo({
- url: "/activityPages/accountsOfficial/accountsOfficial",
- });
- }
- this.goFollowShow = false;
- },
- },
- onLoad(options) {
- this.radioSelect = options.id == 31 ? "1" : "2";
- if (options.text) {
- this.searchTxt = options.text;
- this.getDataList();
- }
- // 获取历史搜索记录
- if (this.$db.get("historySearchListReport")) {
- let historyList = JSON.parse(this.$db.get("historySearchListReport"));
- this.historySearchList = historyList;
- }
- },
- onShow() {
- this.$store.dispatch("statistics", { PageType: "ReportSearch" });
- this.getKeyWord();
- this.researchHotKeyWord();
- },
- /**
- * 用户点击分享
- */
- onShareAppMessage: function (res) {
- return {
- title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "报告",
- path: "/reportPages/reportSearch/reportSearch?text=" + this.searchTxt,
- success: (res) => {},
- fail: (err) => {},
- };
- },
- };
- </script>
- <style lang="scss">
- .searchTarget-container {
- background-color: #fff;
- padding-bottom: 30rpx;
- .searchTarget-header {
- padding: 0 34rpx;
- width: 100%;
- background-color: #fff;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 99;
- padding: 30rpx 0;
- display: flex;
- justify-content: center;
- align-items: center;
- .sea_ipt_placeholder {
- color: #8d8d8d;
- }
- .sea_ipt {
- width: 682rpx;
- height: 70rpx;
- line-height: 70rpx;
- box-sizing: border-box;
- border: 1rpx solid #e5e5e5;
- background-color: rgba(245, 245, 245, 0.2);
- font-size: 26rpx;
- color: #4a4a4a;
- padding: 0 180rpx 0 78rpx;
- border-radius: 70rpx;
- }
- .sea_ico {
- width: 31rpx;
- height: 31rpx;
- position: absolute;
- left: 68rpx;
- top: 50%;
- transform: translateY(-50%);
- }
- .ipt-right {
- display: flex;
- align-items: center;
- position: absolute;
- right: 59rpx;
- top: 50%;
- transform: translateY(-50%);
- color: #3385ff;
- .line {
- margin: 0 21rpx;
- color: #e0e0e0;
- }
- }
- }
- .radio-content {
- width: 100%;
- padding-left: 58rpx;
- background-color: #fff;
- position: fixed;
- height: 70rpx;
- top: 128rpx;
- left: 0;
- z-index: 99;
- display: flex;
- }
- .resource {
- padding: 0 30rpx;
- background-color: #fff;
- margin-top: 4rpx;
- height: 91rpx;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #333333;
- font-size: 30rpx;
- image {
- width: 34rpx;
- height: 36rpx;
- margin-right: 10rpx;
- }
- }
- .content-list {
- .list-ui {
- background-color: #fff;
- margin-top: 2rpx;
- }
- .item-title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 100rpx;
- border-bottom: 1px solid #f6f6f6;
- padding: 0 30rpx;
- background-color: #fff;
- .publish {
- display: flex;
- align-items: center;
- color: #999999;
- font-style: 26rpx;
- }
- }
- .read-more {
- margin-top: 20rpx;
- display: flex;
- flex-wrap: wrap;
- margin-left: 30rpx;
- .text-box {
- margin-bottom: 27rpx;
- margin-right: 15rpx;
- padding: 0;
- font-size: 24rpx;
- color: #408fff;
- width: 216rpx;
- height: 46rpx;
- line-height: 46rpx;
- text-align: center !important;
- background: url(~@/static/img/report_bg.png) no-repeat;
- background-size: 100% 100%;
- text-indent: 0em;
- }
- }
- }
- .search-cont {
- padding-top: 180rpx;
- .search-cont-top {
- padding: 0 34rpx 0;
- margin-bottom: 10rpx;
- padding-top: 20rpx;
- &:last-child {
- margin-bottom: 0;
- }
- .cont-tit {
- font-size: 32rpx;
- margin-bottom: 20rpx;
- font-weight: 500;
- display: flex;
- justify-content: space-between;
- .empty_ico {
- width: 32rpx;
- height: 33rpx;
- }
- }
- .targetList {
- display: flex;
- flex-wrap: wrap;
- font-size: 28rpx;
- .target-item {
- width: 50%;
- margin-bottom: 20rpx;
- }
- }
- }
- .result-cont {
- padding: 0 34rpx 0;
- padding-left: 21rpx;
- .result-list {
- display: flex;
- align-items: center;
- color: #333;
- padding-bottom: 30rpx;
- border-bottom: 1rpx solid #ebedf0;
- margin-bottom: 30rpx;
- .result_ico {
- width: 28rpx;
- height: 28rpx;
- margin-right: 20rpx;
- }
- text {
- display: inline;
- }
- .highlight {
- color: #3385ff;
- }
- }
- }
- .result-data {
- // margin-top: 80rpx;
- min-height: calc(100vh - 130rpx);
- padding: 20rpx 34rpx 40rpx;
- display: flex;
- background-color: #f7f7f7;
- }
- }
- .content-report {
- .content-item {
- background-color: #fff;
- padding: 35rpx 20rpx 0;
- .item-title {
- font-weight: 500;
- .item-industry {
- margin-left: 10rpx;
- color: #3385ff;
- display: inline-block;
- }
- }
- .item-user {
- display: flex;
- align-items: center;
- color: #999999;
- font-size: 28rpx;
- margin-bottom: 20rpx;
- image {
- width: 23rpx;
- height: 26rpx;
- margin-right: 20rpx;
- }
- }
- .item-more {
- display: flex;
- justify-content: space-between;
- color: #cecece;
- margin: 20rpx 0 0;
- padding-bottom: 30rpx;
- border-bottom: 1rpx solid #ececec;
- .pv-ollect {
- display: flex;
- align-items: center;
- width: 40%;
- justify-content: space-between;
- image {
- width: 22rpx;
- height: 21rpx;
- margin-right: 10rpx;
- }
- .pv {
- height: 16rpx;
- }
- }
- }
- }
- }
- }
- </style>
|