index.uvue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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/InfoList"},
  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.png'
  66. },
  67. ] as ImageItem[]
  68. }
  69. },
  70. methods: {
  71. clickBannerItem(item:ImageItem) {
  72. console.info(item)
  73. },
  74. changeSwiper(e:UniSwiperChangeEvent) {
  75. this.current = e.detail.current
  76. },
  77. enterItem(e:Item) {
  78. if (e.path != null && e.path != "") {
  79. uni.navigateTo({
  80. url: e.path as string
  81. });
  82. } else {
  83. uni.showToast({
  84. title: '模块建设中~',
  85. icon: 'none'
  86. });
  87. }
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss">
  93. /* #ifndef APP-NVUE */
  94. .my-page {
  95. display: flex;
  96. flex-direction: column;
  97. box-sizing: border-box;
  98. background-color: #fff;
  99. /* #ifndef APP-ANDROID */
  100. min-height: 100%;
  101. /* #endif */
  102. height: 100%;
  103. }
  104. /* #ifndef APP-ANDROID */
  105. view {
  106. font-size: 14px;
  107. line-height: inherit;
  108. }
  109. /* #endif */
  110. /* #endif */
  111. .text {
  112. text-align: center;
  113. font-size: 26rpx;
  114. margin-top: 10rpx;
  115. }
  116. .swiper {
  117. height: 300rpx;
  118. }
  119. .swiper-box {
  120. height: 150px;
  121. }
  122. .swiper-item {
  123. /* #ifndef APP-NVUE */
  124. display: flex;
  125. /* #endif */
  126. flex-direction: column;
  127. justify-content: center;
  128. align-items: center;
  129. color: #fff;
  130. height: 300rpx;
  131. line-height: 300rpx;
  132. }
  133. @media screen and (min-width: 500px) {
  134. .my-image {
  135. width: 100%;
  136. }
  137. }
  138. .grid-body {
  139. /* #ifndef APP-NVUE */
  140. display: flex;
  141. /* #endif */
  142. flex-wrap: wrap;
  143. justify-content: space-between;
  144. margin-top: 40rpx;
  145. }
  146. .grid-item {
  147. width: 32%;
  148. padding: 18px 15px;
  149. margin-bottom: 40rpx;
  150. border-radius: 20rpx;
  151. box-shadow: 0 8rpx 20rpx rgba(24, 144, 255, 0.15);
  152. display: flex;
  153. flex-direction: column;
  154. .my-icon{
  155. text-align: center;
  156. border-radius: 20rpx;
  157. }
  158. }
  159. .purple {color:#6366f1;}
  160. .blue {color:#2563eb; }
  161. .orange {color:#d97706;}
  162. .green {color:#059669;}
  163. .yellow {color:yellow;}
  164. $uni-primary: #2979ff !default;
  165. .uni-section {
  166. background-color: #fff;
  167. .uni-section-header {
  168. position: relative;
  169. /* #ifndef APP-NVUE */
  170. display: flex;
  171. /* #endif */
  172. flex-direction: row;
  173. align-items: center;
  174. padding: 12px 10px;
  175. font-weight: normal;
  176. &__decoration{
  177. margin-right: 6px;
  178. background-color: $uni-primary;
  179. &.line {
  180. width: 4px;
  181. height: 12px;
  182. border-radius: 10px;
  183. }
  184. &.circle {
  185. width: 8px;
  186. height: 8px;
  187. border-top-right-radius: 50px;
  188. border-top-left-radius: 50px;
  189. border-bottom-left-radius: 50px;
  190. border-bottom-right-radius: 50px;
  191. }
  192. &.square {
  193. width: 8px;
  194. height: 8px;
  195. }
  196. }
  197. &__content {
  198. /* #ifndef APP-NVUE */
  199. display: flex;
  200. /* #endif */
  201. flex-direction: column;
  202. flex: 1;
  203. color: #333;
  204. .distraction {
  205. flex-direction: row;
  206. align-items: center;
  207. }
  208. &-sub {
  209. margin-top: 2px;
  210. }
  211. }
  212. }
  213. }
  214. </style>