detail.vue 8.5 KB

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