activity.vue 19 KB

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