activitySearch.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <view class="container activity-content activity-search-content">
  3. <view class="top-content">
  4. <!-- 搜索 -->
  5. <view class="searchTarget-header">
  6. <input type="text" placeholder="请输入关键字" placeholder-class="sea_ipt_placeholder" class="sea_ipt" v-model="searchTxt" focus="true" confirm-type="search" @confirm="searchHandle" />
  7. <icon type="search" size="15" class="sea_ico" />
  8. <view class="ipt-right">
  9. <icon type="clear" size="16" color="#E0E0E0" @click="clearIpt" />
  10. <text class="line">|</text>
  11. <text @click="searchHandle" style="color: #3385ff">搜索</text>
  12. </view>
  13. </view>
  14. <view class="search-cont" v-if="!isShowSearch">
  15. <view class="search-cont-top">
  16. <view class="cont-tit">
  17. <text>热搜关键词:</text>
  18. </view>
  19. <view class="targetList">
  20. <view class="target-item text_oneLine" v-for="(item, index) in hotKeyWord" :key="index" @click="chooseTarget(item.KeyWord)"># {{ item.KeyWord }}</view>
  21. </view>
  22. </view>
  23. <view class="search-cont-top">
  24. <view class="cont-tit">
  25. <text>推荐关键词:</text>
  26. </view>
  27. <view class="targetList">
  28. <view class="target-item text_oneLine" v-for="(item, index) in keywordList" :key="index" @click="chooseTarget(item)"># {{ item }}</view>
  29. </view>
  30. </view>
  31. <view class="search-cont-top" v-if="historySearchList.length">
  32. <view class="cont-tit">
  33. <text>搜索历史:</text>
  34. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/empty_ico.png" class="empty_ico" @click="clearHistory"></image>
  35. </view>
  36. <view class="targetList">
  37. <block v-for="(item, index) in historySearchList" :key="index">
  38. <view v-if="index < 8" class="target-item text_oneLine" @click="chooseTarget(item)"># {{ item }}</view>
  39. </block>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 各种状态选择 -->
  44. <view class="select-conyent" v-if="isShowSearch">
  45. <text @click="handelState(item)" :class="['state-item', activeState == item.state && 'state-active-item']" v-for="item in activeStateOption" :key="item.name">{{ item.name }}</text>
  46. </view>
  47. </view>
  48. <!-- 内容列表部分 -->
  49. <!-- 活动列表 -->
  50. <view v-if="haveData" class="activity-pages">
  51. <view class="collect-ul">
  52. <view class="collect-ltem" v-for="(item, index) in collectList" :key="index">
  53. <view class="title-date" @click="goDetail(item)">
  54. <text :class="item.ActivityType == 1 ? '' : 'xianxia'">{{ item.ActivityType == 1 ? "线上" : "线下" }}</text>
  55. {{ item.ActivityTimeText }}
  56. <view class="audio-back" v-if="item.AudioLink" @click.stop="audioPlayBack(item)">
  57. <image
  58. class="audio-img"
  59. :src="
  60. curVoiceId === item.ActivityId && !curAudioPaused
  61. ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/back_stop.png'
  62. : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/back_group.png'
  63. "
  64. ></image>
  65. {{ curVoiceId === item.ActivityId && !curAudioPaused ? "暂停" : "回放" }}
  66. </view>
  67. </view>
  68. <view class="item-li">
  69. <view class="item-img" @click="goDetail(item)">
  70. <image :src="item.ImgUrl"> </image>
  71. <text v-if="item.ActiveState == 1" class="img-status begin">未开始</text>
  72. <text v-else-if="item.ActiveState == 2" class="img-status proceed">进行中</text>
  73. <text v-else class="img-status">已结束</text>
  74. <view class="img-type">
  75. <image :src="item.ImgUrlText" mode=""></image>
  76. </view>
  77. </view>
  78. <view class="item">
  79. <view class="item-text" @click="goDetail(item)">
  80. <text class="activity-title"> {{ item.ActivityName }} </text>
  81. <text class="text_twoLine" v-if="item.Expert">专家背景:{{ item.Expert }} </text>
  82. <text class="text_twoLine" v-if="item.DistinguishedGuest">嘉宾:{{ item.DistinguishedGuest }} </text>
  83. <text class="text_twoLine" v-if="item.Speaker">主讲人:{{ item.Speaker }}</text>
  84. </view>
  85. <block v-if="item.ActiveState == 1">
  86. <view :class="['bottom-box', item.ActivityTypeId == 1 && item.IsLimitPeople == 0 && 'expert-item', item.City && 'city']">
  87. <view class="city-img" v-if="item.City">
  88. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/location.png"></image>
  89. {{ item.City }}
  90. </view>
  91. <view style="display: flex">
  92. <text v-if="item.IsShowOutboundCall && item.ActivityTypeId == 1" class="button" @click="signupIsAddOfCancel(item, 1)">{{ item.IsSignup == 1 ? "取消外呼" : "预约外呼" }}</text>
  93. <text v-if="item.IsShowAppointment" @click="summaryIsHandel(item)">{{ item.IsAppointment == 1 ? "取消纪要" : "预约纪要" }}</text>
  94. <text v-if="item.IsShowMeetingReminder" @click="meetingReminderAdd(item.ActivityId, item.IsCancelMeetingReminder)">
  95. {{ item.IsCancelMeetingReminder == 0 ? "消息提醒" : "取消提醒" }}
  96. </text>
  97. <view v-if="item.IsShowHelpSsk" style="width: 130rpx">
  98. <text @click="askingGo(item)">帮我带问</text>
  99. </view>
  100. <text v-if="item.IsShowOutboundCall && item.ActivityTypeId != 1" class="button" @click="signupIsAddOfCancel(item, 1)">{{ item.IsSignup == 1 ? "取消外呼" : "预约外呼" }}</text>
  101. <block v-if="item.IsShowSignup">
  102. <block v-if="item.IsCClassMeeting">
  103. <text class="button" @click="signupIsAddOfCancel(item, 3, 'CClass')">{{ item.IsSignup == 1 ? "取消报名" : "我要报名" }}</text>
  104. </block>
  105. <block v-else>
  106. <text class="button" v-if="item.IsSignup !== 1" @click="wanttosignup(item.ActivityId)">我要报名</text>
  107. <text class="button" v-else @click="signupIsAddOfCancel(item, 2)">{{ item.SignupType == 1 ? "取消外呼" : "取消报名" }}</text>
  108. </block>
  109. </block>
  110. </view>
  111. </view>
  112. </block>
  113. <block v-else>
  114. <view class="bottom-box city" v-if="item.City">
  115. <view class="city-img">
  116. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/location.png" />
  117. {{ item.City }}
  118. </view>
  119. </view>
  120. <view class="bottom-box real-time" v-if="item.ActiveState == 2 && item.ActivityTypeId == 1">
  121. <text class="button" @click="askingGo(item, '提问')">实时提问</text>
  122. </view>
  123. </block>
  124. </view>
  125. </view>
  126. </view>
  127. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage > 1" />
  128. </view>
  129. </view>
  130. <!-- 缺审部分 -->
  131. <view class="nodata" v-else>
  132. <image src="https://hzstatic.hzinsights.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  133. <text>未找到搜索结果</text>
  134. </view>
  135. <!-- 各种自定义弹框 -->
  136. <modalDialog
  137. :isShow="isShow"
  138. :signupType="signupType"
  139. :goFollow="goFollow"
  140. :signupStatus="signupStatus"
  141. :hasPermission="hasPermission"
  142. :jurisdictionList="jurisdictionList"
  143. :editIsShow="editIsShow"
  144. :isCancelShow="isCancelShow"
  145. :idTypeCancel="idTypeCancel"
  146. @cancelShowBtn="cancelEnsure"
  147. :countryCode="countryCode"
  148. :mobileEdit="mobileEdit"
  149. :goOnNextStep="goOnNextStep"
  150. :isShowhasPermission="isShowhasPermission"
  151. :applyForIsShow="applyForIsShow"
  152. :mailboxBinding="mailboxBinding"
  153. />
  154. <!-- 选择区号弹出层 -->
  155. <areaCode :isAreaCode="isAreaCode" :areaCode="areaCode" />
  156. <!-- 参会方式弹出层 -->
  157. <view class="select-box">
  158. <u-popup v-model="selectShow" mode="bottom">
  159. <view style="color: #333333; font-size: 28rpxrpx">请选择参会方式</view>
  160. <view style="color: #2c83ff" @click="signupAdd('id', 1)">预约外呼</view>
  161. <view style="color: #2c83ff" @click="signupAdd('id', 2)">自主拨入</view>
  162. <view style="color: #a9afb8" @click="selectShow = false">取消</view>
  163. </u-popup>
  164. </view>
  165. <view v-if="showAudioBox">
  166. <audioModule :showAudioPop.sync="showAudioPop" />
  167. </view>
  168. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  169. </view>
  170. </template>
  171. <script>
  172. import { activity, User, Search } from "@/config/api.js";
  173. import { Throttle } from "@/config/util.js";
  174. import modalDialog from "@/components/modalDialog.vue";
  175. import areaCode from "@/activityPages/components/areaCode.vue";
  176. import myMixin from "../components/index.js";
  177. import myActivityMixin from "../components/indexActivity.js";
  178. import freeCharge from "@/components/freeCharge";
  179. import audioModule from "@/components/audioModule/index";
  180. let app = getApp({ allowDefault: true });
  181. export default {
  182. data() {
  183. return {
  184. // 关键字列表
  185. keywordList: [],
  186. chartWordList: [],
  187. searchTxt: "",
  188. isShowSearch: false,
  189. status: "loadmore",
  190. totalPage: "",
  191. haveData: true,
  192. activeState: 0, //活动进行状态
  193. activeStateOption: [
  194. {
  195. name: "全部",
  196. state: 0,
  197. },
  198. {
  199. name: "可回放",
  200. state: 1,
  201. },
  202. ],
  203. selectShow: false,
  204. dynamicList: [],
  205. hotKeyWord: [],
  206. showAudioPop: false,
  207. showAudioBox: false,
  208. };
  209. },
  210. mixins: [myMixin, myActivityMixin],
  211. components: {
  212. modalDialog,
  213. areaCode,
  214. freeCharge,
  215. audioModule,
  216. },
  217. methods: {
  218. async researchHotKeyWord() {
  219. const res = await Search.getKeys();
  220. if (res.Ret === 200) {
  221. this.hotKeyWord = res.Data.ListHot || [];
  222. this.chartWordList = res.Data.List || [];
  223. this.keywordList = res.Data.Item ? res.Data.Item.ConfigValue.split(",") : [];
  224. }
  225. },
  226. //获取快捷主题
  227. fastSearchKeWord() {
  228. activity
  229. .fastSearchKeWord({
  230. ActiveState: this.activeState,
  231. Label: "More",
  232. })
  233. .then((res) => {
  234. if (res.Ret !== 200) return;
  235. this.dynamicList = res.Data.List || [];
  236. });
  237. },
  238. //清除了快捷主题
  239. clearDynamicName() {
  240. this.searchTxt = "";
  241. this.collectList = [];
  242. this.haveData = true;
  243. this.isShowSearch = false;
  244. },
  245. //搜索记录进来
  246. searchHandle() {
  247. if (this.searchTxt) {
  248. this.page_no = 1;
  249. //添加搜索记录
  250. if (!this.historySearchList.includes(this.searchTxt)) {
  251. this.historySearchList.unshift(this.searchTxt);
  252. this.$db.set("historySearchListActivity", JSON.stringify(this.historySearchList));
  253. }
  254. this.isShowSearch = true;
  255. this.getList();
  256. } else {
  257. this.$util.toast("请输入关键字");
  258. }
  259. },
  260. // 选择历史搜索
  261. chooseTarget(item) {
  262. this.searchTxt = item;
  263. this.collectList = [];
  264. this.page_no = 1;
  265. this.searchHandle();
  266. },
  267. /* 历史搜索清空 */
  268. clearHistory() {
  269. this.historySearchList = [];
  270. this.$db.del("historySearchListActivity");
  271. },
  272. //获取列表
  273. async getList() {
  274. const res = await activity.getActivityListNew({
  275. PageSize: this.pageSize,
  276. CurrentIndex: this.page_no,
  277. KeyWord: this.searchTxt,
  278. ActiveState: "1,2,3", //活动进行状态
  279. PlayBack: this.activeState,
  280. });
  281. if (res.Ret !== 200) return;
  282. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  283. this.totalPage = res.Data.Paging.Pages; //总页数
  284. if (this.page_no === 1) {
  285. this.collectList = res.Data.List || [];
  286. this.haveData = this.collectList.length ? true : false;
  287. if (this.refresh) {
  288. uni.stopPullDownRefresh();
  289. this.refresh = false;
  290. }
  291. } else {
  292. this.collectList.push(...res.Data.List);
  293. }
  294. },
  295. /* 表单清空 */
  296. clearIpt() {
  297. this.searchTxt = "";
  298. this.collectList = [];
  299. this.haveData = true;
  300. this.isShowSearch = false;
  301. },
  302. //获取是否需要填写区号接口
  303. countryCcode() {
  304. User.countryCcode().then((res) => {
  305. if (res.Ret == 200) {
  306. this.isNeedAddCountryCode = res.Data.IsNeedAddCountryCode;
  307. }
  308. });
  309. },
  310. //全部 或者可回放的点击事件
  311. handelState(item) {
  312. this.activeState = item.state;
  313. this.page_no = 1;
  314. this.getList();
  315. },
  316. //点击了回放
  317. audioPlayBack(item) {
  318. // 判断是否为同一个音频
  319. if (this.$store.state.audioBg.activityId == item.ActivityId) {
  320. if (this.globalBgAudioManager.paused) {
  321. this.globalBgAudioManager.play();
  322. } else {
  323. this.globalBgAudioManager.pause();
  324. }
  325. } else {
  326. this.$store.commit("audioBg/addAudio", { list: item.VoiceList, activityId: item.ActivityId, activityTitle: item.ActivityName });
  327. }
  328. this.showAudioPop = true;
  329. },
  330. },
  331. computed: {
  332. curVoiceId() {
  333. //当前正在播放的音频id
  334. return this.$store.state.audioBg.activityId;
  335. },
  336. curAudioPaused() {
  337. //当前音频是否暂停状态
  338. return this.$store.state.audioBg.paused;
  339. },
  340. },
  341. onShow() {
  342. this.countryCcode(); //判断是否加区号
  343. this.$store.dispatch("statistics", { PageType: "ActivitSearch" });
  344. this.showAudioBox = true;
  345. },
  346. onHide() {
  347. this.showAudioBox = false
  348. },
  349. //load
  350. onLoad(option) {
  351. if (this.$db.get("historySearchListActivity")) {
  352. let historyList = JSON.parse(this.$db.get("historySearchListActivity"));
  353. this.historySearchList = historyList;
  354. }
  355. this.searchTxt = option.text || "";
  356. this.activeState = option.statesId || 0;
  357. if (option.text) {
  358. this.searchHandle();
  359. }
  360. this.researchHotKeyWord();
  361. this.fastSearchKeWord();
  362. },
  363. /* 触底 */
  364. onReachBottom: Throttle(function () {
  365. if (this.status === "nomore") return;
  366. this.status = "loading";
  367. this.page_no++;
  368. this.getList();
  369. }),
  370. /* 用户点击分享 */
  371. onShareAppMessage: function (res) {
  372. return {
  373. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "活动搜索",
  374. path: "/activityPages/activitySearch/activitySearch?statesId=" + this.activeState + "&text=" + this.searchTxt,
  375. success: (res) => {},
  376. fail: (err) => {},
  377. };
  378. },
  379. /* 下拉刷新 */
  380. onPullDownRefresh: Throttle(function () {
  381. this.page_no = 1;
  382. this.refresh = true;
  383. if (this.tabsActive == 0) {
  384. this.getList();
  385. } else {
  386. this.getScheduleList();
  387. }
  388. }),
  389. };
  390. </script>
  391. <style scoped lang="scss">
  392. .activity-pages {
  393. padding-top: 190rpx;
  394. padding-bottom: 30rpx;
  395. }
  396. @import "../components/indexActivity.scss";
  397. .activity-search-content {
  398. background-color: #f7f7f7;
  399. .ipt-right {
  400. z-index: 11;
  401. }
  402. .select-conyent {
  403. display: flex;
  404. float: right;
  405. margin-bottom: 20rpx;
  406. height: 51rpx;
  407. width: 252rpx;
  408. border-radius: 47rpx;
  409. overflow: hidden;
  410. margin-right: 30rpx;
  411. .state-item {
  412. width: 126rpx;
  413. height: 51rpx;
  414. text-align: center;
  415. line-height: 51rpx;
  416. color: #999999;
  417. font-size: 24rpx;
  418. background-color: #f8f8fa;
  419. }
  420. .state-active-item {
  421. background: #3385ff;
  422. color: #fff;
  423. border-radius: 47rpx;
  424. }
  425. }
  426. .title-date {
  427. position: relative;
  428. .audio-back {
  429. position: absolute;
  430. right: 0;
  431. top: 50%;
  432. transform: translateY(-50%);
  433. width: 99rpx;
  434. height: 39rpx;
  435. font-size: 24rpx;
  436. color: #fff;
  437. display: flex;
  438. align-items: center;
  439. background-color: #3385ff;
  440. border-radius: 20rpx;
  441. padding-left: 4rpx;
  442. .audio-img {
  443. width: 30rpx;
  444. height: 30rpx;
  445. margin: 0 5rpx;
  446. }
  447. }
  448. }
  449. .top-content {
  450. width: 100%;
  451. position: fixed;
  452. top: 0;
  453. left: 0;
  454. z-index: 99;
  455. background-color: #fff;
  456. .searchTarget-header {
  457. position: relative;
  458. width: 100%;
  459. background-color: #fff;
  460. padding: 20rpx 0;
  461. display: flex;
  462. justify-content: center;
  463. align-items: center;
  464. .sea_ipt_placeholder {
  465. color: #8d8d8d;
  466. }
  467. .sea_ipt {
  468. width: 682rpx;
  469. height: 70rpx;
  470. line-height: 70rpx;
  471. box-sizing: border-box;
  472. border: 1rpx solid #e5e5e5;
  473. background-color: rgba(245, 245, 245, 0.2);
  474. font-size: 26rpx;
  475. color: #4a4a4a;
  476. padding: 0 180rpx 0 78rpx;
  477. border-radius: 70rpx;
  478. }
  479. .sea_ico {
  480. width: 31rpx;
  481. height: 31rpx;
  482. position: absolute;
  483. left: 60rpx;
  484. top: 50%;
  485. transform: translateY(-50%);
  486. }
  487. .ipt-right {
  488. display: flex;
  489. align-items: center;
  490. position: absolute;
  491. right: 59rpx;
  492. top: 50%;
  493. transform: translateY(-50%);
  494. color: #3385ff;
  495. .line {
  496. margin: 0 21rpx;
  497. color: #e0e0e0;
  498. }
  499. }
  500. }
  501. .search-cont {
  502. height: calc(100vh - 200rpx);
  503. padding-bottom: 20rpx;
  504. overflow: hidden;
  505. overflow-y: auto;
  506. background-color: #f7f7f7;
  507. .search-cont-top {
  508. padding: 0 34rpx 0;
  509. margin-bottom: 10rpx;
  510. padding-top: 20rpx;
  511. &:last-child {
  512. margin-bottom: 0;
  513. }
  514. .cont-tit {
  515. font-size: 32rpx;
  516. margin-bottom: 20rpx;
  517. font-weight: 500;
  518. display: flex;
  519. justify-content: space-between;
  520. .empty_ico {
  521. width: 32rpx;
  522. height: 33rpx;
  523. }
  524. }
  525. .targetList {
  526. display: flex;
  527. flex-wrap: wrap;
  528. font-size: 28rpx;
  529. .target-item {
  530. width: 50%;
  531. margin-bottom: 20rpx;
  532. }
  533. .chart-item {
  534. width: 100%;
  535. margin-bottom: 20rpx;
  536. }
  537. }
  538. }
  539. }
  540. }
  541. }
  542. </style>