guest.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <page-layout class="guest-detail">
  3. <nav-bar title="演讲嘉宾" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view>
  5. <view class="main-container" :class="{'loading':!init,'loaded':init}">
  6. <view class="activity-head">
  7. <view class="activity-title">{{ meetingInfo['title'] }}</view>
  8. <view class="activity-time">
  9. {{ meetingInfo['time'] }} | {{ meetingInfo['address'] }}
  10. </view>
  11. <!-- <view class="activity-action">
  12. <button open-type="share" :plain="true">
  13. <view>
  14. <view class="iconfont icon-zhuanfa"></view>
  15. <view>分享</view>
  16. </view>
  17. </button>
  18. <view @click="onCollect(meetingInfo)">
  19. <view v-if="meetingInfo.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
  20. <view v-else class="iconfont icon-Favourites-Add-Large"></view>
  21. <view>收藏</view>
  22. </view>
  23. </view>-->
  24. </view>
  25. <view class="activity-guest-list">
  26. <template v-for="(item, index) in meetingInfo['speech_schedule']">
  27. <template
  28. v-if="item['expand_content'] && item['expand_content']['schedule'] && item['expand_content']['schedule']['value']">
  29. <view class="activity-guest-item">
  30. <view class="activity-guest-title-1">演讲嘉宾</view>
  31. <view class="activity-guest" v-for="(speaker_item,child_index) in item['expand_content']['schedule']['value']"
  32. :key="child_index">
  33. <view class="activity-guest-avatar">
  34. <image :src="speaker_item[0]['value']" :alt="speaker_item[0]['alt']" mode="aspectFill"/>
  35. </view>
  36. <view class="activity-guest-info">
  37. <view class="activity-guest-name">{{ speaker_item[1]['value'] }}</view>
  38. <view class="activity-guest-alias">{{ speaker_item[2]['value'] }}</view>
  39. <van-collapse :value="activeIndex" @change="(e) => onGuestCollapseChange(e, index,child_index)">
  40. <van-collapse-item :title="speaker_item[3]['value']" :name="index + '-' + child_index">
  41. <text>
  42. {{ speaker_item[3]['value'] }}
  43. </text>
  44. </van-collapse-item>
  45. </van-collapse>
  46. </view>
  47. </view>
  48. <view class="activity-guest-title-2">演讲时间与主题</view>
  49. <view class="activity-guest-time">
  50. {{item.time}}
  51. </view>
  52. <van-collapse class="subject-collapse" :value="item.active" @change="(e) => onSubjectCollapseChange(e, index)">
  53. <van-collapse-item :title="item.description" :name="item.title">
  54. <text class="description">{{item.description}}</text>
  55. </van-collapse-item>
  56. </van-collapse>
  57. </view>
  58. </template>
  59. </template>
  60. </view>
  61. <view class="activity-operation">
  62. <!-- <view class="activity-views"></view>-->
  63. <view class="activity-action">
  64. <button open-type="share" :plain="true">
  65. <view>
  66. <view class="iconfont icon-zhuanfa"></view>
  67. <view>分享</view>
  68. </view>
  69. </button>
  70. <view @click="onCollect(meetingInfo)">
  71. <view v-if="meetingInfo.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
  72. <view v-else class="iconfont icon-Favourites-Add-Large"></view>
  73. <view>收藏</view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </u-scroll-view>
  79. </page-layout>
  80. </template>
  81. <script>
  82. import NavBar from '@/components/layout/nav-bar'
  83. import UScrollView from '@/components/common/u-scroll-view'
  84. import VanCollapse from '@/wxcomponents/vant/collapse/index'
  85. import VanCollapseItem from '@/wxcomponents/vant/collapse-item/index'
  86. import PageLayout from "@/components/layout/page-layout";
  87. import {getMeetingInfo} from "@/api/meeting";
  88. import {returnTimeFormat} from "@/utils";
  89. import {meetingCancelCollect, meetingCollect} from "@/api/exhibitor";
  90. export default {
  91. options: {
  92. styleIsolation: 'shared'
  93. },
  94. components: {
  95. PageLayout,
  96. NavBar,
  97. UScrollView,
  98. VanCollapse,
  99. VanCollapseItem
  100. },
  101. computed: {},
  102. onLoad(options) {
  103. this.id = options.id
  104. this.getActiveInfo()
  105. },
  106. data() {
  107. return {
  108. init: false,
  109. id: 0,
  110. favorited: true,
  111. activeIndex: '',
  112. guests: [{
  113. subjectCollapse: [],
  114. descCollapse: []
  115. }, {
  116. subjectCollapse: [],
  117. descCollapse: []
  118. }, {
  119. subjectCollapse: [],
  120. descCollapse: []
  121. }],
  122. meetingInfo: {},
  123. expand_content: {},
  124. shareInfo: {}
  125. }
  126. },
  127. created() {
  128. },
  129. methods: {
  130. onShareAppMessage: function () {
  131. return this.shareInfo
  132. },
  133. onShareTimeline() {
  134. return this.shareInfo
  135. },
  136. onCollect(item) { // 收藏
  137. if (!this.checkAuth('/pages/activity/guest?id='+ this.id)) {
  138. return
  139. }
  140. if (item.is_collect === 1) {
  141. meetingCancelCollect({ id: item.id }).then(res => {
  142. if (res.code === 0) {
  143. this.meetingInfo.is_collect = 0
  144. }
  145. })
  146. } else {
  147. meetingCollect({ id: item.id }).then(res => {
  148. if (res.code === 0) {
  149. this.meetingInfo.is_collect = 1
  150. }
  151. })
  152. }
  153. },
  154. getActiveInfo() {
  155. this.showLoading()
  156. getMeetingInfo({id: this.id}).then(res => {
  157. this.meetingInfo = res.data
  158. this.meetingInfo.time = returnTimeFormat(res.data.start_date, res.data.end_date)
  159. if (this.meetingInfo.speech_schedule) {
  160. this.meetingInfo.speech_schedule.sort((a, b) => {
  161. // 将日期字符串转换为时间戳(兼容 ISO 格式)
  162. const timeA = new Date(a.start_date.replace(' ', 'T')).getTime();
  163. const timeB = new Date(b.start_date.replace(' ', 'T')).getTime();
  164. return timeA - timeB;
  165. });
  166. }
  167. this.expand_content = res.data.expand_content
  168. this.meetingInfo.speech_schedule.forEach(item=>{
  169. item.active = []
  170. item.time = returnTimeFormat(item.start_date, item.end_date)
  171. item['expand_content']['schedule']['value'].forEach(child_item=>{
  172. child_item.active = []
  173. })
  174. })
  175. this.shareInfo = {
  176. title: this.meetingInfo.title,
  177. path: '/pages/activity/detail?id='+this.id,
  178. imageUrl: this.meetingInfo.image_url
  179. }
  180. this.hideLoading()
  181. setTimeout(()=>{
  182. this.init = true
  183. },500)
  184. // this.meetingInfo.content = convertRichTextToWXML(res.data.content)
  185. })
  186. },
  187. onSubjectCollapseChange(activeNames, index) {
  188. this.meetingInfo['speech_schedule'][index].active = activeNames
  189. this.$forceUpdate()
  190. },
  191. onGuestCollapseChange(activeNames, index,child_index) {
  192. this.activeIndex = activeNames
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss">
  198. .main-container {
  199. transition: .1s ease-in-out;
  200. &.loading {
  201. opacity: 0;
  202. }
  203. &.loaded {
  204. opacity: 1;
  205. }
  206. }
  207. .guest-detail {
  208. .van-collapse-item__content {
  209. padding-top: 0 !important;
  210. }
  211. .activity-head {
  212. position: relative;
  213. font-weight: normal;
  214. font-size: $fontSize6;
  215. color: #333333;
  216. .activity-title {
  217. font-weight: bold;
  218. }
  219. .activity-time {
  220. margin-top: 25rpx;
  221. font-size: $fontSize2;
  222. }
  223. .activity-action {
  224. /*position: absolute;
  225. bottom: 0;
  226. right: 0;*/
  227. margin-left: auto;
  228. margin-top: 10rpx;
  229. }
  230. }
  231. .activity-operation {
  232. @include display-flex-between;
  233. //margin-top: 32rpx;
  234. position: fixed;
  235. width: 100%;
  236. left: 0;
  237. bottom: 0;
  238. padding: 40rpx 0;
  239. padding: 40rpx 30rpx;
  240. background-color: #ffffff;
  241. z-index: 99;
  242. }
  243. .activity-views {
  244. font-size: $fontSize2;
  245. color: #555555;
  246. }
  247. .activity-action {
  248. display: grid;
  249. grid-template-columns: 1fr 1fr;
  250. font-size: $fontSize3;
  251. color: #555555;
  252. grid-gap: 10rpx;
  253. width: 100%;
  254. & > view {
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. }
  259. .iconfont {
  260. font-size: 30rpx;
  261. margin-right: 6rpx;
  262. }
  263. .icon-Favourites-Add-Large {
  264. &.active {
  265. &::before {
  266. content: '\e669';
  267. }
  268. color: $textActionColor;
  269. }
  270. }
  271. button {
  272. font-size: $fontSize3;
  273. white-space: nowrap;
  274. line-height: inherit;
  275. background-color: transparent;
  276. border: none;
  277. view {
  278. display: flex;
  279. align-items: center;
  280. font-size: $fontSize3;
  281. }
  282. }
  283. }
  284. .activity-guest-list {
  285. display: grid;
  286. grid-template-columns: 1fr;
  287. grid-row-gap: 41rpx;
  288. margin-top: 30rpx;
  289. }
  290. .activity-guest-item {
  291. padding: 27rpx 18rpx;
  292. background-color: #FFFFFF;
  293. box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0, 0, 0, 0.15);
  294. border-radius: 10rpx;
  295. .van-hairline--top-bottom:after {
  296. opacity: 0;
  297. }
  298. .van-cell {
  299. padding: 0;
  300. line-height: inherit;
  301. background-color: transparent;
  302. &:after {
  303. content: unset;
  304. }
  305. }
  306. .van-cell {
  307. }
  308. .van-collapse {
  309. margin-top: 35rpx;
  310. }
  311. .van-collapse-item__title--expanded .van-cell__title {
  312. visibility: hidden;
  313. }
  314. .subject-collapse {
  315. .description {
  316. line-height: 1.6;
  317. }
  318. .van-collapse-item {
  319. border-radius: 6px;
  320. border: 1px solid #E3E9F1;
  321. position: relative;
  322. }
  323. .van-collapse-item__title--expanded {
  324. &:before {
  325. content:'';
  326. width: 100%;
  327. height: 100%;
  328. border: 4px solid rgba(232,116,0,0.34);
  329. position: absolute;
  330. border-radius: 6rpx;
  331. left: -8rpx;
  332. top: -8rpx;
  333. }
  334. }
  335. }
  336. .van-icon-arrow {
  337. font-size: $fontSize2;
  338. }
  339. .van-collapse-item__content {
  340. padding: 0;
  341. font-size: $fontSize2;
  342. background-color: transparent;
  343. }
  344. .van-cell__left-icon-wrap, .van-cell__right-icon-wrap {
  345. height: auto;
  346. }
  347. .van-cell__title {
  348. width: 0;
  349. background-color: transparent;
  350. font-size: $fontSize2;
  351. color: #333333;
  352. @include text-ellipsis;
  353. }
  354. }
  355. .subject-collapse {
  356. border-radius: 6rpx;
  357. background-color: #FFFFFF;
  358. &.van-collapse-expanded {
  359. .van-collapse {
  360. border-color: rgba(232, 116, 0, 0.34);
  361. }
  362. .van-cell {
  363. border: 1rpx dotted rgba(0, 0, 0, 0.15);
  364. }
  365. }
  366. .van-collapse {
  367. border: 4rpx solid #FFFFFF;
  368. }
  369. .van-collapse-item__title--expanded {
  370. .van-cell__title {
  371. color: #E87400;
  372. font-weight: bold;
  373. visibility: visible;
  374. }
  375. .van-icon-arrow {
  376. color: #E87400;
  377. }
  378. }
  379. .van-cell {
  380. padding: 31rpx 28rpx;
  381. }
  382. .van-cell__title {
  383. font-size: $fontSize3;
  384. }
  385. .van-collapse-item__content {
  386. font-size: $fontSize2;
  387. color: #535353;
  388. line-height: 30rpx;
  389. padding: 31rpx 28rpx 23rpx 28rpx;
  390. }
  391. }
  392. .activity-guest-title-1, .activity-guest-title-2 {
  393. font-size: $fontSize4;
  394. font-weight: bold;
  395. color: #323232;
  396. }
  397. .activity-guest-title-2 {
  398. margin-top: 39rpx;
  399. }
  400. .activity-guest-time {
  401. margin-top: 20rpx;
  402. font-size: $fontSize2;
  403. color: #333333;
  404. }
  405. .activity-guest {
  406. display: flex;
  407. background-color: #F6F6F6;
  408. border-radius: 10rpx;
  409. margin-top: 23rpx;
  410. padding: 28rpx;
  411. .activity-guest-info {
  412. flex: 1;
  413. }
  414. .activity-guest-name {
  415. font-weight: bold;
  416. font-size: $fontSize3;
  417. color: #333333;
  418. line-height: 35rpx;
  419. }
  420. .activity-guest-alias {
  421. margin-top: 8rpx;
  422. font-size: $fontSize1;
  423. color: #7D7D7D;
  424. line-height: 24rpx;
  425. letter-spacing: 2rpx;
  426. }
  427. .activity-guest-avatar {
  428. width: 96rpx;
  429. height: 96rpx;
  430. margin-right: 32rpx;
  431. border-radius: 50%;
  432. overflow: hidden;
  433. flex-shrink: 0;
  434. }
  435. }
  436. }
  437. </style>