activity.vue 21 KB

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