index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="work-container">
  3. <!-- 轮播图 -->
  4. <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
  5. <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
  6. <swiper-item v-for="(item, index) in data" :key="index">
  7. <view class="swiper-item" @click="clickBannerItem(item)">
  8. <image :src="item.image" mode="aspectFill" :draggable="false" />
  9. </view>
  10. </swiper-item>
  11. </swiper>
  12. </uni-swiper-dot>
  13. <!-- 宫格组件 -->
  14. <uni-section title="系统管理" type="line"></uni-section>
  15. <view class="grid-body">
  16. <uni-grid :column="4" :showBorder="false">
  17. <uni-grid-item>
  18. <view class="grid-item-box" @click="changeTo('/pages/work/myclass')">
  19. <uni-icons type="person-filled" size="30"></uni-icons>
  20. <text class="text">我的班级</text>
  21. </view>
  22. </uni-grid-item>
  23. <uni-grid-item>
  24. <view class="grid-item-box" @click="changeTo('/pages/work/mylession')">
  25. <uni-icons type="staff-filled" size="30"></uni-icons>
  26. <text class="text">我的课程</text>
  27. </view>
  28. </uni-grid-item>
  29. <uni-grid-item>
  30. <view class="grid-item-box" @click="changeTo('/pages/work/myresource')">
  31. <uni-icons type="color" size="30"></uni-icons>
  32. <text class="text">我的资料</text>
  33. </view>
  34. </uni-grid-item>
  35. <uni-grid-item v-if="is_admin">
  36. <view class="grid-item-box" @click="changeTo('/pages/appmanager/classmanager?parentId=100')">
  37. <uni-icons type="settings-filled" size="30"></uni-icons>
  38. <text class="text">班级管理</text>
  39. </view>
  40. </uni-grid-item>
  41. <uni-grid-item>
  42. <view class="grid-item-box">
  43. <uni-icons type="heart-filled" size="30"></uni-icons>
  44. <text class="text">岗位管理</text>
  45. </view>
  46. </uni-grid-item>
  47. <uni-grid-item>
  48. <view class="grid-item-box">
  49. <uni-icons type="bars" size="30"></uni-icons>
  50. <text class="text">字典管理</text>
  51. </view>
  52. </uni-grid-item>
  53. <uni-grid-item>
  54. <view class="grid-item-box">
  55. <uni-icons type="gear-filled" size="30"></uni-icons>
  56. <text class="text">参数设置</text>
  57. </view>
  58. </uni-grid-item>
  59. <uni-grid-item>
  60. <view class="grid-item-box">
  61. <uni-icons type="chat-filled" size="30"></uni-icons>
  62. <text class="text">通知公告</text>
  63. </view>
  64. </uni-grid-item>
  65. <uni-grid-item>
  66. <view class="grid-item-box">
  67. <uni-icons type="wallet-filled" size="30"></uni-icons>
  68. <text class="text">日志管理</text>
  69. </view>
  70. </uni-grid-item>
  71. </uni-grid>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. is_admin: false,
  80. is_user: false,
  81. user_info:{},
  82. current: 0,
  83. swiperDotIndex: 0,
  84. data: [{
  85. image: '/static/images/banner/banner01.jpg'
  86. },
  87. {
  88. image: '/static/images/banner/banner02.jpg'
  89. },
  90. {
  91. image: '/static/images/banner/banner03.jpg'
  92. }
  93. ]
  94. }
  95. },
  96. onLoad() {
  97. this.user_info = uni.getStorageSync("user_info");
  98. for(let i=0;i<this.user_info.roles.length;i++){
  99. if(this.user_info.roles[i] == "admin" && this.user_info.user.userName == "admin"){
  100. this.is_admin = true
  101. break
  102. }
  103. }
  104. console.log("ssss:::",this.user_info.roles.length)
  105. },
  106. methods: {
  107. clickBannerItem(item) {
  108. console.info(item)
  109. },
  110. changeSwiper(e) {
  111. this.current = e.detail.current
  112. },
  113. changeGrid(e) {
  114. this.$modal.showToast('模块建设中~')
  115. },
  116. changeTo(path) {
  117. this.$tab.navigateTo(path)
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. /* #ifndef APP-NVUE */
  124. page {
  125. display: flex;
  126. flex-direction: column;
  127. box-sizing: border-box;
  128. background-color: #fff;
  129. min-height: 100%;
  130. height: auto;
  131. }
  132. view {
  133. font-size: 14px;
  134. line-height: inherit;
  135. }
  136. /* #endif */
  137. .text {
  138. text-align: center;
  139. font-size: 26rpx;
  140. margin-top: 10rpx;
  141. }
  142. .grid-item-box {
  143. flex: 1;
  144. /* #ifndef APP-NVUE */
  145. display: flex;
  146. /* #endif */
  147. flex-direction: column;
  148. align-items: center;
  149. justify-content: center;
  150. padding: 15px 0;
  151. }
  152. .uni-margin-wrap {
  153. width: 690rpx;
  154. width: 100%;
  155. ;
  156. }
  157. .swiper {
  158. height: 300rpx;
  159. }
  160. .swiper-box {
  161. height: 150px;
  162. }
  163. .swiper-item {
  164. /* #ifndef APP-NVUE */
  165. display: flex;
  166. /* #endif */
  167. flex-direction: column;
  168. justify-content: center;
  169. align-items: center;
  170. color: #fff;
  171. height: 300rpx;
  172. line-height: 300rpx;
  173. }
  174. @media screen and (min-width: 500px) {
  175. .uni-swiper-dot-box {
  176. width: 400px;
  177. /* #ifndef APP-NVUE */
  178. margin: 0 auto;
  179. /* #endif */
  180. margin-top: 8px;
  181. }
  182. .image {
  183. width: 100%;
  184. }
  185. }
  186. </style>