index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="main">
  3. <view class="user" @click="go('/pages/user/auth')">
  4. <image :src="user.avatar ? ip + user.avatar : '../../static/favicon.png'" class="head"></image>
  5. <view class="con" v-if="user.id">
  6. <view class="nickName">{{ user.type == 0 ? '个人用户' : '企业用户' }}</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 edit">&#xe62b;</view>
  14. </view>
  15. <view class="cmd">
  16. <view class="s_item" @click="go('/pages/help/my')">
  17. <text class="icon ic" style="color: #f44336">&#xe60b;</text>
  18. <text class="title">我的回访</text>
  19. <text class="icon arrow">&#xe62b;</text>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. ip: this.http.ip,
  29. user: {},
  30. type: [
  31. { name: '找工作(个人)', value: 0 },
  32. { name: '我要招聘(企业)', value: 1 }
  33. ],
  34. show: false
  35. };
  36. },
  37. onShow() {
  38. /* this.user = {
  39. token: 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjdhZGY4MzFmLWE0NjQtNGY5YS04YTY5LWMzM2QyNDU2MzI2ZSJ9.EPHElRmlVoFTfT4OxHNpvIC7bDKc1gKpNiO1u_dBOerYh5JFIuSrSkgp0PtQ0kOhO9iuvU0dttEGbsgofdrcpQ'
  40. };
  41. uni.setStorageSync('user', this.user); */
  42. if (this.hasLogin()) {
  43. this.getUserInfo();
  44. } else {
  45. this.user = {};
  46. }
  47. },
  48. methods: {
  49. getUserInfo() {
  50. this.http.request({
  51. url: '/app/user/info',
  52. success: (res) => {
  53. this.user = res.data.data;
  54. uni.setStorageSync('money', res.data.data.money || 0);
  55. uni.setStorageSync('bankName', res.data.data.bankName);
  56. if (res.data.data.type == null) {
  57. uni.navigateTo({ url: '/pages/user/switch' });
  58. return;
  59. }
  60. }
  61. });
  62. },
  63. go(url) {
  64. if (this.hasLogin()) {
  65. uni.navigateTo({ url: url });
  66. } else {
  67. uni.navigateTo({ url: '/pages/user/login' });
  68. }
  69. }
  70. },
  71. onShareAppMessage: function (res) {
  72. return {
  73. title: '爱就业咨询服务平台',
  74. path: '/pages/index/index',
  75. imageUrl: 'https://chenglantimes.com/prod-api/profile/upload/2024/06/16/blob_20240616055022A009.jpeg',
  76. success: (res) => {},
  77. fail: (res) => {}
  78. };
  79. }
  80. };
  81. </script>
  82. <style lang="scss">
  83. .main {
  84. padding: 5px 15px 25px 15px;
  85. .user {
  86. overflow: hidden;
  87. image {
  88. float: left;
  89. width: 60px;
  90. height: 60px;
  91. border-radius: 50%;
  92. }
  93. .con {
  94. float: left;
  95. padding-left: 15px;
  96. .nickName {
  97. padding-top: 5px;
  98. }
  99. .welcome {
  100. font-size: 14px;
  101. padding-top: 5px;
  102. color: #989898;
  103. .icon {
  104. padding-right: 3px;
  105. }
  106. }
  107. }
  108. .edit {
  109. float: right;
  110. margin-top: 14px;
  111. }
  112. }
  113. }
  114. </style>