Commit f322e21e by zhangzhen

我的车牌内容优化

parent 7178b3a4
......@@ -30,6 +30,16 @@ export const updateUserInfo=(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=()=>{
let url=`/login/logout`
......
......@@ -60,9 +60,13 @@
<view class="cu-list menu sm-border">
<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>
<text class="text-title">我的车辆</text>
<view class="numberplate">
<text>{{userInfo.numberplate || ''}}</text>
</view>
</view>
</view>
......@@ -326,8 +330,9 @@
url:'/pages/deviceManage/index'
})
}else if(val === 6){
let num = this.userInfo.numberplate || '';
uni.navigateTo({
url:'/setting/license-plate-number/list'
url:'/setting/license-plate-number/list?number='+num
})
}
},
......@@ -627,4 +632,12 @@
}
}
}
.numberplate{
position: absolute;
right: 8upx;
top: 0;
height: 100%;
display: flex;
align-items: center;
}
</style>
\ No newline at end of file
......@@ -3,7 +3,8 @@
<view>
<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"> -->
<xm-cell special label="车牌号" :value="item.name"></xm-cell>
<!-- </view> -->
......@@ -13,12 +14,11 @@
<view v-if="licensePlateNumber && licensePlateNumber.length <= 0" class="empty-box">
<u-empty text="暂未绑定车牌号" textColor='#C1C1C1' width="120"
:icon="listBlankImage">
<u-empty text="暂未绑定车牌号" textColor='#C1C1C1' width="120" :icon="listBlankImage">
</u-empty>
</view>
<view class="foot-box">
<view class="foot-box" v-if="!licensePlateNumber.length">
<view class="btn-box">
<button class="cu-btn block bg-blue lg round " @tap="onShowKeyboard('xmKeyboard')">新增</button>
</view>
......@@ -26,69 +26,76 @@
<uni-popup ref="popupConfirm" type="dialog">
<uni-popup-dialog
type="warn"
mode="base"
:content="content"
:duration="2000"
:before-close="true"
@close="close"
@confirm="confirm"
></uni-popup-dialog>
<uni-popup-dialog type="warn" mode="base" :content="content" :duration="2000" :before-close="true"
@close="close" @confirm="confirm"></uni-popup-dialog>
</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>
</template>
<script>
import config from "@/config/index.config"
import config from "@/config/index.config";
import { plateNumberBind,plateNumberUnbind } from "@/api/index.js";
export default {
data() {
return {
initValue:'',
content:"请确认解除车牌号绑定",
listBlankImage:config.assetsPath+'/no_data_icon.png',
licensePlateNumber: [{
id: '1',
name: '鄂A 66666'
}],
initValue: '',
content: "请确认解除车牌号绑定",
listBlankImage: config.assetsPath + '/no_data_icon.png',
licensePlateNumber: [],
options: [{
text: '删除',
style: {
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: {
onClick(e){
console.log(e,909090)
onClick(e) {
console.log(e, 909090)
this.deleteIndex = e.index
this.$refs.popupConfirm.open();
},
close(){
close() {
this.$refs.popupConfirm.close()
},
confirm(){
this.licensePlateNumber = this.licensePlateNumber.filter((item,index) => index!= this.deleteIndex);
this.close()
confirm() {
plateNumberUnbind({
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:"解绑成功"
title:res.data.msg,
})
}
})
this.close()
},
onShowKeyboard(ref) {
......@@ -99,10 +106,30 @@
let obj = {
name: e
}
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,
})
}
})
}
}
}
</script>
......
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