preview.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template id="happiness-member-card-preview">
  2. <div class="happiness-member-card-main" :style="[boxStyle]">
  3. <div class="happiness-member-card-preview-box" flex>
  4. <!--占位元素-->
  5. <div class="avatar-box">
  6. <el-image class="" src="/resources/img/common/default-avatar.png">
  7. </el-image>
  8. </div>
  9. <div class="member-info">
  10. <div class="nickname" flex="cross:center">
  11. <div class="info-name" :style="{color: computedStyle.nicknameColor}">会员昵称</div>
  12. <!-- <div class="info-level" :style="{color: computedStyle.levelColor,background:computedStyle.levelBgColor}">-->
  13. <!-- 普通会员-->
  14. <!-- </div>-->
  15. </div>
  16. <div class="desc-info">
  17. <div class="desc-item">
  18. <div class="desc-item-title" :style="{color: computedStyle.descColor}">养老金:</div>
  19. <div class="desc-item-content" :style="{color: computedStyle.btnColor}">0.00</div>
  20. </div>
  21. <div class="desc-item">
  22. <div class="desc-item-title" :style="{color: computedStyle.descColor}">余额:</div>
  23. <div class="desc-item-content" :style="{color: computedStyle.btnColor}">0.00</div>
  24. </div>
  25. <div class="desc-item">
  26. <div class="desc-item-title" :style="{color: computedStyle.descColor}">积分:</div>
  27. <div class="desc-item-content" :style="{color: computedStyle.btnColor}">0.00</div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. /**
  36. * @descriptions
  37. * 1. 组件名字必须对应模板形式 - 递归组件name
  38. * 2. 样式内容方法尽量内部维护 - 前端方便通用
  39. * 3. 父级组件会传预览数据 - activeItem
  40. */
  41. Vue.component('happiness-member-card-preview', {
  42. name: "happiness-member-card-preview",
  43. props: {
  44. activeItem: {
  45. type: Object,
  46. default () {
  47. return {}
  48. }
  49. }
  50. },
  51. template: '#happiness-member-card-preview',
  52. computed: {
  53. computedStyle() {
  54. return this.activeItem.computedStyle
  55. },
  56. boxStyle() {
  57. let sizeObj = this.computedStyle.sizeObj || {}
  58. let radius = this.computedStyle.searchIpts || {}
  59. let style = {
  60. background: this.computedStyle.background,
  61. marginTop: `${sizeObj.marginTop}`,
  62. marginLeft: `${sizeObj.aroundMargin}`,
  63. marginRight: `${sizeObj.aroundMargin}`,
  64. marginBottom: `${sizeObj.marginBottom}`,
  65. borderRadius: `${radius['border-top-left-radius']} ${radius['border-top-right-radius']} ${radius['border-bottom-right-radius']} ${radius['border-bottom-left-radius']}`
  66. }
  67. if (sizeObj.posTop != '0px') {
  68. style.marginTop = `-${sizeObj.posTop}`
  69. }
  70. return style
  71. }
  72. },
  73. data() {
  74. return {}
  75. }
  76. });
  77. </script>
  78. <style>
  79. .happiness-member-card-main {
  80. position: relative;
  81. z-index: 1;
  82. }
  83. .happiness-member-card-preview-box {
  84. padding: 12px 12px 12px;
  85. border-radius: 4px;
  86. display: flex;
  87. flex-direction: row;
  88. align-items: center;
  89. }
  90. .member-info {
  91. flex: 1;
  92. }
  93. .nickname {
  94. font-size: 14px;
  95. max-width: 275px;
  96. line-height: 20px;
  97. margin-bottom: 9px;
  98. font-weight: 700;
  99. }
  100. .nickname .info-name {
  101. margin-right: 10px;
  102. }
  103. .nickname .info-level {
  104. font-size: 13px;
  105. border-radius: 20px;
  106. padding: 0 5px;
  107. }
  108. .avatar-box {
  109. width: 60px;
  110. height: 60px;
  111. margin-right: 12px;
  112. }
  113. .desc-info {
  114. font-size: 13px;
  115. display: flex;
  116. flex-direction: row;
  117. }
  118. .desc-info .desc-item {
  119. display: flex;
  120. flex-direction: row;
  121. width: 33%;
  122. }
  123. .desc-item-title {
  124. color: #AAAAAA;
  125. }
  126. .desc-item-content {
  127. color: #333333;
  128. }
  129. </style>