me.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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" url="/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. logout() {
  71. uni.removeStorageSync('erpToken');
  72. uni.reLaunch({
  73. url: '/pages/login/login'
  74. });
  75. }
  76. }
  77. }
  78. </script>
  79. <style>
  80. .cu-bar {
  81. padding-left: 60rpx;
  82. padding-top: 30rpx;
  83. }
  84. .avatar-txt span {
  85. display: block;
  86. width: 100;
  87. }
  88. .list-con {
  89. margin-top: 50rpx;
  90. }
  91. .w-h-100 {
  92. height: 100%;
  93. width: 100%;
  94. }
  95. .uni-row .flex-item-30 {
  96. color: #8799a3;
  97. }
  98. .flex-item-30 {
  99. flex-basis: 30%;
  100. }
  101. .flex-item-70 {
  102. flex-basis: 70%;
  103. }
  104. </style>