activity.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  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" />
  12. 活动搜索
  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/hot_activity.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/hot_activity.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 "@/activityPages/components/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. collectTypeList: [],
  96. chartPermissionName: "所有行业",
  97. haveData: true,
  98. activityTimeList: [
  99. { Id: 1, IsChoose: false, StatusName: "今日活动" },
  100. { Id: 2, IsChoose: false, StatusName: "明日活动" },
  101. ],
  102. whichDay: "",
  103. listChartPermission: [],
  104. listChartPermissionInit: [],
  105. chartPermissionIds: "",
  106. isShowJurisdiction: false, //
  107. isGetJurisdiction: 0,
  108. isrefresh: true,
  109. activityTypeId: "",
  110. };
  111. },
  112. computed: {
  113. messageTitle() {
  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. async getUserSearchContent() {
  131. const res = await activity.getUserSearchContent({
  132. IsShowJurisdiction: this.isGetJurisdiction,
  133. });
  134. if (res.Ret === 200) {
  135. this.isShowJurisdiction = res.Data.IsShowJurisdiction;
  136. this.listChartPermission = res.Data.ListChartPermission;
  137. this.listChartPermissionInit = res.Data.ListChartPermission2;
  138. this.clickPermission();
  139. if (this.chartPermissionIds) {
  140. this.closeTheWindow();
  141. }
  142. }
  143. },
  144. //获取列表数据
  145. async getActivityLabelTypeList() {
  146. const res = await activity.getActivityLabelTypeList({
  147. ChartPermissionIds: this.chartPermissionIds,
  148. IsShowJurisdiction: this.isGetJurisdiction,
  149. ActiveState: "1",
  150. WhichDay: this.whichDay,
  151. IsPower: this.isGetJurisdiction,
  152. });
  153. if (res.Ret === 200) {
  154. this.collectTypeList = res.Data.List || [];
  155. this.haveData = this.collectTypeList.length ? true : false;
  156. if (this.refresh) {
  157. uni.stopPullDownRefresh();
  158. this.refresh = false;
  159. }
  160. }
  161. },
  162. // 下拉的选择的关闭事件
  163. closeTheWindow() {
  164. const types = this.chartPermissionIds ? this.chartPermissionIds.split(",").map(Number) : [];
  165. if (types.length > 0) {
  166. const str = [];
  167. this.listChartPermission.forEach((item) => {
  168. if (types.includes(item.ChartPermissionId)) {
  169. item.IsChoose = true;
  170. str.push(item.PermissionName);
  171. } else {
  172. item.IsChoose = false;
  173. }
  174. });
  175. this.chartPermissionName = str.length == 6 ? "所有行业" : str.join(",");
  176. }
  177. },
  178. // 下拉的选择的选中事件
  179. overallClick(item) {
  180. if (this.isShowJurisdiction) return;
  181. this.listChartPermission.forEach((key) => {
  182. if (key.ChartPermissionId == item.ChartPermissionId) {
  183. key.IsChoose = !key.IsChoose;
  184. }
  185. });
  186. },
  187. // 下拉的选择的重置事件
  188. replacementBtn() {
  189. this.listChartPermission = this.listChartPermissionInit;
  190. this.chartPermissionIds = "";
  191. this.isShowJurisdiction = false;
  192. this.listChartPermission.map((item) => (item.IsChoose = false));
  193. this.chartPermissionName = "所有行业";
  194. this.getActivityLabelTypeList();
  195. },
  196. //下拉选择的确定事件
  197. replacementConfirm() {
  198. const arr = [];
  199. const str = [];
  200. this.listChartPermission &&
  201. this.listChartPermission.forEach((key) => {
  202. if (key.IsChoose) {
  203. arr.push(key.ChartPermissionId);
  204. str.push(key.PermissionName);
  205. }
  206. });
  207. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  208. this.chartPermissionName = "所有行业";
  209. } else {
  210. this.chartPermissionName = str.join(",");
  211. }
  212. this.chartPermissionIds = arr.join(",");
  213. this.getActivityLabelTypeList();
  214. this.selectComponent("#industry").toggle(false);
  215. },
  216. //今日明日的点击事件
  217. isActivityDate(id) {
  218. this.selectComponent("#industry").toggle(false);
  219. this.activityTimeList.forEach((item) => {
  220. if (item.Id == id) item.IsChoose = !item.IsChoose;
  221. });
  222. const arr = [];
  223. this.activityTimeList.forEach((item) => item.IsChoose && arr.push(item.Id));
  224. this.whichDay = arr.join(",");
  225. this.getActivityLabelTypeList();
  226. },
  227. //是否有权限的点击事件
  228. async permissioActivity() {
  229. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  230. this.selectComponent("#industry").toggle(false);
  231. this.isShowJurisdiction = !this.isShowJurisdiction;
  232. this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
  233. await this.getUserSearchContent();
  234. this.selectComponent("#industry").toggle(false);
  235. if (this.isShowJurisdiction) {
  236. this.getActivityLabelTypeList();
  237. } else {
  238. this.replacementBtn();
  239. }
  240. } else {
  241. //已授权未绑定
  242. uni.navigateTo({
  243. url: "/pageMy/login/login",
  244. });
  245. }
  246. },
  247. //点击后有权限的
  248. clickPermission() {
  249. if (this.isShowJurisdiction) {
  250. const arr = [];
  251. this.listChartPermission &&
  252. this.listChartPermission.forEach((key) => {
  253. if (key.IsChoose) {
  254. arr.push(key.ChartPermissionId);
  255. }
  256. });
  257. this.chartPermissionIds = arr.join(",");
  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. goDetails(item, key) {
  276. if (item.Resource === 1 || key === 1) {
  277. let type = item.ActivityTypeName || "";
  278. let key = item.ActivityTypeId || item.KeyWord;
  279. this.$store.dispatch("checkHandle", "/activityPages/themeActivity/themeActivity?title=" + key + "&type=" + type + "&permissionIds=" + this.chartPermissionIds + "&whichDay=" + this.whichDay);
  280. } else {
  281. if (key) {
  282. this.$store.dispatch("checkHandle", "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId);
  283. } else {
  284. this.$store.dispatch("checkHandle", "/activityPages/specialResearchPage/specialResearchPage");
  285. }
  286. }
  287. },
  288. //去往搜索事件
  289. goSearch() {
  290. this.$store.dispatch("checkHandle", "/activityPages/activitySearch/activitySearch");
  291. },
  292. //去往 活动回放activityPlayBack
  293. activityPlayBack() {
  294. this.$store.dispatch("checkHandle", "/activityPages/playBack/playBack");
  295. },
  296. },
  297. //load
  298. onLoad(option) {
  299. this.loadShare(option);
  300. this.getUserSearchContent();
  301. this.getActivityLabelTypeList();
  302. this.initNavBar();
  303. },
  304. async onShow() {
  305. await this.$store.dispatch("checkHandle", "noGO");
  306. },
  307. /** 用户点击分享 */
  308. onShareAppMessage: function (res) {
  309. return {
  310. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.messageTitle,
  311. path: "/pages/activity/activity?whichDay=" + this.whichDay + "&chartPermissionIds=" + this.chartPermissionIds + "&isGetJurisdiction=" + this.isGetJurisdiction,
  312. };
  313. },
  314. /* 下拉刷新 */
  315. onPullDownRefresh: Throttle(function () {
  316. this.refresh = true;
  317. this.page_no = 1;
  318. this.getActivityLabelTypeList();
  319. }),
  320. // 页面滚动事件
  321. onPageScroll() {},
  322. };
  323. </script>
  324. <style scoped lang="scss">
  325. .activity-content {
  326. background-color: #f7f7f7;
  327. padding-bottom: 90rpx;
  328. position: relative;
  329. .top-content-box {
  330. position: sticky;
  331. top: 0;
  332. left: 0;
  333. width: 100%;
  334. z-index: 99;
  335. background-color: #fff;
  336. .nav-bar-wrap {
  337. background-color: #fff;
  338. width: 100%;
  339. .content {
  340. height: 100%;
  341. display: flex;
  342. align-items: center;
  343. padding-left: 30rpx;
  344. .activity-back {
  345. display: flex;
  346. flex-shrink: 0;
  347. align-items: center;
  348. color: #3385ff;
  349. font-size: 30rpx;
  350. image {
  351. width: 28rpx;
  352. height: 28rpx;
  353. margin-right: 10rpx;
  354. }
  355. }
  356. .activity-search {
  357. margin-left: 20rpx;
  358. width: 46%;
  359. height: 62rpx;
  360. color: #999999;
  361. font-size: 26rpx;
  362. display: flex;
  363. align-items: center;
  364. padding-left: 20rpx;
  365. background: #f3f3f3;
  366. border-radius: 82rpx;
  367. border: 1px solid #dcdfe6;
  368. }
  369. }
  370. }
  371. }
  372. .screen-item {
  373. height: 100rpx;
  374. padding: 0 34rpx;
  375. font-size: 24rpx;
  376. color: #333;
  377. display: flex;
  378. justify-content: space-between;
  379. align-items: center;
  380. text {
  381. width: 150rpx;
  382. text-align: center;
  383. line-height: 51rpx;
  384. background-color: #f8f8fa;
  385. box-sizing: border-box;
  386. border-radius: 26rpx;
  387. }
  388. .active {
  389. background-color: #3385ff;
  390. color: #fff;
  391. }
  392. }
  393. .select-conyent {
  394. .decide {
  395. background-color: #f8f8fa;
  396. display: flex;
  397. align-items: center;
  398. margin: 0 auto;
  399. height: 110rpx;
  400. width: 100%;
  401. padding-left: 30rpx;
  402. }
  403. .items-box {
  404. width: 40rpx;
  405. }
  406. .menu-items {
  407. background-color: #f8f8fa;
  408. width: 100%;
  409. display: flex;
  410. flex-wrap: wrap;
  411. padding: 30rpx 30rpx 0;
  412. .menu-items-box {
  413. display: flex;
  414. width: 50%;
  415. font-size: 28rpx;
  416. font-weight: 400;
  417. margin-bottom: 40rpx;
  418. }
  419. text {
  420. text-align: left;
  421. }
  422. }
  423. .replacement {
  424. margin: 0rpx 30rpx 20rpx;
  425. display: flex;
  426. background-color: #2c83ff;
  427. height: 60rpx;
  428. font-size: 28rpx;
  429. font-weight: 400;
  430. color: #ffffff;
  431. border-radius: 30rpx;
  432. box-sizing: border-box;
  433. text {
  434. flex: 1;
  435. line-height: 58rpx;
  436. background-color: #2c83ff;
  437. }
  438. .replacement-box {
  439. border: 1rpx solid #2c83ff;
  440. color: #2c83ff;
  441. background: #ffffff;
  442. border-radius: 28rpx 0rpx 28rpx 28rpx;
  443. }
  444. }
  445. }
  446. .nodata_ico {
  447. width: 374rpx;
  448. height: 288rpx;
  449. }
  450. .content-list {
  451. display: flex;
  452. padding: 34rpx;
  453. }
  454. .half {
  455. width: 50%;
  456. }
  457. .activity-ltem {
  458. width: 331rpx;
  459. position: relative;
  460. margin-bottom: 30rpx;
  461. .zindex-one {
  462. position: absolute;
  463. top: 0;
  464. left: 0;
  465. height: 250rpx;
  466. width: 100%;
  467. z-index: 1;
  468. }
  469. .zindex-two {
  470. position: absolute;
  471. top: 0;
  472. left: 0;
  473. width: 100%;
  474. height: 100%;
  475. z-index: 2;
  476. }
  477. .content {
  478. position: sticky;
  479. top: 0;
  480. left: 0;
  481. width: 100%;
  482. border-radius: 15rpx;
  483. overflow: hidden;
  484. z-index: 3;
  485. }
  486. .item-img {
  487. width: 100%;
  488. height: 147rpx;
  489. margin-bottom: 30rpx;
  490. font-size: 34rpx;
  491. color: #fff;
  492. }
  493. .activity-li {
  494. width: 100%;
  495. height: 86rpx;
  496. display: flex;
  497. align-items: center;
  498. justify-content:center;
  499. background-repeat: no-repeat;
  500. background-size: 100% 100%;
  501. padding: 0 20rpx;
  502. position: relative;
  503. font-size: 26rpx;
  504. color: #fff;
  505. .item-image {
  506. position: absolute;
  507. left: 0;
  508. top: 50%;
  509. transform: translateY(-50%);
  510. width: 100%;
  511. height: 50rpx;
  512. }
  513. .new_img {
  514. width: 26rpx;
  515. height: 28rpx;
  516. }
  517. }
  518. }
  519. .more {
  520. width: 100%;
  521. text-align: center;
  522. font-size: 34rpx;
  523. color: #3385ff;
  524. margin-top: 90rpx;
  525. }
  526. .activity-ui {
  527. padding: 20rpx;
  528. background-repeat: no-repeat;
  529. background-size: 100% 100%;
  530. }
  531. }
  532. /deep/.van-dropdown-menu {
  533. background-color: #fff;
  534. box-shadow: none !important;
  535. align-items: center !important;
  536. }
  537. /deep/.van-dropdown-menu__item {
  538. box-sizing: border-box;
  539. width: 166rpx;
  540. padding-right: 20rpx;
  541. height: 51rpx;
  542. border-radius: 26rpx;
  543. background: #f8f8fa;
  544. }
  545. /deep/.van-dropdown-item {
  546. margin-top: -10rpx;
  547. }
  548. /deep/[data-index="2"] {
  549. margin-right: 0rpx;
  550. }
  551. /deep/ .van-ellipsis {
  552. font-size: 24rpx;
  553. }
  554. @import "@/activityPages/components/indexActivity.scss";
  555. </style>