activity.vue 20 KB

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