IndexPresent.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <div v-on:click="toDetail">
  3. <van-card
  4. :thumb="presentImg"
  5. >
  6. <div slot="title" style="position: absolute; text-align: left; top: 0;">
  7. <p style="margin: 10px 0 0"><strong>{{presentName}}</strong></p>
  8. <p style="margin-top: 5px">{{presentDesc}}</p>
  9. </div>
  10. <div slot="tags" style="position: absolute; bottom: 0; text-align: left">
  11. <p>{{publishTime}}</p>
  12. </div>
  13. <div slot="footer" style="width: 100%">
  14. <van-tag class="present_tag" :color="statusColor[status]">{{statusString[status]}}</van-tag>
  15. </div>
  16. </van-card>
  17. </div>
  18. </template>
  19. <script>
  20. import { Card, Tag } from 'vant';
  21. export default {
  22. name: "IndexPresent",
  23. components: {
  24. [Card.name]: Card, [Tag.name]: Tag,
  25. },
  26. data() {
  27. return {
  28. statusString: ['审核中', '匹配中', '匹配成功', '交换成功', '审核失败'],
  29. statusColor: ['#f43736', '#00ff00', '#00bfff', '#00fa9a', 'ff0000']
  30. }
  31. },
  32. props: {
  33. presentImg: {
  34. type: String,
  35. default: require('../assets/image_load_fail.jpg')
  36. },
  37. presentName: {
  38. type: String,
  39. default: '礼物名称'
  40. },
  41. presentDesc: {
  42. type: String,
  43. default: '礼物描述'
  44. },
  45. publishTime: {
  46. type: String,
  47. default: '1970-01-01'
  48. },
  49. status: {
  50. type: Number,
  51. default: 0
  52. }
  53. },
  54. methods: {
  55. toDetail() {
  56. this.$emit('to-detail')
  57. }
  58. }
  59. }
  60. </script>
  61. <style scoped>
  62. div {
  63. background-color: #fff6e3;
  64. }
  65. </style>