index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="main">
  3. <view class="user" @click="go('/pages/user/info')">
  4. <image :src="user.avatarUrl ? user.avatarUrl : '../../static/favicon.png'" class="head"></image>
  5. <view class="con" v-if="user.token">
  6. <view class="nickName">微信用户</view>
  7. <view class="welcome">欢迎使用承揽时代</view>
  8. </view>
  9. <view class="con" v-else>
  10. <view class="nickName">你还没登录</view>
  11. <view class="welcome">欢迎使用承揽时代</view>
  12. </view>
  13. <view class="icon">&#xe62b;</view>
  14. </view>
  15. <view class="cmd">
  16. <view class="s_item" @click="go('/pages/authentication/index')">
  17. <text class="icon ic">&#xe600;</text>
  18. <text class="title">我的认证</text>
  19. <text class="icon arrow">&#xe62b;</text>
  20. </view>
  21. <view class="s_item" @click="go('/pages/activity/up')">
  22. <text class="icon ic">&#xe6ed;</text>
  23. <text class="title">我的签约</text>
  24. <text class="icon arrow">&#xe62b;</text>
  25. </view>
  26. <view class="s_item" @click="go('/pages/goods/order')">
  27. <text class="icon ic">&#xe623;</text>
  28. <text class="title">关联企业</text>
  29. <text class="icon arrow">&#xe62b;</text>
  30. </view>
  31. <view class="s_item" @click="go('/pages/notice/index')">
  32. <text class="icon ic">&#xe604;</text>
  33. <text class="title">我的接包</text>
  34. <text class="icon arrow">&#xe62b;</text>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. user: {}
  44. };
  45. },
  46. onShow() {
  47. /* this.user = {
  48. token: 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjI2NTFjMmU4LTAxNzEtNDQwYS04YjA2LTcwOWI3N2ZhNGZiZCJ9.zb2gQaeHZApJkbo4LoSeZfnVVsJJ-QabY7FnsVn13Kf1KUgKeBQ82bwhzD-CqchI1dhUOQFoVh__zeJaJHFWGg'
  49. };
  50. uni.setStorageSync('user', this.user); */
  51. if (this.hasLogin()) {
  52. this.user = this.getUser();
  53. }
  54. },
  55. methods: {
  56. go(url) {
  57. if (this.hasLogin()) {
  58. uni.navigateTo({ url: url });
  59. } else {
  60. uni.navigateTo({ url: '/pages/user/login' });
  61. }
  62. },
  63. //退出登录
  64. exit(url) {
  65. uni.showModal({
  66. title: '提示',
  67. content: '确定退出登录?',
  68. success: (res) => {
  69. if (res.confirm) {
  70. this.http.request({
  71. url: this.http.urls.logout,
  72. success: (res) => {
  73. uni.removeStorageSync('user');
  74. uni.$emit('top');
  75. uni.switchTab({
  76. url: '/pages/index/index'
  77. });
  78. }
  79. });
  80. }
  81. }
  82. });
  83. }
  84. }
  85. };
  86. </script>
  87. <style lang="scss">
  88. .main {
  89. padding: 20px;
  90. }
  91. .user {
  92. overflow: hidden;
  93. image {
  94. float: left;
  95. width: 60px;
  96. height: 60px;
  97. border-radius: 50%;
  98. }
  99. .con {
  100. float: left;
  101. padding-left: 15px;
  102. .nickName {
  103. padding-top: 5px;
  104. }
  105. .welcome {
  106. font-size: 13px;
  107. padding-top: 5px;
  108. color: #989898;
  109. }
  110. }
  111. .icon {
  112. float: right;
  113. margin-top: 14px;
  114. }
  115. }
  116. .exit {
  117. width: 40%;
  118. margin-top: 20px;
  119. }
  120. </style>