From 38430ddb8612fce15a2f1c940f9bd57d4da3e70b Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 16 九月 2021 11:59:39 +0800
Subject: [PATCH] add new key

---
 pages/myCarList/myCarList.vue |  302 +++++++++++++++++++++++++-------------------------
 1 files changed, 151 insertions(+), 151 deletions(-)

diff --git a/pages/myCarList/myCarList.vue b/pages/myCarList/myCarList.vue
index 750d9a3..4f2f1d3 100644
--- a/pages/myCarList/myCarList.vue
+++ b/pages/myCarList/myCarList.vue
@@ -1,173 +1,173 @@
 <template>
 	<view class="content">
-		<uniNavBar title="鎴戠殑杞﹁締" status-bar="true" class="header-bar" background-color="#fff" left-icon="back" :right-text="isShowEdit?'瀹屾垚':'缂栬緫'" color="#000" @clickLeft="goBack" @clickRight="edit">
-		</uniNavBar>
-		<!-- <div class="gap"></div> -->
-		<view>
-			<uni-swipe-action ref="swipeBar">
-			    <uni-swipe-action-item :disabled="isShowEdit" :options="options" @click="onClick($event,i)" @change="change" v-for="(i,index) in myCarList" :key="index">
-			        <view class='cont'>
-						<uni-icons class="del" v-show="isShowEdit" @click="delItem(i)" type="minus-filled" size="20" color="#ff0000"></uni-icons>
-						<text>{{i}}</text>
-					</view>
-			    </uni-swipe-action-item>
-			</uni-swipe-action>
-		</view>
-
-		<button class="add" type="default" @click="toAddCar">
-			<uni-icons class="plus" type="plus" size="20" color="#fff"></uni-icons>
-			娣诲姞杞﹁締
+		<uniNavBar title="鎴戠殑杞﹁締" status-bar="true" class="header-bar" background-color="#fff" left-icon="back" :right-text="isShowEdit?'瀹屾垚':'缂栬緫'" color="#000" @clickLeft="goBack" @clickRight="edit">
+		</uniNavBar>
+		<!-- <div class="gap"></div> -->
+		<view>
+			<uni-swipe-action ref="swipeBar">
+			    <uni-swipe-action-item :disabled="isShowEdit" :options="options" @click="onClick($event,i)" @change="change" v-for="(i,index) in myCarList" :key="index">
+			        <view class='cont'>
+						<uni-icons class="del" v-show="isShowEdit" @click="delItem(i)" type="minus-filled" size="20" color="#ff0000"></uni-icons>
+						<text>{{i}}</text>
+					</view>
+			    </uni-swipe-action-item>
+			</uni-swipe-action>
+		</view>
+
+		<button class="add" type="default" @click="toAddCar">
+			<uni-icons class="plus" type="plus" size="20" color="#fff"></uni-icons>
+			娣诲姞杞﹁締
 		</button>
 	</view>
 </template>
 
-<script>
-	import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue';
-	import uniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue';
-	const {userId} = JSON.parse(uni.getStorageSync('user'));
+<script>
+	import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue';
+	import uniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue';
+	const {userId} = JSON.parse(uni.getStorageSync('user'));
 	console.log(JSON.parse(uni.getStorageSync('user')))
-	export default {
-		components: {
-			uniSwipeAction,uniSwipeActionItem
+	export default {
+		components: {
+			uniSwipeAction,uniSwipeActionItem
 		},
 		data() {
 			return {
-				options:[{
-					text: '鍒犻櫎',
-					style: {
-						backgroundColor: '#ff0000'
-					}
-				}],
-				isShowEdit: false,
-				isEditable: true,
+				options:[{
+					text: '鍒犻櫎',
+					style: {
+						backgroundColor: '#ff0000'
+					}
+				}],
+				isShowEdit: false,
+				isEditable: true,
 				myCarList:[]
 			}
-		},
-		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
 		},
-		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))
+		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
+		},
+		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;
+					
+				}
 			},
