activity.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  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. collectTypeList: [],
  110. chartPermissionName: "所有行业",
  111. haveData: true,
  112. activityTimeList: [
  113. { Id: 1, IsChoose: false, StatusName: "今日活动" },
  114. { Id: 2, IsChoose: false, StatusName: "明日活动" },
  115. ],
  116. whichDay: "",
  117. listChartPermission: [],
  118. listChartPermissionInit: [],
  119. chartPermissionIds: "",
  120. isShowJurisdiction: false, //
  121. isGetJurisdiction: 0,
  122. isrefresh: true,
  123. activityTypeId: "",
  124. };
  125. },
  126. computed: {
  127. messageTitle() {
  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. async getUserSearchContent() {
  145. const res = await activity.getUserSearchContent({
  146. IsShowJurisdiction: this.isGetJurisdiction,
  147. });
  148. if (res.Ret === 200) {
  149. this.isShowJurisdiction = res.Data.IsShowJurisdiction;
  150. this.listChartPermission = res.Data.ListChartPermission;
  151. this.listChartPermissionInit = res.Data.ListChartPermission2;
  152. this.clickPermission();
  153. if (this.chartPermissionIds) {
  154. this.closeTheWindow();
  155. }
  156. }
  157. },
  158. //获取列表数据
  159. async getActivityLabelTypeList() {
  160. const res = await activity.getActivityLabelTypeList({
  161. ChartPermissionIds: this.chartPermissionIds,
  162. IsShowJurisdiction: this.isGetJurisdiction,
  163. ActiveState: "1",
  164. WhichDay: this.whichDay,
  165. IsPower: this.isGetJurisdiction,
  166. });
  167. if (res.Ret === 200) {
  168. this.collectTypeList = res.Data.List || [];
  169. this.haveData = this.collectTypeList.length ? true : false;
  170. if (this.refresh) {
  171. uni.stopPullDownRefresh();
  172. this.refresh = false;
  173. }
  174. }
  175. },
  176. // 下拉的选择的关闭事件
  177. closeTheWindow() {
  178. const types = this.chartPermissionIds ? this.chartPermissionIds.split(",").map(Number) : [];
  179. if (types.length > 0) {
  180. const str = [];
  181. this.listChartPermission.forEach((item) => {
  182. if (types.includes(item.ChartPermissionId)) {
  183. item.IsChoose = true;
  184. str.push(item.PermissionName);
  185. } else {
  186. item.IsChoose = false;
  187. }
  188. });
  189. this.chartPermissionName = str.length == 6 ? "所有行业" : str.join(",");
  190. }
  191. },
  192. // 下拉的选择的选中事件
  193. overallClick(item) {
  194. if (this.isShowJurisdiction) return;
  195. this.listChartPermission.forEach((key) => {
  196. if (key.ChartPermissionId == item.ChartPermissionId) {
  197. key.IsChoose = !key.IsChoose;
  198. }
  199. });
  200. },
  201. // 下拉的选择的重置事件
  202. replacementBtn() {
  203. this.listChartPermission = this.listChartPermissionInit;
  204. this.chartPermissionIds = "";
  205. this.isShowJurisdiction = false;
  206. this.listChartPermission.map((item) => (item.IsChoose = false));
  207. this.chartPermissionName = "所有行业";
  208. this.getActivityLabelTypeList();
  209. },
  210. //下拉选择的确定事件
  211. replacementConfirm() {
  212. const arr = [];
  213. const str = [];
  214. this.listChartPermission &&
  215. this.listChartPermission.forEach((key) => {
  216. if (key.IsChoose) {
  217. arr.push(key.ChartPermissionId);
  218. str.push(key.PermissionName);
  219. }
  220. });
  221. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  222. this.chartPermissionName = "所有行业";
  223. } else {
  224. this.chartPermissionName = str.join(",");
  225. }
  226. this.chartPermissionIds = arr.join(",");
  227. this.getActivityLabelTypeList();
  228. this.selectComponent("#industry").toggle(false);
  229. },
  230. //今日明日的点击事件
  231. isActivityDate(id) {
  232. this.selectComponent("#industry").toggle(false);
  233. this.activityTimeList.forEach((item) => {
  234. if (item.Id == id) item.IsChoose = !item.IsChoose;
  235. });
  236. const arr = [];
  237. this.activityTimeList.forEach((item) => item.IsChoose && arr.push(item.Id));
  238. this.whichDay = arr.join(",");
  239. this.getActivityLabelTypeList();
  240. },
  241. //是否有权限的点击事件
  242. async permissioActivity() {
  243. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  244. this.selectComponent("#industry").toggle(false);
  245. this.isShowJurisdiction = !this.isShowJurisdiction;
  246. this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
  247. await this.getUserSearchContent();
  248. this.selectComponent("#industry").toggle(false);
  249. if (this.isShowJurisdiction) {
  250. this.getActivityLabelTypeList();
  251. } else {
  252. this.replacementBtn();
  253. }
  254. } else {
  255. //已授权未绑定
  256. uni.navigateTo({
  257. url: "/pageMy/login/login",
  258. });
  259. }
  260. },
  261. //点击后有权限的
  262. clickPermission() {
  263. if (this.isShowJurisdiction) {
  264. const arr = [];
  265. this.listChartPermission &&
  266. this.listChartPermission.forEach((key) => {
  267. if (key.IsChoose) {
  268. arr.push(key.ChartPermissionId);
  269. }
  270. });
  271. this.chartPermissionIds = arr.join(",");
  272. }
  273. },
  274. loadShare(option) {
  275. if (option && Object.keys(option).length !== 0) {
  276. this.whichDay = option.whichDay || "";
  277. this.chartPermissionIds = option.chartPermissionIds || "";
  278. this.isGetJurisdiction = option.isGetJurisdiction;
  279. this.$nextTick(() => {
  280. let day = this.whichDay ? this.whichDay.split(",").map(Number) : [];
  281. this.activityTimeList.forEach((item) => {
  282. if (day.includes(item.Id)) {
  283. item.IsChoose = true;
  284. }
  285. });
  286. });
  287. }
  288. },
  289. goDetails(item, key) {
  290. if (item.Resource === 1 || key === 1) {
  291. let type = item.ActivityTypeName || "";
  292. let key = item.ActivityTypeId || item.KeyWord;
  293. let id = typeof key == "string" ? item.ActivityId : "";
  294. this.$store.dispatch(
  295. "checkHandle",
  296. "/activityPages/themeActivity/themeActivity?title=" + key + "&type=" + type + "&permissionIds=" + this.chartPermissionIds + "&whichDay=" + this.whichDay + "&id=" + id
  297. );
  298. } else {
  299. if (key) {
  300. this.$store.dispatch("checkHandle", "/activityPages/specialDetail/specialDetail?id=" + item.ActivityId);
  301. } else {
  302. this.$store.dispatch("checkHandle", "/activityPages/specialResearchPage/specialResearchPage");
  303. }
  304. }
  305. },
  306. //去往搜索事件
  307. goSearch() {
  308. this.$store.dispatch("checkHandle", "/pages-search/indedxSearch/indedxSearch");
  309. },
  310. //去往 活动回放activityPlayBack
  311. activityPlayBack() {
  312. this.$store.dispatch("checkHandle", "/activityPages/playBack/playBack");
  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. }
  530. .new_img {
  531. width: 26rpx;
  532. height: 28rpx;
  533. }
  534. }
  535. }
  536. .more {
  537. width: 100%;
  538. text-align: center;
  539. font-size: 34rpx;
  540. color: #3385ff;
  541. margin-top: 90rpx;
  542. }
  543. .activity-ui {
  544. padding: 20rpx;
  545. background-repeat: no-repeat;
  546. background-size: 100% 100%;
  547. }
  548. }
  549. /deep/.van-dropdown-menu {
  550. background-color: #fff;
  551. box-shadow: none !important;
  552. align-items: center !important;
  553. }
  554. /deep/.van-dropdown-menu__item {
  555. box-sizing: border-box;
  556. width: 166rpx;
  557. padding-right: 20rpx;
  558. height: 51rpx;
  559. border-radius: 26rpx;
  560. background: #f8f8fa;
  561. }
  562. /deep/.van-dropdown-item {
  563. margin-top: -10rpx;
  564. }
  565. /deep/[data-index="2"] {
  566. margin-right: 0rpx;
  567. }
  568. /deep/ .van-ellipsis {
  569. font-size: 24rpx;
  570. }
  571. @import "@/components/activity/indexActivity.scss";
  572. </style>