king.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="cu-modal" :class="{'show': visible}">
  3. <view class="mask" @click="close"></view>
  4. <view class="cu-dialog" style="background-color: transparent; width:100%">
  5. <view class="relative wrapper" v-if="data">
  6. <image class="super" :src="LEVEL_MAP[data.level].bg" mode="scaleToFill" />
  7. <image class="super-image translateX" :src="data.cover" mode="aspectFit"
  8. :style="{top: coverSize.top + 'rpx',width: coverSize.width + 'rpx', height: coverSize.height + 'rpx'}" />
  9. <image class="super-text translateX" :src="LEVEL_MAP[data.level].titleImg"
  10. :style="{bottom: textSize.bottom + 'rpx',width: textSize.width + 'rpx', height: textSize.height + 'rpx'}" />
  11. </view>
  12. <view class="paddingT30 flex-align-center">
  13. <image :src="resource.close" class="x" @click="close"/>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { LEVEL_MAP } from '@/utils/config'
  20. import resource from '@/utils/resource'
  21. export default {
  22. data() {
  23. return {
  24. resource,
  25. LEVEL_MAP,
  26. coverSize: { width: 293, height: 370, top: 33 },
  27. textSize: { width: 230, height: 102, bottom: 40 },
  28. data: null,
  29. visible: false
  30. }
  31. },
  32. methods: {
  33. open(data) {
  34. this.data = data
  35. this.visible = true
  36. },
  37. close() {
  38. this.visible = false
  39. this.data = null
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .mask {
  46. position: absolute;
  47. left: 0;
  48. right: 0;
  49. top: 0;
  50. bottom: 0;
  51. }
  52. .wrapper {
  53. z-index: 1001;
  54. width: 353rpx; height: 545rpx;
  55. background-color: transparent;
  56. margin: 0 auto;
  57. .super {
  58. position: absolute;
  59. left: 0;
  60. top: 0;
  61. width: 100%;
  62. height: 100%;
  63. }
  64. .super-image {
  65. position: absolute;
  66. border-radius: 8rpx;
  67. }
  68. .super-text {
  69. width: 182rpx;
  70. height: 56rpx;
  71. position: absolute;
  72. bottom: 40rpx;
  73. }
  74. }
  75. .x {
  76. width: 60rpx;
  77. height: 60rpx;
  78. }
  79. </style>