activity.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <template>
  2. <view class="container activity-content">
  3. <view class="top-content-box">
  4. <view class="nav-bar-wrap" :style="{ height: navBarStyle.height, paddingTop: navBarStyle.paddingTop, paddingBottom: navBarStyle.paddingBottom }">
  5. <view class="content">
  6. <view class="activity-back" @click="activityPlayBack">
  7. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/at_back.png"></image>
  8. 活动回放
  9. </view>
  10. <view class="activity-search" @click="goSearch">
  11. <icon type="search" size="15" class="search_ico" style="margin-right: 10rpx" />
  12. {{ searchPlaceholderList.ActivitySearch || "" }}
  13. </view>
  14. </view>
  15. </view>
  16. <view class="screen-item">
  17. <text :class="isShowJurisdiction ? 'active' : ''" @click="permissioActivity">有权限行业</text>
  18. <!-- 各种状态选择 -->
  19. <view class="select-conyent" ref="select-conyent">
  20. <van-dropdown-menu active-color="#333333">
  21. <van-dropdown-item id="industry" :title="chartPermissionName">
  22. <view class="menu-items">
  23. <view class="menu-items-box" v-for="item in listChartPermission" :key="item.ChartPermissionId" @click="overallClick(item)">
  24. <view class="items-box">
  25. <u-icon v-if="item.IsChoose" name="checkbox-mark" :color="isShowJurisdiction ? '#ccc' : '#2C83FF'" size="24"></u-icon>
  26. </view>
  27. <text>{{ item.PermissionName }}</text>
  28. </view>
  29. </view>
  30. <view class="replacement">
  31. <text @click="replacementBtn" class="replacement-box">重置</text>
  32. <text @click="replacementConfirm">确定</text>
  33. </view>
  34. </van-dropdown-item>
  35. </van-dropdown-menu>
  36. </view>
  37. <text v-for="item in activityTimeList" :key="item.Id" :class="item.IsChoose ? 'active' : ''" @click="isActivityDate(item.Id)">{{ item.StatusName }}</text>
  38. </view>
  39. </view>
  40. <!-- 筛选状态 -->
  41. <!-- 活动列表 -->
  42. <view class="collect-activity" v-if="haveData">
  43. <view class="content-list">
  44. <view class="half">
  45. <block v-for="(item, index) in collectTypeList" :key="index">
  46. <view class="activity-ltem" v-if="item.Position == 1">
  47. <image class="zindex-one" :src="item.ImgUrl" lazy-load></image>
  48. <view class="content">
  49. <view class="item-img" @click="goDetails(item)"> </view>
  50. <view :style="{ 'background-image': 'url(' + item.ImgUrlBg + ')' }" class="activity-ui">
  51. <view class="activity-li" :style="{ 'background-image': 'url(' + val.ImgUrlBg + ')' }" v-for="val in item.List" :key="val.ActivityId" @click="goDetails(val, item.Resource)">
  52. <image v-if="val.IsNew" class="item-image" lazy-load src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/new_report.png"></image>
  53. <text class="text_oneLine"> {{ val.KeyWord }}</text>
  54. <view class="item-trip" v-if="val.TripStatus == 2">确定行程</view>
  55. <view class="item-trip item-city" v-if="val.City.length == 2">{{ val.City }}</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </block>
  61. </view>
  62. <view class="half">
  63. <block v-for="(item, index) in collectTypeList" :key="index">
  64. <view class="activity-ltem" v-if="item.Position == 2">
  65. <image class="zindex-one" :src="item.ImgUrl" lazy-load></image>
  66. <view class="content">
  67. <view class="item-img" @click="goDetails(item)"> </view>
  68. <view :style="{ 'background-image': 'url(' + item.ImgUrlBg + ')' }" class="activity-ui">
  69. <view class="activity-li" :style="{ 'background-image': 'url(' + val.ImgUrlBg + ')' }" v-for="val in item.List" :key="val.ActivityId" @click="goDetails(val, item.Resource)">
  70. <image v-if="val.IsNew" class="item-image" lazy-load src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/new_report.png"></image>
  71. <text class="text_oneLine"> {{ val.KeyWord }}</text>
  72. <view class="item-trip" v-if="val.TripStatus == 2">确定行程</view>
  73. <view class="item-trip item-city" v-if="val.City.length == 2">{{ val.City }}</view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </block>
  79. </view>
  80. </view>
  81. <view class="end-activity-text" v-if="collectTypeList.length" @click="endActivity">已结束活动 >></view>
  82. </view>
  83. <view class="nodata" v-if="!haveData">
  84. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  85. <text>暂时没有符合条件的活动</text>
  86. </view>
  87. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  88. </view>
  89. </template>
  90. <script>
  91. import { activity } from "@/config/api.js";
  92. import { Throttle } from "@/config/util.js";
  93. import freeCharge from "@/components/freeCharge";
  94. let app = getApp();
  95. export default {
  96. components: {
  97. freeCharge,
  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. initNavBar() {
  130. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  131. this.navBarStyle = {
  132. height: menuButtonInfo.height + menuButtonInfo.top + 8 + "px",
  133. paddingTop: menuButtonInfo.top - 4 + "px",
  134. paddingBottom: "4px",
  135. };
  136. },
  137. // 获取权限、所有的行业
  138. async getUserSearchContent() {
  139. const res = await activity.getUserSearchContent({
  140. IsShowJurisdiction: this.isGetJurisdiction,
  141. });
  142. if (res.Ret === 200) {
  143. this.isShowJurisdiction = res.Data.IsShowJurisdiction;
  144. this.listChartPermission = res.Data.ListChartPermission;
  145. this.listChartPermissionInit = res.Data.ListChartPermission2;
  146. this.clickPermission();
  147. if (this.chartPermissionIds) {
  148. this.closeTheWindow();
  149. }
  150. }
  151. },
  152. // 获取列表数据
  153. async getActivityLabelTypeList() {
  154. const res = await activity.getActivityLabelTypeList({
  155. ChartPermissionIds: this.chartPermissionIds,
  156. IsShowJurisdiction: this.isGetJurisdiction,
  157. ActiveState: "1",
  158. WhichDay: this.whichDay,
  159. IsPower: this.isGetJurisdiction,
  160. });
  161. if (res.Ret === 200) {
  162. this.collectTypeList = res.Data.List || [];
  163. this.haveData = this.collectTypeList.length ? true : false;
  164. if (this.refresh) {
  165. uni.stopPullDownRefresh();
  166. this.refresh = false;
  167. }
  168. }
  169. },
  170. // 下拉的选择的关闭事件
  171. closeTheWindow() {
  172. const types = this.chartPermissionIds ? this.chartPermissionIds.split(",").map(Number) : [];
  173. if (types.length > 0) {
  174. const str = [];
  175. this.listChartPermission.forEach((item) => {
  176. if (types.includes(item.ChartPermissionId)) {
  177. item.IsChoose = true;
  178. str.push(item.PermissionName);
  179. } else {
  180. item.IsChoose = false;
  181. }
  182. });
  183. this.chartPermissionName = str.length == 6 ? "所有行业" : str.join(",");
  184. }
  185. },
  186. // 下拉的选择的选中事件
  187. overallClick(item) {
  188. if (this.isShowJurisdiction) return;
  189. this.listChartPermission.forEach((key) => {
  190. if (key.ChartPermissionId == item.ChartPermissionId) {
  191. key.IsChoose = !key.IsChoose;
  192. }
  193. });
  194. },
  195. // 下拉的选择的重置事件
  196. replacementBtn() {
  197. this.listChartPermission = this.listChartPermissionInit;
  198. this.chartPermissionIds = "";
  199. this.isShowJurisdiction = false;
  200. this.listChartPermission.map((item) => (item.IsChoose = false));
  201. this.chartPermissionName = "所有行业";
  202. this.getActivityLabelTypeList();
  203. },
  204. // 下拉选择的确定事件
  205. replacementConfirm() {
  206. const arr = [];
  207. const str = [];
  208. this.listChartPermission &&
  209. this.listChartPermission.forEach((key) => {
  210. if (key.IsChoose) {
  211. arr.push(key.ChartPermissionId);
  212. str.push(key.PermissionName);
  213. }
  214. });
  215. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  216. this.chartPermissionName = "所有行业";
  217. } else {
  218. this.chartPermissionName = str.join(",");
  219. }
  220. this.chartPermissionIds = arr.join(",");
  221. this.getActivityLabelTypeList();
  222. this.selectComponent("#industry").toggle(false);
  223. },
  224. // 今日明日的点击事件
  225. isActivityDate(id) {
  226. this.selectComponent("#industry").toggle(false);
  227. this.activityTimeList.forEach((item) => {
  228. if (item.Id == id) item.IsChoose = !item.IsChoose;
  229. });
  230. const arr = [];
  231. this.activityTimeList.forEach((item) => item.IsChoose && arr.push(item.Id));
  232. this.whichDay = arr.join(",");
  233. this.getActivityLabelTypeList();
  234. },
  235. // 是否有权限的点击事件
  236. async permissioActivity() {
  237. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  238. this.selectComponent("#industry").toggle(false);
  239. this.isShowJurisdiction = !this.isShowJurisdiction;
  240. this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
  241. await this.getUserSearchContent();
  242. this.selectComponent("#industry").toggle(false);
  243. if (this.isShowJurisdiction) {
  244. this.getActivityLabelTypeList();
  245. } else {
  246. this.replacementBtn();
  247. }
  248. } else {
  249. //已授权未绑定
  250. uni.navigateTo({
  251. url: "/pageMy/login/login",
  252. });
  253. }
  254. },
  255. // 点击后有权限的
  256. clickPermission() {
  257. if (this.isShowJurisdiction) {
  258. const arr = [];
  259. this.listChartPermission &&
  260. this.listChartPermission.forEach((key) => {
  261. if (key.IsChoose) {
  262. arr.push(key.ChartPermissionId);
  263. }
  264. });
  265. this.chartPermissionIds = arr.join(",");
  266. }
  267. },
  268. // 进入页面 判断是否是分享的
  269. loadShare(option) {
  270. if (option && Object.keys(option).length !== 0) {
  271. this.whichDay = option.whichDay || "";
  272. this.chartPermissionIds = option.chartPermissionIds || "";
  273. this.isGetJurisdiction = option.isGetJurisdiction;
  274. this.$nextTick(() => {
  275. let day = this.whichDay ? this.whichDay.split(",").map(Number) : [];
  276. this.activityTimeList.forEach((item) => {
  277. if (day.includes(item.Id)) {
  278. item.IsChoose = true;
  279. }
  280. });
  281. });
  282. }
  283. },
  284. // 去往详情
  285. goDetails(item, key) {
  286. if (item.Resource === 1 || key === 1) {
  287. let type = item.ActivityTypeName || "";
  288. let key = item.ActivityTypeId || item.KeyWord;
  289. let id = typeof key == "string" ? item.ActivityId : "";
  290. let str = type ? "&permissionIds=" + this.chartPermissionIds + "&showJurisdiction=" + (this.isShowJurisdiction ? "show" : "") : "";
  291. this.$store.dispatch("checkHandle", "/activityPages/themeActivity/themeActivity?title=" + key + "&type=" + type + "&id=" + id + "&whichDay=" + this.whichDay + str);
  292. } else {
  293. if (key) {
  294. this.$store.dispatch("checkHandle", "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId);
  295. } else {
  296. this.$store.dispatch("checkHandle", "/activityPages/specialResearchPage/specialResearchPage");
  297. }
  298. }
  299. },
  300. //去往搜索事件
  301. goSearch() {
  302. this.$store.dispatch("checkHandle", "/pages-search/indedxSearch/indedxSearch?source=活动页面");
  303. },
  304. //去往 活动回放activityPlayBack
  305. activityPlayBack() {
  306. this.$store.dispatch("checkHandle", "/activityPages/playBack/playBack");
  307. },
  308. // 跳转已结束活动
  309. endActivity() {
  310. uni.navigateTo({
  311. url: "/activityPages/endActivity/endActivity",
  312. });
  313. },
  314. },
  315. //load
  316. onLoad(option) {
  317. this.loadShare(option);
  318. this.getUserSearchContent();
  319. this.getActivityLabelTypeList();
  320. this.initNavBar();
  321. },
  322. async onShow() {
  323. this.$store.commit("setRouterReport", "活动");
  324. this.$store.commit("setRouterActivity", "活动");
  325. await this.$store.dispatch("checkHandle", "noGO");
  326. this.getRecordTracking("活动");
  327. },
  328. /** 用户点击分享 */
  329. onShareAppMessage: function (res) {
  330. return {
  331. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.messageTitle,
  332. path: "/pages/activity/activity?whichDay=" + this.whichDay + "&chartPermissionIds=" + this.chartPermissionIds + "&isGetJurisdiction=" + this.isGetJurisdiction,
  333. };
  334. },
  335. /* 下拉刷新 */
  336. onPullDownRefresh: Throttle(function () {
  337. this.refresh = true;
  338. this.page_no = 1;
  339. this.getActivityLabelTypeList();
  340. }),
  341. // 页面滚动事件
  342. onPageScroll() {},
  343. };
  344. </script>
  345. <style scoped lang="scss">
  346. .activity-content {
  347. background-color: #f7f7f7;
  348. padding-bottom: 90rpx;
  349. position: relative;
  350. .top-content-box {
  351. position: sticky;
  352. top: 0;
  353. left: 0;
  354. width: 100%;
  355. z-index: 99;
  356. background-color: #fff;
  357. .nav-bar-wrap {
  358. background-color: #fff;
  359. width: 100%;
  360. .content {
  361. height: 100%;
  362. display: flex;
  363. align-items: center;
  364. padding-left: 30rpx;
  365. .activity-back {
  366. display: flex;
  367. flex-shrink: 0;
  368. align-items: center;
  369. color: #3385ff;
  370. font-size: 30rpx;
  371. image {
  372. width: 28rpx;
  373. height: 28rpx;
  374. margin-right: 10rpx;
  375. }
  376. }
  377. .activity-search {
  378. margin-left: 20rpx;
  379. width: 46%;
  380. height: 62rpx;
  381. color: #8d8d8d;
  382. font-size: 30rpx;
  383. display: flex;
  384. align-items: center;
  385. padding-left: 20rpx;
  386. background: #f3f3f3;
  387. border-radius: 82rpx;
  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. }
  578. /deep/.van-dropdown-menu {
  579. background-color: #fff;
  580. box-shadow: none !important;
  581. align-items: center !important;
  582. }
  583. /deep/.van-dropdown-menu__item {
  584. box-sizing: border-box;
  585. width: 166rpx;
  586. padding-right: 20rpx;
  587. height: 51rpx;
  588. border-radius: 26rpx;
  589. background: #f8f8fa;
  590. }
  591. /deep/.van-dropdown-item {
  592. margin-top: -10rpx;
  593. }
  594. /deep/[data-index="2"] {
  595. margin-right: 0rpx;
  596. }
  597. /deep/ .van-ellipsis {
  598. font-size: 24rpx;
  599. }
  600. @import "@/components/activity/indexActivity.scss";
  601. </style>