-			goBack(){
-				uni.navigateBack({
-				    delta: 1,
-				    animationType: 'pop-out',
-				    animationDuration: 200
-				});
-			},
-			edit(){
-				if(this.isEditable){
-					this.isShowEdit = !this.isShowEdit;
-					console.log(this.$refs['swipeBar'])
-				}
-			},
-			onClick(e,i){
-				debugger
-				console.log('褰撳墠鐐瑰嚮鐨勬槸绗�'+e.index+'涓寜閽紝鐐瑰嚮鍐呭鏄�'+e.content.text);
-				if(e.index==0){
-					this.delItem(i)
-				}
-			},
-			delItem(plateNo){
-				debugger
-				this.$api.syncRequest({
-					url:`/basic/api/user/delPlateNo?userId=${userId}&&plateNo=${plateNo}`,
-					method: 'DELETE'
-				}).then(res=>{
-					if(res.data.success){
-						uni.showToast({
-							icon: 'none',
-							title: '杞﹁締宸插垹闄�'
-						});
-						this.getCarList();
-						this.updateStorage();
-					}
-				})
-			},
-			change(open){
-			  console.log('褰撳墠寮�鍚姸鎬侊細'+ open);
-		
-			  if(open){
-				  this.isEditable = false
-			  }else{
-				  this.isEditable = true
-			  }
-			},
-			toAddCar(){
-				uni.navigateTo({
-					url: '/pages/addCar/addCar'
-				});
+			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
+				});
+			},
+			edit(){
+				if(this.isEditable){
+					this.isShowEdit = !this.isShowEdit;
+					console.log(this.$refs['swipeBar'])
+				}
+			},
+			onClick(e,i){
+				debugger
+				console.log('褰撳墠鐐瑰嚮鐨勬槸绗�'+e.index+'涓寜閽紝鐐瑰嚮鍐呭鏄�'+e.content.text);
+				if(e.index==0){
+					this.delItem(i)
+				}
+			},
+			delItem(plateNo){
+				debugger
+				this.$api.syncRequest({
+					url:`/basic/api/user/delPlateNo?userId=${userId}&&plateNo=${plateNo}`,
+					method: 'DELETE'
+				}).then(res=>{
+					if(res.data.success){
+						uni.showToast({
+							icon: 'none',
+							title: '杞﹁締宸插垹闄�'
+						});
+						this.getCarList();
+						this.updateStorage();
+					}
+				})
+			},
+			change(open){
+			  console.log('褰撳墠寮�鍚姸鎬侊細'+ open);
+		
+			  if(open){
+				  this.isEditable = false
+			  }else{
+				  this.isEditable = true
+			  }
+			},
+			toAddCar(){
+				uni.navigateTo({
+					url: '/pages/addCar/addCar'
+				});
 			}
 		}
 	}
 </script>
 
-<style lang="scss" scoped>
-	uni-page-wrapper,uni-page-body{
-		height: 100%;
+<style lang="scss" scoped>
+	uni-page-wrapper,uni-page-body{
+		height: 100%;
 	}
-	.content{
-		height: 100%;
-		background-color: #fbfbfb;
-		.header-bar{
-			height: 200rpx;		
-		}
-		
-		/deep/.uni-swipe_box{
-			line-height: 90rpx;
-			padding-left: 30rpx;
-			box-sizing: border-box;
-			border-bottom: 1rpx solid #F1F1F1;
-			&:focus{
-				background-color: #F1F1F1;
-			}
-			.cont{
-				.del{
-					vertical-align: top;
-					padding: 0 10rpx 0;
-				}
-				font-size: 36rpx;
-			}
-		}
-		.add{
-			margin: 120rpx 30rpx 0;
-			background-color: #0bbf71;
-			color: #fff;
-			.plus{
-				padding-right:20rpx;
-				font-weight: bold;
-			}
-		}
+	.content{
+		height: 100%;
+		background-color: #fbfbfb;
+		.header-bar{
+			height: 200rpx;		
+		}
+		
+		/deep/.uni-swipe_box{
+			line-height: 90rpx;
+			padding-left: 30rpx;
+			box-sizing: border-box;
+			border-bottom: 1rpx solid #F1F1F1;
+			&:focus{
+				background-color: #F1F1F1;
+			}
+			.cont{
+				.del{
+					vertical-align: top;
+					padding: 0 10rpx 0;
+				}
+				font-size: 36rpx;
+			}
+		}
+		.add{
+			margin: 120rpx 30rpx 0;
+			background-color: #0bbf71;
+			color: #fff;
+			.plus{
+				padding-right:20rpx;
+				font-weight: bold;
+			}
+		}
 	}
 </style>

--
Gitblit v1.8.0