roadlist.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view>
  3. <u-navbar
  4. title="停车场列表"
  5. title-color="#fff"
  6. :custom-back="customBack"
  7. :border-bottom="false"
  8. back-icon-color="#CCE8FF"
  9. :background="{background: 'linear-gradient(145deg, #41AFF9 0%, #2D8CFB 100%)' }"></u-navbar>
  10. <view class="road-list">
  11. <view class="road-list-item" v-for="item in Roads" :key="item.id" @click="handleModifyRoad(item.id)">
  12. <view class="name">{{item.roadName}}</view>
  13. <view class="position">{{item.roadName}}</view>
  14. <view class="distance">{{item.roadName}}</view>
  15. </view>
  16. </view>
  17. <u-toast ref="uToast" />
  18. </view>
  19. </template>
  20. <script>
  21. export default{
  22. data(){
  23. return{
  24. Roads:[],
  25. }
  26. },
  27. onLoad(){
  28. this.Roads = this.$store.state.vuex_user?.roadList;
  29. console.log('Roads',JSON.parse(JSON.stringify(this.Roads)));
  30. },
  31. onShow(){
  32. },
  33. methods:{
  34. customBack(){
  35. this.$u.route({
  36. // type:'switchTab',
  37. url: 'pages/index/index'
  38. });
  39. },
  40. handleModifyRoad(id){
  41. console.log('id',id);
  42. this.$u.api.modifyRoad({roadId:id})
  43. .then(res=>{
  44. this.$refs.uToast.show({
  45. title: res.msg,
  46. type: 'success',
  47. url: 'pages/index/index'
  48. });
  49. console.log('modifyRoad',res)
  50. }).catch(err=>{
  51. this.$refs.uToast.show({
  52. title: err.msg,
  53. type: 'error',
  54. });
  55. console.log('modifyRoad ',err)
  56. });
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss">
  62. @import './roadlist.scss'
  63. </style>