activity.vue 18 KB

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