Commit f322e21e by zhangzhen

我的车牌内容优化

parent 7178b3a4
...@@ -30,6 +30,16 @@ export const updateUserInfo=(data)=>{ ...@@ -30,6 +30,16 @@ export const updateUserInfo=(data)=>{
return http.post(url,data) return http.post(url,data)
} }
export const plateNumberBind=(data)=>{
let url=`/consumer/bind`
return http.post(url,data)
}
export const plateNumberUnbind=(data)=>{
let url=`/consumer/bind`
return http.post(url,data)
}
// 退出登录操作 // 退出登录操作
export const loginOut=()=>{ export const loginOut=()=>{
let url=`/login/logout` let url=`/login/logout`
......
...@@ -60,9 +60,13 @@ ...@@ -60,9 +60,13 @@
<view class="cu-list menu sm-border"> <view class="cu-list menu sm-border">
<view class="cu-item arrow" @tap="onHandle(6)"> <view class="cu-item arrow" @tap="onHandle(6)">
<view class="content"> <view class="content" style="position: relative;">
<image :src="assetsPath+'/my_list_3.png'" class="png" mode="aspectFit"></image> <image :src="assetsPath+'/my_list_3.png'" class="png" mode="aspectFit"></image>
<text class="text-title">我的车辆</text> <text class="text-title">我的车辆</text>
<view class="numberplate">
<text>{{userInfo.numberplate || ''}}</text>
</view>
</view> </view>
</view> </view>
...@@ -326,8 +330,9 @@ ...@@ -326,8 +330,9 @@
url:'/pages/deviceManage/index' url:'/pages/deviceManage/index'
}) })
}else if(val === 6){ }else if(val === 6){
let num = this.userInfo.numberplate || '';
uni.navigateTo({ uni.navigateTo({
url:'/setting/license-plate-number/list' url:'/setting/license-plate-number/list?number='+num
}) })
} }
}, },
...@@ -627,4 +632,12 @@ ...@@ -627,4 +632,12 @@
} }
} }
} }
.numberplate{
position: absolute;
right: 8upx;
top: 0;
height: 100%;
display: flex;
align-items: center;
}
</style> </style>
\ No newline at end of file
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<view> <view>
<u-swipe-action> <u-swipe-action>
<u-swipe-action-item v-for="(item,k) in licensePlateNumber" :key="k" :index="k" :name="k" :options="options" @click="onClick"> <u-swipe-action-item v-for="(item,k) in licensePlateNumber" :key="k" :index="k" :name="k"
:options="options" @click="onClick">
<!-- <view class="swipe-action u-border-top u-border-bottom"> --> <!-- <view class="swipe-action u-border-top u-border-bottom"> -->
<xm-cell special label="车牌号" :value="item.name"></xm-cell> <xm-cell special label="车牌号" :value="item.name"></xm-cell>
<!-- </view> --> <!-- </view> -->
...@@ -13,12 +14,11 @@ ...@@ -13,12 +14,11 @@
<view v-if="licensePlateNumber && licensePlateNumber.length <= 0" class="empty-box"> <view v-if="licensePlateNumber && licensePlateNumber.length <= 0" class="empty-box">
<u-empty text="暂未绑定车牌号" textColor='#C1C1C1' width="120" <u-empty text="暂未绑定车牌号" textColor='#C1C1C1' width="120" :icon="listBlankImage">
:icon="listBlankImage">
</u-empty> </u-empty>
</view> </view>
<view class="foot-box"> <view class="foot-box" v-if="!licensePlateNumber.length">
<view class="btn-box"> <view class="btn-box">
<button class="cu-btn block bg-blue lg round " @tap="onShowKeyboard('xmKeyboard')">新增</button> <button class="cu-btn block bg-blue lg round " @tap="onShowKeyboard('xmKeyboard')">新增</button>
</view> </view>
...@@ -26,71 +26,78 @@ ...@@ -26,71 +26,78 @@
<uni-popup ref="popupConfirm" type="dialog"> <uni-popup ref="popupConfirm" type="dialog">
<uni-popup-dialog <uni-popup-dialog type="warn" mode="base" :content="content" :duration="2000" :before-close="true"
type="warn" @close="close" @confirm="confirm"></uni-popup-dialog>
mode="base"
:content="content"
:duration="2000"
:before-close="true"
@close="close"
@confirm="confirm"
></uni-popup-dialog>
</uni-popup> </uni-popup>
<xm-keyboard-v2 ref="xmKeyboard" :initValue="initValue" :cursor="true" :vibration="true" @confirm="onSave"></xm-keyboard-v2> <xm-keyboard-v2 ref="xmKeyboard" :initValue="initValue" :cursor="true" :vibration="true"
@confirm="onSave"></xm-keyboard-v2>
</view> </view>
</template> </template>
<script> <script>
import config from "@/config/index.config" import config from "@/config/index.config";
import { plateNumberBind,plateNumberUnbind } from "@/api/index.js";
export default { export default {
data() { data() {
return { return {
initValue:'', initValue: '',
content:"请确认解除车牌号绑定", content: "请确认解除车牌号绑定",
listBlankImage:config.assetsPath+'/no_data_icon.png', listBlankImage: config.assetsPath + '/no_data_icon.png',
licensePlateNumber: [{ licensePlateNumber: [],
id: '1',
name: '鄂A 66666'
}],
options: [{ options: [{
text: '删除', text: '删除',
style: { style: {
backgroundColor: '#f56c6c' backgroundColor: '#f56c6c'
} }
}], }],
deleteIndex:'', deleteIndex: '',
userInfo:{}
}; };
}, },
onLoad() { onLoad(option) {
console.log(option, 999)
this.userInfo = uni.getStorageSync('userInfo')
if (option.number){
this.licensePlateNumber.push({
name: option.number
})
}
}, },
methods: { methods: {
onClick(e){ onClick(e) {
console.log(e,909090) console.log(e, 909090)
this.deleteIndex = e.index this.deleteIndex = e.index
this.$refs.popupConfirm.open(); this.$refs.popupConfirm.open();
}, },
close() {
close(){
this.$refs.popupConfirm.close() this.$refs.popupConfirm.close()
}, },
confirm(){ confirm() {
plateNumberUnbind({
this.licensePlateNumber = this.licensePlateNumber.filter((item,index) => index!= this.deleteIndex); id:this.userInfo.id
}).then(res=>{
if(res.data.code == 200 ){
uni.showToast({
icon:"none",
title:"解绑成功",
success: () => {
this.licensePlateNumber = this.licensePlateNumber.filter((item, index) => index != this.deleteIndex);
}
})
}else{
uni.showToast({
icon:"none",
title:res.data.msg,
})
}
})
this.close() this.close()
uni.showToast({
icon:"none",
title:"解绑成功"
})
}, },
onShowKeyboard(ref) { onShowKeyboard(ref) {
this.$refs.xmKeyboard.toShow() this.$refs.xmKeyboard.toShow()
}, },
...@@ -99,9 +106,29 @@ ...@@ -99,9 +106,29 @@
let obj = { let obj = {
name: e name: e
} }
this.licensePlateNumber.push(obj) plateNumberBind({
id:this.userInfo.id,
numberplate:e
}).then(res=>{
if(res.data.code == 200 ){
uni.showToast({
icon:"none",
title:"保存成功",
success: () => {
this.licensePlateNumber.push(obj)
this.$refs.xmKeyboard.inputClear()
}
})
}else{
uni.showToast({
icon:"none",
title:res.data.msg,
})
}
})
this.$refs.xmKeyboard.inputClear()
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment