index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="container">
  3. <view class="selector">
  4. <picker @change="onPickerChange" :value="pickerIndex" :range="paperTypes">
  5. <view class="picker">
  6. {{ paperTypes[pickerIndex] }}
  7. <text class="arrow">▼</text>
  8. </view>
  9. </picker>
  10. </view>
  11. <scroll-view scroll-y class="table-container">
  12. <image class="table-image" :src="currentImage" mode="widthFix"></image>
  13. </scroll-view>
  14. <view class="contact-btn" @click="goToContactPage">一键联系</view>
  15. </view>
  16. </template>
  17. <script setup>
  18. import { ref, computed } from 'vue'
  19. const paperTypes = ['瓦楞纸', '卫生纸']
  20. const pickerIndex = ref(0)
  21. const images = {
  22. '瓦楞纸': 'https://leaseraycos.oss-cn-shanghai.aliyuncs.com/document/20240912211537_06a2792b4e49f11b8ee1e1e372f9f0e1_1182344_3168_5468.jpg',
  23. '卫生纸': 'https://leaseraycos.oss-cn-shanghai.aliyuncs.com/document/20240913094914_18e718fc39e02503f31aa4b8f3cdb4f.jpg'
  24. }
  25. const goToContactPage = () =>{
  26. uni.navigateTo({
  27. url: '/pages/oil-recommendation/contact'
  28. })
  29. }
  30. const currentImage = computed(() => {
  31. return images[paperTypes[pickerIndex.value]]
  32. })
  33. const onPickerChange = (e) => {
  34. pickerIndex.value = e.detail.value
  35. }
  36. </script>
  37. <style>
  38. .container {
  39. display: flex;
  40. flex-direction: column;
  41. height: 100vh;
  42. background-color: #f0f0f0;
  43. }
  44. .header {
  45. display: flex;
  46. justify-content: space-between;
  47. align-items: center;
  48. background-color: #1296db;
  49. color: white;
  50. padding: 10px 20px;
  51. }
  52. .back-icon, .right-icons {
  53. font-size: 20px;
  54. }
  55. .circle {
  56. margin-left: 10px;
  57. }
  58. .selector {
  59. background-color: #fff;
  60. padding: 10px 20px;
  61. margin: 10px;
  62. border-radius: 5px;
  63. }
  64. .picker {
  65. display: flex;
  66. justify-content: space-between;
  67. align-items: center;
  68. }
  69. .arrow {
  70. color: #999;
  71. }
  72. .table-container {
  73. flex: 1;
  74. margin: 0 5px;
  75. }
  76. .table-image {
  77. width: 100%;
  78. height: auto;
  79. padding-bottom: 100px;
  80. }
  81. .contact-btn {
  82. background-color: #1296db;
  83. color: white;
  84. text-align: center;
  85. padding: 10px;
  86. margin: 10px;
  87. border-radius: 20px;
  88. width: 50%;
  89. margin: 10px auto;
  90. position: fixed;
  91. left: 25%;
  92. bottom: 3%;
  93. }
  94. </style>