activity.vue 18 KB

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