activityDetailNew.vue 15 KB

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