detail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <template>
  2. <view class="content">
  3. <image class="banner" :src="info.activity.image">
  4. </image>
  5. <view class="aInfo">
  6. <view class="atitle">
  7. {{info.activity.activity_title}}
  8. </view>
  9. <view class="aitem">
  10. <view>{{info.activity.title1}}</view>
  11. <view>{{info.activity.content1}}</view>
  12. </view>
  13. <view class="aitem">
  14. <view>{{info.activity.title2}}</view>
  15. <!-- <view>{{ parse.filterTime(info.activity.start_time) }}至{{ parse.filterTime(info.activity.end_time) }}</view> -->
  16. <view>{{info.activity.content2}}</view>
  17. </view>
  18. <view class="aitem">
  19. <view>{{info.activity.title3}}</view>
  20. <view class="aAddress">{{info.activity.content3}}</view>
  21. <view class="aoperate">
  22. <image
  23. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/47a789f04633b188498bb700002e2841.png">
  24. </image>
  25. <view></view>
  26. <image @click="callPhone"
  27. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/d90e0ad7eb6fd669e1103fb241325593.png">
  28. </image>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="aInfo" style="margin-top: 22rpx;padding-top: 24rpx;">
  33. <view class="mTip">
  34. <view class="mTitle">
  35. <view></view>
  36. <view>报名人员</view>
  37. </view>
  38. <view class="mMore" @click="goMore">
  39. <view>更多</view>
  40. <image
  41. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/24ea2b5e78be1a4a66c94cdd670edb91.png">
  42. </image>
  43. </view>
  44. </view>
  45. <view class="mList">
  46. <view class="mItem" v-for="(item,index) in info.user_list" :key='index'>
  47. <image :src="item.avatar">
  48. </image>
  49. <view>{{item.username}}</view>
  50. </view>
  51. </view>
  52. <view v-if="!info.user_list.length" style='color:#999;text-align:center;margin:50rpx 0;font-size:30rpx'>暂无数据</view>
  53. </view>
  54. <view class="aInfo" style="margin-top: 22rpx;padding-top: 24rpx;">
  55. <view class="mTip">
  56. <view class="mTitle">
  57. <view></view>
  58. <view>活动介绍</view>
  59. </view>
  60. </view>
  61. <rich-text :nodes="info.activity.activity_detail"></rich-text>
  62. </view>
  63. <view class="bot">
  64. <button class="btn1" open-type="share">
  65. <image
  66. src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/dcc924cd0cd143a5e5c467ec74838c3f.png">
  67. </image>
  68. <view>
  69. 活动分享
  70. </view>
  71. </button>
  72. <button class="btn2" @click="btnConfirm" >
  73. 活动报名
  74. </button>
  75. <!-- <button class="btn2" @click="btnConfirm" v-if="infi.activity.activity_status==1&&phone">
  76. 活动报名
  77. </button> -->
  78. <!-- <button class="btn2" v-if="infi.activity.activity_status==1&&!phone" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">
  79. 活动报名
  80. </button> -->
  81. <view class="btn3" v-if="infi.activity.activity_status==0">
  82. 活动结束
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script module="parse" lang="wxs">
  89. module.exports = {
  90. filterTime: function(time) {
  91. console.log(time)
  92. var nowDate = getDate(time * 1000);
  93. var year = nowDate.getFullYear();
  94. var month = nowDate.getMonth() + 1;
  95. var date = nowDate.getDate();
  96. var hours = nowDate.getHours();
  97. var minutes = nowDate.getMinutes();
  98. var seconds = nowDate.getSeconds();
  99. month = month > 9 ? month : '0' + month;
  100. date = date > 9 ? date : '0' + date;
  101. hours = hours > 9 ? hours : '0' + hours;
  102. minutes = minutes > 9 ? minutes : '0' + minutes;
  103. seconds = seconds > 9 ? seconds : '0' + seconds;
  104. return year + '-' + month + '-' + date + " " + hours + ":" + minutes + ":" + seconds;
  105. }
  106. }
  107. </script>
  108. <script>
  109. // pages/backstage/index/index.js
  110. var app = getApp();
  111. // import { request } from '../../../utils/request.js';
  112. export default {
  113. data() {
  114. return {
  115. info: "",
  116. id: "",
  117. phone:""
  118. };
  119. }
  120. /**
  121. * 生命周期函数--监听页面加载
  122. */
  123. ,
  124. onLoad: function(options) {
  125. this.id = options.id || 4
  126. this.getinfo();
  127. },
  128. /**
  129. * 生命周期函数--监听页面初次渲染完成
  130. */
  131. onShow: function() {},
  132. /**
  133. * 生命周期函数--监听页面隐藏
  134. */
  135. onPullDownRefresh: function() {},
  136. /**
  137. * 页面上拉触底事件的处理函数
  138. */
  139. onReachBottom: function() {},
  140. /**
  141. * 用户点击右上角分享
  142. */
  143. onShareAppMessage: function() {
  144. return {
  145. title: this.info.activity.activity_title,
  146. imageUrl: this.info.activity.image,
  147. path: ''
  148. }
  149. },
  150. methods: {
  151. async decryptPhoneNumber(e){
  152. var that = this
  153. console.log(e)
  154. let res = await that.$api.request('/Activity/activity_join', 'GET', {
  155. code: e.detail.code
  156. });
  157. if(res){
  158. this.phone = res
  159. }
  160. },
  161. btnConfirm() {
  162. var that = this;
  163. uni.showModal({
  164. title: '提示',
  165. content: '确认报名?',
  166. async success(res) {
  167. if (res.confirm) {
  168. let res = await that.$api.request('/Activity/activity_join', 'GET', {
  169. activity_id: that.id,
  170. phone:that.phone||''
  171. });
  172. if (res) {
  173. uni.showToast({
  174. title: '报名成功'
  175. })
  176. }
  177. } else if (res.cancel) {
  178. console.log('用户点击取消');
  179. }
  180. }
  181. });
  182. },
  183. goMore() {
  184. uni.navigateTo({
  185. url: "/pages/activity/memberlist"
  186. })
  187. },
  188. callPhone() {
  189. },
  190. async getinfo() {
  191. var that = this;
  192. let res = await this.$api.request('/Activity/detail', 'GET', {
  193. id: this.id
  194. });
  195. console.log(res)
  196. if (res) {
  197. res.activity.activity_detail = res.activity.activity_detail.replace(/\<img/gi,
  198. '<img style="max-width:100%;height:auto;display:block;"');
  199. this.info = res
  200. }
  201. },
  202. }
  203. };
  204. </script>
  205. <style>
  206. page {
  207. background: #F6F3F7;
  208. }
  209. .content {
  210. padding-bottom: 120rpx;
  211. }
  212. .banner {
  213. width: 100%;
  214. }
  215. .aInfo {
  216. width: 100%;
  217. padding: 46rpx 40rpx 28rpx;
  218. box-sizing: border-box;
  219. background: #fff;
  220. }
  221. .atitle {
  222. font-size: 40rpx;
  223. color: #010101;
  224. font-weight: 700;
  225. text-align: center;
  226. padding: 0 140rpx 38rpx;
  227. border-bottom: 1px solid #E5E2E5;
  228. }
  229. .aitem {
  230. margin-top: 30rpx;
  231. display: flex;
  232. align-items: center;
  233. position: relative;
  234. }
  235. .aitem>view:nth-child(1) {
  236. font-size: 26rpx;
  237. color: #8E8E8E;
  238. }
  239. .aitem>view:nth-child(2) {
  240. font-size: 26rpx;
  241. color: #000000;
  242. margin-left: 22rpx;
  243. }
  244. .aAddress {
  245. width: 360rpx;
  246. overflow: hidden;
  247. text-overflow: ellipsis;
  248. white-space: nowrap;
  249. }
  250. .aoperate {
  251. display: flex;
  252. align-items: center;
  253. position: absolute;
  254. right: 0;
  255. }
  256. .aoperate>view {
  257. width: 1px;
  258. height: 36rpx;
  259. background: #818181;
  260. margin: 0 14rpx;
  261. }
  262. .aoperate>image {
  263. width: 44rpx;
  264. height: 44rpx;
  265. }
  266. .mTip {
  267. display: flex;
  268. align-items: center;
  269. justify-content: space-between;
  270. }
  271. .mTitle {
  272. display: flex;
  273. align-items: center;
  274. justify-content: space-be
  275. }
  276. .mTitle>view:nth-child(1) {
  277. width: 8rpx;
  278. height: 34rpx;
  279. background: #F94E6F;
  280. border-radius: 4rpx;
  281. }
  282. .mTitle>view:nth-child(2) {
  283. font-size: 32rpx;
  284. color: #000000;
  285. margin-left: 10rpx;
  286. }
  287. .mMore {
  288. display: flex;
  289. align-items: center;
  290. }
  291. .mMore>view {
  292. font-size: 24rpx;
  293. color: #8E8E8E;
  294. }
  295. .mMore>image {
  296. width: 12rpx;
  297. margin-left: 10rpx;
  298. height: 20rpx;
  299. }
  300. .mList {
  301. margin-top: 56rpx;
  302. display: flex;
  303. }
  304. .mItem {
  305. display: flex;
  306. flex-direction: column;
  307. align-items: center;
  308. margin-right: 30rpx;
  309. }
  310. .mItem>view {
  311. font-size: 28rpx;
  312. color: #010101;
  313. margin-top: 20rpx;
  314. }
  315. .mItem>image {
  316. width: 110rpx;
  317. height: 110rpx;
  318. border-radius: 50%;
  319. }
  320. rich-text {
  321. margin-top: 30rpx;
  322. }
  323. .bot {
  324. width: 100%;
  325. height: 112rpx;
  326. position: fixed;
  327. background: #fff;
  328. bottom: 0;
  329. display: flex;
  330. justify-content: space-around;
  331. align-items: center;
  332. padding: 0 30rpx;
  333. }
  334. .btn1 {
  335. width: 224rpx;
  336. height: 86rpx;
  337. display: flex;
  338. align-items: center;
  339. background: #FB4C6F;
  340. justify-content: center;
  341. border-radius: 60rpx;
  342. }
  343. .btn1>image {
  344. width: 30rpx;
  345. height: 30rpx;
  346. margin-right: 12rpx;
  347. }
  348. .btn1>view {
  349. font-size: 28rpx;
  350. color: #fff;
  351. }
  352. .btn2 {
  353. width: 224rpx;
  354. height: 86rpx;
  355. display: flex;
  356. align-items: center;
  357. background: #FB4C6F;
  358. justify-content: center;
  359. border-radius: 60rpx;
  360. color: #FFF;
  361. }
  362. .btn3 {
  363. width: 224rpx;
  364. height: 86rpx;
  365. display: flex;
  366. align-items: center;
  367. background: #8E8E8E;
  368. justify-content: center;
  369. border-radius: 60rpx;
  370. color: #FFF;
  371. }
  372. button {
  373. margin: 0;
  374. }
  375. </style>