activityDetail.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <!-- 教研室详情 -->
  3. <view class="activityDetail">
  4. <statusBar :item="navbar"></statusBar>
  5. <!-- 顶部 -->
  6. <view class="backPic" v-for="(item,index) in actItemList" :key="index + 'a' ">
  7. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Rectangle 40.png" mode="aspectFill"></image>
  8. <view style="padding: 0 30rpx;margin-bottom: 20px;">
  9. <view class="card">
  10. <view class="cardTop three-font">
  11. {{ item.acName }}
  12. </view>
  13. <view class="col fz-font">
  14. 活动日期:<text>{{ item.create_at.split('T')[0] }}</text>
  15. </view>
  16. <view class="col fz-font">
  17. 招募人数:<text>0/{{ item.pers }}</text>
  18. </view>
  19. <view class="col fz-font">
  20. 活动地址:<text>{{ item.address }}</text>
  21. <uni-icons type="location" color="#0056a8"
  22. style="position: absolute;right: 10px;top: 0;width: 32rpx;height: 45rpx;"></uni-icons>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 创建者用户名 -->
  28. <view style="padding: 0 30rpx;">
  29. <view class="creator" v-for="(item,index) in actItemList" :key="index + 'b' ">
  30. <image
  31. :src="item.avatar == null ? 'https://teacherapi.cocorobo.cn/teaching-file/static//mine/Avatar_default.png' : item.avatar"
  32. mode="aspectFill"></image>
  33. <view class="creName btn-font">
  34. {{ item.username }}
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 活动详情 -->
  39. <view class="" style="padding: 0 30rpx;">
  40. <detailBlock :actItemList='actItemList' :item='judge'></detailBlock>
  41. </view>
  42. <!-- 当前成员 -->
  43. <view style="padding: 0 30rpx; display: none;">
  44. <view class="member">
  45. <view class="memberTop">
  46. <view class="btn-font">报名情况(已报名0人)</view>
  47. <view class="fz-font" style="color: rgba(0, 0, 0, 0.4);display: flex;align-items: center;"
  48. @click="perList">
  49. <text>查看更多</text>
  50. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
  51. style="width: 32rpx;height: 32rpx;" mode="aspectFill"></image>
  52. <!-- <uni-icons type="right"></uni-icons> -->
  53. </view>
  54. </view>
  55. <view class="pers">
  56. <!-- <view class="per" v-if="perNum == []" v-for="(item,index) in perNum">
  57. <image :src="item.img"></image>
  58. <view class="perName fz-font">
  59. {{item.Name}}
  60. </view>
  61. </view> -->
  62. <view class="per">
  63. <!-- <image :src="item.img"></image> -->
  64. <view class="perName fz-font">
  65. 暂无人员
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 申请加入 -->
  72. <view class="btnBlock" v-show="btnShow">
  73. <button class="btn zw-font" :disabled="isButtonDisabled" @click="gotoAdd"
  74. :style="isButtonDisabled ? 'background-color:#87CEFA;' : 'background-colo:#0056a8;'">{{ btnText }}</button>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. navbar: {
  83. title: '活动详情',
  84. btn: 1
  85. },
  86. btnShow: true, //控制按钮显示隐藏
  87. isButtonDisabled: false,
  88. btnText: '立即报名',
  89. judge: {
  90. isShow: 1,
  91. info: ''
  92. },
  93. actItemList: [],
  94. perNum: []
  95. // perNum: [{
  96. // Name: '陈芬',
  97. // img: 'https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 4 (3).png'
  98. // },
  99. // {
  100. // Name: '贺豪杰',
  101. // img: 'https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 4 (4).png'
  102. // },
  103. // {
  104. // Name: '张孝迪',
  105. // img: 'https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 4.png'
  106. // },
  107. // {
  108. // Name: '马冬梅',
  109. // img: 'https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 4 (2).png'
  110. // },
  111. // {
  112. // Name: '康雯妍',
  113. // img: 'https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 4 (1).png'
  114. // },
  115. // {
  116. // Name: '张燕琴',
  117. // img: 'https://teacherapi.cocorobo.cn/teaching-file/static//mine/Avatar.png'
  118. // }
  119. // ]
  120. };
  121. },
  122. methods: {
  123. perList() {
  124. uni.navigateTo({
  125. url: '/pages/dy/dy'
  126. })
  127. },
  128. gotoAdd() {
  129. // console.log(e.currentTarget.dataset['index'], 123);
  130. // let edata = e.currentTarget.dataset['index'];
  131. const routes = getCurrentPages();
  132. const ty = routes[1].options.ty ? routes[1].options.ty : routes[2].options.ty;
  133. const clickedAcId = this.actItemList[0].acId;
  134. console.log(clickedAcId);
  135. uni.navigateTo({
  136. url: '/pages/hd/hd?acId=' + clickedAcId + '&ty=' + ty
  137. })
  138. },
  139. //判断是否报名
  140. btnEnroll(clickedAcId) {
  141. this.$request('/selectActivityEnrollid', "POST", {
  142. acId: clickedAcId,
  143. openid: uni.getStorageSync('oId')
  144. }).then(res => {
  145. if (!res[0][0] || !res[0][0].hasOwnProperty('acId')) {
  146. console.log('acId 未定义或不存在');
  147. return
  148. }
  149. if (clickedAcId === res[0][0].acId) {
  150. this.isButtonDisabled = true
  151. this.btnText = '已加入'
  152. }
  153. })
  154. },
  155. getActivity() {
  156. // 获取当前页面的URL
  157. const routes = getCurrentPages();
  158. console.log(routes);
  159. // const acId = routes[1].options.acId ? routes[1].options.acId : routes[2].options.acId;
  160. // const ty = routes[1].options.ty ? routes[1].options.ty : routes[2].options.ty;
  161. // if (routes[2]) {
  162. // this.isShow = routes[2].options.isShow ?false : true
  163. // }
  164. // this.isShow = routes[2].options.isShow
  165. // console.log(this.isShow);
  166. let acId, ty, isShow;
  167. if (routes.length > 1) {
  168. acId = routes[1].options.acId ? routes[1].options.acId : routes[2].options.acId;
  169. ty = routes[1].options.ty ? routes[1].options.ty : routes[2].options.ty;
  170. isShow = routes[2] ? (routes[2].options.isShow ? false : true) : true;
  171. }
  172. this.btnShow = isShow;
  173. let data = {
  174. acId: acId,
  175. ty: ty
  176. }
  177. this.$request('/selectActivityID', "POST", data).then(res => {
  178. console.log(res[0]);
  179. // this.activeList=[...this.activeList,...res[0]]
  180. this.actItemList = res[0]
  181. const clickedAcId = this.actItemList[0].acId;
  182. this.btnEnroll(clickedAcId)
  183. })
  184. },
  185. },
  186. onShow() {
  187. this.getActivity()
  188. }
  189. }
  190. </script>
  191. <style lang="scss">
  192. .activityDetail {
  193. padding-bottom: 80px;
  194. .backPic {
  195. width: 750rpx;
  196. position: relative;
  197. image {
  198. width: 100%;
  199. display: block;
  200. }
  201. .card {
  202. position: absolute;
  203. width: 690rpx;
  204. // height: 150px;
  205. bottom: -20px;
  206. left: 50%;
  207. // padding: 30rpx 16px;
  208. padding: 30rpx;
  209. border-radius: 10px;
  210. background-color: #ffffff;
  211. transform: translate(-50%, 0);
  212. .cardTop {
  213. // display: flex;
  214. // justify-content: center;
  215. // padding-bottom: 5px;
  216. margin-bottom: 5px;
  217. // font-size: 18px;
  218. font-weight: bold;
  219. display: -webkit-box;
  220. word-break: break-all;
  221. text-overflow: ellipsis;
  222. overflow: hidden;
  223. -webkit-box-orient: vertical;
  224. -webkit-line-clamp: 2;
  225. /*设置 需要显示的行数*/
  226. .title {
  227. font-weight: bold;
  228. }
  229. }
  230. .col {
  231. position: relative;
  232. margin-bottom: 10rpx;
  233. color: #999999;
  234. padding-right: 40px;
  235. // font-size: 14px;
  236. width: 100%;
  237. display: -webkit-box;
  238. word-break: break-all;
  239. text-overflow: ellipsis;
  240. overflow: hidden;
  241. -webkit-box-orient: vertical;
  242. -webkit-line-clamp: 2;
  243. /*设置 需要显示的行数*/
  244. text {
  245. color: #333333;
  246. }
  247. }
  248. .tag {
  249. display: flex;
  250. }
  251. }
  252. // background-image: url(https://teacherapi.cocorobo.cn/teaching-file/static//resource/jqr.png);
  253. }
  254. .creator {
  255. display: flex;
  256. // padding: 10px 30px;
  257. padding: 30rpx 20rpx;
  258. background-color: #ffffff;
  259. align-items: center;
  260. margin-top: 30px;
  261. margin-bottom: 20rpx;
  262. border-radius: 10px;
  263. image {
  264. width: 96rpx;
  265. height: 96rpx;
  266. border-radius: 50%;
  267. margin-right: 20rpx;
  268. }
  269. .creName {
  270. font-weight: bold;
  271. }
  272. }
  273. .member {
  274. background-color: #ffffff;
  275. margin-top: 20rpx;
  276. padding: 30rpx;
  277. border-radius: 10px;
  278. margin-bottom: 30rpx;
  279. .memberTop {
  280. display: flex;
  281. justify-content: space-between;
  282. margin-bottom: 10px;
  283. }
  284. .pers {
  285. display: flex;
  286. justify-content: space-between;
  287. align-items: center;
  288. .per {
  289. // display: inline-block;
  290. display: flex;
  291. flex-direction: column;
  292. // justify-content: center;
  293. align-items: center;
  294. image {
  295. width: 72rpx;
  296. height: 72rpx;
  297. border-radius: 50%;
  298. }
  299. .perName {
  300. // font-size: 14px;
  301. text-align: center;
  302. }
  303. }
  304. }
  305. }
  306. .btnBlock {
  307. position: fixed;
  308. bottom: 0;
  309. width: 750rpx;
  310. background-color: #ffffff;
  311. // padding: 20px 0;
  312. padding: 2vh 0;
  313. .btn {
  314. width: 432rpx;
  315. height: 88rpx;
  316. font-weight: 500;
  317. display: flex;
  318. justify-content: center;
  319. align-items: center;
  320. margin: auto;
  321. background-color: #0056a8;
  322. color: #ffffff;
  323. }
  324. }
  325. }
  326. </style>