hdInfo.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <!-- swiper -->
  4. <view class="sw">
  5. <swiper :indicator-dots="false" style="width: 100%;height: 100%;" :autoplay="true" :interval="3000"
  6. :duration="300">
  7. <swiper-item v-for="(item,index) in imgs">
  8. <image :src="item" style="width: 100%;height: 100%;" mode="aspectFill"></image>
  9. </swiper-item>
  10. </swiper>
  11. </view>
  12. <!-- 活动标题 -->
  13. <view class="title flex justify-center align-center">
  14. <view class="title-box flex align-center">
  15. {{info.activityTitle}}
  16. </view>
  17. </view>
  18. <!-- 活动内容 -->
  19. <view class="info flex justify-center">
  20. <view class="info-box" v-html="content">
  21. </view>
  22. </view>
  23. <!-- 加入按钮 -->
  24. <view class="submit flex justify-center align-center">
  25. <view class="submit-box flex justify-center align-center" @click="joinHd()">
  26. 加入活动
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. activityId: '',
  36. info: {},
  37. content: '',
  38. imgs: [],
  39. };
  40. },
  41. onLoad(option) {
  42. console.log()
  43. this.activityId = option.activityId
  44. this.getInfo()
  45. },
  46. methods: {
  47. //加入活动
  48. joinHd() {
  49. let data = {
  50. activityId: this.activityId,
  51. shopId: uni.getStorageSync('shopId')
  52. }
  53. this.$Request.get("/app/activityManage/shopJoinActivity", data).then(res => {
  54. if (res.code == 0) {
  55. uni.showModal({
  56. title: '提示',
  57. content: '确定加入该活动?',
  58. complete(ret) {
  59. if (ret.confirm) {
  60. uni.showToast({
  61. title: '加入成功'
  62. })
  63. setTimeout(() => {
  64. uni.navigateBack()
  65. }, 1000)
  66. }
  67. }
  68. })
  69. } else {
  70. uni.showToast({
  71. title: res.msg,
  72. icon: 'none'
  73. })
  74. }
  75. });
  76. },
  77. //活动详情
  78. getInfo() {
  79. let data = {
  80. activityId: this.activityId
  81. }
  82. this.$Request.get("/app/activityManage/getActivityInfo", data).then(res => {
  83. if (res.code == 0) {
  84. this.content = res.data.activityContent.replace(new RegExp("img", "g"),
  85. 'img style="width:100%;height:auto;"')
  86. this.info = res.data
  87. this.imgs = res.data.activityImage.split(',')
  88. }
  89. });
  90. },
  91. }
  92. }
  93. </script>
  94. <style lang="scss">
  95. page {
  96. background-color: #ffffff;
  97. }
  98. .sw {
  99. width: 100%;
  100. height: 300rpx;
  101. }
  102. .title {
  103. width: 100%;
  104. height: 100rpx;
  105. background-color: #ffffff;
  106. .title-box {
  107. width: 686rpx;
  108. height: 100%;
  109. font-size: 32rpx;
  110. font-weight: bold;
  111. }
  112. }
  113. .info {
  114. width: 100%;
  115. height: auto;
  116. .info-box {
  117. width: 686rpx;
  118. height: 100%;
  119. }
  120. }
  121. .submit {
  122. width: 100%;
  123. height: 160rpx;
  124. position: fixed;
  125. bottom: 0;
  126. background-color: #ffffff;
  127. .submit-box {
  128. width: 686rpx;
  129. height: 88rpx;
  130. background-color: #FCD202;
  131. border-radius: 40rpx;
  132. }
  133. }
  134. </style>