activity.vue 20 KB

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