activity.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  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.KeyWord" @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.KeyWord" @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");
  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. await this.$store.dispatch("checkHandle", "noGO");
  324. },
  325. /** 用户点击分享 */
  326. onShareAppMessage: function (res) {
  327. return {
  328. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.messageTitle,
  329. path: "/pages/activity/activity?whichDay=" + this.whichDay + "&chartPermissionIds=" + this.chartPermissionIds + "&isGetJurisdiction=" + this.isGetJurisdiction,
  330. };
  331. },
  332. /* 下拉刷新 */
  333. onPullDownRefresh: Throttle(function () {
  334. this.refresh = true;
  335. this.page_no = 1;
  336. this.getActivityLabelTypeList();
  337. }),
  338. // 页面滚动事件
  339. onPageScroll() {},
  340. };
  341. </script>
  342. <style scoped lang="scss">
  343. .activity-content {
  344. background-color: #f7f7f7;
  345. padding-bottom: 90rpx;
  346. position: relative;
  347. .top-content-box {
  348. position: sticky;
  349. top: 0;
  350. left: 0;
  351. width: 100%;
  352. z-index: 99;
  353. background-color: #fff;
  354. .nav-bar-wrap {
  355. background-color: #fff;
  356. width: 100%;
  357. .content {
  358. height: 100%;
  359. display: flex;
  360. align-items: center;
  361. padding-left: 30rpx;
  362. .activity-back {
  363. display: flex;
  364. flex-shrink: 0;
  365. align-items: center;
  366. color: #3385ff;
  367. font-size: 30rpx;
  368. image {
  369. width: 28rpx;
  370. height: 28rpx;
  371. margin-right: 10rpx;
  372. }
  373. }
  374. .activity-search {
  375. margin-left: 20rpx;
  376. width: 46%;
  377. height: 62rpx;
  378. color: #8d8d8d;
  379. font-size: 30rpx;
  380. display: flex;
  381. align-items: center;
  382. padding-left: 20rpx;
  383. background: #f3f3f3;
  384. border-radius: 82rpx;
  385. }
  386. }
  387. }
  388. }
  389. .screen-item {
  390. height: 100rpx;
  391. padding: 0 34rpx;
  392. font-size: 24rpx;
  393. color: #333;
  394. display: flex;
  395. justify-content: space-between;
  396. align-items: center;
  397. text {
  398. width: 150rpx;
  399. text-align: center;
  400. line-height: 51rpx;
  401. background-color: #f8f8fa;
  402. box-sizing: border-box;
  403. border-radius: 26rpx;
  404. }
  405. .active {
  406. background-color: #3385ff;
  407. color: #fff;
  408. }
  409. }
  410. .select-conyent {
  411. .decide {
  412. background-color: #f8f8fa;
  413. display: flex;
  414. align-items: center;
  415. margin: 0 auto;
  416. height: 110rpx;
  417. width: 100%;
  418. padding-left: 30rpx;
  419. }
  420. .items-box {
  421. width: 40rpx;
  422. }
  423. .menu-items {
  424. background-color: #f8f8fa;
  425. width: 100%;
  426. display: flex;
  427. flex-wrap: wrap;
  428. padding: 30rpx 30rpx 0;
  429. .menu-items-box {
  430. display: flex;
  431. width: 50%;
  432. font-size: 28rpx;
  433. font-weight: 400;
  434. margin-bottom: 40rpx;
  435. }
  436. text {
  437. text-align: left;
  438. }
  439. }
  440. .replacement {
  441. margin: 0rpx 30rpx 20rpx;
  442. display: flex;
  443. background-color: #2c83ff;
  444. height: 60rpx;
  445. font-size: 28rpx;
  446. font-weight: 400;
  447. color: #ffffff;
  448. border-radius: 30rpx;
  449. box-sizing: border-box;
  450. text {
  451. flex: 1;
  452. line-height: 58rpx;
  453. background-color: #2c83ff;
  454. }
  455. .replacement-box {
  456. border: 1rpx solid #2c83ff;
  457. color: #2c83ff;
  458. background: #ffffff;
  459. border-radius: 28rpx 0rpx 28rpx 28rpx;
  460. }
  461. }
  462. }
  463. .nodata_ico {
  464. width: 374rpx;
  465. height: 288rpx;
  466. }
  467. .content-list {
  468. display: flex;
  469. padding: 34rpx;
  470. }
  471. .half {
  472. width: 50%;
  473. }
  474. .activity-ltem {
  475. width: 331rpx;
  476. position: relative;
  477. margin-bottom: 30rpx;
  478. .zindex-one {
  479. position: absolute;
  480. top: 0;
  481. left: 0;
  482. height: 250rpx;
  483. width: 100%;
  484. z-index: 1;
  485. }
  486. .zindex-two {
  487. position: absolute;
  488. top: 0;
  489. left: 0;
  490. width: 100%;
  491. height: 100%;
  492. z-index: 2;
  493. }
  494. .content {
  495. position: sticky;
  496. top: 0;
  497. left: 0;
  498. width: 100%;
  499. border-radius: 15rpx;
  500. overflow: hidden;
  501. z-index: 3;
  502. }
  503. .item-img {
  504. width: 100%;
  505. height: 147rpx;
  506. margin-bottom: 30rpx;
  507. font-size: 34rpx;
  508. color: #fff;
  509. }
  510. .activity-li {
  511. width: 100%;
  512. height: 86rpx;
  513. display: flex;
  514. align-items: center;
  515. justify-content: center;
  516. background-repeat: no-repeat;
  517. background-size: 100% 100%;
  518. padding: 0 20rpx;
  519. position: relative;
  520. font-size: 26rpx;
  521. color: #fff;
  522. .item-image {
  523. position: absolute;
  524. right: 0;
  525. top: 0;
  526. width: 60rpx;
  527. height: 30rpx;
  528. border-radius: 4rpx;
  529. color: #fff;
  530. }
  531. .new_img {
  532. width: 26rpx;
  533. height: 28rpx;
  534. }
  535. .item-trip {
  536. position: absolute;
  537. right: -10rpx;
  538. top: 0;
  539. display: flex;
  540. align-items: center;
  541. justify-content: center;
  542. width: 73rpx;
  543. height: 30rpx;
  544. background: linear-gradient(90deg, #da5555 0%, #e87a7a 100%);
  545. border-radius: 4rpx;
  546. font-size: 16rpx;
  547. }
  548. .item-city {
  549. background: linear-gradient(90deg, #408dff 0%, #6fa9ff 100%);
  550. }
  551. }
  552. }
  553. .more {
  554. width: 100%;
  555. text-align: center;
  556. font-size: 34rpx;
  557. color: #3385ff;
  558. margin-top: 90rpx;
  559. }
  560. .activity-ui {
  561. max-height: 666rpx;
  562. overflow: hidden;
  563. overflow-y: auto;
  564. padding: 20rpx;
  565. background-repeat: no-repeat;
  566. background-size: 100% 100%;
  567. }
  568. .end-activity-text {
  569. display: flex;
  570. justify-content: center;
  571. margin-top: 60rpx;
  572. color: #3385ff;
  573. }
  574. }
  575. /deep/.van-dropdown-menu {
  576. background-color: #fff;
  577. box-shadow: none !important;
  578. align-items: center !important;
  579. }
  580. /deep/.van-dropdown-menu__item {
  581. box-sizing: border-box;
  582. width: 166rpx;
  583. padding-right: 20rpx;
  584. height: 51rpx;
  585. border-radius: 26rpx;
  586. background: #f8f8fa;
  587. }
  588. /deep/.van-dropdown-item {
  589. margin-top: -10rpx;
  590. }
  591. /deep/[data-index="2"] {
  592. margin-right: 0rpx;
  593. }
  594. /deep/ .van-ellipsis {
  595. font-size: 24rpx;
  596. }
  597. @import "@/components/activity/indexActivity.scss";
  598. </style>