home.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="home">
  3. <commons-header></commons-header>
  4. <uni-card v-for="i in userInfoData.menus" :key="i.id">
  5. <view class="title">
  6. {{i.name}}
  7. </view>
  8. <view class="menu-list-warp">
  9. <view class="menu-list-box" v-for="j in i.children" :key="j.id" @click="toRouter(j)">
  10. <image :src="'../static/' + j.icon" mode=""></image>
  11. <view class="">
  12. {{j.name}}
  13. </view>
  14. </view>
  15. </view>
  16. </uni-card>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. getInfo
  22. } from "@/util/api.js";
  23. import Vue from 'vue'
  24. import commonsHeader from '../components/commons-header/index.vue'
  25. export default {
  26. components:{
  27. commonsHeader
  28. },
  29. data() {
  30. return {
  31. userInfoData: [],
  32. notificationData:[],
  33. }
  34. },
  35. onLoad() {
  36. const v = this
  37. // v.$post('/wx/login/getUserInfo').then(res => {
  38. // v.userInfoData = res.data
  39. // Vue.prototype.$userInfo = res.data
  40. // uni.setStorage({
  41. // key: "userInfo",
  42. // data: res.data,
  43. // success(res) {
  44. // },
  45. // fail(res) {}
  46. // })
  47. // })
  48. // v.$post('/wx/message/notification',{}).then(res=>{
  49. // v.notificationData = res.data
  50. // })
  51. },
  52. methods: {
  53. toRouter(j) {
  54. console.log(j)
  55. uni.navigateTo({
  56. url: '/pages/' + j.menuKey + '/' + j.menuKey
  57. })
  58. },
  59. },
  60. }
  61. </script>
  62. <style lang="less">
  63. .home{
  64. background-color: #e9e9e9;
  65. }
  66. .menu-list-warp {
  67. .menu-list-box {
  68. width: 25%;
  69. text-align: center;
  70. float: left;
  71. padding: 20rpx;
  72. image {
  73. width: 100rpx;
  74. height: 100rpx;
  75. }
  76. }
  77. }
  78. </style>