toolA.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="column" style="position: relative">
  3. <view class="top-content">
  4. <view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
  5. <view class="top-title">首页</view>
  6. </view>
  7. <view class="index-body" :style="{ marginTop: statusBarHeight+64 + 'px' }">
  8. <swiper
  9. :autoplay="swiper.autoplay"
  10. :circular="true"
  11. class="swipr-box"
  12. :duration="swiper.duration"
  13. :easingFunction="swiper.easing"
  14. :indicatorActiveColor="swiper.activeColor"
  15. :indicatorColor="swiper.color"
  16. :indicatorDots="swiper.indicatorDots"
  17. :interval="swiper.interval"
  18. :nextMargin="swiper.lrmargin"
  19. :previousMargin="swiper.lrmargin">
  20. <swiper-item class="seiper-smbox" v-for="(item, index) in imgUrls" :key="index">
  21. <navigator hoverClass="none" openType="navigate" :url="item.openpath">
  22. <image class="slide-image" :src="item.img"></image>
  23. </navigator>
  24. </swiper-item>
  25. </swiper>
  26. <view class="newlist">
  27. <view v-for="(item, idx) in grid9.slice(0, 1)" :key="idx"
  28. @tap="handleNav(item.openpath)" class="first-list">
  29. <view class="ml40 pt40">
  30. <view class="justify-start align-center">
  31. <image class="w90 h90" :src="item.img" mode="aspectFill"></image>
  32. <view class="colorf ml12">{{ item.text }}</view>
  33. </view>
  34. <view class="colorf mt12">{{item.desc}}</view>
  35. </view>
  36. <view class="box-shi">点击使用</view>
  37. </view>
  38. <view class="mt40 column justify-between">
  39. <view v-for="(item, idx) in grid9.slice(1, 3)" :key="idx"
  40. @tap="handleNav(item.openpath)" class="second-list justify-start align-center ml20 bgf p12 radius20 ">
  41. <view class="">
  42. <image class="w90 h90" :src="item.img" mode="aspectFill"></image>
  43. </view>
  44. <view class="colorf ml20">
  45. <view class="base-color-3">{{ item.text }}</view>
  46. <view class="base-color-6">{{ item.desc }}</view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view >
  52. <view class=" justify-between wrap " style="width: calc(100% - 40rpx);padding: 0 10rpx;" >
  53. <view v-for="(item, idx) in grid9.slice(3, 7)" :key="idx" style="width: calc(50% - 40rpx);height: 180rpx;"
  54. @tap="handleNav(item.openpath)" class=" justify-start align-center mt20 bgf ml20 pl20 radius20 ">
  55. <view class="">
  56. <image class="w90 h90" :src="item.img" mode="aspectFill"></image>
  57. </view>
  58. <view class="colorf ml20">
  59. <view class="base-color-3">{{ item.text }}</view>
  60. <view class="base-color-6">{{ item.desc }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="h90"></view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. name: 'tools',
  72. data() {
  73. return {
  74. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  75. swiper: {
  76. indicatorDots: true,
  77. autoplay: true,
  78. interval: 5000,
  79. duration: 1000,
  80. lrmargin: '40rpx',
  81. easing: 'easeInOutCubic',
  82. activeColor: '#fff',
  83. color: 'rgba(255, 255, 255, .3)'
  84. },
  85. imgUrls: [
  86. {
  87. img: 'https://zkzh-2025.oss-cn-beijing.aliyuncs.com/fs/20250901/55d56de7b34d4450bb39464a16fc591c.jpg',
  88. openpath: ''
  89. }
  90. ],
  91. recommend: [
  92. {
  93. img: '/static/images/toolIcon/weather.png',
  94. openpath: '../../pages/weather/weather',
  95. text: '天气'
  96. },
  97. {
  98. img: '/static/images/toolIcon/qrcode.png',
  99. openpath: '../../pages/qrcode/index',
  100. text: '生成二维码'
  101. },
  102. {
  103. img: '/static/images/toolIcon/hl.png',
  104. openpath: '../../pages/cand/index',
  105. text: '程序员黄历'
  106. }
  107. ],
  108. server: [
  109. {
  110. img: '/static/images/toolIcon/sdm.png',
  111. openpath: '/pages_tool/pages/christmasHat/index/index',
  112. text: '圣诞帽',
  113. desc:'合成节日氛围图片'
  114. },
  115. {
  116. img: '/static/images/toolIcon/weather.png',
  117. openpath: '/pages_tool/pages/wxyj/index',
  118. text: '五险一金计算',
  119. desc:'计算薪资个税'
  120. },
  121. {
  122. img: '/static/images/toolIcon/gz.png',
  123. openpath: '/pages_tool/pages/game/game',
  124. text: '摇骰子',
  125. desc:'娱乐工具,模拟六面骰子'
  126. },
  127. {
  128. img: '/static/images/toolIcon/cha.png',
  129. openpath: '/pages_tool/pages/pinyin/index',
  130. text: '查拼音',
  131. desc:"查询生僻汉字的拼音"
  132. },
  133. {
  134. img: '/static/images/toolIcon/clac.png',
  135. openpath: '/pages_tool/pages/calc/index',
  136. text: '计算器',
  137. desc:'日常使用计算器'
  138. },
  139. {
  140. img: '/static/images/toolIcon/wsyt.png',
  141. openpath: '/pages_tool/pages/gojuuonn/gojuuonn',
  142. text: '五十音图'
  143. },
  144. {
  145. img: '/static/images/toolIcon/sc.png',
  146. openpath: '/pages_tool/pages/figure/figure',
  147. text: '身材计算',
  148. desc:'身体质量指数'
  149. },
  150. {
  151. img: '/static/images/toolIcon/qrcode.png',
  152. openpath: '/pages_tool/pages/qrcode/index',
  153. text: '生成二维码',
  154. desc:'生成网页地址二维码'
  155. },
  156. {
  157. img: '/static/images/toolIcon/historyToday.png',
  158. openpath: '/pages_tool/pages/historyToday/historyToday',
  159. text: '历史今天',
  160. desc:'历史使用工具'
  161. }
  162. ]
  163. };
  164. },
  165. computed: {
  166. grid9() {
  167. return Array.isArray(this.server) ? this.server.slice(0, 9) : [];
  168. }
  169. },
  170. methods: {
  171. handleNav(url) {
  172. if (!url) return;
  173. const finalUrl = url.startsWith('/') ? url : `/${url.replace(/^\/+/, '')}`;
  174. try {
  175. uni.navigateTo({ url: finalUrl });
  176. } catch (e) {
  177. console.error('navigateTo failed:', e, finalUrl);
  178. }
  179. }
  180. }
  181. };
  182. </script>
  183. <style lang="scss" scoped>
  184. .newlist{
  185. width: calc(100% - 40rpx);
  186. display: flex;
  187. padding: 20rpx;
  188. .first-list{
  189. width: 50%;
  190. height: 420rpx;
  191. background: linear-gradient(180deg,#2E7DF6 ,#80B0F8);
  192. border-radius: 20rpx;
  193. margin-top: 40rpx;
  194. display: flex;
  195. flex-direction: column;
  196. justify-content: space-between;
  197. .box-shi{
  198. border: 2rpx solid #fff;
  199. color: #fff;
  200. border-radius: 20rpx;
  201. padding: 20rpx 40rpx;
  202. margin: 40rpx 40rpx;
  203. text-align: center;
  204. }
  205. }
  206. .second-list{
  207. height: 168rpx;
  208. }
  209. }
  210. .top-content {
  211. width: 100%;
  212. z-index: 10;
  213. position: fixed;
  214. top: 0;
  215. left: 0;
  216. background-color: #ffffff;
  217. .top-title {
  218. height: 88rpx;
  219. line-height: 88rpx;
  220. font-size: 42rpx;
  221. font-family: Source Han Sans CN;
  222. font-weight: bold;
  223. color: #222222;
  224. padding-left: 41rpx;
  225. background-color: #ffffff;
  226. }
  227. }
  228. .swipr-box {
  229. width: 100%;
  230. height: 280rpx;
  231. padding: 20rpx 0rpx;
  232. background-color: #fff;
  233. box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.05);
  234. }
  235. .seiper-smbox {
  236. padding: 0rpx 0rpx;
  237. box-sizing: border-box;
  238. width: 100%;
  239. }
  240. .slide-image {
  241. display: inline-block;
  242. width: 100%;
  243. height: 280rpx;
  244. border-radius: 10rpx;
  245. }
  246. .recommend-box {
  247. margin: 20rpx 0rpx;
  248. padding: 0rpx 30rpx;
  249. }
  250. .recommend-box,
  251. .recommend-smbox {
  252. width: 100%;
  253. box-sizing: border-box;
  254. }
  255. .recommend-smbox {
  256. background-color: #fff;
  257. border-radius: 10rpx;
  258. padding: 30rpx 0rpx;
  259. display: flex;
  260. justify-content: space-around;
  261. box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.05);
  262. }
  263. </style>
  264. <style lang="scss" scoped>
  265. .empty-box {
  266. width: 100%;
  267. padding: 60rpx 0;
  268. display: flex;
  269. align-items: center;
  270. justify-content: center;
  271. }
  272. .empty-text {
  273. color: #9ca3af;
  274. font-size: 28rpx;
  275. }
  276. </style>