workark.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="workark-list">
  3. <view class="workark-item" v-for="(item,index) in list" :key="item.id">
  4. <view class="workark-item-title">{{item.name}}</view>
  5. <view class="workark-content">
  6. <view class="workark-content-item" v-for="(serve,i) in item.children" :key="serve.id">
  7. <view class="workark-content-box">
  8. <view class="product-item" @click="clickItem">
  9. <view class="product-item-image">
  10. <uv-image :src="imageUrl(serve.showPictures)" mode="scaleToFill" width="100%"
  11. height="100%">
  12. </uv-image>
  13. </view>
  14. <view class="product-content">
  15. <view class="product-item-title">{{serve.name}}</view>
  16. <uv-text :lines="2" :text="serve.remark" type="tips" size="13"></uv-text>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. getServeProductList
  28. } from '@/request/api/workark.js'
  29. export default {
  30. data() {
  31. return {
  32. list: []
  33. }
  34. },
  35. onLoad() {
  36. this.init();
  37. },
  38. methods: {
  39. async init() {
  40. let productData = await getServeProductList(-1);
  41. if (productData.state) this.list = productData.data;
  42. },
  43. clickItem() {
  44. },
  45. imageUrl(data) {
  46. if (!data) return 'https://assets.api.uizard.io/api/cdn/stream/c05650d2-192b-4a56-ae97-05638f53804c.png';
  47. let imgData = JSON.parse(data)[0];
  48. if (!imgData) {
  49. return 'https://assets.api.uizard.io/api/cdn/stream/c05650d2-192b-4a56-ae97-05638f53804c.png';
  50. }
  51. return imgData.url;
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .workark-list {
  58. padding: 30rpx;
  59. }
  60. .workark-item {
  61. margin-bottom: 30rpx;
  62. }
  63. .workark-item-title {
  64. padding-bottom: 20rpx;
  65. font-weight: bold;
  66. }
  67. .workark-content {
  68. display: flex;
  69. flex-wrap: wrap;
  70. }
  71. .workark-content-item {
  72. width: 50%;
  73. box-sizing: border-box;
  74. margin-bottom: 30rpx;
  75. &:nth-child(2n) {
  76. padding-left: 15rpx;
  77. }
  78. &:nth-child(2n-1) {
  79. padding-right: 15rpx;
  80. }
  81. }
  82. .workark-content-box {
  83. background: #fff;
  84. box-shadow: 0px 2rpx 24rpx rgba(3, 3, 3, 0.1);
  85. border-radius: 16rpx;
  86. overflow: hidden;
  87. }
  88. .product-item-image {
  89. width: 100%;
  90. height: 200rpx;
  91. overflow: hidden;
  92. border-radius: 16rpx;
  93. }
  94. .product-content {
  95. padding: 20rpx;
  96. }
  97. .product-item-title {
  98. font-size: 32rpx;
  99. font-weight: 600;
  100. margin-bottom: 10rpx;
  101. }
  102. </style>