index.uvue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <!-- #ifdef APP -->
  3. <scroll-view style="flex:1">
  4. <!-- #endif -->
  5. <view class="my-page">
  6. <!-- 轮播图 -->
  7. <swiper class="swiper-box my-swiper" :current="swiperDotIndex" :indicator-dots="true" @change="changeSwiper">
  8. <swiper-item v-for="item in data" >
  9. <view class="swiper-item" @click="clickBannerItem(item)">
  10. <image class="my-image" :src="item.image" mode="aspectFill" />
  11. </view>
  12. </swiper-item>
  13. </swiper>
  14. <!-- 标题栏 -->
  15. <view class=" uni-section">
  16. <view class=" uni-section-header">
  17. <view class=" uni-section-header__decoration line"/>
  18. <view class=" uni-section-header__content">
  19. <text style="font-size:14px;color:#333" class="distraction">系统管理</text>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 宫格 -->
  24. <view class="grid-body">
  25. <view class="grid uni-row">
  26. <view class="grid-item" v-for="(item, index) in items" :key="index" @click="enterItem(item)" >
  27. <!-- 您的网格项内容 -->
  28. <uni-icons class="my-icon" :type="item.iconType" size="40" :color="item.colorClass" ></uni-icons>
  29. <text class="text">{{ item.text }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- #ifdef APP -->
  35. </scroll-view>
  36. <!-- #endif -->
  37. </template>
  38. <script lang="uts">
  39. type ImageItem={
  40. image:string
  41. }
  42. type Item={
  43. colorClass:string,
  44. iconType:string,
  45. path:string,
  46. text:string
  47. }
  48. export default {
  49. data() {
  50. return {
  51. items: [
  52. {colorClass: 'blue', iconType: "person-filled", text: "用户管理",path:"" },
  53. {colorClass: 'blue', iconType: "download", text: "数据下载",path:"/pages/work/download/DownloadList" },
  54. {colorClass: 'blue', iconType: "list", text: "任务管理",path:"/pages/work/task/TaskList" },
  55. {colorClass: 'orange', iconType: "mic", text: "声像记录", path:"/pages/work/record/RecordList"},
  56. {colorClass: 'orange', iconType: "calendar", text: "检验记录",path:"/pages/work/report/InspectionList" },
  57. {colorClass: 'orange', iconType: "gear-filled", text: "关键工序",path:"/pages/work/process/ProcessList" },
  58. {colorClass: 'green', iconType: "folder-add-filled", text: "文档查阅",path:"" },
  59. {colorClass: 'green', iconType: "cloud-upload", text: "数据上传",path:"" },
  60. {colorClass: 'green', iconType: "wallet-filled", text: "日志管理",path:"" }
  61. ] as Item[],
  62. current: 0 as number,
  63. swiperDotIndex: 0 as number,
  64. data: [{
  65. image: '/static/images/banner/banner01.jpg'
  66. },
  67. {
  68. image: '/static/images/banner/banner02.jpg'
  69. },
  70. {
  71. image: '/static/images/banner/banner03.jpg'
  72. }
  73. ] as ImageItem[]
  74. }
  75. },
  76. methods: {
  77. clickBannerItem(item:ImageItem) {
  78. console.info(item)
  79. },
  80. changeSwiper(e:UniSwiperChangeEvent) {
  81. this.current = e.detail.current
  82. },
  83. enterItem(e:Item) {
  84. if (e.path != null && e.path != "") {
  85. uni.navigateTo({
  86. url: e.path as string
  87. });
  88. } else {
  89. uni.showToast({
  90. title: '模块建设中~',
  91. icon: 'none'
  92. });
  93. }
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. /* #ifndef APP-NVUE */
  100. .my-page {
  101. display: flex;
  102. flex-direction: column;
  103. box-sizing: border-box;
  104. background-color: #fff;
  105. /* #ifndef APP-ANDROID */
  106. min-height: 100%;
  107. /* #endif */
  108. height: 100%;
  109. }
  110. /* #ifndef APP-ANDROID */
  111. view {
  112. font-size: 14px;
  113. line-height: inherit;
  114. }
  115. /* #endif */
  116. /* #endif */
  117. .text {
  118. text-align: center;
  119. font-size: 26rpx;
  120. margin-top: 10rpx;
  121. }
  122. .swiper {
  123. height: 300rpx;
  124. }
  125. .swiper-box {
  126. height: 150px;
  127. }
  128. .swiper-item {
  129. /* #ifndef APP-NVUE */
  130. display: flex;
  131. /* #endif */
  132. flex-direction: column;
  133. justify-content: center;
  134. align-items: center;
  135. color: #fff;
  136. height: 300rpx;
  137. line-height: 300rpx;
  138. }
  139. @media screen and (min-width: 500px) {
  140. .my-image {
  141. width: 100%;
  142. }
  143. }
  144. .grid-body {
  145. /* #ifndef APP-NVUE */
  146. display: flex;
  147. /* #endif */
  148. flex-wrap: wrap;
  149. justify-content: space-between;
  150. margin-top: 40rpx;
  151. }
  152. .grid-item {
  153. width: 32%;
  154. padding: 18px 15px;
  155. margin-bottom: 40rpx;
  156. border-radius: 20rpx;
  157. box-shadow: 0 8rpx 20rpx rgba(24, 144, 255, 0.15);
  158. display: flex;
  159. flex-direction: column;
  160. .my-icon{
  161. text-align: center;
  162. border-radius: 20rpx;
  163. }
  164. }
  165. .purple {color:#6366f1;}
  166. .blue {color:#2563eb; }
  167. .orange {color:#d97706;}
  168. .green {color:#059669;}
  169. .yellow {color:yellow;}
  170. $uni-primary: #2979ff !default;
  171. .uni-section {
  172. background-color: #fff;
  173. .uni-section-header {
  174. position: relative;
  175. /* #ifndef APP-NVUE */
  176. display: flex;
  177. /* #endif */
  178. flex-direction: row;
  179. align-items: center;
  180. padding: 12px 10px;
  181. font-weight: normal;
  182. &__decoration{
  183. margin-right: 6px;
  184. background-color: $uni-primary;
  185. &.line {
  186. width: 4px;
  187. height: 12px;
  188. border-radius: 10px;
  189. }
  190. &.circle {
  191. width: 8px;
  192. height: 8px;
  193. border-top-right-radius: 50px;
  194. border-top-left-radius: 50px;
  195. border-bottom-left-radius: 50px;
  196. border-bottom-right-radius: 50px;
  197. }
  198. &.square {
  199. width: 8px;
  200. height: 8px;
  201. }
  202. }
  203. &__content {
  204. /* #ifndef APP-NVUE */
  205. display: flex;
  206. /* #endif */
  207. flex-direction: column;
  208. flex: 1;
  209. color: #333;
  210. .distraction {
  211. flex-direction: row;
  212. align-items: center;
  213. }
  214. &-sub {
  215. margin-top: 2px;
  216. }
  217. }
  218. }
  219. }
  220. </style>