activityDetailNew.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. <template>
  2. <!-- 教研室详情 -->
  3. <view class="activityDetailNew">
  4. <statusBar :item="navbar"></statusBar>
  5. <!-- 消息提示 -->
  6. <msgPop></msgPop>
  7. <view class="top">
  8. <image class="img1" src="https://teacherapi.cocorobo.cn/teaching-file/static/yym/Rectangle25.png"
  9. mode="widthFix">
  10. </image>
  11. <image class="img2" src="../../static/Dropdown.png" mode="widthFix"></image>
  12. </view>
  13. <view class="decontent">
  14. <view class="actit">
  15. {{actItemList.acName}}
  16. </view>
  17. <view class="footer">
  18. <view class="">
  19. {{actItemList.create_at}}
  20. </view>
  21. <view class="">
  22. 阅读量:{{actItemList.views}}
  23. </view>
  24. </view>
  25. <view class="avaList">
  26. <view class="ava" @click="gotoMorePer">
  27. <u-avatar-group :urls="applyUserlist" maxCount='6' showMore size="35"
  28. :extraValue='applyUserlist.length' gap="0.4"></u-avatar-group>
  29. <text
  30. style="font-size: 24rpx;font-weight: 400;color:rgba(0, 0, 0, 0.6);margin-left: 20rpx;">{{!applyUserlist.length?'暂无报名':'已报名'}}</text>
  31. </view>
  32. <view class="cost">
  33. ¥<text style="font-size: 48rpx;">{{actItemList.cost}}</text>
  34. </view>
  35. </view>
  36. <view class="acinfo">
  37. <view class="acinfoAddress">
  38. <view class="acinfoTit">
  39. <text>时</text>
  40. <text>间</text>
  41. </view>:
  42. <text class="inf">{{actItemList.begin_at}}</text>
  43. </view>
  44. <!-- <view class="acinfoAddress">
  45. 地点:<text class="inf">{{actItemList.address}}</text>
  46. </view> -->
  47. <!-- <view class="">
  48. 主办单位:<text class="inf">暂无字段</text>
  49. </view> -->
  50. <view class="acinfoAddress">
  51. <view class="acinfoTit">
  52. <text>活</text>
  53. <text>动</text>
  54. <text>形</text>
  55. <text>式</text>
  56. </view>: <text style="color:rgba(0, 86, 168, 1) ;">{{actItemList.acshape}}</text>
  57. </view>
  58. </view>
  59. <!-- 活动介绍 -->
  60. <view class="acbrief">
  61. <view class="britit">
  62. 活动介绍
  63. </view>
  64. <!-- <web-view :src="actItemList.link" webview-styles="{'height': '700rpx';}"></web-view> -->
  65. <!-- <br /> -->
  66. <view class="bricon">
  67. <!-- <rich-text :nodes="">{{actItemList.brief}}</rich-text> -->
  68. <rich-text :nodes="actItemList.brief"></rich-text>
  69. <!-- <view style="color: blue;display: inline-block;" :data-link="actItemList.link" @click="gotoLink">
  70. <u-icon name="arrow-right" labelSize='14' size='14' labelColor='blue' space='2' color='blue' labelPos='left' label='查看更多'></u-icon>
  71. </view> -->
  72. </view>
  73. <!-- <image class="briImg" :src="actItemList.pic" mode="widthFix"></image> -->
  74. </view>
  75. </view>
  76. <!-- 按钮 -->
  77. <view class="btnBlock">
  78. <view class="icos">
  79. <view class="ico">
  80. <view class="imgBlock" @click="coll">
  81. <image class="icoimg"
  82. :src="collArr.includes(actItemList.acId) ? pic_coll2 : '../../static/Starhhh.png'"
  83. mode="aspectFill"></image>
  84. </view>
  85. <text class="icotxt">收藏</text>
  86. </view>
  87. <!-- <view class="ico" style="position: relative;" @click="share"> -->
  88. <view class="ico" style="position: relative;">
  89. <view class="imgBlock">
  90. <image class="icoimg" style="height: 70%;width: 65%;" src="../../static/union.png"
  91. mode="aspectFill"></image>
  92. </view>
  93. <button open-type="share"
  94. style="background-color: aquamarine;opacity: 0; position: absolute;left: 0;width: 100%;height: 100%;"></button>
  95. <text class="icotxt">分享</text>
  96. </view>
  97. </view>
  98. <view class="rightBtn">
  99. <view class="btnt1" v-if="actItemList.openid==oid">本人创建,暂不支持加入</view>
  100. <view class="btnt" v-else-if="!isSign" @click="applyAdd">立即报名</view>
  101. <view class="btnt1" v-else-if="isSign">已报名</view>
  102. <view class="btnt1" v-else-if="actItemList.bnum>=actItemList.pers">人数已满</view>
  103. <!-- <view class="btnt1" v-else-if="isSign && actItemList.openid!=oid">已报名</view> -->
  104. </view>
  105. </view>
  106. <!-- 弹窗 -->
  107. <view>
  108. <view class="mask" v-show="showPopup" @click="showPopup = false"></view>
  109. <view class="popup-container" v-show="showPopup">
  110. <view class="popup">
  111. <view class="header">
  112. <text>确认报名</text>
  113. </view>
  114. <view class="footer">
  115. <view class="cancel-btn" @click="showPopup=false">取消</view>
  116. <view class="confirm-btn" @click="conf">确认</view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="" style="height: 170rpx;width: 750rpx;">
  122. <!-- 占位的 -->
  123. </view>
  124. </view>
  125. </template>
  126. <script>
  127. export default {
  128. data() {
  129. return {
  130. navbar: {
  131. title: '活动详情',
  132. btn: 1
  133. },
  134. // 用户openid
  135. oid: '',
  136. // 活动id
  137. acId: '',
  138. // 页面数据
  139. actItemList: {},
  140. // 用户收藏列表
  141. collArr: [],
  142. // 用户订阅列表
  143. // subArr: [],
  144. // 收藏按钮节流
  145. stopTimer: 0,
  146. //控制弹窗
  147. showPopup: false,
  148. // 是否已加入
  149. isSign: 0,
  150. // 报名列表
  151. applyUserlist: [],
  152. pic_coll2: 'https://teacherapi.cocorobo.cn/teaching-file/static/mine/Collect_yellow.png',
  153. nodes: [{
  154. name: 'div',
  155. attrs: {
  156. class: 'div-class',
  157. style: 'line-height: 60px; color: red; text-align:center;'
  158. },
  159. children: [{
  160. type: 'text',
  161. text: 'Hello&nbsp;uni-app!'
  162. }]
  163. }],
  164. strings: '<div style="text-align:center;"><img src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"/></div>'
  165. // pic_sub: 'https://teacherapi.cocorobo.cn/teaching-file/static/yym/Vector (Stroke) (1).png',
  166. // pic_sub2: 'https://teacherapi.cocorobo.cn/teaching-file/static/dingyue_blue.png',
  167. };
  168. },
  169. // 分享
  170. onShareAppMessage() {
  171. uni.share({
  172. provider: "weixin",
  173. scene: "WXSceneSession",
  174. type: 1,
  175. summary: "我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!",
  176. success: function(res) {
  177. console.log("success:" + JSON.stringify(res));
  178. },
  179. fail: function(err) {
  180. console.log("fail:" + JSON.stringify(err));
  181. }
  182. });
  183. },
  184. // onUnload() {
  185. // this.$store.dispatch('asyncDelAll')
  186. // },
  187. methods: {
  188. //跳转到第三方链接
  189. gotoLink(e) {
  190. let link = e.currentTarget.dataset.link;
  191. uni.navigateTo({
  192. url: "/pages/skipone/skipone?url=" + encodeURIComponent(link),
  193. });
  194. },
  195. share() {
  196. // onShareAppMessage() {
  197. uni.showToast({
  198. title: '暂未开发,还不能分享哦',
  199. icon: 'none'
  200. })
  201. },
  202. // 获取页面数据
  203. getdata() {
  204. let data = {
  205. oid: this.$store.state.user.openid,
  206. acId: this.acId,
  207. }
  208. this.$request('/selectActivityID', "POST", data).then(res => {
  209. console.log('页面数据', res[0][0]);
  210. this.actItemList = res[0][0]
  211. })
  212. },
  213. // 申请加入
  214. applyAdd() {
  215. // console.log('报名');
  216. this.showPopup = true
  217. },
  218. // 确认操作
  219. conf() {
  220. // this.showPopup = false;
  221. // this.showPopupConfirm = true
  222. // 做最后判断防止同一时间进入报名页面都报名成功
  223. this.$request('/selectIntercept', "POST", {
  224. oid: this.$store.state.user.openid,
  225. acid: this.acId
  226. }).then(res => {
  227. let c = res[0][0]
  228. console.log('报名人数', res[0][0]);
  229. console.log(c.bnum >= c.pers * 1);
  230. if (c.bnum >= c.pers * 1) {
  231. return uni.showToast({
  232. title: '已有人先您一步报名,名额已满',
  233. icon: "none"
  234. })
  235. } else {
  236. let data = {
  237. oid: this.$store.state.user.openid, //用户id
  238. acid: this.acId,
  239. ty: 2,
  240. }
  241. this.$request('/insertSignup', "POST", data).then(res => {
  242. console.log('报名返回', res);
  243. // 添加消息页面系统通知提示报名成功
  244. this.addMessage()
  245. // 弹窗关闭
  246. this.showPopup = false
  247. uni.reLaunch({
  248. url: '/pages/Sign/Sign',
  249. })
  250. })
  251. }
  252. })
  253. },
  254. // 添加消息页面系统通知提示报名成功
  255. addMessage() {
  256. let data = {
  257. oid: this.$store.state.user.openid,
  258. acid: this.acId,
  259. type: 0,
  260. }
  261. this.$request('/insertMessage', "POST", data).then(res => {
  262. console.log('添加消息页面系统通知提示报名成功', res);
  263. })
  264. },
  265. // 查看更多报名同学
  266. gotoMorePer() {
  267. uni.navigateTo({
  268. url: `/pages/dy/dy?acId=${this.acId}`
  269. })
  270. },
  271. //获取是否报名
  272. btnEnroll() {
  273. let data = {
  274. oid: this.$store.state.user.openid, //用户id
  275. aid: this.acId,
  276. type: 2
  277. }
  278. this.$request('/selectSignup', 'POST', data).then(res => {
  279. // console.log('获取报名', res[0][0]);
  280. this.isSign = res[0][0].num
  281. })
  282. },
  283. // 收藏事件
  284. coll() {
  285. // this.stopTimer=0
  286. if (this.stopTimer) return uni.showToast({
  287. icon: 'none',
  288. title: '点击过快'
  289. })
  290. this.stopTimer = 1
  291. setTimeout(() => {
  292. this.stopTimer = 0
  293. }, 500)
  294. //判断是否收藏
  295. let iscoll = null
  296. // 查询是否收藏过
  297. let data = {
  298. acid: this.acId,
  299. oid: this.$store.state.user.openid, //用户id
  300. ty: 0
  301. }
  302. this.$request('/selectOneOperator', 'POST', data).then(res => {
  303. // console.log('查询是否收藏过',res);
  304. res[0].length ? iscoll = true : iscoll = false;
  305. // iscoll为true表示已经收藏过,执行删除 为true则收藏
  306. if (iscoll) {
  307. this.$store.dispatch('asyncUpdatemsg', {
  308. collAoff: 0
  309. })
  310. console.log('执行删除');
  311. this.$request('/deleteOperator', 'POST', data).then(res => {
  312. // console.log(res);
  313. this.getColl()
  314. setTimeout(() => {
  315. this.$store.dispatch('asyncDelMsg')
  316. }, 1500)
  317. })
  318. } else {
  319. this.$store.dispatch('asyncUpdatemsg', {
  320. collAoff: 1
  321. })
  322. console.log('执行添加');
  323. this.$request('/insertOperator', 'POST', data).then(res => {
  324. // console.log(res);
  325. this.getColl()
  326. setTimeout(() => {
  327. this.$store.dispatch('asyncDelMsg')
  328. }, 1500)
  329. })
  330. }
  331. })
  332. },
  333. //获取是否收藏
  334. getColl() {
  335. let data = {
  336. oid: this.$store.state.user.openid, //用户id
  337. type: 0
  338. }
  339. this.$request('/selectOperator', 'POST', data).then(res => {
  340. // console.log('获取收藏', res);
  341. // 每次调用前清零,防止push叠加错误
  342. this.collArr = []
  343. // 将acid遍历到collArr中
  344. res[0].forEach(i => {
  345. this.collArr.push(i.acId)
  346. })
  347. })
  348. },
  349. // 获取报名用户
  350. getUsers() {
  351. let data = {
  352. oid: this.$store.state.user.openid, //用户id
  353. aid: this.acId,
  354. type: 2,
  355. page: 1, //下拉获取更多的备用字段
  356. lim: 6 //一次获取多少数据
  357. }
  358. this.$request('/selectApplyUser', 'POST', data).then(res => {
  359. console.log('获取报名用户列表', res[0]);
  360. res[0].forEach(e => {
  361. this.applyUserlist.push(e.avatar)
  362. })
  363. // this.applyUserlist = res[0]
  364. })
  365. }
  366. },
  367. onLoad(e) {
  368. // this.stopTimer=0
  369. // console.log('接收参数',e);
  370. this.acId = e.acId
  371. this.oid = this.$store.state.user.openid
  372. // 获取是否报名
  373. this.btnEnroll()
  374. // WebviewObject plus.webview.create( url, id, styles, extras );
  375. // this.getActivity()
  376. // 获取页面数据
  377. this.getdata()
  378. // 获取是否收藏
  379. this.getColl()
  380. // 获取是否订阅
  381. // this.getSub()
  382. // 获取报名人名单
  383. this.getUsers()
  384. }
  385. }
  386. </script>
  387. <style lang="scss">
  388. .activityDetailNew {
  389. background-color: #fff;
  390. .top {
  391. width: 750rpx;
  392. position: relative;
  393. .img1 {
  394. display: block;
  395. margin: auto;
  396. width: 750rpx;
  397. }
  398. .img2 {
  399. position: absolute;
  400. width: 100%;
  401. left: 0;
  402. bottom: 0;
  403. }
  404. }
  405. .decontent {
  406. width: 750rpx;
  407. border-top-right-radius: 30rpx;
  408. border-top-left-radius: 30rpx;
  409. background-color: #fff;
  410. padding: 32rpx;
  411. display: flex;
  412. flex-direction: column;
  413. justify-content: flex-start;
  414. border-bottom: 1rpx rgba(231, 231, 231, 1) solid;
  415. .actit {
  416. font-weight: 600;
  417. font-size: 40rpx;
  418. color: rgba(0, 0, 0, 0.8);
  419. line-height: 56rpx;
  420. display: -webkit-box;
  421. word-break: break-all;
  422. text-overflow: ellipsis;
  423. overflow: hidden;
  424. -webkit-box-orient: vertical;
  425. -webkit-line-clamp: 2;
  426. }
  427. .footer {
  428. display: flex;
  429. justify-content: space-between;
  430. color: rgba(0, 0, 0, 0.4);
  431. font-size: 24rpx;
  432. // height: 32rpx;
  433. // line-height: 32rpx;
  434. font-weight: 400;
  435. padding: 20rpx 0;
  436. padding-bottom: 0;
  437. }
  438. .avaList {
  439. display: flex;
  440. justify-content: space-between;
  441. width: 100%;
  442. align-items: center;
  443. padding: 30rpx 0;
  444. border-bottom: 1rpx rgba(231, 231, 231, 1) solid;
  445. margin-bottom: 20rpx;
  446. .ava {
  447. width: 353rpx;
  448. display: flex;
  449. align-items: center;
  450. }
  451. .cost {
  452. flex: 1;
  453. text-align: right;
  454. font-weight: 700;
  455. font-size: 40rpx;
  456. color: rgba(246, 135, 23, 1);
  457. }
  458. }
  459. .acinfo {
  460. width: 100%;
  461. display: flex;
  462. flex-direction: column;
  463. justify-content: space-between;
  464. font-size: 28rpx;
  465. font-weight: 400;
  466. color: rgba(0, 0, 0, 0.6);
  467. border-bottom: 1rpx rgba(231, 231, 231, 1) solid;
  468. // padding-bottom: 30rpx;
  469. .acinfoAddress {
  470. // padding: 20rpx 0;
  471. display: flex;
  472. padding-bottom: 20rpx;
  473. .acinfoTit {
  474. width: 150rpx;
  475. display: flex;
  476. justify-content: space-between;
  477. // text-align: justify;
  478. .justified-text {
  479. text-align: justify;
  480. text-justify: inter-word;
  481. /* 兼容性写法,用于处理中英文混排时的对齐效果 */
  482. }
  483. }
  484. }
  485. .inf {
  486. color: rgba(0, 0, 0, 0.8);
  487. }
  488. }
  489. .acbrief {
  490. width: 100%;
  491. .britit {
  492. width: 100%;
  493. height: 48rpx;
  494. font-weight: 600;
  495. line-height: 48rpx;
  496. font-size: 32rpx;
  497. color: rgba(0, 0, 0, 0.8);
  498. margin: 30rpx 0;
  499. }
  500. .bricon {
  501. font-weight: 400;
  502. font-size: 28rpx;
  503. line-height: 44rpx;
  504. color: (0, 0, 0, 0.8);
  505. margin-bottom: 30rpx;
  506. }
  507. .briImg {
  508. width: 100%;
  509. }
  510. }
  511. }
  512. .btnBlock {
  513. position: fixed;
  514. bottom: 0;
  515. left: 0;
  516. width: 750rpx;
  517. height: 175rpx;
  518. background-color: #fff;
  519. display: flex;
  520. justify-content: flex-start;
  521. align-items: center;
  522. padding: 30rpx 30rpx;
  523. padding-bottom: 40rpx;
  524. border-top: 1rpx rgba(231, 231, 231, 1) solid;
  525. // padding-bottom: 78rpx;
  526. .icos {
  527. width: 200rpx;
  528. height: 96rpx;
  529. flex-shrink: 0;
  530. margin-right: 30rpx;
  531. display: flex;
  532. justify-content: space-between;
  533. .ico {
  534. width: 100rpx;
  535. display: flex;
  536. flex-direction: column;
  537. justify-content: space-between;
  538. align-items: center;
  539. .imgBlock {
  540. width: 48rpx;
  541. height: 48rpx;
  542. display: flex;
  543. align-items: center;
  544. justify-content: center;
  545. .icoimg {
  546. width: 42rpx;
  547. height: 40rpx;
  548. }
  549. }
  550. .icotxt {
  551. font-size: 24rpx;
  552. height: 40rpx;
  553. line-height: 40rpx;
  554. color: rgba(4, 0, 0, 1);
  555. }
  556. }
  557. }
  558. .rightBtn {
  559. flex: 1;
  560. display: flex;
  561. justify-content: center;
  562. align-items: center;
  563. .btnt {
  564. width: 454rpx;
  565. color: #fff;
  566. // font-weight: 600;
  567. height: 96rpx;
  568. background-color: rgba(0, 86, 168, 1);
  569. display: flex;
  570. justify-content: center;
  571. align-items: center;
  572. border-radius: 10rpx;
  573. }
  574. .btnt1 {
  575. width: 454rpx;
  576. color: #fff;
  577. // font-weight: 600;
  578. height: 96rpx;
  579. background-color: rgba(139, 190, 255, 1);
  580. display: flex;
  581. justify-content: center;
  582. align-items: center;
  583. border-radius: 10rpx;
  584. }
  585. }
  586. }
  587. }
  588. </style>