activity.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  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. <block>
  41. <view class="collect-activity" v-if="haveData">
  42. <activityTypeList :dataList="collectTypeList" :chartPermissionIds="chartPermissionIds"
  43. :isShowJurisdiction="isShowJurisdiction" :whichDay="whichDay" containerStyle="padding: 34rpx;display: flex;"/>
  44. <view class="end-activity-text" v-if="collectTypeList.length" @click="endActivity">已结束活动 >></view>
  45. </view>
  46. <view class="nodata" v-if="!haveData">
  47. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  48. <text>暂时没有符合条件的活动</text>
  49. </view>
  50. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  51. </block>
  52. <!-- <not-have-login v-else /> -->
  53. <Loading />
  54. </view>
  55. </template>
  56. <script>
  57. import { activity } from "@/config/api.js";
  58. import { Throttle } from "@/config/util.js";
  59. import SearchBar from "@/components/search-bar/searchBar.vue";
  60. import activityTypeList from "./components/activityTypeList.vue"
  61. import freeCharge from "@/components/freeCharge";
  62. import NotHaveLogin from "../../components/notHaveLogin.vue";
  63. let app = getApp();
  64. export default {
  65. components: {
  66. freeCharge,
  67. SearchBar,
  68. NotHaveLogin,
  69. activityTypeList
  70. },
  71. data() {
  72. return {
  73. whichDay: "",
  74. activityTypeId: "",
  75. chartPermissionIds: "",
  76. chartPermissionName: "所有行业",
  77. isGetJurisdiction: 0,
  78. isrefresh: true,
  79. isShowJurisdiction: false, //
  80. haveData: true,
  81. listChartPermission: [],
  82. listChartPermissionInit: [],
  83. collectTypeList: [],
  84. activityTimeList: [
  85. { Id: 1, IsChoose: false, StatusName: "今日活动" },
  86. { Id: 2, IsChoose: false, StatusName: "明日活动" },
  87. ],
  88. };
  89. },
  90. computed: {
  91. messageTitle() {
  92. // 计算分享时候的title
  93. let arr = this.whichDay ? this.whichDay.split(",") : [];
  94. let whichData = arr.length == 2 ? "今日活动,明日活动" : arr == "1" ? "今日活动" : arr == "2" ? "明日活动" : "";
  95. let title = whichData ? whichData + "," + this.chartPermissionName : this.chartPermissionName !== "所有行业" ? this.chartPermissionName : "";
  96. return title || "近期所有行业活动预告";
  97. },
  98. },
  99. methods: {
  100. // 获取权限、所有的行业
  101. async getUserSearchContent() {
  102. // IsHideResearch 行业列表是否隐藏 买方研选
  103. const res = await activity.getUserSearchContent({
  104. IsShowJurisdiction: this.isGetJurisdiction,
  105. IsHideResearch:false
  106. });
  107. if (res.Ret === 200) {
  108. this.isShowJurisdiction = res.Data.IsShowJurisdiction;
  109. this.listChartPermission = res.Data.ListChartPermission;
  110. this.listChartPermissionInit = res.Data.ListChartPermission2;
  111. this.clickPermission();
  112. if (this.chartPermissionIds) {
  113. this.closeTheWindow();
  114. }
  115. }
  116. },
  117. // 获取列表数据
  118. async getActivityLabelTypeList() {
  119. const res = await activity.getActivityLabelTypeList({
  120. ChartPermissionIds: this.chartPermissionIds,
  121. IsShowJurisdiction: this.isGetJurisdiction,
  122. ActiveState: "1",
  123. WhichDay: this.whichDay,
  124. IsPower: this.isGetJurisdiction,
  125. });
  126. if (res.Ret === 200) {
  127. this.collectTypeList = res.Data.List || [];
  128. this.haveData = this.collectTypeList.length ? true : false;
  129. if (this.refresh) {
  130. uni.stopPullDownRefresh();
  131. this.refresh = false;
  132. }
  133. }
  134. },
  135. // 下拉的选择的关闭事件
  136. closeTheWindow() {
  137. const types = this.chartPermissionIds ? this.chartPermissionIds.split(",").map(Number) : [];
  138. if (types.length > 0) {
  139. const str = [];
  140. this.listChartPermission.forEach((item) => {
  141. if (types.includes(item.ChartPermissionId)) {
  142. item.IsChoose = true;
  143. str.push(item.PermissionName);
  144. } else {
  145. item.IsChoose = false;
  146. }
  147. });
  148. this.chartPermissionName = str.length == 6 ? "所有行业" : str.join(",");
  149. }
  150. },
  151. // 下拉的选择的选中事件
  152. overallClick(item) {
  153. if (this.isShowJurisdiction) return;
  154. this.listChartPermission.forEach((key) => {
  155. if (key.ChartPermissionId == item.ChartPermissionId) {
  156. key.IsChoose = !key.IsChoose;
  157. }
  158. });
  159. },
  160. // 下拉的选择的重置事件
  161. replacementBtn() {
  162. this.listChartPermission = this.listChartPermissionInit;
  163. this.chartPermissionIds = "";
  164. this.isShowJurisdiction = false;
  165. this.listChartPermission.map((item) => (item.IsChoose = false));
  166. this.chartPermissionName = "所有行业";
  167. this.getActivityLabelTypeList();
  168. },
  169. // 下拉选择的确定事件
  170. replacementConfirm() {
  171. const arr = [];
  172. const str = [];
  173. this.listChartPermission &&
  174. this.listChartPermission.forEach((key) => {
  175. if (key.IsChoose) {
  176. arr.push(key.ChartPermissionId);
  177. str.push(key.PermissionName);
  178. }
  179. });
  180. if ((str.length == this.listChartPermission.length) || str.length <= 0) {
  181. this.chartPermissionName = "所有行业";
  182. } else {
  183. this.chartPermissionName = str.join(",");
  184. }
  185. this.chartPermissionIds = arr.join(",");
  186. this.getActivityLabelTypeList();
  187. this.selectComponent("#industry").toggle(false);
  188. },
  189. // 今日明日的点击事件
  190. isActivityDate(id) {
  191. this.selectComponent("#industry").toggle(false);
  192. this.activityTimeList.forEach((item) => {
  193. if (item.Id == id) item.IsChoose = !item.IsChoose;
  194. });
  195. const arr = [];
  196. this.activityTimeList.forEach((item) => item.IsChoose && arr.push(item.Id));
  197. this.whichDay = arr.join(",");
  198. this.getActivityLabelTypeList();
  199. },
  200. // 是否有权限的点击事件
  201. async permissioActivity() {
  202. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  203. this.selectComponent("#industry").toggle(false);
  204. this.isShowJurisdiction = !this.isShowJurisdiction;
  205. this.isGetJurisdiction = this.isShowJurisdiction ? 1 : 2;
  206. await this.getUserSearchContent();
  207. this.selectComponent("#industry").toggle(false);
  208. if (this.isShowJurisdiction) {
  209. this.getActivityLabelTypeList();
  210. } else {
  211. this.replacementBtn();
  212. }
  213. } else {
  214. //已授权未绑定
  215. this.$store.dispatch("checkHandle");
  216. }
  217. },
  218. // 点击后有权限的
  219. clickPermission() {
  220. if (this.isShowJurisdiction) {
  221. const arr = [];
  222. this.listChartPermission &&
  223. this.listChartPermission.forEach((key) => {
  224. if (key.IsChoose) {
  225. arr.push(key.ChartPermissionId);
  226. }
  227. });
  228. this.chartPermissionIds = arr.join(",");
  229. }
  230. },
  231. // 进入页面 判断是否是分享的
  232. loadShare(option) {
  233. if (option && Object.keys(option).length !== 0) {
  234. this.whichDay = option.whichDay || "";
  235. this.chartPermissionIds = option.chartPermissionIds || "";
  236. this.isGetJurisdiction = option.isGetJurisdiction;
  237. this.$nextTick(() => {
  238. let day = this.whichDay ? this.whichDay.split(",").map(Number) : [];
  239. this.activityTimeList.forEach((item) => {
  240. if (day.includes(item.Id)) {
  241. item.IsChoose = true;
  242. }
  243. });
  244. });
  245. }
  246. },
  247. //去往搜索事件
  248. goSearch() {
  249. this.$store.dispatch("checkHandle", "/pages-search/indedxSearch/indedxSearch?source=活动页面");
  250. },
  251. //去往 活动回放activityPlayBack
  252. async activityPlayBack() {
  253. // await this.$store.dispatch("showLoginModal");
  254. uni.navigateTo({ url: "/activityPages/playBack/playBack" });
  255. },
  256. // 跳转已结束活动
  257. endActivity() {
  258. uni.navigateTo({
  259. url: "/activityPages/endActivity/endActivity",
  260. });
  261. },
  262. },
  263. //load
  264. onLoad(option) {
  265. this.loadShare(option);
  266. this.getUserSearchContent();
  267. this.getActivityLabelTypeList();
  268. },
  269. onShow() {
  270. this.$store.commit("setRouterReport", "活动");
  271. this.$store.commit("setRouterActivity", "活动");
  272. this.getRecordTracking("活动");
  273. },
  274. /** 用户点击分享 */
  275. onShareAppMessage: function (res) {
  276. return {
  277. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.messageTitle,
  278. path: "/pages/activity/activity?whichDay=" + this.whichDay + "&chartPermissionIds=" + this.chartPermissionIds + "&isGetJurisdiction=" + this.isGetJurisdiction,
  279. };
  280. },
  281. /* 下拉刷新 */
  282. onPullDownRefresh: Throttle(function () {
  283. this.refresh = true;
  284. this.page_no = 1;
  285. this.getActivityLabelTypeList();
  286. }),
  287. // 页面滚动事件
  288. onPageScroll() {},
  289. };
  290. </script>
  291. <style scoped lang="scss">
  292. .activity-content {
  293. background-color: #f7f7f7;
  294. padding-bottom: 90rpx;
  295. position: relative;
  296. .top-content-box {
  297. position: sticky;
  298. top: 0;
  299. left: 0;
  300. width: 100%;
  301. z-index: 99;
  302. background-color: #fff;
  303. /deep/ .nav-bar-wrap {
  304. .content {
  305. height: 100%;
  306. display: flex;
  307. align-items: center;
  308. padding-left: 30rpx;
  309. margin-right: 20rpx;
  310. .activity-back {
  311. display: flex;
  312. flex-shrink: 0;
  313. align-items: center;
  314. color: #3385ff;
  315. font-size: 30rpx;
  316. image {
  317. width: 28rpx;
  318. height: 28rpx;
  319. margin-right: 10rpx;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. .screen-item {
  326. height: 100rpx;
  327. padding: 0 34rpx;
  328. font-size: 24rpx;
  329. color: #333;
  330. display: flex;
  331. justify-content: space-between;
  332. align-items: center;
  333. text {
  334. width: 150rpx;
  335. text-align: center;
  336. line-height: 51rpx;
  337. background-color: #f8f8fa;
  338. box-sizing: border-box;
  339. border-radius: 26rpx;
  340. }
  341. .active {
  342. background-color: #3385ff;
  343. color: #fff;
  344. }
  345. }
  346. .select-conyent {
  347. .decide {
  348. background-color: #f8f8fa;
  349. display: flex;
  350. align-items: center;
  351. margin: 0 auto;
  352. height: 110rpx;
  353. width: 100%;
  354. padding-left: 30rpx;
  355. }
  356. .items-box {
  357. width: 40rpx;
  358. }
  359. .menu-items {
  360. background-color: #f8f8fa;
  361. width: 100%;
  362. display: flex;
  363. flex-wrap: wrap;
  364. padding: 30rpx 30rpx 0;
  365. .menu-items-box {
  366. display: flex;
  367. width: 50%;
  368. font-size: 28rpx;
  369. font-weight: 400;
  370. margin-bottom: 40rpx;
  371. }
  372. text {
  373. text-align: left;
  374. }
  375. }
  376. .replacement {
  377. margin: 0rpx 30rpx 20rpx;
  378. display: flex;
  379. background-color: #2c83ff;
  380. height: 60rpx;
  381. font-size: 28rpx;
  382. font-weight: 400;
  383. color: #ffffff;
  384. border-radius: 30rpx;
  385. box-sizing: border-box;
  386. text {
  387. flex: 1;
  388. line-height: 58rpx;
  389. background-color: #2c83ff;
  390. }
  391. .replacement-box {
  392. border: 1rpx solid #2c83ff;
  393. color: #2c83ff;
  394. background: #ffffff;
  395. border-radius: 28rpx 0rpx 28rpx 28rpx;
  396. }
  397. }
  398. }
  399. .nodata_ico {
  400. width: 374rpx;
  401. height: 288rpx;
  402. }
  403. .end-activity-text {
  404. display: flex;
  405. justify-content: center;
  406. margin-top: 60rpx;
  407. color: #3385ff;
  408. }
  409. /deep/.not-have-login {
  410. padding-top: 200rpx !important;
  411. }
  412. }
  413. /deep/.van-dropdown-menu {
  414. background-color: #fff;
  415. box-shadow: none !important;
  416. align-items: center !important;
  417. }
  418. /deep/.van-dropdown-menu__item {
  419. box-sizing: border-box;
  420. width: 166rpx;
  421. padding-right: 20rpx;
  422. height: 51rpx;
  423. border-radius: 26rpx;
  424. background: #f8f8fa;
  425. }
  426. /deep/.van-dropdown-item {
  427. margin-top: -10rpx;
  428. }
  429. /deep/[data-index="2"] {
  430. margin-right: 0rpx;
  431. }
  432. /deep/ .van-ellipsis {
  433. font-size: 24rpx;
  434. }
  435. @import "@/components/activity/indexActivity.scss";
  436. </style>