activity.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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. <image
  53. style="width: 73rpx; right: -6rpx"
  54. v-if="val.IsExternalLabel"
  55. class="item-image"
  56. lazy-load
  57. src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/activity_external.png"
  58. ></image>
  59. <text class="text_oneLine"> {{ val.KeyWord }}</text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="half">
  66. <view class="activity-ltem" v-for="(item, index) in collectTypeList" :key="index" v-if="item.Position == 2">
  67. <image class="zindex-one" :src="item.ImgUrl" lazy-load></image>
  68. <view class="content">
  69. <view class="item-img" @click="goDetails(item)"> </view>
  70. <view :style="{ 'background-image': 'url(' + item.ImgUrlBg + ')' }" class="activity-ui">
  71. <view class="activity-li" :style="{ 'background-image': 'url(' + val.ImgUrlBg + ')' }" v-for="val in item.List" :key="val.KeyWord" @click="goDetails(val, item.Resource)">
  72. <image v-if="val.IsNew" class="item-image" lazy-load src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/new_report.png"></image>
  73. <image
  74. style="width: 73rpx; right: -6rpx"
  75. v-if="val.IsExternalLabel"
  76. class="item-image"
  77. lazy-load
  78. src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/activity_external.png"
  79. ></image>
  80. <text class="text_oneLine"> {{ val.KeyWord }}</text>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage > 1" />
  88. </view>
  89. <view class="nodata" v-if="!haveData">
  90. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  91. <text>{{ tabsActive == 0 ? "暂时没有符合条件的活动" : "暂无我的日程" }}</text>
  92. </view>
  93. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  94. </view>
  95. </template>
  96. <script>
  97. import { activity } from "@/config/api.js";
  98. import { Throttle } from "@/config/util.js";
  99. import myActivityMixin from "@/components/activity/indexActivity.js";
  100. import freeCharge from "@/components/freeCharge";
  101. let app = getApp();
  102. export default {
  103. mixins: [myActivityMixin],
  104. components: {
  105. freeCharge,
  106. },
  107. data() {
  108. return {
  109. whichDay: "",
  110. activityTypeId: "",
  111. chartPermissionIds: "",
  112. chartPermissionName: "所有行业",
  113. isGetJurisdiction: 0,
  114. isrefresh: true,
  115. isShowJurisdiction: false, //
  116. haveData: true,
  117. listChartPermission: [],
  118. listChartPermissionInit: [],
  119. collectTypeList: [],
  120. activityTimeList: [
  121. { Id: 1, IsChoose: false, StatusName: "今日活动" },
  122. { Id: 2, IsChoose: false, StatusName: "明日活动" },
  123. ],
  124. };
  125. },
  126. computed: {
  127. messageTitle() { // 计算分享时候的title
  128. let arr = this.whichDay ? this.whichDay.split(",") : [];
  129. let whichData = arr.length == 2 ? "今日活动,明日活动" : arr == "1" ? "今日活动" : arr == "2" ? "明日活动" : "";
  130. let title = whichData ? whichData + "," + this.chartPermissionName : this.chartPermissionName !== "所有行业" ? this.chartPermissionName : "";
  131. return title || "近期所有行业活动预告";
  132. },
  133. },
  134. methods: {
  135. //获取胶囊位置
  136. initNavBar() {
  137. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  138. this.navBarStyle = {
  139. height: menuButtonInfo.height + menuButtonInfo.top + 8 + "px",
  140. paddingTop: menuButtonInfo.top - 4 + "px",
  141. paddingBottom: "4px",
  142. };
  143. },
  144. // 获取权限、所有的行业
  145. async getUserSearchContent() {
  146. const res = await activity.getUserSearchContent({
  147. IsShowJurisdiction: this.isGetJurisdiction,
  148. });
  149. if (res.Ret === 200) {
  150. this.isShowJurisdiction = res.Data.IsShowJurisdiction;
  151. this.listChartPermission = res.Data.ListChartPermission;
  152. this.listChartPermissionInit = res.Data.ListChartPermission2;
  153. this.clickPermission();
  154. if (this.chartPermissionIds) {
  155. this.closeTheWindow();
  156. }
  157. }
  158. },
  159. // 获取列表数据
  160. async getActivityLabelTypeList() {
  161. const res = await activity.getActivityLabelTypeList({
  162. ChartPermissionIds: this.chartPermissionIds,
  163. IsShowJurisdiction: this.isGetJurisdiction,
  164. ActiveState: "1",
  165. WhichDay: this.whichDay,
  166. IsPower: this.isGetJurisdiction,
  167. });
  168. if (res.Ret === 200) {
  169. this.collectTypeList = res.Data.List || [];
  170. this.haveData = this.collectTypeList.length ? true : false;
  171. if (this.refresh) {
  172. uni.stopPullDownRefresh();
  173. this.refresh = false;
  174. }
  175. }
  176. },
  177. // 下拉的选择的关闭事件
  178. closeTheWindow() {
  179. const types = this.chartPermissionIds ? this.chartPermissionIds.split(",").map(Number) : [];
  180. if (types.length > 0) {
  181. const str = [];
  182. this.listChartPermission.forEach((item) => {
  183. if (types.includes(item.ChartPermissionId)) {
  184. item.IsChoose = true;
  185. str.push(item.PermissionName);
  186. } else {
  187. item.IsChoose = false;
  188. }
  189. });
  190. this.chartPermissionName = str.length == 6 ? "所有行业" : str.join(",");
  191. }
  192. },
  193. // 下拉的选择的选中事件
  194. overallClick(item) {
  195. if (this.isShowJurisdiction) return;
  196. this.listChartPermission.forEach((key) => {
  197. if (key.ChartPermissionId == item.ChartPermissionId) {
  198. key.IsChoose = !key.IsChoose;
  199. }
  200. });
  201. },
  202. // 下拉的选择的重置事件
  203. replacementBtn() {
  204. this.listChartPermission = this.listChartPermissionInit;
  205. this.chartPermissionIds = "";
  206. this.isShowJurisdiction = false;
  207. this.listChartPermission.map((item) => (item.IsChoose = false));
  208. this.chartPermissionName = "所有行业";
  209. this.getActivityLabelTypeList();
  210. },
  211. // 下拉选择的确定事件
  212. replacementConfirm() {
  213. const arr = [];
  214. const str = [];
  215. this.listChartPermission &&
  216. this.listChartPermission.forEach((key) => {
  217. if (key.IsChoose) {
  218. arr.push(key.ChartPermissionId);
  219. str.push(key.PermissionName);
  220. }
  221. });
  222. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  223. this.chartPermissionName = "所有行业";
  224. } else {
  225. this.chartPermissionName = str.join(",");
  226. }
  227. this.chartPermissionIds = arr.join(",");
  228. this.getActivityLabelTypeList();
  229. this.selectComponent("#industry").toggle(false);
  230. },
  231. // 今日明日的点击事件
  232. isActivityDate(id) {
  233. this.selectComponent("#industry").toggle(false);
  234. this.activityTimeList.forEach((item) => {
  235. if (item.Id == id) item.IsChoose = !item.IsChoose;
  236. });
  237. const arr = [];
  238. this.activityTimeList.forEach((item) => item.IsChoose && arr.push(item.Id));
  239. this.whichDay = arr.join(",");
  240. this.getActivityLabelTypeList();
  241. },
  242. // 是否有权限的点击事件
  243. async permissioActivity() {
  244. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  245. this.selectComponent("#industry").toggle(false);
  246. this.isShowJurisdiction = !this.isShowJurisdiction;
  247. this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
  248. await this.getUserSearchContent();
  249. this.selectComponent("#industry").toggle(false);
  250. if (this.isShowJurisdiction) {
  251. this.getActivityLabelTypeList();
  252. } else {
  253. this.replacementBtn();
  254. }
  255. } else {
  256. //已授权未绑定
  257. uni.navigateTo({
  258. url: "/pageMy/login/login",
  259. });
  260. }
  261. },
  262. // 点击后有权限的
  263. clickPermission() {
  264. if (this.isShowJurisdiction) {
  265. const arr = [];
  266. this.listChartPermission &&
  267. this.listChartPermission.forEach((key) => {
  268. if (key.IsChoose) {
  269. arr.push(key.ChartPermissionId);
  270. }
  271. });
  272. this.chartPermissionIds = arr.join(",");
  273. }
  274. },
  275. // 进入页面 判断是否是分享的
  276. loadShare(option) {
  277. if (option && Object.keys(option).length !== 0) {
  278. this.whichDay = option.whichDay || "";
  279. this.chartPermissionIds = option.chartPermissionIds || "";
  280. this.isGetJurisdiction = option.isGetJurisdiction;
  281. this.$nextTick(() => {
  282. let day = this.whichDay ? this.whichDay.split(",").map(Number) : [];
  283. this.activityTimeList.forEach((item) => {
  284. if (day.includes(item.Id)) {
  285. item.IsChoose = true;
  286. }
  287. });
  288. });
  289. }
  290. },
  291. // 去往详情
  292. goDetails(item, key) {
  293. if (item.Resource === 1 || key === 1) {
  294. let type = item.ActivityTypeName || "";
  295. let key = item.ActivityTypeId || item.KeyWord;
  296. let id = typeof key == "string" ? item.ActivityId : "";
  297. this.$store.dispatch(
  298. "checkHandle",
  299. "/activityPages/themeActivity/themeActivity?title=" + key + "&type=" + type + "&permissionIds=" + this.chartPermissionIds + "&whichDay=" + this.whichDay + "&id=" + id
  300. );
  301. } else {
  302. if (key) {
  303. this.$store.dispatch("checkHandle", "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId);
  304. } else {
  305. this.$store.dispatch("checkHandle", "/activityPages/specialResearchPage/specialResearchPage");
  306. }
  307. }
  308. },
  309. //去往搜索事件
  310. goSearch() {
  311. this.$store.dispatch("checkHandle", "/pages-search/indedxSearch/indedxSearch");
  312. },
  313. //去往 活动回放activityPlayBack
  314. activityPlayBack() {
  315. this.$store.dispatch("checkHandle", "/activityPages/playBack/playBack");
  316. },
  317. },
  318. //load
  319. onLoad(option) {
  320. this.loadShare(option);
  321. this.getUserSearchContent();
  322. this.getActivityLabelTypeList();
  323. this.initNavBar();
  324. },
  325. async onShow() {
  326. await this.$store.dispatch("checkHandle", "noGO");
  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. }
  533. .new_img {
  534. width: 26rpx;
  535. height: 28rpx;
  536. }
  537. }
  538. }
  539. .more {
  540. width: 100%;
  541. text-align: center;
  542. font-size: 34rpx;
  543. color: #3385ff;
  544. margin-top: 90rpx;
  545. }
  546. .activity-ui {
  547. padding: 20rpx;
  548. background-repeat: no-repeat;
  549. background-size: 100% 100%;
  550. }
  551. }
  552. /deep/.van-dropdown-menu {
  553. background-color: #fff;
  554. box-shadow: none !important;
  555. align-items: center !important;
  556. }
  557. /deep/.van-dropdown-menu__item {
  558. box-sizing: border-box;
  559. width: 166rpx;
  560. padding-right: 20rpx;
  561. height: 51rpx;
  562. border-radius: 26rpx;
  563. background: #f8f8fa;
  564. }
  565. /deep/.van-dropdown-item {
  566. margin-top: -10rpx;
  567. }
  568. /deep/[data-index="2"] {
  569. margin-right: 0rpx;
  570. }
  571. /deep/ .van-ellipsis {
  572. font-size: 24rpx;
  573. }
  574. @import "@/components/activity/indexActivity.scss";
  575. </style>