my.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="container">
  3. <view class="placeholder"></view>
  4. <!-- 每一个选项 -->
  5. <view class="box" v-for="item in list" :key="item.id" @click="handleClick(item)">
  6. <view class="icon">
  7. <img :src="item.icon">
  8. </view>
  9. <view class="title">
  10. {{item.title}}
  11. </view>
  12. <view class="right">
  13. <img src="../static/imgs/right.png">
  14. </view>
  15. </view>
  16. <!-- 底部导航栏区域 -->
  17. <view class="tab_bar">
  18. <navigator open-type="redirect" url="/pagesClockIn/home/home" class="tab_box">
  19. <img v-if="pageUrl=='pagesClockIn/home/home'" src="../static/imgs/home_active.png">
  20. <img v-else src="../static/imgs/home.png">
  21. <view v-if="pageUrl=='pagesClockIn/home/home'" class="tab_title_active">
  22. 首页
  23. </view>
  24. <view v-else class="tab_title">
  25. 首页
  26. </view>
  27. </navigator>
  28. <navigator open-type="redirect" url="/pagesClockIn/stat/stat" class="tab_box">
  29. <img v-if="pageUrl=='pagesClockIn/stat/stat'" src="../static/imgs/stat_active.png">
  30. <img v-else src="../static/imgs/stat.png">
  31. <view v-if="pageUrl=='pagesClockIn/stat/stat'" class="tab_title_active">
  32. 统计
  33. </view>
  34. <view v-else class="tab_title">
  35. 统计
  36. </view>
  37. </navigator>
  38. <navigator open-type="redirect" v-if="flag" url="/pagesClockIn/my/my" class="tab_box">
  39. <img v-if="pageUrl=='pagesClockIn/my/my'" src="../static/imgs/my_active.png">
  40. <img v-else src="../static/imgs/my.png">
  41. <view v-if="pageUrl=='pagesClockIn/my/my'" class="tab_title_active">
  42. 我的
  43. </view>
  44. <view v-else class="tab_title">
  45. 我的
  46. </view>
  47. </navigator>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data() {
  54. return {
  55. // 是否为管理员标识
  56. flag: false,
  57. // 页面选项数组
  58. list: [{
  59. id: 1,
  60. icon: "../static/imgs/my1.png",
  61. title: "规则设置",
  62. url: "/pagesClockIn/ruleSet/ruleSet"
  63. },
  64. {
  65. id: 2,
  66. icon: "../static/imgs/my2.png",
  67. title: "权限设置",
  68. url: "/pagesClockIn/powerSet/powerSet"
  69. },
  70. {
  71. id: 3,
  72. icon: "../static/imgs/my3.png",
  73. title: "打卡记录",
  74. url: "/pagesClockIn/cardRecord/cardRecord"
  75. },
  76. {
  77. id: 4,
  78. icon: "../static/imgs/my4.png",
  79. title: "考勤组",
  80. url: "/pagesClockIn/group/group?flag=1"
  81. },
  82. ],
  83. // 当前页面的路由地址
  84. pageUrl: ""
  85. };
  86. },
  87. onLoad() {
  88. },
  89. onShow() {
  90. this.getPageUrl()
  91. let flag = uni.getStorageSync("manager")
  92. let flag2 = uni.getStorageSync("sub-administrator")
  93. if (flag || flag2) {
  94. this.flag = true
  95. } else {
  96. this.flag = false
  97. uni.redirectTo({
  98. url:"/pagesClockIn/404/404"
  99. })
  100. }
  101. },
  102. methods: {
  103. handleClick(item) {
  104. // console.log(item.url);
  105. uni.navigateTo({
  106. url: item.url
  107. })
  108. },
  109. getPageUrl() {
  110. // 获取当前打开过的页面路由数组
  111. let routes = getCurrentPages();
  112. // 获取当前页面路由,也就是最后一个打开的页面路由
  113. let curRoute = routes[routes.length - 1].route
  114. this.pageUrl = curRoute
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .container {
  121. min-width: 100vw;
  122. min-height: 100vh;
  123. background-color: #F2F2F2;
  124. .placeholder {
  125. height: 30rpx;
  126. }
  127. .box {
  128. display: flex;
  129. width: 750rpx;
  130. height: 110rpx;
  131. line-height: 110rpx;
  132. border-bottom: 1rpx solid #DDDDDD;
  133. background-color: #fff;
  134. .icon {
  135. flex: 1;
  136. text-align: center;
  137. img {
  138. margin-top: 36rpx;
  139. width: 42rpx;
  140. height: 38rpx;
  141. }
  142. }
  143. .title {
  144. flex: 5;
  145. font-size: 30rpx;
  146. font-weight: 400;
  147. }
  148. .right {
  149. flex: 1;
  150. text-align: center;
  151. img {
  152. width: 24rpx;
  153. height: 32rpx;
  154. }
  155. }
  156. }
  157. .tab_bar {
  158. position: fixed;
  159. left: 0;
  160. bottom: 0;
  161. display: flex;
  162. width: 750rpx;
  163. height: 128rpx;
  164. border-top: 1rpx solid #CCC;
  165. background-color: #fff;
  166. .tab_box {
  167. flex: 1;
  168. display: flex;
  169. flex-direction: column;
  170. justify-content: center;
  171. align-items: center;
  172. img {
  173. margin-bottom: 10rpx;
  174. width: 54rpx;
  175. height: 48rpx;
  176. }
  177. .tab_title {
  178. font-size: 20rpx;
  179. }
  180. .tab_title_active {
  181. font-size: 20rpx;
  182. color: #0082FC;
  183. }
  184. }
  185. }
  186. }
  187. </style>