西藏巴青项目

index.vue 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <view :key="layoutKey" :class="pageRootClass" class="tab-page home-root">
  3. <view class="home-body">
  4. <view class="home-banner">
  5. <swiper
  6. class="home-banner__swiper"
  7. circular
  8. autoplay
  9. :interval="4000"
  10. :duration="500"
  11. indicator-dots
  12. indicator-color="rgba(255,255,255,0.45)"
  13. indicator-active-color="#ffffff"
  14. >
  15. <swiper-item
  16. v-for="banner in banners"
  17. :key="banner.id"
  18. class="home-banner__item"
  19. >
  20. <view class="home-banner__slide">
  21. <image
  22. class="home-banner__img"
  23. :src="banner.image"
  24. mode="aspectFill"
  25. />
  26. </view>
  27. </swiper-item>
  28. </swiper>
  29. </view>
  30. <view class="tp-card home-services">
  31. <view class="home-grid">
  32. <view
  33. v-for="item in gridItems"
  34. :key="item.id"
  35. class="home-grid__item"
  36. role="button"
  37. hover-class="home-grid__item--hover"
  38. @click="goEntry(item)"
  39. >
  40. <view class="home-grid__icon" :class="'home-grid__icon--' + item.tone">
  41. <up-icon :name="item.icon" :color="item.iconColor" :size="40" />
  42. </view>
  43. <text class="text-body home-grid__label">{{ $t(item.titleKey) }}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import UIcon from 'uview-plus/components/u-icon/u-icon.vue'
  52. import tabPage from '@/mixins/tabPage'
  53. import { useUserStore } from '@/store/user'
  54. const GRID_ICON = '#5f7168'
  55. const BANNER_IMAGE_DIR = '/static/banner'
  56. export default {
  57. components: {
  58. 'up-icon': UIcon
  59. },
  60. mixins: [tabPage],
  61. data() {
  62. return {
  63. navTitleKey: 'nav.home',
  64. banners: [
  65. { id: 'banner-1', image: `${BANNER_IMAGE_DIR}/1.png` },
  66. { id: 'banner-2', image: `${BANNER_IMAGE_DIR}/2.png` },
  67. { id: 'banner-3', image: `${BANNER_IMAGE_DIR}/3.png` },
  68. { id: 'banner-4', image: `${BANNER_IMAGE_DIR}/4.png` }
  69. ],
  70. gridItems: [
  71. {
  72. id: 'breedingNews',
  73. titleKey: 'homeGrid.breedingNews',
  74. icon: 'file-text',
  75. tone: 'sage',
  76. iconColor: GRID_ICON,
  77. url: '/package-a/breeding-news/index'
  78. },
  79. {
  80. id: 'livestockResources',
  81. titleKey: 'homeGrid.livestockResources',
  82. icon: 'folder',
  83. tone: 'leaf',
  84. iconColor: GRID_ICON,
  85. url: '/package-a/livestock-resources/index'
  86. },
  87. {
  88. id: 'agriClassroom',
  89. titleKey: 'homeGrid.agriClassroom',
  90. icon: 'play-circle',
  91. tone: 'clay',
  92. iconColor: GRID_ICON,
  93. url: '/package-a/agri-classroom/index'
  94. },
  95. {
  96. id: 'medicineTools',
  97. titleKey: 'homeGrid.medicineTools',
  98. icon: 'list',
  99. tone: 'mist',
  100. iconColor: GRID_ICON,
  101. url: '/package-a/medicine-tools/index'
  102. },
  103. {
  104. id: 'yakMarket',
  105. titleKey: 'homeGrid.yakMarket',
  106. icon: 'rmb-circle',
  107. tone: 'moss',
  108. iconColor: GRID_ICON,
  109. url: '/package-a/yak-market/index'
  110. },
  111. // {
  112. // id: 'myStore',
  113. // titleKey: 'homeGrid.myStore',
  114. // icon: 'shopping-cart',
  115. // tone: 'wheat',
  116. // iconColor: GRID_ICON,
  117. // url: '/package-a/my-store/index'
  118. // },
  119. {
  120. id: 'bookingService',
  121. titleKey: 'homeGrid.bookingService',
  122. icon: 'calendar',
  123. tone: 'pine',
  124. iconColor: GRID_ICON,
  125. url: '/package-a/booking-service/index'
  126. },
  127. {
  128. id: 'onlineClinic',
  129. titleKey: 'homeGrid.onlineClinic',
  130. icon: 'chat-fill',
  131. tone: 'sea',
  132. iconColor: GRID_ICON,
  133. url: '/package-a/online-clinic/index'
  134. },
  135. {
  136. id: 'aiAssistant',
  137. titleKey: 'homeGrid.aiAssistant',
  138. icon: 'grid-fill',
  139. tone: 'plum',
  140. iconColor: '#22C55E',
  141. url: '/package-a/ai-assistant/index'
  142. }
  143. ]
  144. }
  145. },
  146. computed: {
  147. userStore() {
  148. return useUserStore()
  149. }
  150. },
  151. onShow() {
  152. if (this.userStore.isLoggedIn() && !this.userStore.state.roles.length) {
  153. this.userStore.fetchUserInfo().catch(() => {})
  154. }
  155. },
  156. methods: {
  157. goEntry(item) {
  158. if (!item.url) return
  159. uni.navigateTo({ url: item.url })
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. @import '@/styles/tab-page.scss';
  166. @import '@/styles/morandi.scss';
  167. .home-root {
  168. display: flex;
  169. flex-direction: column;
  170. min-height: 100%;
  171. background: $morandi-bg-page;
  172. box-sizing: border-box;
  173. }
  174. .home-scroll {
  175. flex: 1;
  176. min-height: 0;
  177. min-width: 0;
  178. box-sizing: border-box;
  179. }
  180. .home-body {
  181. display: flex;
  182. flex-direction: column;
  183. gap: 24rpx;
  184. padding: 24rpx 24rpx 32rpx;
  185. min-width: 0;
  186. box-sizing: border-box;
  187. }
  188. .home-banner {
  189. min-width: 0;
  190. border-radius: 16rpx;
  191. overflow: hidden;
  192. box-shadow: 0 8rpx 28rpx rgba(74, 69, 66, 0.08);
  193. }
  194. .home-banner__swiper {
  195. width: 100%;
  196. height: 300rpx;
  197. }
  198. .home-banner__item {
  199. width: 100%;
  200. height: 100%;
  201. }
  202. .home-banner__slide {
  203. position: relative;
  204. width: 100%;
  205. height: 100%;
  206. min-width: 0;
  207. overflow: hidden;
  208. background: $morandi-bg-card;
  209. box-sizing: border-box;
  210. }
  211. .home-banner__img {
  212. position: absolute;
  213. inset: 0;
  214. width: 100%;
  215. height: 100%;
  216. }
  217. .home-services {
  218. padding: 28rpx 16rpx 20rpx;
  219. box-shadow: 0 8rpx 32rpx rgba(74, 69, 66, 0.06);
  220. }
  221. .home-grid {
  222. display: flex;
  223. flex-direction: row;
  224. flex-wrap: wrap;
  225. min-width: 0;
  226. }
  227. .home-grid__item {
  228. width: 33.3333%;
  229. display: flex;
  230. flex-direction: column;
  231. align-items: center;
  232. justify-content: flex-start;
  233. min-width: 0;
  234. padding: 20rpx 10rpx 24rpx;
  235. gap: 14rpx;
  236. box-sizing: border-box;
  237. border-radius: 12rpx;
  238. transition: opacity 0.15s ease;
  239. }
  240. .home-grid__item--hover {
  241. opacity: 0.82;
  242. }
  243. .home-grid__icon {
  244. display: flex;
  245. align-items: center;
  246. justify-content: center;
  247. width: 96rpx;
  248. height: 96rpx;
  249. border-radius: 24rpx;
  250. box-sizing: border-box;
  251. }
  252. .home-grid__icon--sage {
  253. background: #e8f0e6;
  254. }
  255. .home-grid__icon--leaf {
  256. background: #e3efe8;
  257. }
  258. .home-grid__icon--clay {
  259. background: #efeae4;
  260. }
  261. .home-grid__icon--mist {
  262. background: #e8ecef;
  263. }
  264. .home-grid__icon--moss {
  265. background: #dfe8e0;
  266. }
  267. .home-grid__icon--wheat {
  268. background: #f0ebe3;
  269. }
  270. .home-grid__icon--pine {
  271. background: #e5ebe6;
  272. }
  273. .home-grid__icon--sea {
  274. background: #e4eaef;
  275. }
  276. .home-grid__icon--plum {
  277. background: #e8f5ec;
  278. border: 1rpx solid rgba(34, 197, 94, 0.2);
  279. }
  280. .home-grid__label {
  281. text-align: center;
  282. font-size: 26rpx;
  283. line-height: 1.4;
  284. color: $morandi-text;
  285. word-break: break-word;
  286. overflow-wrap: anywhere;
  287. }
  288. </style>