me.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. pageCurrent: 'me',
  47. text: '',
  48. driverInfo: {
  49. driverName: '',
  50. driverState: 0,
  51. defaultTruckCode: ''
  52. }
  53. }
  54. },
  55. methods: {
  56. initData() {
  57. let _that = this;
  58. request.httpPost("/dnyDriver/getDriverInfo", {}).then(res => {
  59. if (res.httpCode == 200) {
  60. // console.log("3333", res.data)
  61. _that.driverInfo = res.data
  62. _that.text = res.data.driverName.charAt(0)
  63. } else {
  64. uni.showToast({
  65. title: res.msg,
  66. icon: "error"
  67. })
  68. }
  69. });
  70. },
  71. navTo(url) {
  72. // console.log("22222")
  73. uni.navigateTo({
  74. url: url
  75. });
  76. },
  77. logout() {
  78. uni.removeStorageSync('erpToken');
  79. uni.reLaunch({
  80. url: '/pages/login/login'
  81. });
  82. }
  83. }
  84. }
  85. </script>
  86. <style>
  87. .cu-bar {
  88. padding-left: 60rpx;
  89. padding-top: 30rpx;
  90. }
  91. .avatar-txt span {
  92. display: block;
  93. width: 100;
  94. }
  95. .list-con {
  96. margin-top: 50rpx;
  97. }
  98. .w-h-100 {
  99. height: 100%;
  100. width: 100%;
  101. }
  102. .uni-row .flex-item-30 {
  103. color: #8799a3;
  104. }
  105. .flex-item-30 {
  106. flex-basis: 30%;
  107. }
  108. .flex-item-70 {
  109. flex-basis: 70%;
  110. }
  111. </style>