index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view :class="className">
  3. <!-- style -->
  4. <!--<view v-html="css"></view>-->
  5. <template v-if="datas.list && datas.list.choose_style ==1">
  6. <view class="fixed-box" v-for="(item, index) in datas.list.list" :key="index"
  7. :style="{top : `${(datas.over_top + 30)*2}rpx`}">
  8. <!--悬浮按钮静态-->
  9. <view class="btn" :style="button_style">
  10. <u--image radius="25px" :style="{'width': datas.button_size+'px', 'height': datas.button_size+'px'}" :showLoading="true" :src="item.image || emptyImage" width="50px"
  11. height="50px"></u--image>
  12. </view>
  13. </view>
  14. </template>
  15. <template v-if="datas.list && datas.list.choose_style ==2">
  16. <view class="fixed-box2" :style="{top : `${(datas.over_top-15)*2}rpx`}" v-if="datas.list.show_style ==1">
  17. <u--image radius="25px" :style="button_style" :showLoading="true" :src="datas.list.unfold_button || openImage" width="50px"
  18. height="50px"></u--image>
  19. <view class="btn" v-for="(item, index) in datas.list.list" :key="index"
  20. :style="{top : `${-70*(index+1)}px`,left: `${datas.position_location =='left'?((datas.button_size-50)/2)+10: 315-((datas.button_size-50)/2)}px`}">
  21. <u--image radius="25px" :showLoading="true" :src="item.image || emptyImage" width="50px"
  22. height="50px"></u--image>
  23. </view>
  24. </view>
  25. <view class="fixed-box2" :style="{top : `${(datas.over_top-15 )*2}rpx`}" v-if="datas.list.show_style ==2">
  26. <u--image radius="25px" :style="button_style" :showLoading="true" :src="datas.list.unfold_button || openImage" width="50px"
  27. height="50px"></u--image>
  28. <view class="btn" style="top:-70px;" :style="btn_1_style" v-if="datas.list.list[0]">
  29. <u--image radius="25px" :showLoading="true" :src="datas.list.list[0].image" width="50px"
  30. height="50px"></u--image>
  31. </view>
  32. <view class="btn" :style="btn_3_style" v-if="datas.list.list[1]">
  33. <u--image radius="25px" :showLoading="true" :src="datas.list.list[1].image" width="50px"
  34. height="50px"></u--image>
  35. </view>
  36. <view class="btn" :style="btn_4_style" v-if="datas.list.list[2]">
  37. <u--image radius="25px" :showLoading="true" :src="datas.list.list[2].image" width="50px"
  38. height="50px"></u--image>
  39. </view>
  40. <view class="btn" style="top: 70px;" :style="btn_2_style" v-if="datas.list.list[3]">
  41. <u--image radius="25px" :showLoading="true" :src="datas.list.list[3].image" width="50px"
  42. height="50px"></u--image>
  43. </view>
  44. </view>
  45. </template>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. props: ['datas', 'styles'],
  51. data() {
  52. let siteinfo = getApp().globalData.siteinfo;
  53. let data = {
  54. settingFile: siteinfo,
  55. emptyImage: siteinfo.root_img + '/static/app/image.png',
  56. openImage: siteinfo.root_img + '/static/app/open.png',
  57. }
  58. return data;
  59. },
  60. computed: {
  61. button_style() {
  62. const {
  63. button_size,
  64. position_location,
  65. } = this.datas;
  66. return `
  67. width: ${button_size}px;
  68. height: ${button_size}px;
  69. margin-left: ${position_location =='left'?25:630}rpx;
  70. `;
  71. },
  72. btn_1_style() {
  73. const {
  74. position_location,
  75. } = this.datas;
  76. return `
  77. left: ${position_location =='left'?'10':315}px;
  78. `;
  79. },
  80. btn_2_style() {
  81. const {
  82. button_size,
  83. position_location,
  84. } = this.datas;
  85. return `
  86. top: ${20+button_size}px;
  87. left: ${position_location =='left'?'10':315}px;
  88. `;
  89. },
  90. btn_3_style() {
  91. const {
  92. button_size,
  93. position_location,
  94. } = this.datas;
  95. return `
  96. top: ${15-button_size}px;
  97. left: ${position_location =='left' ? 20+button_size:310-button_size}px;
  98. `;
  99. },
  100. btn_4_style() {
  101. const {
  102. button_size,
  103. position_location,
  104. } = this.datas;
  105. return `
  106. top: ${button_size-15}px;
  107. left: ${position_location =='left' ? 20+button_size:310-button_size}px;
  108. `;
  109. },
  110. className() {
  111. const name = ['component-wrapper', `component-${this.id}`];
  112. return name;
  113. },
  114. },
  115. methods: {},
  116. };
  117. </script>
  118. <style lang="less" scoped>
  119. // 默认
  120. .component-wrapper {
  121. width: 750rpx;
  122. }
  123. .fixed-box {
  124. width: 750rpx;
  125. position: fixed;
  126. top: 114px;
  127. z-index: 2;
  128. .btn {
  129. width: 50px;
  130. height: 50px;
  131. border-radius: 100%;
  132. display: flex;
  133. align-items: center;
  134. justify-content: center;
  135. position: absolute;
  136. flex-direction: column;
  137. font-size: 13px;
  138. img {
  139. width: 100%;
  140. height: 100%;
  141. border-radius: 50%;
  142. }
  143. }
  144. }
  145. .fixed-box2 {
  146. width: 750rpx;
  147. top: 114px;
  148. z-index: 2;
  149. position: fixed;
  150. .imgs {
  151. width: 60px;
  152. height: 60px;
  153. border-radius: 50%;
  154. z-index: 2;
  155. position: relative;
  156. }
  157. .btn {
  158. width: 50px;
  159. height: 50px;
  160. border-radius: 100%;
  161. display: flex;
  162. align-items: center;
  163. justify-content: center;
  164. position: absolute;
  165. flex-direction: column;
  166. font-size: 13px;
  167. img {
  168. width: 50px;
  169. height: 50px;
  170. border-radius: 50%;
  171. }
  172. }
  173. }
  174. </style>