me.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="w-h-100">
  3. <view class="cu-bar">
  4. <u-row gutter="20">
  5. <u-col span="4">
  6. <view>
  7. <u-avatar
  8. :text="text"
  9. fontSize="18"
  10. randomBgColor
  11. ></u-avatar>
  12. </view>
  13. </u-col>
  14. <u-col span="8">
  15. <view class="avatar-txt">
  16. <span>{{driverInfo.driverName}}(<b
  17. style="color: #e4493c;">{{driverInfo.driverState == 1? '已审核' : '未审核'}}</b>)</span>
  18. <span>{{driverInfo.defaultTruckCode}}</span>
  19. </view>
  20. </u-col>
  21. </u-row>
  22. </view>
  23. <view class="list-con">
  24. <u-cell-group>
  25. <!-- <u-cell :isLink="true" title="我的资料" icon="account"></u-cell>-->
  26. <u-cell :isLink="true" title="我的车辆" icon="car" @click="navTo('/pages/index/myTruckList')"></u-cell>
  27. <!-- <u-cell :isLink="true" title="已配送订单(当月)" icon="order"></u-cell>-->
  28. </u-cell-group>
  29. </view>
  30. <view class="padding-lr padding-tb-xs">
  31. <button class="cu-btn block shadow bg-white margin text-red" @tap="logout">退出登录</button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import request from '@/common/libs/request.js';
  37. export default {
  38. mounted() {
  39. this.initData()
  40. uni.setNavigationBarTitle({
  41. title:'个人中心'
  42. })
  43. },
  44. data() {
  45. return {
  46. text: '',
  47. driverInfo: {
  48. driverName: '',
  49. driverState: 0,
  50. defaultTruckCode: ''
  51. }
  52. }
  53. },
  54. methods: {
  55. initData() {
  56. let _that = this;
  57. request.httpPost("/dnyDriver/getDriverInfo", {}).then(res => {
  58. if (res.httpCode == 200) {
  59. // console.log("3333", res.data)
  60. _that.driverInfo = res.data
  61. _that.text = res.data.driverName.charAt(0)
  62. } else {
  63. uni.showToast({
  64. title: res.msg,
  65. icon: "error"
  66. })
  67. }
  68. });
  69. },
  70. navTo(url) {
  71. console.log("22222")
  72. uni.navigateTo({
  73. url: url
  74. });
  75. },
  76. logout() {
  77. uni.removeStorageSync('erpToken');
  78. uni.reLaunch({
  79. url: '/pages/login/login'
  80. });
  81. }
  82. }
  83. }
  84. </script>
  85. <style>
  86. .cu-bar {
  87. padding-left: 60rpx;
  88. padding-top: 30rpx;
  89. }
  90. .avatar-txt span {
  91. display: block;
  92. width: 100;
  93. }
  94. .list-con {
  95. margin-top: 50rpx;
  96. }
  97. .w-h-100 {
  98. height: 100%;
  99. width: 100%;
  100. }
  101. .uni-row .flex-item-30 {
  102. color: #8799a3;
  103. }
  104. .flex-item-30 {
  105. flex-basis: 30%;
  106. }
  107. .flex-item-70 {
  108. flex-basis: 70%;
  109. }
  110. </style>