home.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" height="80px" dark color="#ffffff" backgroundColor="#1989fa" shadow left-text="退出"
  4. title="主页" @clickLeft="quitLogin()"/>
  5. <uni-grid :column="4" :highlight="true" :borderColor="borderColor">
  6. <uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
  7. <view class="grid-item-box" style="background-color: #fff;margin-:20px;" @click="navClick(item)">
  8. <image :src="item.srcUrl" style="height: 40px;width: 40px;"></image>
  9. <text class="text">{{item.text}}</text>
  10. </view>
  11. </uni-grid-item>
  12. </uni-grid>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. components: {},
  18. data() {
  19. return {
  20. dynamicList: [],
  21. borderColor:'#fff',
  22. list: [{
  23. url: '/pages/inspection/Plan',
  24. srcUrl:require("../../static/img/inspection_01.png"),
  25. text: '巡检计划'
  26. },
  27. {
  28. url: '/pages/inspection/Point',
  29. srcUrl:require("../../static/img/inspection_02.png"),
  30. text: '巡更点'
  31. }
  32. ]
  33. }
  34. },
  35. methods:{
  36. navClick(item){
  37. uni.navigateTo({
  38. url:item.url
  39. })
  40. },
  41. quitLogin(){
  42. console.log('before reomveToken:===='+uni.getStorageSync('token'))
  43. uni.removeStorageSync('token')
  44. console.log('reomveToken:===='+uni.getStorageSync('token'))
  45. uni.showToast({
  46. icon: 'none',
  47. title: '退出成功'
  48. });
  49. uni.navigateTo({
  50. url:"/pages/index/login"
  51. })
  52. }
  53. },
  54. }
  55. </script>
  56. <style lang="scss">
  57. .image {
  58. width: 25px;
  59. height: 25px;
  60. }
  61. .text {
  62. font-size: 14px;
  63. margin-top: 5px;
  64. }
  65. .grid-dynamic-box {
  66. margin-bottom: 15px;
  67. }
  68. .grid-item-box {
  69. flex: 1;
  70. // position: relative;
  71. /* #ifndef APP-NVUE */
  72. display: flex;
  73. /* #endif */
  74. flex-direction: column;
  75. align-items: center;
  76. justify-content: center;
  77. padding: 15px 0;
  78. }
  79. </style>