金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

223 lines
4.9 KiB

  1. <template>
  2. <view>
  3. <u-waterfall v-model="dataList" ref="uWaterfall" v-for="itemFather of listlength" :key="itemFather" v-if="itemFather == tabindex">
  4. <template v-slot:left="{leftList}">
  5. <view class="list-warter" v-for="(item, index) in leftList" :key="index">
  6. <view v-if="!item.is_ad" @click="onClick(item.id)">
  7. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :height="!ifsale?333:0" :img-mode="ifsale?'aspectFill':''" :image="item.picture" :index="index">
  8. <view class="list-label" v-if="ifsale">已售{{item.sale}}</view>
  9. </u-lazy-load>
  10. <view class="lf-p-20">
  11. <view class="list-title">
  12. {{item.title}}
  13. </view>
  14. <view>
  15. <text class="lf-font-36 lf-color-primary lf-font-bold">8493</text>
  16. <text class="lf-font-24 lf-color-777 lf-m-l-10">个兑换</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view v-else @click="goAd(item.type,item.url)">
  21. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
  22. <view class="lf-p-20">
  23. <view class="list-title">
  24. {{item.title}}
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <template v-slot:right="{rightList}">
  31. <view class="list-warter" v-for="(item, index) in rightList" :key="index">
  32. <view v-if="!item.is_ad" @click="onClick(item.id)">
  33. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :height="!ifsale?333:0" :img-mode="ifsale?'aspectFill':''" :image="item.picture" :index="index">
  34. <view class="list-label" v-if="ifsale">已售{{item.sale}}</view>
  35. </u-lazy-load>
  36. <view class="lf-p-20">
  37. <view class="list-title">
  38. {{item.title}}
  39. </view>
  40. <view>
  41. <text class="lf-font-36 lf-color-primary lf-font-bold">8493</text>
  42. <text class="lf-font-24 lf-color-777 lf-m-l-10">个兑换</text>
  43. </view>
  44. </view>
  45. </view>
  46. <view v-else @click="goAd(item.type,item.url)">
  47. <u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.picture" :index="index"></u-lazy-load>
  48. <view class="lf-p-20">
  49. <view class="list-title">
  50. {{item.title}}
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. </u-waterfall>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. props: {
  62. list: {
  63. type: Array,
  64. default: []
  65. },
  66. tabindex: {
  67. type: Number,
  68. default: 0
  69. },
  70. listlength: {
  71. type: Number,
  72. default: 1
  73. },
  74. ifsale: {
  75. type: Boolean,
  76. default: true
  77. }
  78. },
  79. data(){
  80. return {
  81. // dataList: []
  82. }
  83. },
  84. computed: {
  85. dataList: {
  86. get() {
  87. console.log('组件当前数据====',this.list)
  88. console.log(this.ifsale)
  89. return this.list;
  90. },
  91. set(newValue) { console.log('newvalue',newValue) }
  92. },
  93. },
  94. // watch: {
  95. // list(newValue,oldValue) {
  96. // console.log('值变了',newValue)
  97. // console.log('旧值',this.$refs)
  98. // // this.$forceUpdate();
  99. // this.dataList = newValue
  100. // console.log('当前值',this.dataList)
  101. // return newValue
  102. // }
  103. // },
  104. onShow(){
  105. },
  106. deactivated() {
  107. },
  108. onLoad() {
  109. },
  110. destroyed() {
  111. },
  112. methods: {
  113. onClick(id){
  114. this.$url('/pages/shop/goodsdetail?type=point&goods_id='+id);
  115. this.$emit('click');
  116. },
  117. goAd(type,url){
  118. if(url) {
  119. if(type == 0) {
  120. this.$url(url);
  121. }else {
  122. this.$url('/pages/index/urlWeb?url='+url);
  123. }
  124. }
  125. },
  126. clear() {
  127. console.log('组件名',this.$refs)
  128. this.$refs.uWaterfall[0].clear();
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped="scoped">
  134. // ====
  135. .list-warter {
  136. border-radius: 20rpx;
  137. margin: 10px 5px;
  138. margin-top: 0px;
  139. background-color: #ffffff;
  140. // padding: 8px;
  141. position: relative;
  142. overflow: hidden;
  143. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  144. }
  145. .u-close {
  146. position: absolute;
  147. top: 32rpx;
  148. right: 32rpx;
  149. }
  150. .list-image {
  151. width: 100%;
  152. border-radius: 4px;
  153. }
  154. .list-title {
  155. font-size: 28rpx;
  156. font-weight: bold;
  157. color: $u-main-color;
  158. }
  159. .list-label{
  160. position: absolute;
  161. bottom: 0;
  162. right: 0;
  163. background-color: rgba(0,0,0,0.5);
  164. width: 140rpx;
  165. height: 48rpx;
  166. border-radius: 20rpx 0rpx 0rpx 0rpx;
  167. font-size: 22rpx;
  168. color: #FFFFFF;
  169. line-height: 48rpx;
  170. text-align: center;
  171. }
  172. .list-tag {
  173. display: flex;
  174. margin-top: 5px;
  175. }
  176. .list-tag-owner {
  177. background-color: $u-type-error;
  178. color: #FFFFFF;
  179. display: flex;
  180. align-items: center;
  181. padding: 4rpx 14rpx;
  182. border-radius: 50rpx;
  183. font-size: 20rpx;
  184. line-height: 1;
  185. }
  186. .list-tag-text {
  187. border: 1px solid $u-type-primary;
  188. color: $u-type-primary;
  189. margin-left: 10px;
  190. border-radius: 50rpx;
  191. line-height: 1;
  192. padding: 4rpx 14rpx;
  193. display: flex;
  194. align-items: center;
  195. border-radius: 50rpx;
  196. font-size: 20rpx;
  197. }
  198. .list-price {
  199. font-size: 30rpx;
  200. color: $u-type-error;
  201. margin-top: 5px;
  202. display: flex;
  203. align-items: center;
  204. }
  205. // ====
  206. </style>