index.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view>
  3. <home v-if="PageCur=='home'"></home>
  4. <my v-if="PageCur=='my'"></my>
  5. <view class="cu-bar tabbar bg-white shadow foot">
  6. <view class="action" @click="NavChange" data-cur="home">
  7. <view class="cuIcon-cu-image">
  8. <image :src="'/static/icons/home' + [PageCur=='home'?'_cur':''] + '.png'"></image>
  9. </view>
  10. <view :class="PageCur=='home'?'text-green':'text-gray'">首页</view>
  11. </view>
  12. <view class="action" @click="NavChange" data-cur="my">
  13. <view class="cuIcon-cu-image">
  14. <image :src="'/static/icons/my' + [PageCur == 'my'?'_cur':''] + '.png'"></image>
  15. </view>
  16. <view :class="PageCur=='my'?'text-green':'text-gray'">我的</view>
  17. </view>
  18. </view>
  19. <!-- <view style="position: absolute;bottom:80px;right:40px;">aaa</view> -->
  20. </view>
  21. </template>
  22. <script>
  23. import { _login } from "../login/login-model";
  24. export default {
  25. data() {
  26. return {
  27. PageCur: "home"
  28. };
  29. },
  30. created() {
  31. this.loadUserInfo();
  32. },
  33. methods: {
  34. NavChange: function(e) {
  35. this.PageCur = e.currentTarget.dataset.cur;
  36. },
  37. loadUserInfo() {
  38. /* _login.userInfo(res => {
  39. const { data: { code,data: { user } } } = res;
  40. uni.setStorageSync("userInfo", user);
  41. if(code === 401){
  42. this.$msg("登录已过期,请重新登录");
  43. uni.removeStorageSync("userinfo");
  44. uni.removeStorageSync("token");
  45. setTimeout(()=>{
  46. wx.redirectTo({
  47. url: "/pages/login/index"
  48. });
  49. },1500)
  50. }
  51. }); */
  52. }
  53. }
  54. };
  55. </script>
  56. <style>
  57. </style>