detail.vue 8.8 KB

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