uni-permission-view.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="permissionView dis a-c j-c " :class="[
  3. direction === 'column' ? 'f-c padding1' : 'padding',
  4. position === 'fixed' ? 'fixed' : 'absolute',
  5. backimage===true?'backimage':''
  6. ]" :style="{borderRadius:cornerRadius,background:backimage?'':background,padding:padding}">
  7. <image class="lockedimg" src="/static/image/index/img/locked.png" mode="" :style="imageStyle"></image>
  8. <view class="content dis f-c a-c" :class="[direction === 'column' ? 'mt-3 mb-3' : 'row-content-margin']"
  9. :style="contentStyle">
  10. <!-- 锁定金额 -->
  11. <text class="lockedAmount" v-if="sum" :style="lockedAmountStyle">有 <text class="sum">{{sum}}</text>
  12. 元佣金处于锁定状态( <text class="days">{{days}}</text> 天后清0)</text>
  13. <!-- 默认内容 -->
  14. <text class="genericText" :style="genericTextStyle" v-html="genericText"></text>
  15. </view>
  16. <view class="locked-btn" @click.stop="requestUnlock">
  17. {{btnText}}
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. props: {
  24. //定位方式
  25. position: {
  26. type: String,
  27. default: "absolute"
  28. },
  29. // 组件排列方式 row-横向,column-竖向
  30. direction: {
  31. type: String,
  32. default: 'column',
  33. },
  34. cornerRadius: {
  35. type: String,
  36. default: '',
  37. },
  38. sum: {
  39. //锁定金额
  40. type: String,
  41. default: null,
  42. },
  43. //天数
  44. days: {
  45. type: String | Number,
  46. default: null,
  47. },
  48. contentStyle: Object,
  49. genericText: String,
  50. //内容自定义样式
  51. genericTextStyle: Object,
  52. //标题自定义样式
  53. lockedAmountStyle: Object,
  54. //logo自定义样式
  55. imageStyle: Object,
  56. background: {
  57. type: String,
  58. default: 'linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0) 100%)'
  59. },
  60. //自定义padding
  61. padding: {
  62. type: String,
  63. default: ''
  64. },
  65. backimage: {
  66. type: Boolean,
  67. default: false,
  68. },
  69. btnText: {
  70. type: String,
  71. default: "立即解锁",
  72. }
  73. },
  74. data() {
  75. return {
  76. }
  77. },
  78. onShow() {
  79. },
  80. onLoad() {
  81. },
  82. methods: {
  83. requestUnlock() {
  84. this.$emit('requestUnlock')
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .backimage {
  91. background-image: url('/static/image/index/img/lockedback.png');
  92. background-size: 100% 100%;
  93. }
  94. .permissionView {
  95. z-index: 999;
  96. width: 100%;
  97. backdrop-filter: blur(8rpx);
  98. .lockedimg {
  99. width: 92rpx;
  100. height: 90rpx;
  101. }
  102. .content {
  103. .lockedAmount {
  104. font-size: 28rpx;
  105. color: #333;
  106. font-weight: bold;
  107. line-height: 1.4;
  108. .sum {
  109. color: #F74141;
  110. }
  111. .days {
  112. color: #2D6DFF;
  113. }
  114. }
  115. .genericText {
  116. font-size: 28rpx;
  117. color: #666;
  118. line-height: 1.4;
  119. }
  120. }
  121. //横排内容撑开,附带左右margin
  122. .row-content-margin {
  123. flex: 1;
  124. margin-left: 15rpx;
  125. margin-right: 23rpx;
  126. }
  127. //解锁按钮样式
  128. .locked-btn {
  129. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  130. border-radius: 4rpx 4rpx 4rpx 4rpx;
  131. padding: 6rpx 16rpx;
  132. box-sizing: border-box;
  133. font-size: 26rpx;
  134. color: #fff;
  135. }
  136. }
  137. .absolute {
  138. position: absolute;
  139. top: 0;
  140. left: 0;
  141. height: 100%;
  142. }
  143. .fixed {
  144. position: fixed;
  145. bottom: 0;
  146. left: 0;
  147. right: 0;
  148. }
  149. .padding {
  150. padding: 52rpx 30rpx;
  151. }
  152. .padding1 {
  153. padding: 30rpx;
  154. }
  155. </style>