index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="container">
  3. <view class="header1">
  4. 服务
  5. </view>
  6. <view class="service-back">
  7. <view class="services">
  8. <view v-for="(service, index) in services" :key="index" class="service-item" @click="navigateTo(service)">
  9. <image :src="service.icon" mode="aspectFit" />
  10. <text style="text-align: center; ">{{ service.name }}</text>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="sections">
  15. <view v-for="(section, index) in sections" :key="index" class="section-item" @click="navigateTo(section)">
  16. <image :src="section.image" mode="aspectFill" />
  17. <text >{{ section.title }}</text>
  18. </view>
  19. </view>
  20. <view class="company">
  21. <image class="company-image" src="https://leaseraycos.oss-cn-shanghai.aliyuncs.com/document/20240912212116_bb38e4382cc089f4680f971ab4e09f58_323088_1918_1080.jpg" mode="aspectFill" />
  22. </view>
  23. </view>
  24. </template>
  25. <script setup>
  26. import { ref } from 'vue'
  27. const services = ref([
  28. { name: '产能计算', icon: '/static/计算器.svg', link: '/pages/capacity-calculation/index' },
  29. { name: '油品推荐', icon: '/static/油品.svg', link: '/pages/oil-recommendation/index' },
  30. { name: '刀片推荐', icon: 'https://leaseraycos.oss-cn-shanghai.aliyuncs.com/document/20240912211758_4037d040dfd724a7ed7eb4ccc398d6fb_33697_400_323.jpg', link: '/pages/blade-recommendation/index' },
  31. { name: '包胶硬度对比', icon: '/static/橡胶密封件.svg', link: '/pages/rubber-hardness-comparison/index' },
  32. { name: '锯体重量计算', icon: '/static/公斤.svg', link: '/pages/saw-weight-calculation/index' },
  33. {
  34. name: '轴承查询',
  35. icon: '/static/轴承.svg',
  36. isMiniprogramLink: true,
  37. appId: 'wxb4b83027a868ac52', // 替换为实际的小程序 appId
  38. path: 'pages/index/index' // 替换为实际的小程序页面路径
  39. },
  40. { name: '温度与压力', icon: '/static/液压仪(压力).svg', link: '/pages/hydraulic-hose/index' },
  41. { name: '壹领AI助理', icon: '/static/人工智能.svg', link: '/pages/ai-assistant/index' },
  42. ])
  43. const sections = ref([
  44. { title: '智桥科技', image: 'https://leaseraycos.oss-cn-shanghai.aliyuncs.com/document/20240912212224_ef8282907ec2bbf3589eff1d9bbb2cab_66988_355_532.png', link: '/pages/zhiqiao/index' },
  45. { title: '公众号', image: 'https://leaseraycos.oss-cn-shanghai.aliyuncs.com/document/20240912212158_ed0551d910c462394ec553ff61d7033e_100506_371_557.png', link: '/pages/qinglianggz/index' },
  46. { title: '投诉建议', image: 'https://leaseraycos.oss-cn-shanghai.aliyuncs.com/document/20240912211631_6d06996798bb191f9a32fd10e45ede10_202607_493_657.png', link: '/pages/complaint/index' }
  47. ])
  48. const navigateTo = (service) => {
  49. console.log('Attempting to navigate to:', service);
  50. if (!service) {
  51. console.error('Service object is undefined or empty');
  52. return;
  53. }
  54. if (service.isMiniprogramLink) {
  55. // 跳转到其他小程序
  56. uni.navigateToMiniProgram({
  57. appId: service.appId,
  58. path: service.path,
  59. success: (res) => {
  60. console.log('Mini program navigation successful', res);
  61. },
  62. fail: (err) => {
  63. console.error('Mini program navigation failed', err);
  64. // 可以在这里添加失败后的处理逻辑,比如显示错误提示
  65. }
  66. });
  67. } else if (service.link) {
  68. // 普通页面跳转
  69. uni.navigateTo({
  70. url: service.link,
  71. success: (res) => {
  72. console.log('Navigation successful', res);
  73. },
  74. fail: (err) => {
  75. console.error('Navigation failed', err);
  76. // 如果 navigateTo 失败,尝试使用 reLaunch
  77. uni.reLaunch({
  78. url: service.link,
  79. success: (res) => console.log('reLaunch successful', res),
  80. fail: (reLaunchErr) => console.error('reLaunch also failed', reLaunchErr)
  81. });
  82. }
  83. });
  84. } else {
  85. console.error('Invalid service object: missing link or miniprogram info');
  86. }
  87. };
  88. </script>
  89. <style>
  90. .container {
  91. font-family:Arial, Helvetica, sans-serif;
  92. font-size: 12px;
  93. padding-bottom: 20rpx;
  94. }
  95. .header1 {
  96. font-size: 30rpx;
  97. font-weight: bold;
  98. height: 30px;
  99. background-color: #1296db;
  100. color: #ffffff;
  101. text-align: center;
  102. padding-top: 60px;
  103. }
  104. .service-back{
  105. display: flex;
  106. flex-wrap: wrap;
  107. background-color: white;
  108. border-radius: 0px 0px 10px 10px ;
  109. width: 100%;
  110. margin-bottom: 20rpx;
  111. padding-bottom: 10px;
  112. background-color: #1296db;
  113. }
  114. .services {
  115. display: flex;
  116. flex-wrap: wrap;
  117. background-color: white;
  118. border-radius: 10px;
  119. padding: 5px;
  120. margin: 20rpx;
  121. }
  122. .service-item {
  123. width: 25%;
  124. display: flex;
  125. flex-direction: column;
  126. align-items: center;
  127. margin-top: 10px;
  128. margin-bottom: 10px;
  129. }
  130. .service-item image {
  131. width: 80rpx;
  132. height: 80rpx;
  133. }
  134. .service-item text {
  135. font-size: 24rpx;
  136. margin-top: 20rpx;
  137. }
  138. .sections {
  139. display: flex;
  140. justify-content: space-between;
  141. margin: 20rpx;
  142. }
  143. .section-item {
  144. width: 30%;
  145. position: relative;
  146. height:130px;
  147. }
  148. .section-item image {
  149. width: 100%;
  150. height: 150px;
  151. border-radius: 6px;
  152. }
  153. .section-item text {
  154. position: absolute;
  155. bottom: 30%;
  156. left: 30%;
  157. color: #ffffff;
  158. font-size: 24rpx;
  159. }
  160. .company{
  161. display: flex;
  162. justify-content: space-between;
  163. height: 170px;
  164. border-radius: 10px;
  165. margin-left: 10px ;
  166. margin-right: 10px ;
  167. margin-top: 30px;
  168. overflow: hidden;
  169. margin-bottom: 40px;
  170. }
  171. .company-image {
  172. width: 100%;
  173. display: flex;
  174. height: 170px;
  175. }
  176. .tab-item {
  177. flex: 1;
  178. display: flex;
  179. flex-direction: column;
  180. align-items: center;
  181. justify-content: center;
  182. }
  183. .tab-item image {
  184. width: 40rpx;
  185. height: 40rpx;
  186. }
  187. .tab-item text {
  188. font-size: 24rpx;
  189. margin-top: 5rpx;
  190. }
  191. .tab-item.active {
  192. color: #1296db;
  193. }
  194. </style>