activityDetailNew.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <!-- 教研室详情 -->
  3. <view class="activityDetailNew">
  4. <statusBar :item="navbar"></statusBar>
  5. <view class="top">
  6. <image class="img1" src="https://teacherapi.cocorobo.cn/teaching-file/static/yym/Rectangle25.png"
  7. mode="widthFix">
  8. </image>
  9. <image class="img2" src="../../static/Dropdown.png" mode="widthFix"></image>
  10. </view>
  11. <view class="decontent">
  12. <view class="actit">
  13. {{actItemList.acName}}
  14. </view>
  15. <view class="avaList">
  16. <view class="ava" @click="gotoMorePer">
  17. <u-avatar-group :urls="applyUserlist" maxCount='6' showMore size="35"
  18. :extraValue='applyUserlist.length' gap="0.4"></u-avatar-group>
  19. <text
  20. style="font-size: 24rpx;font-weight: 400;color:rgba(0, 0, 0, 0.6);margin-left: 20rpx;">{{!applyUserlist.length?'暂无报名':'已报名'}}</text>
  21. </view>
  22. <view class="cost" v-if="false">
  23. ¥<text style="font-size: 48rpx;">{{actItemList.cost}}</text>
  24. </view>
  25. </view>
  26. <view class="acinfo">
  27. <view class="">
  28. 时间:<text class="inf">{{actItemList.begin_at}}</text>
  29. </view>
  30. <view class="">
  31. 地点:<text class="inf">{{actItemList.address}}</text>
  32. </view>
  33. <view class="">
  34. 主办单位:<text class="inf">暂无字段</text>
  35. </view>
  36. <view class="">
  37. 活动形式:<text style="color:rgba(0, 86, 168, 1) ;">{{actItemList.acshape}}</text>
  38. </view>
  39. </view>
  40. <view class="acbrief">
  41. <view class="britit">
  42. 活动介绍
  43. </view>
  44. <view class="bricon">
  45. {{actItemList.brief}}
  46. </view>
  47. <image class="briImg" :src="actItemList.pic" mode="widthFix"></image>
  48. </view>
  49. <view class="footer">
  50. <view class="">
  51. {{actItemList.create_at}}
  52. </view>
  53. <view class="">
  54. 阅读量:{{actItemList.views}}
  55. </view>
  56. </view>
  57. </view>
  58. <view class="btnBlock">
  59. <view class="icos">
  60. <view class="ico">
  61. <view class="imgBlock" @click="coll">
  62. <image class="icoimg"
  63. :src="collArr.includes(actItemList.acId) ? pic_coll2 : '../../static/Starhhh.png'"
  64. mode="aspectFill"></image>
  65. </view>
  66. <text class="icotxt">收藏</text>
  67. </view>
  68. <view class="ico" @click="share">
  69. <view class="imgBlock">
  70. <image class="icoimg" style="height: 70%;width: 65%;" src="../../static/union.png"
  71. mode="aspectFill"></image>
  72. </view>
  73. <text class="icotxt">分享</text>
  74. </view>
  75. </view>
  76. <view class="rightBtn">
  77. <view class="btnt1" v-if="actItemList.openid==oid">本人创建,暂不支持加入</view>
  78. <view class="btnt" v-else-if="!isSign" @click="applyAdd">立即报名</view>
  79. <view class="btnt1" v-else-if="isSign">已报名</view>
  80. <view class="btnt1" v-else-if="actItemList.bnum>=actItemList.pers">人数已满</view>
  81. <!-- <view class="btnt1" v-else-if="isSign && actItemList.openid!=oid">已报名</view> -->
  82. </view>
  83. </view>
  84. <view class="" style="height: 170rpx;width: 750rpx;">
  85. <!-- 占位的 -->
  86. </view>
  87. </view>
  88. </template>
  89. <script>
  90. export default {
  91. data() {
  92. return {
  93. navbar: {
  94. title: '活动详情',
  95. btn: 1
  96. },
  97. // 用户openid
  98. oid: '',
  99. // 活动id
  100. acId: '',
  101. // 页面数据
  102. actItemList: {},
  103. // 用户收藏列表
  104. collArr: [],
  105. // 用户订阅列表
  106. // subArr: [],
  107. // 是否已加入
  108. isSign: 0,
  109. // 报名列表
  110. applyUserlist: [],
  111. pic_coll2: 'https://teacherapi.cocorobo.cn/teaching-file/static/mine/Collect_yellow.png',
  112. // pic_sub: 'https://teacherapi.cocorobo.cn/teaching-file/static/yym/Vector (Stroke) (1).png',
  113. // pic_sub2: 'https://teacherapi.cocorobo.cn/teaching-file/static/dingyue_blue.png',
  114. };
  115. },
  116. methods: {
  117. // 获取页面数据
  118. getdata() {
  119. let data = {
  120. oid: this.$store.state.user.openid,
  121. acId: this.acId,
  122. }
  123. this.$request('/selectActivityID', "POST", data).then(res => {
  124. console.log('页面数据', res[0][0]);
  125. this.actItemList = res[0][0]
  126. })
  127. },
  128. // 申请加入
  129. applyAdd() {
  130. uni.navigateTo({
  131. url: `/pages/jys/jys?acId=${this.acId}&tit=${'活动报名'}`
  132. })
  133. },
  134. // 查看更多报名同学
  135. gotoMorePer() {
  136. uni.navigateTo({
  137. url: `/pages/dy/dy?acId=${this.acId}`
  138. })
  139. },
  140. share() {
  141. uni.showToast({
  142. title:'暂未开发,还不能分享哦',
  143. icon:'none'
  144. })
  145. },
  146. //获取是否报名
  147. btnEnroll() {
  148. let data = {
  149. oid: this.$store.state.user.openid, //用户id
  150. aid: this.acId,
  151. type: 2
  152. }
  153. this.$request('/selectSignup', 'POST', data).then(res => {
  154. // console.log('获取报名', res[0][0]);
  155. this.isSign = res[0][0].num
  156. })
  157. },
  158. // 收藏事件
  159. coll() {
  160. //判断是否收藏
  161. let iscoll = null
  162. // 查询是否收藏过
  163. let data = {
  164. acid: this.acId,
  165. oid: this.$store.state.user.openid, //用户id
  166. ty: 0
  167. }
  168. this.$request('/selectOneOperator', 'POST', data).then(res => {
  169. // console.log('查询是否收藏过',res);
  170. res[0].length ? iscoll = true : iscoll = false;
  171. // iscoll为true表示已经收藏过,执行删除 为true则收藏
  172. if (iscoll) {
  173. console.log('执行删除');
  174. this.$request('/deleteOperator', 'POST', data).then(res => {
  175. // console.log(res);
  176. this.getColl()
  177. })
  178. } else {
  179. console.log('执行添加');
  180. this.$request('/insertOperator', 'POST', data).then(res => {
  181. // console.log(res);
  182. this.getColl()
  183. })
  184. }
  185. })
  186. },
  187. //获取是否收藏
  188. getColl() {
  189. let data = {
  190. oid: this.$store.state.user.openid, //用户id
  191. type: 0
  192. }
  193. this.$request('/selectOperator', 'POST', data).then(res => {
  194. // console.log('获取收藏', res);
  195. // 每次调用前清零,防止push叠加错误
  196. this.collArr = []
  197. // 将acid遍历到collArr中
  198. res[0].forEach(i => {
  199. this.collArr.push(i.acId)
  200. })
  201. })
  202. },
  203. // 获取报名用户
  204. getUsers() {
  205. let data = {
  206. oid: this.$store.state.user.openid, //用户id
  207. aid: this.acId,
  208. type: 2,
  209. page: 1, //下拉获取更多的备用字段
  210. lim: 6 //一次获取多少数据
  211. }
  212. this.$request('/selectApplyUser', 'POST', data).then(res => {
  213. console.log('获取报名用户列表', res[0]);
  214. res[0].forEach(e => {
  215. this.applyUserlist.push(e.avatar)
  216. })
  217. // this.applyUserlist = res[0]
  218. })
  219. }
  220. },
  221. onLoad(e) {
  222. // console.log('接收参数',e);
  223. this.acId = e.acId
  224. this.oid = this.$store.state.user.openid
  225. // this.getActivity()
  226. // 获取页面数据
  227. this.getdata()
  228. // 获取是否收藏
  229. this.getColl()
  230. // 获取是否订阅
  231. // this.getSub()
  232. // 获取是否报名
  233. this.btnEnroll()
  234. // 获取报名人名单
  235. this.getUsers()
  236. }
  237. }
  238. </script>
  239. <style lang="scss">
  240. .activityDetailNew {
  241. background-color: #000;
  242. .top {
  243. width: 750rpx;
  244. position: relative;
  245. .img1 {
  246. display: block;
  247. margin: auto;
  248. width: 750rpx;
  249. }
  250. .img2 {
  251. position: absolute;
  252. width: 100%;
  253. left: 0;
  254. bottom: 0;
  255. }
  256. }
  257. .decontent {
  258. width: 750rpx;
  259. border-top-right-radius: 30rpx;
  260. border-top-left-radius: 30rpx;
  261. background-color: #fff;
  262. padding: 32rpx;
  263. display: flex;
  264. flex-direction: column;
  265. justify-content: flex-start;
  266. border-bottom: 1rpx rgba(231, 231, 231, 1) solid;
  267. .actit {
  268. font-weight: 600;
  269. font-size: 40rpx;
  270. color: rgba(0, 0, 0, 0.8);
  271. line-height: 56rpx;
  272. display: -webkit-box;
  273. word-break: break-all;
  274. text-overflow: ellipsis;
  275. overflow: hidden;
  276. -webkit-box-orient: vertical;
  277. -webkit-line-clamp: 2;
  278. }
  279. .avaList {
  280. display: flex;
  281. justify-content: space-between;
  282. width: 100%;
  283. align-items: center;
  284. padding: 30rpx 0;
  285. border-bottom: 1rpx rgba(231, 231, 231, 1) solid;
  286. margin-bottom: 30rpx;
  287. .ava {
  288. width: 353rpx;
  289. display: flex;
  290. align-items: center;
  291. }
  292. .cost {
  293. flex: 1;
  294. text-align: right;
  295. font-weight: 700;
  296. font-size: 40rpx;
  297. color: rgba(246, 135, 23, 1);
  298. }
  299. }
  300. .acinfo {
  301. width: 100%;
  302. height: 304rpx;
  303. // background-color: #000;
  304. display: flex;
  305. flex-direction: column;
  306. justify-content: space-between;
  307. font-size: 28rpx;
  308. font-weight: 400;
  309. color: rgba(0, 0, 0, 0.6);
  310. border-bottom: 1rpx rgba(231, 231, 231, 1) solid;
  311. padding-bottom: 30rpx;
  312. .inf {
  313. color: rgba(0, 0, 0, 0.8);
  314. }
  315. }
  316. .acbrief {
  317. width: 100%;
  318. .britit {
  319. width: 100%;
  320. height: 48rpx;
  321. font-weight: 600;
  322. line-height: 48rpx;
  323. font-size: 32rpx;
  324. color: rgba(0, 0, 0, 0.8);
  325. margin: 30rpx 0;
  326. }
  327. .bricon {
  328. font-weight: 400;
  329. font-size: 28rpx;
  330. line-height: 44rpx;
  331. color: (0, 0, 0, 0.8);
  332. margin-bottom: 30rpx;
  333. }
  334. .briImg {
  335. width: 100%;
  336. }
  337. }
  338. .footer {
  339. display: flex;
  340. justify-content: space-between;
  341. color: rgba(0, 0, 0, 0.4);
  342. font-size: 24rpx;
  343. height: 32rpx;
  344. line-height: 32rpx;
  345. font-weight: 400;
  346. margin: 30rpx 0;
  347. }
  348. }
  349. .btnBlock {
  350. position: fixed;
  351. bottom: 0;
  352. left: 0;
  353. width: 750rpx;
  354. height: 175rpx;
  355. background-color: #fff;
  356. display: flex;
  357. justify-content: flex-start;
  358. align-items: center;
  359. padding: 30rpx 30rpx;
  360. padding-bottom: 40rpx;
  361. border-top: 1rpx rgba(231, 231, 231, 1) solid;
  362. // padding-bottom: 78rpx;
  363. .icos {
  364. width: 200rpx;
  365. height: 96rpx;
  366. flex-shrink: 0;
  367. margin-right: 30rpx;
  368. display: flex;
  369. justify-content: space-between;
  370. .ico {
  371. width: 100rpx;
  372. display: flex;
  373. flex-direction: column;
  374. justify-content: space-between;
  375. align-items: center;
  376. .imgBlock {
  377. width: 48rpx;
  378. height: 48rpx;
  379. display: flex;
  380. align-items: center;
  381. justify-content: center;
  382. .icoimg {
  383. width: 42rpx;
  384. height: 40rpx;
  385. }
  386. }
  387. .icotxt {
  388. font-size: 24rpx;
  389. height: 40rpx;
  390. line-height: 40rpx;
  391. color: rgba(4, 0, 0, 1);
  392. }
  393. }
  394. }
  395. .rightBtn {
  396. flex: 1;
  397. display: flex;
  398. justify-content: center;
  399. align-items: center;
  400. .btnt {
  401. width: 454rpx;
  402. color: #fff;
  403. // font-weight: 600;
  404. height: 96rpx;
  405. background-color: rgba(0, 86, 168, 1);
  406. display: flex;
  407. justify-content: center;
  408. align-items: center;
  409. border-radius: 10rpx;
  410. }
  411. .btnt1 {
  412. width: 454rpx;
  413. color: #fff;
  414. // font-weight: 600;
  415. height: 96rpx;
  416. background-color: rgba(139, 190, 255, 1);
  417. display: flex;
  418. justify-content: center;
  419. align-items: center;
  420. border-radius: 10rpx;
  421. }
  422. }
  423. }
  424. }
  425. </style>