home.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="home">
  3. <!-- <uni-notice-bar show-icon scrollable
  4. text="uni-app 版正式发布,开发一次,同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。" /> -->
  5. <!-- <uni-card v-for="i in userInfoData.menus" :key="i.id">
  6. <view class="title">
  7. {{i.name}}
  8. </view>
  9. <view class="menu-list-warp">
  10. <view class="menu-list-box" v-for="j in i.children" :key="j.id" @click="toRouter(j)">
  11. <image :src="'../static/' + j.icon" mode=""></image>
  12. <view class="">
  13. {{j.name}}
  14. </view>
  15. </view>
  16. </view>
  17. </uni-card> -->
  18. <uni-card>
  19. <view class="title">
  20. 库存
  21. </view>
  22. <view class="menu-list-warp">
  23. <view class="menu-list-box" @click="toRouter('/submit/submit')">
  24. <image :src="'../static/smck.png'" mode=""></image>
  25. <view class="">
  26. 异常上报
  27. </view>
  28. </view>
  29. <view class="menu-list-box" @click="toRouter('/usedTotal/usedTotal')" v-if="isRoom">
  30. <image :src="'../static/tj.png'" mode=""></image>
  31. <view class="">
  32. 库存统计
  33. </view>
  34. </view>
  35. </view>
  36. </uni-card>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. getInfo
  42. } from "@/util/api.js";
  43. import Vue from 'vue'
  44. export default {
  45. data() {
  46. return {
  47. userInfoData: [],
  48. notificationData: [],
  49. isRoom: false,
  50. }
  51. },
  52. onLoad() {
  53. // wx.requestSubscribeMessage({
  54. // tmplIds: ['Tt0C6SOrtd2QXIdLqrm0CNdarUE4LG_lNJblUnkqTPM'],
  55. // success(res) {
  56. // },
  57. // fail(err){
  58. // console.log(err)
  59. // }
  60. // })
  61. const v = this
  62. if (
  63. Vue.prototype.$token.role_id == '1552548151620026370' ||
  64. Vue.prototype.$token.role_id == '1552550790307004417' ||
  65. Vue.prototype.$token.role_id == '1552550978346041346') {
  66. this.isRoom = true
  67. }
  68. // v.$post('/wx/login/getUserInfo').then(res => {
  69. // v.userInfoData = res.data
  70. // Vue.prototype.$userInfo = res.data
  71. // uni.setStorage({
  72. // key: "userInfo",
  73. // data: res.data,
  74. // success(res) {
  75. // },
  76. // fail(res) {}
  77. // })
  78. // })
  79. // v.$post('/wx/message/notification',{}).then(res=>{
  80. // v.notificationData = res.data
  81. // })
  82. },
  83. methods: {
  84. toRouter(j) {
  85. console.log(j)
  86. wx.requestSubscribeMessage({
  87. tmplIds: ['Tt0C6SOrtd2QXIdLqrm0CNdarUE4LG_lNJblUnkqTPM'],
  88. success(res) {
  89. },
  90. fail(err){
  91. console.log(err)
  92. }
  93. })
  94. uni.navigateTo({
  95. url: '/pages' + j
  96. })
  97. },
  98. },
  99. }
  100. </script>
  101. <style lang="less">
  102. .menu-list-warp {
  103. .menu-list-box {
  104. width: 25%;
  105. text-align: center;
  106. float: left;
  107. padding: 20rpx;
  108. image {
  109. width: 100rpx;
  110. height: 100rpx;
  111. }
  112. }
  113. }
  114. </style>