|
@@ -4,20 +4,45 @@
|
|
width="242"
|
|
width="242"
|
|
height="103"
|
|
height="103"
|
|
v-show="showSub"
|
|
v-show="showSub"
|
|
|
|
+ @click="saveChepaiFunc"
|
|
class="saveData"
|
|
class="saveData"
|
|
:src="saveData"
|
|
:src="saveData"
|
|
/>
|
|
/>
|
|
|
|
|
|
<van-image width="214" height="74" class="iis" :src="iis" />
|
|
<van-image width="214" height="74" class="iis" :src="iis" />
|
|
|
|
|
|
- <van-image width="330" height="53" class="chepai" :src="chepai" />
|
|
|
|
-
|
|
|
|
<van-image width="327" height="71" class="jialing" :src="jialing" />
|
|
<van-image width="327" height="71" class="jialing" :src="jialing" />
|
|
|
|
|
|
- <label for="jialing" style="font-size: 60px;" class="label">
|
|
|
|
|
|
+ <label for="jialing" style="font-size: 60px" class="label">
|
|
{{ labels.jialing }}
|
|
{{ labels.jialing }}
|
|
</label>
|
|
</label>
|
|
- <CarNumber defaultCarPlate="陕" :fontSize="35" borderColor="#00000000" class="label chepaiLabel" :width="330" :height="53"></CarNumber>
|
|
|
|
|
|
+ <div class="chepaiLabel">
|
|
|
|
+ <div
|
|
|
|
+ class="chepai"
|
|
|
|
+ :style="isNew ? 'width: 363px' : ''"
|
|
|
|
+ @click="showFingerboard"
|
|
|
|
+ >
|
|
|
|
+ <div class="item">
|
|
|
|
+ <img :src="chepai" style="width: 32px; height: 28px" />
|
|
|
|
+ </div>
|
|
|
|
+ <template v-if="isNew">
|
|
|
|
+ <div
|
|
|
|
+ :class="{ item: true, newClass: index == 6 }"
|
|
|
|
+ v-for="(item, index) in 7"
|
|
|
|
+ :key="index"
|
|
|
|
+ v-text="labels.chepai[index] !== '' ? labels.chepai[index] : ''"
|
|
|
|
+ ></div>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <div
|
|
|
|
+ class="item"
|
|
|
|
+ v-for="(item, index) in 6"
|
|
|
|
+ :key="index"
|
|
|
|
+ v-text="labels.chepai[index] !== '' ? labels.chepai[index] : ''"
|
|
|
|
+ ></div>
|
|
|
|
+ </template>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
<input
|
|
<input
|
|
type="number"
|
|
type="number"
|
|
class="input"
|
|
class="input"
|
|
@@ -31,26 +56,27 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
<script setup>
|
|
-import { ref } from 'vue';
|
|
|
|
-// import { onMounted, reactive } from "vue";
|
|
|
|
|
|
+import { ref, defineExpose, defineEmits } from 'vue';
|
|
import { showToast } from 'vant';
|
|
import { showToast } from 'vant';
|
|
|
|
+// import { onMounted, reactive } from "vue";
|
|
|
|
+import { saveChepai } from '@/api/fingerboard';
|
|
import saveData from '@/assets/img/gethaibao.png';
|
|
import saveData from '@/assets/img/gethaibao.png';
|
|
import iis from '@/assets/img/iis.png';
|
|
import iis from '@/assets/img/iis.png';
|
|
import chepai from '@/assets/img/chepai.png';
|
|
import chepai from '@/assets/img/chepai.png';
|
|
import jialing from '@/assets/img/jialing.png';
|
|
import jialing from '@/assets/img/jialing.png';
|
|
const showSub = ref(true);
|
|
const showSub = ref(true);
|
|
|
|
+const isNew = ref(false);
|
|
|
|
+const emit = defineEmits(['changeFinger', 'removeThis']);
|
|
const labels = ref({
|
|
const labels = ref({
|
|
- chepai: '',
|
|
|
|
|
|
+ chepai: [],
|
|
jialing: '',
|
|
jialing: '',
|
|
});
|
|
});
|
|
const blur = () => {
|
|
const blur = () => {
|
|
// 失去焦点
|
|
// 失去焦点
|
|
- showToast('blur');
|
|
|
|
showSub.value = true;
|
|
showSub.value = true;
|
|
};
|
|
};
|
|
const focus = () => {
|
|
const focus = () => {
|
|
// 获得焦点
|
|
// 获得焦点
|
|
- showToast('focus');
|
|
|
|
showSub.value = false;
|
|
showSub.value = false;
|
|
};
|
|
};
|
|
|
|
|
|
@@ -58,6 +84,34 @@ const jialingInput = () => {
|
|
if (labels.value.jialing >= 100) labels.value.jialing = 99;
|
|
if (labels.value.jialing >= 100) labels.value.jialing = 99;
|
|
if (labels.value.jialing < 0) labels.value.jialing = 0;
|
|
if (labels.value.jialing < 0) labels.value.jialing = 0;
|
|
};
|
|
};
|
|
|
|
+const showFingerboard = () => {
|
|
|
|
+ // 显示键盘
|
|
|
|
+ emit('changeFinger', true, labels.value.chepai);
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const saveChepaiFunc = () => {
|
|
|
|
+ // 保存车牌
|
|
|
|
+ if (isNew.value && labels.value.chepai.length != 7)
|
|
|
|
+ return showToast('请输入正确的车牌');
|
|
|
|
+ if (!isNew.value && labels.value.chepai.length != 6)
|
|
|
|
+ return showToast('请输入正确的车牌');
|
|
|
|
+ if (isNaN(labels.value.jialing)) return showToast('请输入正确的驾龄');
|
|
|
|
+ saveChepai({
|
|
|
|
+ carId: '陕' + labels.value.chepai.join(''),
|
|
|
|
+ drivingAge: labels.value.jialing,
|
|
|
|
+ }).then(() => {
|
|
|
|
+ window.localStorage.setItem('chepai', labels.value.chepai);
|
|
|
|
+ emit('removeThis', 2, '陕' + labels.value.chepai.join(''));
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const setIsNew = value => {
|
|
|
|
+ isNew.value = value;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+defineExpose({
|
|
|
|
+ setIsNew,
|
|
|
|
+});
|
|
</script>
|
|
</script>
|
|
<style scoped>
|
|
<style scoped>
|
|
.page_item {
|
|
.page_item {
|
|
@@ -82,9 +136,29 @@ const jialingInput = () => {
|
|
}
|
|
}
|
|
|
|
|
|
.chepai {
|
|
.chepai {
|
|
- top: 280px;
|
|
|
|
- left: 24px;
|
|
|
|
- position: absolute;
|
|
|
|
|
|
+ min-width: 310px;
|
|
|
|
+ height: 49px;
|
|
|
|
+ background: #fff;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ padding: 6px 6px 5px 6px;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.chepai .item {
|
|
|
|
+ height: 100%;
|
|
|
|
+ width: 40px;
|
|
|
|
+ font-size: 38px;
|
|
|
|
+ color: #1e3c95;
|
|
|
|
+ line-height: 1em;
|
|
|
|
+ text-align: center;
|
|
|
|
+ display: inline-block;
|
|
|
|
+ border: 2px solid #1e3c95;
|
|
|
|
+ border-radius: 3px;
|
|
|
|
+ vertical-align: middle;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.chepai .item:not(:last-child) {
|
|
|
|
+ margin-right: 3px;
|
|
}
|
|
}
|
|
|
|
|
|
.jialing {
|
|
.jialing {
|
|
@@ -104,14 +178,24 @@ const jialingInput = () => {
|
|
}
|
|
}
|
|
|
|
|
|
.chepaiLabel {
|
|
.chepaiLabel {
|
|
|
|
+ position: absolute;
|
|
top: 280px;
|
|
top: 280px;
|
|
- left: 24px;
|
|
|
|
|
|
+ left: 50%;
|
|
|
|
+ transform: translateX(-50%);
|
|
height: 53px;
|
|
height: 53px;
|
|
- width: 330px;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
.input {
|
|
.input {
|
|
float: left;
|
|
float: left;
|
|
margin-left: -100%;
|
|
margin-left: -100%;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+.newClass {
|
|
|
|
+ background: green;
|
|
|
|
+}
|
|
|
|
+</style>
|
|
|
|
+<style>
|
|
|
|
+.page_item .car__number__container .keyboard__container {
|
|
|
|
+ position: absolute;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|