activityDetail.vue 4.5 KB

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