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/addCar/addCar.vue | 280 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 140 insertions(+), 140 deletions(-) diff --git a/pages/addCar/addCar.vue b/pages/addCar/addCar.vue index 7a36f02..435c49b 100644 --- a/pages/addCar/addCar.vue +++ b/pages/addCar/addCar.vue @@ -1,49 +1,49 @@ <template> - <view class="content"> - <view class="top"> - <text>璇疯緭鍏ヨ溅鐗屽彿锛�</text> - <view class="search-car-input" > - <view class="car-input"> - <view class="split-input" ref="splitInput" @click="carInputClick"> - <view class="split-cell" :class="{'focus-cell':i===plateNum.length+1,'separator':i===2,'new-energe':i===8&& noVal}" v-for="i in 8" :key="i" >{{plateNum[i-1]}}</view> - <!-- <view class="energy" v-show="plateNum.length>7"> - <image :src="energy" mode="widthFix" /> - </view> --> - </view> - </view> - </view> - <button class="save" type="default" :disabled="plateNum.length<=6" @click="save">淇� 瀛�</button> - </view> - - <!-- 寮曠敤杞︾墝缁勪欢 --> + <view class="content"> + <view class="top"> + <text>璇疯緭鍏ヨ溅鐗屽彿锛�</text> + <view class="search-car-input" > + <view class="car-input"> + <view class="split-input" ref="splitInput" @click="carInputClick"> + <view class="split-cell" :class="{'focus-cell':i===plateNum.length+1,'separator':i===2,'new-energe':i===8&& noVal}" v-for="i in 8" :key="i" >{{plateNum[i-1]}}</view> + <!-- <view class="energy" v-show="plateNum.length>7"> + <image :src="energy" mode="widthFix" /> + </view> --> + </view> + </view> + </view> + <button class="save" type="default" :disabled="plateNum.length<=6" @click="save">淇� 瀛�</button> + </view> + + <!-- 寮曠敤杞︾墝缁勪欢 --> <plate-number ref="plate" v-model="plateNum" @showOrHide="showOrHide"></plate-number> </view> </template> <script> - import cursor from '../../static/addCar/cursor.gif' - import energy from '../../static/addCar/energy.png' - import plateNumber from '@/components/plate-number/plateNumber.vue' - - export default { + import cursor from '../../static/addCar/cursor.gif' + import energy from '../../static/addCar/energy.png' + import plateNumber from '@/components/plate-number/plateNumber.vue' + + export default { components:{plateNumber}, data() { return { plateNum: '', //杈撳叆鐨勮溅鐗屽彿 cursor: '', //杈撳叆鐒︾偣gif鍦板潃 isCursor: true, //鏄惁鏄剧ず鐒︾偣 - energy: '', //鏂拌兘婧愬浘鏍囩殑鍦板潃 + energy: '', //鏂拌兘婧愬浘鏍囩殑鍦板潃 noVal: true }; - }, - watch:{ - plateNum(newV,oldV){ - if(newV.length==8){ - this.noVal = false - }else{ - this.noVal = true - } - } + }, + watch:{ + plateNum(newV,oldV){ + if(newV.length==8){ + this.noVal = false + }else{ + this.noVal = true + } + } }, onLoad(option) {}, onHide() { @@ -54,8 +54,8 @@ //鍒濆鍖� // this.$refs.plate.init(); this.cursor = cursor; - this.energy = energy; - + this.energy = energy; + this.carInputClick(); }, methods: { @@ -71,46 +71,46 @@ carInputClick() { this.$refs.plate.show(); }, - updateStorage(){ - let user = JSON.parse(uni.getStorageSync('user')); - user.plateNos.push(this.plateNum); - uni.setStorageSync('user',JSON.stringify(user)); + updateStorage(){ + let user = JSON.parse(uni.getStorageSync('user')); + user.plateNos.push(this.plateNum); + uni.setStorageSync('user',JSON.stringify(user)); }, - save() { - let _this = this; + save() { + let _this = this; const {userId} = JSON.parse(uni.getStorageSync('user')); //杈撳叆浜嗘纭殑杞︾墝鎵嶆墽琛岃姹� if (this.plateNum.length > 6) { - this.$refs.plate.close(); - this.$api.syncRequest({ - url: '/basic/api/user/addPlateNo', - method: 'POST', - data: {userId,plateNo:_this.plateNum} - }).then(res=>{ - if(res.data.success){ - - uni.showToast({ - icon:'none', - title: '杞︾墝:'+_this.plateNum+'娣诲姞鎴愬姛', - duration: 1500, - complete() { - _this.updateStorage(); - } - }); - setTimeout(()=>{ - uni.navigateTo({ - url:'/pages/myCarList/myCarList' - }) - },2000) - - } - - }) - - } else { - uni.showToast({ - title: '璇疯緭鍏ユ纭殑杞︾墝鍙�', - duration: 2000 + this.$refs.plate.close(); + this.$api.syncRequest({ + url: '/basic/api/user/addPlateNo', + method: 'POST', + data: {userId,plateNo:_this.plateNum} + }).then(res=>{ + if(res.data.success){ + + uni.showToast({ + icon:'none', + title: '杞︾墝:'+_this.plateNum+'娣诲姞鎴愬姛', + duration: 1500, + complete() { + _this.updateStorage(); + } + }); + setTimeout(()=>{ + uni.navigateTo({ + url:'/pages/myCarList/myCarList' + }) + },2000) + + } + + }) + + } else { + uni.showToast({ + title: '璇疯緭鍏ユ纭殑杞︾墝鍙�', + duration: 2000 }); } } @@ -118,76 +118,76 @@ } </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; - .top{ - padding: 40rpx 60rpx; - text{ - line-height: 80rpx; - font-size: 36rpx; - color: #bfbfbf; - } - .search-car-input{ - .split-input{ - display: flex; - .split-cell{ - width: 64rpx; - height: 64rpx; - text-align: center; - line-height: 64rpx; - border: 1rpx solid #dadada; - margin-right:7rpx; - &.new-energe{ - background: url(../../static/addCar/new.png) no-repeat center; - background-size: 100%; - } - &.focus-cell{ - animation: focus-gif .5s infinite alternate-reverse; - } - &.separator{ - position: relative; - margin-right:50rpx; - &:after{ - content:'.'; - position: absolute; - left: 65rpx; - top: -26rpx; - font-size: 36px; - width: 50rpx; - height: 64rpx; - color: #999; - } - } - } - } - .energy{ - image{ - width: 90rpx; - } - } - } - uni-button[disabled]{ - opacity: .5; - } - .save{ - margin-top: 120rpx; - background-color: #0bbf71; - color: #fff; - - } - } - } - @keyframes focus-gif{ - from{ - border-color: #c6f0ff; - }, - to{ - border-color: #3ec5ff; - } + .content{ + height: 100%; + background-color: #fbfbfb; + .top{ + padding: 40rpx 60rpx; + text{ + line-height: 80rpx; + font-size: 36rpx; + color: #bfbfbf; + } + .search-car-input{ + .split-input{ + display: flex; + .split-cell{ + width: 64rpx; + height: 64rpx; + text-align: center; + line-height: 64rpx; + border: 1rpx solid #dadada; + margin-right:7rpx; + &.new-energe{ + background: url(../../static/addCar/new.png) no-repeat center; + background-size: 100%; + } + &.focus-cell{ + animation: focus-gif .5s infinite alternate-reverse; + } + &.separator{ + position: relative; + margin-right:50rpx; + &:after{ + content:'.'; + position: absolute; + left: 65rpx; + top: -26rpx; + font-size: 36px; + width: 50rpx; + height: 64rpx; + color: #999; + } + } + } + } + .energy{ + image{ + width: 90rpx; + } + } + } + uni-button[disabled]{ + opacity: .5; + } + .save{ + margin-top: 120rpx; + background-color: #0bbf71; + color: #fff; + + } + } + } + @keyframes focus-gif{ + from{ + border-color: #c6f0ff; + } + to{ + border-color: #3ec5ff; + } } </style> -- Gitblit v1.8.0