activityDetail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view>
  3. <u-navbar title="活动详情"></u-navbar>
  4. <view class="main" v-html="info.content">
  5. </view>
  6. <view class="bottom" v-if="!userInfo" >
  7. <u-button @click="issueMethod()">未登录</u-button>
  8. </view>
  9. <view class="bottom" v-else-if="info.status=='77d93870-e1e1-4369-b2b6-629e8645e8d9'" >
  10. <u-button >活动已结束</u-button>
  11. </view>
  12. <view class="bottom" v-else >
  13. <u-button type="primary" v-if="!info.isJoin"
  14. @click="enrollMethod()" >线上报名</u-button>
  15. <u-button v-else @click="cancelMethod()" >已报名</u-button>
  16. <!-- <u-button type="info">发布作品</u-button> -->
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import * as API from '@/apis/pagejs/activity.js'
  22. export default {
  23. data() {
  24. return {
  25. userInfo:null,
  26. id:'',
  27. info:{},
  28. }
  29. },
  30. onLoad(op){
  31. this.userInfo=this.carhelp.getPersonInfo()
  32. console.log(this.userInfo)
  33. if(op.id){
  34. this.id=op.id
  35. this.getInfo()
  36. }
  37. },
  38. methods: {
  39. cancelActivity(){
  40. uni.showLoading({
  41. title: "加载中",
  42. mask: true,
  43. })
  44. API.cancelActivity(this.id).then((res) => {
  45. //this.list=response.data.data
  46. this.info.isJoin=false;
  47. uni.hideLoading();
  48. uni.showToast({
  49. title:"取消报名"
  50. })
  51. }).catch(error => {
  52. uni.showToast({
  53. title: error,
  54. icon: "none"
  55. })
  56. })
  57. },
  58. joinActivity(){
  59. uni.showLoading({
  60. title: "加载中",
  61. mask: true,
  62. })
  63. API.joinActivity(this.id).then((res) => {
  64. //this.list=response.data.data
  65. this.info.isJoin=true;
  66. uni.hideLoading();
  67. uni.showToast({
  68. title:"报名成功!"
  69. })
  70. }).catch(error => {
  71. uni.showToast({
  72. title: error,
  73. icon: "none"
  74. })
  75. })
  76. },
  77. cancelMethod(){
  78. var _this=this;
  79. uni.showModal({
  80. title:_this.info.title,
  81. content:"确认是否取消报名?",
  82. confirmText:"取消报名",
  83. showCancel:true,
  84. success: (res)=> {
  85. if(res.confirm){
  86. _this.cancelActivity()
  87. }
  88. }
  89. })
  90. },
  91. enrollMethod(){
  92. var _this=this;
  93. uni.showModal({
  94. title:_this.info.title,
  95. content:"确认是否参与本活动报名?",
  96. confirmText:"报名",
  97. showCancel:true,
  98. success: (res)=> {
  99. if(res.confirm){
  100. _this.joinActivity()
  101. }
  102. }
  103. })
  104. },
  105. issueMethod(){
  106. uni.showModal({
  107. title:"提示",
  108. content:"未登录,登录后参与分享活动",
  109. confirmText:"前往登录",
  110. showCancel:true,
  111. success: function (res) {
  112. if(res.confirm){
  113. uni.navigateTo({
  114. url:'/pages/login/index'
  115. })
  116. }
  117. }
  118. })
  119. },
  120. getInfo(){
  121. uni.showLoading({
  122. title: "加载中",
  123. mask: true,
  124. })
  125. API.edit(this.id).then((res) => {
  126. uni.hideLoading();
  127. //this.list=response.data.data
  128. this.info=res.data;
  129. }).catch(error => {
  130. uni.showToast({
  131. title: error,
  132. icon: "none"
  133. })
  134. })
  135. },
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. page{
  141. padding-bottom: 100px;
  142. }
  143. .main{
  144. margin: 24rpx 32rpx 0 32rpx;
  145. // 活动介绍
  146. .introduction{
  147. margin-top: 24rpx;
  148. font-family: 'Regular';
  149. .title{
  150. color: rgba(16, 16, 16, 1);
  151. font-size: 18px;
  152. line-height: 26px;
  153. }
  154. .content{
  155. color: rgba(51, 51, 51, 1);
  156. line-height: 24px;
  157. margin-top: 16rpx;
  158. }
  159. }
  160. // 活动时间
  161. .date{
  162. font-family: 'Regular';
  163. margin-top: 32rpx;
  164. .title{
  165. color: rgba(16, 16, 16, 1);
  166. font-size: 18px;
  167. line-height: 26px;
  168. }
  169. .item{
  170. margin-top:16rpx;
  171. display: flex;
  172. color: rgba(51, 51, 51, 1);
  173. line-height: 20px;
  174. .item-title{
  175. margin-right: 24rpx;
  176. }
  177. .name{
  178. width: 100rpx;
  179. }
  180. }
  181. }
  182. }
  183. // 积分获取
  184. .integral{
  185. margin-top: 32rpx;
  186. .title{
  187. color: rgba(16, 16, 16, 1);
  188. font-size: 18px;
  189. line-height: 26px;
  190. font-family: 'Regular';
  191. }
  192. .integral-group{
  193. margin-top: 24rpx;
  194. background-color: #fff;
  195. .item{
  196. display: flex;
  197. justify-content: space-between;
  198. line-height: 44px;
  199. padding-left: 16rpx;
  200. color: rgba(51, 51, 51, 1);
  201. font-size: 16px;
  202. border-bottom: solid 1px #e6e6e6;
  203. font-size: 14rpx;
  204. .value{
  205. width: 170rpx;
  206. text-align: center;
  207. }
  208. }
  209. .item1{
  210. color: rgba(16, 16, 16, 1);
  211. font-size: 16px;
  212. }
  213. }
  214. }
  215. .bottom{
  216. padding: 16rpx 32rpx;
  217. background-color: #fff;
  218. position: fixed;
  219. bottom: 0;
  220. left: 0;
  221. right: 0;
  222. font-family: Arial;
  223. }
  224. </style>