tools.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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="server-box">
  27. <view id="tips" class="tips">圣诞帽/五险一金查询最新发布欢迎使用</view>
  28. <view class="server-smbox">
  29. <view class="server-name">
  30. <view class="server-text fc3d fs30">实用工具</view>
  31. </view>
  32. <view class="tools-grid">
  33. <view
  34. v-for="(item, idx) in grid9"
  35. class="tool-card"
  36. @tap="handleNav(item.openpath)">
  37. <view class="card-bg"></view>
  38. <view class="card-content" :class="{ 'card-content1': idx === 1 }">
  39. <view class="icon-wrap">
  40. <image class="icon" :src="item.img" mode="aspectFill"></image>
  41. </view>
  42. <view class="label">{{ item.text }}</view>
  43. </view>
  44. </view>
  45. <view v-if="!grid9 || grid9.length === 0" class="empty-box">
  46. <view class="empty-text">暂无工具</view>
  47. </view>
  48. </view>
  49. <view class="clear"></view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. name: 'tools',
  57. data() {
  58. return {
  59. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  60. swiper: {
  61. indicatorDots: true,
  62. autoplay: true,
  63. interval: 5000,
  64. duration: 1000,
  65. lrmargin: '40rpx',
  66. easing: 'easeInOutCubic',
  67. activeColor: '#fff',
  68. color: 'rgba(255, 255, 255, .3)'
  69. },
  70. imgUrls: [
  71. {
  72. img: 'https://zkzh-2025.oss-cn-beijing.aliyuncs.com/fs/20250901/55d56de7b34d4450bb39464a16fc591c.jpg',
  73. openpath: ''
  74. }
  75. ],
  76. recommend: [
  77. {
  78. img: '/static/images/toolIcon/weather.png',
  79. openpath: '../../pages/weather/weather',
  80. text: '天气'
  81. },
  82. {
  83. img: '/static/images/toolIcon/qrcode.png',
  84. openpath: '../../pages/qrcode/index',
  85. text: '生成二维码'
  86. },
  87. // {
  88. // img: '/static/images/toolIcon/IP.png',
  89. // openpath: '../../pages/IP/IP',
  90. // text: 'IP地址查询'
  91. // },
  92. {
  93. img: '/static/images/toolIcon/hl.png',
  94. openpath: '../../pages/cand/index',
  95. text: '程序员黄历'
  96. }
  97. ],
  98. server: [
  99. {
  100. img: '/static/images/toolIcon/sdm.png',
  101. openpath: '/pages_tool/pages/christmasHat/index/index',
  102. text: '圣诞帽'
  103. },
  104. // {
  105. // img: '/static/images/toolIcon/qrcode.png',
  106. // openpath: '../../pages_tool/pages/cloudNote/index/index',
  107. // text: '云笔记'
  108. // },
  109. {
  110. img: '/static/images/toolIcon/weather.png',
  111. openpath: '/pages_tool/pages/wxyj/index',
  112. text: '五险一金计算'
  113. },
  114. {
  115. img: '/static/images/toolIcon/gz.png',
  116. openpath: '/pages_tool/pages/game/game',
  117. text: '摇骰子'
  118. },
  119. {
  120. img: '/static/images/toolIcon/cha.png',
  121. openpath: '/pages_tool/pages/pinyin/index',
  122. text: '查拼音'
  123. },
  124. // {
  125. // img: '/static/images/toolIcon/clac.png',
  126. // openpath: '/pages_tool/pages/calc/index',
  127. // text: '计算器'
  128. // },
  129. // {
  130. // img: '/static/images/toolIcon/hl.png',
  131. // openpath: '../../pages_tool/pages/cand/index',
  132. // text: '程序员黄历'
  133. // },
  134. {
  135. img: '/static/images/toolIcon/wsyt.png',
  136. openpath: '/pages_tool/pages/gojuuonn/gojuuonn',
  137. text: '五十音图'
  138. },
  139. {
  140. img: '/static/images/toolIcon/sc.png',
  141. openpath: '/pages_tool/pages/figure/figure',
  142. text: '身材计算'
  143. },
  144. {
  145. img: '/static/images/toolIcon/qrcode.png',
  146. openpath: '/pages_tool/pages/qrcode/index',
  147. text: '生成二维码'
  148. },
  149. // {
  150. // img: '/static/images/toolIcon/weather.png',
  151. // openpath: '../../pages_tool/pages/weather/weather',
  152. // text: '天气'
  153. // },
  154. // {
  155. // img: '/static/images/toolIcon/IP.png',
  156. // openpath: '../../pages_tool/pages/IP/IP',
  157. // text: 'IP地址查询'
  158. // },
  159. {
  160. img: '/static/images/toolIcon/MobileHome.png',
  161. openpath: '/pages_tool/pages/MobileHome/MobileHome',
  162. text: '手机归属地'
  163. },
  164. // {
  165. // img: '/static/images/toolIcon/codePars.png',
  166. // openpath: '/pages_tool/pages/codePars/codePars',
  167. // text: '电码查询'
  168. // },
  169. {
  170. img: '/static/images/toolIcon/historyToday.png',
  171. openpath: '/pages_tool/pages/historyToday/historyToday',
  172. text: '历史今天'
  173. }
  174. ]
  175. };
  176. },
  177. computed: {
  178. grid9() {
  179. return Array.isArray(this.server) ? this.server.slice(0, 9) : [];
  180. }
  181. },
  182. methods: {
  183. handleNav(url) {
  184. if (!url) return;
  185. const finalUrl = url.startsWith('/') ? url : `/${url.replace(/^\/+/, '')}`;
  186. try {
  187. uni.navigateTo({ url: finalUrl });
  188. } catch (e) {
  189. console.error('navigateTo failed:', e, finalUrl);
  190. }
  191. }
  192. }
  193. };
  194. </script>
  195. <style lang="scss" scoped>
  196. .top-content {
  197. width: 100%;
  198. z-index: 10;
  199. position: fixed;
  200. top: 0;
  201. left: 0;
  202. background-color: #ffffff;
  203. .top-title {
  204. height: 88rpx;
  205. line-height: 88rpx;
  206. font-size: 42rpx;
  207. font-family: Source Han Sans CN;
  208. font-weight: bold;
  209. color: #222222;
  210. padding-left: 41rpx;
  211. background-color: #ffffff;
  212. }
  213. }
  214. .swipr-box {
  215. width: 100%;
  216. height: 280rpx;
  217. padding: 20rpx 0rpx;
  218. background-color: #fff;
  219. box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.05);
  220. }
  221. .seiper-smbox {
  222. padding: 0rpx 0rpx;
  223. box-sizing: border-box;
  224. width: 100%;
  225. }
  226. .slide-image {
  227. display: inline-block;
  228. width: 100%;
  229. height: 280rpx;
  230. border-radius: 10rpx;
  231. }
  232. .recommend-box {
  233. margin: 20rpx 0rpx;
  234. padding: 0rpx 30rpx;
  235. }
  236. .recommend-box,
  237. .recommend-smbox {
  238. width: 100%;
  239. box-sizing: border-box;
  240. }
  241. .recommend-smbox {
  242. background-color: #fff;
  243. border-radius: 10rpx;
  244. padding: 30rpx 0rpx;
  245. display: flex;
  246. justify-content: space-around;
  247. box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.05);
  248. }
  249. .col-1 {
  250. width: 25%;
  251. }
  252. .ad-index {
  253. width: 100%;
  254. box-sizing: border-box;
  255. padding: 0rpx 30rpx;
  256. }
  257. .ad-df {
  258. border-radius: 10rpx;
  259. overflow: hidden;
  260. box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.05);
  261. }
  262. .server-box {
  263. width: 100%;
  264. padding: 0rpx 30rpx;
  265. box-sizing: border-box;
  266. margin: 20rpx 0rpx;
  267. margin-top: 17vh;
  268. }
  269. .tips{
  270. background-color: #ff5500;
  271. color: #fff;
  272. height: 60rpx;
  273. line-height: 60rpx;
  274. border-radius: 10rpx;
  275. padding-left: 20rpx;
  276. }
  277. .server-smbox {
  278. width: 100%;
  279. background-color: transparent;
  280. border-radius: 10rpx;
  281. padding-bottom: 15rpx;
  282. box-shadow: inset 0 0 0 1rpx rgba(255,255,255,0.06), 0 16rpx 40rpx rgba(0, 0, 0, 0.18);
  283. margin-top: 20rpx;
  284. }
  285. .server-t {
  286. text-align: center;
  287. }
  288. .server-name {
  289. padding: 15rpx 20rpx;
  290. }
  291. .server-text {
  292. border-bottom: 1rpx solid #f6f6f6;
  293. font-weight: 700;
  294. height: 40rpx;
  295. line-height: 40rpx;
  296. padding-bottom: 15rpx;
  297. margin-top: 60rpx;
  298. font-size: 42rpx;
  299. margin-left: 40rpx;
  300. }
  301. .list-server,
  302. .listbox {
  303. box-sizing: border-box;
  304. }
  305. .listbox {
  306. width: 25%;
  307. text-align: center;
  308. float: left;
  309. padding: 15rpx 0rpx;
  310. }
  311. .listimg {
  312. width: 100rpx;
  313. height: 100rpx;
  314. }
  315. .inm {
  316. margin-bottom: 60rpx;
  317. }
  318. .bottomLine {
  319. padding: 50rpx 0rpx;
  320. font-size: 24rpx;
  321. text-align: center;
  322. color: #8b8b8b;
  323. }
  324. /* 科技感九宫格布局与卡片样式 */
  325. .tools-grid {
  326. /* 九宫格:3列,顶部/底部保留 10% 视口高度 */
  327. display: grid;
  328. grid-template-columns: repeat(3, 1fr);
  329. gap: 20rpx;
  330. height: 60vh;
  331. margin-top: 0vh;
  332. padding: 0 24rpx;
  333. box-sizing: border-box;
  334. }
  335. .tool-card {
  336. position: relative;
  337. margin: 0;
  338. border-radius: 20rpx;
  339. overflow: hidden;
  340. //background: linear-gradient(135deg, #0b1220 0%, #0e1b2e 100%);
  341. //box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.28), inset 0 0 0 1rpx rgba(255,255,255,0.06);
  342. display: flex;
  343. flex-direction: column;
  344. align-items: center;
  345. justify-content: center;
  346. }
  347. .span-1 { flex: 0 0 33.33%; }
  348. .span-2 { flex: 0 0 66.66%; }
  349. .card-bg {
  350. position: absolute;
  351. inset: 0;
  352. background-image:
  353. repeating-linear-gradient(
  354. 90deg,
  355. rgba(255, 255, 255, 0.04) 0rpx,
  356. rgba(255, 255, 255, 0.04) 1rpx,
  357. transparent 1rpx,
  358. transparent 20rpx
  359. ),
  360. repeating-linear-gradient(
  361. 0deg,
  362. rgba(255, 255, 255, 0.04) 0rpx,
  363. rgba(255, 255, 255, 0.04) 1rpx,
  364. transparent 1rpx,
  365. transparent 20rpx
  366. );
  367. opacity: 0.75;
  368. }
  369. .card-content {
  370. position: relative;
  371. display: flex;
  372. flex-direction: column;
  373. align-items: center;
  374. justify-content: center;
  375. padding: 24rpx;
  376. }
  377. .card-content1 {
  378. padding: 0rpx;
  379. }
  380. /* 高亮第二项的内容块(可按需修改效果) */
  381. .content1 {
  382. filter: brightness(1.08);
  383. }
  384. .icon-wrap {
  385. width: 96rpx;
  386. height: 96rpx;
  387. border-radius: 18rpx;
  388. background: linear-gradient(180deg, rgba(59,130,246,0.18), rgba(59,130,246,0.06));
  389. border: 1rpx solid rgba(59,130,246,0.35);
  390. display: flex;
  391. align-items: center;
  392. justify-content: center;
  393. box-shadow: 0 0 28rpx rgba(59,130,246,0.35);
  394. }
  395. .icon {
  396. width: 72rpx;
  397. height: 72rpx;
  398. border-radius: 14rpx;
  399. }
  400. .label {
  401. margin-left: 0;
  402. margin-top: 16rpx;
  403. font-size: 30rpx;
  404. letter-spacing: 1rpx;
  405. color: #333;
  406. text-shadow: 0 2rpx 6rpx rgba(0,0,0,0.35);
  407. text-align: center;
  408. }
  409. .tool-card:active .card-bg {
  410. filter: brightness(1.08);
  411. transform: scale(1.01);
  412. transition: all 120ms linear;
  413. }
  414. </style>
  415. <style lang="scss" scoped>
  416. .empty-box {
  417. width: 100%;
  418. padding: 60rpx 0;
  419. display: flex;
  420. align-items: center;
  421. justify-content: center;
  422. }
  423. .empty-text {
  424. color: #9ca3af;
  425. font-size: 28rpx;
  426. }
  427. </style>