1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
| <template>
| <view class="content">
| <uniNavBar title="我的车辆" status-bar="true" class="header-bar" background-color="#fff" left-icon="back" color="#000" @clickLeft="goBack" >
| </uniNavBar>
| <!-- <div class="gap"></div> -->
| <view v-if="myCarList.length>0">
| <view class='cont' v-for="(i,index) in myCarList" :key="index" >
| <uni-icons class="del" v-show="isShowEdit" @click="delItem(i)" type="minus-filled" size="20" color="#ff0000"></uni-icons>
| <text>{{i}}</text>
| </view>
| </view>
| <view v-else class="tip">暂无车牌号,请联系管理员进行添加</view>
| </view>
| </template>
|
| <script>
| export default {
| data() {
| return {
| options:[{
| text: '删除',
| style: {
| backgroundColor: '#ff0000'
| }
| }],
| isShowEdit: false,
| isEditable: true,
| myCarList:[],
| }
| },
| methods: {
| async getCarList(){
| console.log(JSON.parse(uni.getStorageSync('user')));
| let {userId} = JSON.parse(uni.getStorageSync('user'));
| console.log(userId)
| let res = await this.$api.syncRequest({
| url: '/basic/api/user/myPlateNos?userId='+userId
| });
| if(res.data.success){
| this.myCarList = res.data.data;
|
| }
| },
| updateStorage(){
| let user = JSON.parse(uni.getStorageSync('user'));
| user.plateNos = this.myCarList;
| debugger
| //localStorage.setItem('user',JSON.stringify(user));
| uni.setStorageSync('user',JSON.stringify(user))
| },
| goBack(){
| uni.navigateBack({
| delta: 1,
| animationType: 'pop-out',
| animationDuration: 200
| });
| },
| },
| mounted(){
| //this.getCarList();
| console.log(JSON.parse(uni.getStorageSync('user')))
| this.getCarList();
| },
| onShow(){
| console.log(JSON.parse(uni.getStorageSync('user')))
| this.getCarList();
| },
| onBackPress(e){
| console.log(e);
| uni.navigateTo({
| url:'/pages/mine/mine'
| })
| return true
| },
| }
| </script>
|
| <style>
| .cont{
| line-height: 80rpx;
| height: 80rpx;
| padding-left: 40rpx;
| border-bottom: 1px solid #eee;
| }
| .tip{
| height: 100rpx;
| line-height: 100rpx;
| text-align: center;
| color: #999999;
| font-size: 14px;
| }
| </style>
|
|