activity.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <template>
  2. <view class="container activity-content">
  3. <view class="top-content-box">
  4. <search-bar @goSearch="goSearch" :searchTitle="searchPlaceholderList.SummarySearch" :width="46">
  5. <template slot="content-left">
  6. <view class="content">
  7. <view class="activity-back" @click="activityPlayBack">
  8. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/at_back.png"></image>
  9. 活动回放
  10. </view>
  11. </view>
  12. </template>
  13. </search-bar>
  14. <view class="screen-item" v-if="isUserBindingPhoneNumber">
  15. <text :class="isShowJurisdiction ? 'active' : ''" @click="permissioActivity">有权限行业</text>
  16. <!-- 各种状态选择 -->
  17. <view class="select-conyent" ref="select-conyent">
  18. <van-dropdown-menu active-color="#333333">
  19. <van-dropdown-item id="industry" :title="chartPermissionName">
  20. <view class="menu-items">
  21. <view class="menu-items-box" v-for="item in listChartPermission" :key="item.ChartPermissionId" @click="overallClick(item)">
  22. <view class="items-box">
  23. <u-icon v-if="item.IsChoose" name="checkbox-mark" :color="isShowJurisdiction ? '#ccc' : '#2C83FF'" size="24"></u-icon>
  24. </view>
  25. <text>{{ item.PermissionName }}</text>
  26. </view>
  27. </view>
  28. <view class="replacement">
  29. <text @click="replacementBtn" class="replacement-box">重置</text>
  30. <text @click="replacementConfirm">确定</text>
  31. </view>
  32. </van-dropdown-item>
  33. </van-dropdown-menu>
  34. </view>
  35. <text v-for="item in activityTimeList" :key="item.Id" :class="item.IsChoose ? 'active' : ''" @click="isActivityDate(item.Id)">{{
  36. item.StatusName
  37. }}</text>
  38. </view>
  39. </view>
  40. <!-- 筛选状态 -->
  41. <!-- 活动列表 -->
  42. <block v-if="isUserBindingPhoneNumber">
  43. <view class="collect-activity" v-if="haveData">
  44. <view class="content-list">
  45. <view class="half">
  46. <block v-for="(item, index) in collectTypeList" :key="index">
  47. <view class="activity-ltem" v-if="item.Position == 1">
  48. <image class="zindex-one" :src="item.ImgUrl" lazy-load></image>
  49. <view class="content">
  50. <view class="item-img" @click="goDetails(item)"> </view>
  51. <view :style="{ 'background-image': 'url(' + item.ImgUrlBg + ')' }" class="activity-ui">
  52. <view
  53. class="activity-li"
  54. :style="{ 'background-image': 'url(' + val.ImgUrlBg + ')' }"
  55. v-for="val in item.List"
  56. :key="val.ActivityId"
  57. @click="goDetails(val, item.Resource)"
  58. >
  59. <image
  60. v-if="val.IsNew"
  61. class="item-image"
  62. lazy-load
  63. src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/new_report.png"
  64. ></image>
  65. <image
  66. style="width: 73rpx; right: -6rpx"
  67. v-if="val.IsExternalLabel"
  68. class="item-image"
  69. lazy-load
  70. src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/activity_external.png"
  71. ></image>
  72. <text class="text_oneLine"> {{ val.KeyWord }}</text>
  73. <view class="item-trip" v-if="val.TripStatus == 2">确定行程</view>
  74. <view class="item-trip item-city" v-if="val.City.length == 2">{{ val.City }}</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </block>
  80. </view>
  81. <view class="half">
  82. <block v-for="(item, index) in collectTypeList" :key="index">
  83. <view class="activity-ltem" v-if="item.Position == 2">
  84. <image class="zindex-one" :src="item.ImgUrl" lazy-load></image>
  85. <view class="content">
  86. <view class="item-img" @click="goDetails(item)"> </view>
  87. <view :style="{ 'background-image': 'url(' + item.ImgUrlBg + ')' }" class="activity-ui">
  88. <view
  89. class="activity-li"
  90. :style="{ 'background-image': 'url(' + val.ImgUrlBg + ')' }"
  91. v-for="val in item.List"
  92. :key="val.ActivityId"
  93. @click="goDetails(val, item.Resource)"
  94. >
  95. <image
  96. v-if="val.IsNew"
  97. class="item-image"
  98. lazy-load
  99. src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/new_report.png"
  100. ></image>
  101. <image
  102. style="width: 73rpx; right: -6rpx"
  103. v-if="val.IsExternalLabel"
  104. class="item-image"
  105. lazy-load
  106. src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/activity_external.png"
  107. ></image>
  108. <text class="text_oneLine"> {{ val.KeyWord }}</text>
  109. <view class="item-trip" v-if="val.TripStatus == 2">确定行程</view>
  110. <view class="item-trip item-city" v-if="val.City.length == 2">{{ val.City }}</view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </block>
  116. </view>
  117. </view>
  118. <view class="end-activity-text" v-if="collectTypeList.length" @click="endActivity">已结束活动 >></view>
  119. </view>
  120. <view class="nodata" v-if="!haveData">
  121. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  122. <text>暂时没有符合条件的活动</text>
  123. </view>
  124. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  125. </block>
  126. <not-have-login v-else />
  127. </view>
  128. </template>
  129. <script>
  130. import { activity } from "@/config/api.js";
  131. import { Throttle } from "@/config/util.js";
  132. import SearchBar from "@/components/search-bar/searchBar.vue";
  133. import freeCharge from "@/components/freeCharge";
  134. import NotHaveLogin from "../../components/notHaveLogin.vue";
  135. let app = getApp();
  136. export default {
  137. components: {
  138. freeCharge,
  139. SearchBar,
  140. NotHaveLogin,
  141. },
  142. data() {
  143. return {
  144. whichDay: "",
  145. activityTypeId: "",
  146. chartPermissionIds: "",
  147. chartPermissionName: "所有行业",
  148. isGetJurisdiction: 0,
  149. isrefresh: true,
  150. isShowJurisdiction: false, //
  151. haveData: true,
  152. listChartPermission: [],
  153. listChartPermissionInit: [],
  154. collectTypeList: [],
  155. activityTimeList: [
  156. { Id: 1, IsChoose: false, StatusName: "今日活动" },
  157. { Id: 2, IsChoose: false, StatusName: "明日活动" },
  158. ],
  159. };
  160. },
  161. computed: {
  162. messageTitle() {
  163. // 计算分享时候的title
  164. let arr = this.whichDay ? this.whichDay.split(",") : [];
  165. let whichData = arr.length == 2 ? "今日活动,明日活动" : arr == "1" ? "今日活动" : arr == "2" ? "明日活动" : "";
  166. let title = whichData ? whichData + "," + this.chartPermissionName : this.chartPermissionName !== "所有行业" ? this.chartPermissionName : "";
  167. return title || "近期所有行业活动预告";
  168. },
  169. },
  170. methods: {
  171. // 获取权限、所有的行业
  172. async getUserSearchContent() {
  173. const res = await activity.getUserSearchContent({
  174. IsShowJurisdiction: this.isGetJurisdiction,
  175. });
  176. if (res.Ret === 200) {
  177. this.isShowJurisdiction = res.Data.IsShowJurisdiction;
  178. this.listChartPermission = res.Data.ListChartPermission;
  179. this.listChartPermissionInit = res.Data.ListChartPermission2;
  180. this.clickPermission();
  181. if (this.chartPermissionIds) {
  182. this.closeTheWindow();
  183. }
  184. }
  185. },
  186. // 获取列表数据
  187. async getActivityLabelTypeList() {
  188. const res = await activity.getActivityLabelTypeList({
  189. ChartPermissionIds: this.chartPermissionIds,
  190. IsShowJurisdiction: this.isGetJurisdiction,
  191. ActiveState: "1",
  192. WhichDay: this.whichDay,
  193. IsPower: this.isGetJurisdiction,
  194. });
  195. if (res.Ret === 200) {
  196. this.collectTypeList = res.Data.List || [];
  197. this.haveData = this.collectTypeList.length ? true : false;
  198. if (this.refresh) {
  199. uni.stopPullDownRefresh();
  200. this.refresh = false;
  201. }
  202. }
  203. },
  204. // 下拉的选择的关闭事件
  205. closeTheWindow() {
  206. const types = this.chartPermissionIds ? this.chartPermissionIds.split(",").map(Number) : [];
  207. if (types.length > 0) {
  208. const str = [];
  209. this.listChartPermission.forEach((item) => {
  210. if (types.includes(item.ChartPermissionId)) {
  211. item.IsChoose = true;
  212. str.push(item.PermissionName);
  213. } else {
  214. item.IsChoose = false;
  215. }
  216. });
  217. this.chartPermissionName = str.length == 6 ? "所有行业" : str.join(",");
  218. }
  219. },
  220. // 下拉的选择的选中事件
  221. overallClick(item) {
  222. if (this.isShowJurisdiction) return;
  223. this.listChartPermission.forEach((key) => {
  224. if (key.ChartPermissionId == item.ChartPermissionId) {
  225. key.IsChoose = !key.IsChoose;
  226. }
  227. });
  228. },
  229. // 下拉的选择的重置事件
  230. replacementBtn() {
  231. this.listChartPermission = this.listChartPermissionInit;
  232. this.chartPermissionIds = "";
  233. this.isShowJurisdiction = false;
  234. this.listChartPermission.map((item) => (item.IsChoose = false));
  235. this.chartPermissionName = "所有行业";
  236. this.getActivityLabelTypeList();
  237. },
  238. // 下拉选择的确定事件
  239. replacementConfirm() {
  240. const arr = [];
  241. const str = [];
  242. this.listChartPermission &&
  243. this.listChartPermission.forEach((key) => {
  244. if (key.IsChoose) {
  245. arr.push(key.ChartPermissionId);
  246. str.push(key.PermissionName);
  247. }
  248. });
  249. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  250. this.chartPermissionName = "所有行业";
  251. } else {
  252. this.chartPermissionName = str.join(",");
  253. }
  254. this.chartPermissionIds = arr.join(",");
  255. this.getActivityLabelTypeList();
  256. this.selectComponent("#industry").toggle(false);
  257. },
  258. // 今日明日的点击事件
  259. isActivityDate(id) {
  260. this.selectComponent("#industry").toggle(false);
  261. this.activityTimeList.forEach((item) => {
  262. if (item.Id == id) item.IsChoose = !item.IsChoose;
  263. });
  264. const arr = [];
  265. this.activityTimeList.forEach((item) => item.IsChoose && arr.push(item.Id));
  266. this.whichDay = arr.join(",");
  267. this.getActivityLabelTypeList();
  268. },
  269. // 是否有权限的点击事件
  270. async permissioActivity() {
  271. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  272. this.selectComponent("#industry").toggle(false);
  273. this.isShowJurisdiction = !this.isShowJurisdiction;
  274. this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
  275. await this.getUserSearchContent();
  276. this.selectComponent("#industry").toggle(false);
  277. if (this.isShowJurisdiction) {
  278. this.getActivityLabelTypeList();
  279. } else {
  280. this.replacementBtn();
  281. }
  282. } else {
  283. //已授权未绑定
  284. this.$store.dispatch("checkHandle");
  285. }
  286. },
  287. // 点击后有权限的
  288. clickPermission() {
  289. if (this.isShowJurisdiction) {
  290. const arr = [];
  291. this.listChartPermission &&
  292. this.listChartPermission.forEach((key) => {
  293. if (key.IsChoose) {
  294. arr.push(key.ChartPermissionId);
  295. }
  296. });
  297. this.chartPermissionIds = arr.join(",");
  298. }
  299. },
  300. // 进入页面 判断是否是分享的
  301. loadShare(option) {
  302. if (option && Object.keys(option).length !== 0) {
  303. this.whichDay = option.whichDay || "";
  304. this.chartPermissionIds = option.chartPermissionIds || "";
  305. this.isGetJurisdiction = option.isGetJurisdiction;
  306. this.$nextTick(() => {
  307. let day = this.whichDay ? this.whichDay.split(",").map(Number) : [];
  308. this.activityTimeList.forEach((item) => {
  309. if (day.includes(item.Id)) {
  310. item.IsChoose = true;
  311. }
  312. });
  313. });
  314. }
  315. },
  316. // 去往详情
  317. goDetails(item, key) {
  318. if (item.Resource === 1 || key === 1) {
  319. let type = item.ActivityTypeName || "";
  320. let key = item.ActivityTypeId || item.KeyWord;
  321. let id = typeof key == "string" ? item.ActivityId : "";
  322. let str = type ? "&permissionIds=" + this.chartPermissionIds + "&showJurisdiction=" + (this.isShowJurisdiction ? "show" : "") : "";
  323. this.$store.dispatch(
  324. "checkHandle",
  325. "/activityPages/themeActivity/themeActivity?title=" + key + "&type=" + type + "&id=" + id + "&whichDay=" + this.whichDay + str
  326. );
  327. } else {
  328. if (key) {
  329. uni.navigateTo({ url: "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId });
  330. } else {
  331. uni.navigateTo({ url: "/activityPages/specialResearchPage/specialResearchPage" });
  332. }
  333. }
  334. },
  335. //去往搜索事件
  336. goSearch() {
  337. this.$store.dispatch("checkHandle", "/pages-search/indedxSearch/indedxSearch?source=活动页面");
  338. },
  339. //去往 活动回放activityPlayBack
  340. async activityPlayBack() {
  341. await this.$store.dispatch("showLoginModal");
  342. uni.navigateTo({ url: "/activityPages/playBack/playBack" });
  343. },
  344. // 跳转已结束活动
  345. endActivity() {
  346. uni.navigateTo({
  347. url: "/activityPages/endActivity/endActivity",
  348. });
  349. },
  350. },
  351. //load
  352. onLoad(option) {
  353. this.loadShare(option);
  354. this.getUserSearchContent();
  355. this.getActivityLabelTypeList();
  356. },
  357. onShow() {
  358. this.$store.commit("setRouterReport", "活动");
  359. this.$store.commit("setRouterActivity", "活动");
  360. this.getRecordTracking("活动");
  361. },
  362. /** 用户点击分享 */
  363. onShareAppMessage: function (res) {
  364. return {
  365. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.messageTitle,
  366. path:
  367. "/pages/activity/activity?whichDay=" +
  368. this.whichDay +
  369. "&chartPermissionIds=" +
  370. this.chartPermissionIds +
  371. "&isGetJurisdiction=" +
  372. this.isGetJurisdiction,
  373. };
  374. },
  375. /* 下拉刷新 */
  376. onPullDownRefresh: Throttle(function () {
  377. this.refresh = true;
  378. this.page_no = 1;
  379. this.getActivityLabelTypeList();
  380. }),
  381. // 页面滚动事件
  382. onPageScroll() {},
  383. };
  384. </script>
  385. <style scoped lang="scss">
  386. .activity-content {
  387. background-color: #f7f7f7;
  388. padding-bottom: 90rpx;
  389. position: relative;
  390. .top-content-box {
  391. position: sticky;
  392. top: 0;
  393. left: 0;
  394. width: 100%;
  395. z-index: 99;
  396. background-color: #fff;
  397. /deep/ .nav-bar-wrap {
  398. .content {
  399. height: 100%;
  400. display: flex;
  401. align-items: center;
  402. padding-left: 30rpx;
  403. margin-right: 20rpx;
  404. .activity-back {
  405. display: flex;
  406. flex-shrink: 0;
  407. align-items: center;
  408. color: #3385ff;
  409. font-size: 30rpx;
  410. image {
  411. width: 28rpx;
  412. height: 28rpx;
  413. margin-right: 10rpx;
  414. }
  415. }
  416. }
  417. }
  418. }
  419. .screen-item {
  420. height: 100rpx;
  421. padding: 0 34rpx;
  422. font-size: 24rpx;
  423. color: #333;
  424. display: flex;
  425. justify-content: space-between;
  426. align-items: center;
  427. text {
  428. width: 150rpx;
  429. text-align: center;
  430. line-height: 51rpx;
  431. background-color: #f8f8fa;
  432. box-sizing: border-box;
  433. border-radius: 26rpx;
  434. }
  435. .active {
  436. background-color: #3385ff;
  437. color: #fff;
  438. }
  439. }
  440. .select-conyent {
  441. .decide {
  442. background-color: #f8f8fa;
  443. display: flex;
  444. align-items: center;
  445. margin: 0 auto;
  446. height: 110rpx;
  447. width: 100%;
  448. padding-left: 30rpx;
  449. }
  450. .items-box {
  451. width: 40rpx;
  452. }
  453. .menu-items {
  454. background-color: #f8f8fa;
  455. width: 100%;
  456. display: flex;
  457. flex-wrap: wrap;
  458. padding: 30rpx 30rpx 0;
  459. .menu-items-box {
  460. display: flex;
  461. width: 50%;
  462. font-size: 28rpx;
  463. font-weight: 400;
  464. margin-bottom: 40rpx;
  465. }
  466. text {
  467. text-align: left;
  468. }
  469. }
  470. .replacement {
  471. margin: 0rpx 30rpx 20rpx;
  472. display: flex;
  473. background-color: #2c83ff;
  474. height: 60rpx;
  475. font-size: 28rpx;
  476. font-weight: 400;
  477. color: #ffffff;
  478. border-radius: 30rpx;
  479. box-sizing: border-box;
  480. text {
  481. flex: 1;
  482. line-height: 58rpx;
  483. background-color: #2c83ff;
  484. }
  485. .replacement-box {
  486. border: 1rpx solid #2c83ff;
  487. color: #2c83ff;
  488. background: #ffffff;
  489. border-radius: 28rpx 0rpx 28rpx 28rpx;
  490. }
  491. }
  492. }
  493. .nodata_ico {
  494. width: 374rpx;
  495. height: 288rpx;
  496. }
  497. .content-list {
  498. display: flex;
  499. padding: 34rpx;
  500. }
  501. .half {
  502. width: 50%;
  503. }
  504. .activity-ltem {
  505. width: 331rpx;
  506. position: relative;
  507. margin-bottom: 30rpx;
  508. .zindex-one {
  509. position: absolute;
  510. top: 0;
  511. left: 0;
  512. height: 250rpx;
  513. width: 100%;
  514. z-index: 1;
  515. }
  516. .zindex-two {
  517. position: absolute;
  518. top: 0;
  519. left: 0;
  520. width: 100%;
  521. height: 100%;
  522. z-index: 2;
  523. }
  524. .content {
  525. position: sticky;
  526. top: 0;
  527. left: 0;
  528. width: 100%;
  529. border-radius: 15rpx;
  530. overflow: hidden;
  531. z-index: 3;
  532. }
  533. .item-img {
  534. width: 100%;
  535. height: 147rpx;
  536. margin-bottom: 30rpx;
  537. font-size: 34rpx;
  538. color: #fff;
  539. }
  540. .activity-li {
  541. width: 100%;
  542. height: 86rpx;
  543. display: flex;
  544. align-items: center;
  545. justify-content: center;
  546. background-repeat: no-repeat;
  547. background-size: 100% 100%;
  548. padding: 0 20rpx;
  549. position: relative;
  550. font-size: 26rpx;
  551. color: #fff;
  552. .item-image {
  553. position: absolute;
  554. right: 0;
  555. top: 0;
  556. width: 60rpx;
  557. height: 30rpx;
  558. border-radius: 4rpx;
  559. color: #fff;
  560. }
  561. .new_img {
  562. width: 26rpx;
  563. height: 28rpx;
  564. }
  565. .item-trip {
  566. position: absolute;
  567. right: -10rpx;
  568. top: 0;
  569. display: flex;
  570. align-items: center;
  571. justify-content: center;
  572. width: 73rpx;
  573. height: 30rpx;
  574. background: linear-gradient(90deg, #da5555 0%, #e87a7a 100%);
  575. border-radius: 4rpx;
  576. font-size: 16rpx;
  577. }
  578. .item-city {
  579. background: linear-gradient(90deg, #408dff 0%, #6fa9ff 100%);
  580. }
  581. }
  582. }
  583. .more {
  584. width: 100%;
  585. text-align: center;
  586. font-size: 34rpx;
  587. color: #3385ff;
  588. margin-top: 90rpx;
  589. }
  590. .activity-ui {
  591. max-height: 666rpx;
  592. overflow: hidden;
  593. overflow-y: auto;
  594. padding: 20rpx;
  595. background-repeat: no-repeat;
  596. background-size: 100% 100%;
  597. }
  598. .end-activity-text {
  599. display: flex;
  600. justify-content: center;
  601. margin-top: 60rpx;
  602. color: #3385ff;
  603. }
  604. /deep/.not-have-login {
  605. padding-top: 200rpx !important;
  606. }
  607. }
  608. /deep/.van-dropdown-menu {
  609. background-color: #fff;
  610. box-shadow: none !important;
  611. align-items: center !important;
  612. }
  613. /deep/.van-dropdown-menu__item {
  614. box-sizing: border-box;
  615. width: 166rpx;
  616. padding-right: 20rpx;
  617. height: 51rpx;
  618. border-radius: 26rpx;
  619. background: #f8f8fa;
  620. }
  621. /deep/.van-dropdown-item {
  622. margin-top: -10rpx;
  623. }
  624. /deep/[data-index="2"] {
  625. margin-right: 0rpx;
  626. }
  627. /deep/ .van-ellipsis {
  628. font-size: 24rpx;
  629. }
  630. @import "@/components/activity/indexActivity.scss";
  631. </style>