rule.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="rule-main">
  3. <network-error />
  4. <view class="u-font-32 line-44 bold color-212121">符合活动的评价要求,需满足:</view>
  5. <view class="u-m-t-16 u-font-28 line-20 color-333">{{detail.requirement}}</view>
  6. </view>
  7. </template>
  8. <script>
  9. import { getActivityDetail } from '@/api/activityApi'
  10. export default {
  11. data () {
  12. return {
  13. activityId: '',
  14. detail: {}
  15. }
  16. },
  17. onLoad (options) {
  18. this.activityId = options.id
  19. this.getDetailData()
  20. },
  21. methods: {
  22. // 获取用户经纬度
  23. getLocation () {
  24. return new Promise((resolve, reject) => {
  25. uni.getLocation({
  26. type: 'gcj02',
  27. success: (res) => {
  28. resolve(res)
  29. },
  30. fail: () => {
  31. resolve(false)
  32. }
  33. })
  34. })
  35. },
  36. // 获取活动详情
  37. async getDetailData () {
  38. const location = await this.getLocation()
  39. if (!location) { return }
  40. const params = {
  41. id: this.activityId,
  42. lng: location.longitude,
  43. lat: location.latitude
  44. }
  45. const { code, data } = await getActivityDetail(params)
  46. if (code === 200) {
  47. this.detail = data
  48. }
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .rule-main {
  55. box-sizing: border-box;
  56. padding: 48px 32px 0;
  57. height: 100vh;
  58. background-color: #fff;
  59. .color-212121 {
  60. color: #212121;
  61. }
  62. .color-333 {
  63. color: #333;
  64. }
  65. }
  66. </style>