action.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="content">
  3. <image :src="actionImg" mode="widthFix" class="action-img"></image>
  4. <view class="action-wrap">
  5. <image src="../../static/image/action-top.png" mode="" class="action-top"></image>
  6. <view class="">
  7. 请拍下您与爱车的合照,点击下方按钮上传照片即可获得奖励。
  8. </view>
  9. <image :src="upimg" mode="widthFix" class="up-img" v-if="upimg" @click="upActionImg"></image>
  10. <image src="../../static/image/upimg-g.png" mode="widthFix" class="up-img" v-else @click="upActionImg"></image>
  11. <view class="action-btn" @click="joinAction">
  12. 上传照片
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import { upload } from '@/api/order.js'
  19. export default {
  20. data() {
  21. return {
  22. upimg: '',
  23. loading:false
  24. };
  25. },
  26. computed: {
  27. actionImg() {
  28. return this.$store.state.baseURL + '/static/img/action.png'
  29. }
  30. },
  31. onLoad(opt) {
  32. },
  33. onShow() {
  34. },
  35. onReachBottom() {
  36. },
  37. methods: {
  38. upActionImg() {
  39. upload().then(res => {
  40. this.upimg = res[0].url
  41. })
  42. },
  43. joinAction() {
  44. if(this.loading) {
  45. return
  46. }
  47. if(this.upimg == '') {
  48. this.$api.msg('请上传合影照片')
  49. }
  50. this.loading = true
  51. joinAction({
  52. img: this.upimg
  53. }).then(res => {
  54. this.loading = false
  55. uni.showToast({
  56. title: '提交成功',
  57. duration: 2000
  58. });
  59. }).catch(err => {
  60. this.loading = false
  61. })
  62. }
  63. }
  64. };
  65. </script>
  66. <style lang="scss" scoped>
  67. .content {
  68. padding-bottom: 50px;
  69. }
  70. page {
  71. background-color: #fff;
  72. height: auto;
  73. min-height: 100%;
  74. }
  75. .action-img {
  76. width: 750rpx;
  77. }
  78. .action-wrap {
  79. width: 690rpx;
  80. margin:50rpx auto 0;
  81. // height: 560rpx;
  82. background-color: #dcf4ef;
  83. border-radius: 20rpx;
  84. padding: 60px 35rpx;
  85. display: flex;
  86. flex-direction: column;
  87. justify-content: space-between;
  88. align-items: center;
  89. text-align: justify;
  90. color: #333;
  91. font-weight: bold;
  92. font-size: 28rpx;
  93. position: relative;
  94. .up-img {
  95. width: 160rpx;
  96. height: 160rpx;
  97. margin: 45rpx auto;
  98. }
  99. .action-btn {
  100. width: 580rpx;
  101. height: 90rpx;
  102. color: #fff;
  103. font-weight: 500;
  104. background-color: #ffc43d;
  105. text-align: center;
  106. border-radius: 45rpx;
  107. line-height: 90rpx;
  108. }
  109. .action-top {
  110. width: 345rpx;
  111. height: 60rpx;
  112. position: absolute;
  113. top: -30rpx;
  114. left: 0;
  115. right: 0;
  116. margin: auto;
  117. }
  118. }
  119. </style>