ccjgmwz 3 éve
szülő
commit
6d7c23482a

+ 306 - 0
components/master-keyboard/master-keyboard.scss

@@ -0,0 +1,306 @@
+.master_wrap{
+	width: 100%;
+	background-color: #eee;
+	position: fixed;
+	bottom: 0;
+	left: 0;
+	padding-top: 10rpx;
+	padding-bottom: 20rpx;
+	.down_wrap{
+		width: 100%;
+		height: 50rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		image{
+			width: 48rpx;
+			height: 48rpx;
+		}
+	}
+	.kerboard_number{
+		width: 100%;
+		display: flex;
+		justify-content: space-evenly;
+		flex-flow: wrap;
+		.number_item{
+			width: 30%;
+			height: 80rpx;
+			margin-top: 10rpx;
+			background-color: white;
+			border-radius: 10rpx;
+			text-align: center;
+			line-height: 80rpx;
+			box-sizing: border-box;
+			display: block;
+		}
+		.number_item_active{
+			width: 30%;
+			height: 80rpx;
+			margin-top: 10rpx;
+			background-color: #888;
+			border-radius: 10rpx;
+			text-align: center;
+			line-height: 80rpx;
+			box-sizing: border-box;
+			display: block;
+			color: white;
+		}
+		.number_empty{
+			background-color: #eeeeee;
+			width: 30%;
+			height: 80rpx;
+			margin-top: 10rpx;
+			border-radius: 10rpx;
+		}
+		.number_empty_active{
+			background-color: #eeeeee;
+		}
+		.number_delete{
+			width: 30%;
+			height: 80rpx;
+			margin-top: 10rpx;
+			background-color: white;
+			display: flex;
+			justify-content: center;
+			align-items: center;
+			.delete_img{
+				width: 65rpx;
+				height: 64rpx;
+			}
+		}
+		.number_delete_active{
+			width: 30%;
+			height: 80rpx;
+			margin-top: 10rpx;
+			background-color: #e64d3a;
+			display: flex;
+			justify-content: center;
+			align-items: center;
+			border-radius: 10rpx;
+			.delete_img{
+				width: 65rpx;
+				height: 64rpx;
+			}
+		}
+	}
+	
+	.keyboard_car{
+		width: 100%;
+		display: flex;
+		flex-direction: column;
+		position: relative;
+		.car_down{
+			position: absolute;
+			top: 10rpx;
+			left: 15rpx;
+			width: 48rpx;
+			height: 48rpx;
+		}
+		.tab_wrap{
+			height: 65rpx;
+			margin: 0 auto;
+			background-color: white;
+			border-radius: 20rpx;
+			display: flex;
+			padding-left: 25rpx;
+			padding-right: 25rpx;
+			image{
+				width: 48rpx;
+				height: 48rpx;
+			}
+			.tab_item{
+				height: 100%;
+				text-align: center;
+				line-height: 65rpx;
+				font-size: 26rpx;
+				margin: 0 20rpx;
+			}
+			.tab_item_active{
+				height: 100%;
+				text-align: center;
+				line-height: 65rpx;
+				font-size: 26rpx;
+				margin: 0 20rpx;
+				text-decoration: underline;
+				color: #e64d3a;
+			}
+		}
+		
+		.car_content{
+			width: 100%;
+			position: relative;
+			.car_province{
+				width: 100%;
+				display: flex;
+				justify-content: space-evenly;
+				flex-flow: wrap;
+				margin: 0;
+				.province_item{
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: white;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+				}
+				.province_item_active{
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: #888;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+					color: white;
+				}
+				.province_item_disable{
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: #fff;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+					opacity: 0.5;
+				}
+			}
+			.car_province_1{
+				width: 100%;
+				display: flex;
+				margin: 0;
+				.province_item1{
+					margin: 0;
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: white;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+				}
+				.province_item_active{
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: #888;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+					color: white;
+				}
+				.province_item_disable{
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: #fff;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+					opacity: 0.5;
+				}
+			}
+			.car_latter{
+				width: 100%;
+				display: flex;
+				justify-content: space-evenly;
+				flex-flow: wrap;
+				.latter_item{
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: white;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+				}
+				.province_item_active{
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: #888;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+					color: white;
+				}
+				.province_item_disable{
+					width: 9.5%;
+					height: 80rpx;
+					margin-top: 10rpx;
+					background-color: #fff;
+					border-radius: 10rpx;
+					text-align: center;
+					line-height: 80rpx;
+					box-sizing: border-box;
+					display: block;
+					font-size: 28rpx;
+					font-weight: 450;
+					opacity: 0.5;
+				}
+			}
+			.car_delete{
+				width: 15%;
+				height: 80rpx;
+				margin-top: 10rpx;
+				background-color: white;
+				border-radius: 10rpx;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				position: absolute;
+				.delete_img{
+					width: 65rpx;
+					height: 64rpx;
+				}
+			}
+			.car_delete_active{
+				width: 15%;
+				height: 80rpx;
+				margin-top: 10rpx;
+				background-color: #e64d3a;
+				border-radius: 10rpx;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				position: absolute;
+				.delete_img{
+					width: 65rpx;
+					height: 64rpx;
+				}
+			}
+		}
+	}
+}

+ 306 - 0
components/master-keyboard/master-keyboard.vue

@@ -0,0 +1,306 @@
+<template>
+	<view class="master_wrap" v-show="show" hover-stop-propagation>
+		<block v-if="keyboardtype == 'number' || keyboardtype == 'digit' || keyboardtype == 'idcard'">
+			<view class="down_wrap">
+				<image src="../../static/icon_down.png" @tap.stop="handleCloseKeyboard(false)"></image>
+			</view>
+			<view class="kerboard_number">
+				<view @tap.stop="handleNumberKeyboardClick(item)" :hover-stay-time="100"
+					:class="item== '-1' ? keyboardtype == 'number' ?  'number_empty' :'number_item' : item=='-2' ? 'number_delete' : 'number_item' "
+					:hover-class="item== '-1' ?  keyboardtype == 'number' ?  'number_empty_active' : 'number_item_active' : item=='-2' ? 'number_delete_active' : 'number_item_active'"
+					v-for="(item,index) in  randomNumberArr" :key="index">
+					<block v-if="item == '-1'">
+						<view v-if="keyboardtype == 'digit'">
+							·
+						</view>
+						<view v-else-if=" keyboardtype ==  'idcard'">
+							X
+						</view>
+					</block>
+					<block v-else-if="item == '-2'">
+						<image class="delete_img" src="../../static/icon_delete.png"></image>
+					</block>
+					<block v-else>
+						{{item}}
+					</block>
+				</view>
+			</view>
+		</block>
+		<block v-else-if="keyboardtype == 'car'">
+			<view class="keyboard_car">
+				<image @tap.stop="handleCloseKeyboard(false)" class="car_down" src="../../static/icon_down.png"></image>
+				<view class="tab_wrap">
+					<view @tap.stop="handleCarTabItemClick(index)"
+						:class=" carType === index ?'tab_item_active' : 'tab_item'" hover-class="tab_item_active"
+						v-for="(item,index) in carTabArr" :key="index">
+						{{item}}
+					</view>
+				</view>
+				<view class="car_content">
+					<block v-if="carType === 0">
+						<view class="car_province">
+							<view @tap.stop="handleCarKerboardClick(item)"
+								:class="computedDefaultValueLength ===0 ?  'province_item' :'province_item_disable'"
+								:hover-class="computedDefaultValueLength ===0 ? 'province_item_active' : 'none'"
+								:hover-stay-time="100" v-for="(item,index) in sliceProvinceArr" :key="index">
+								{{item}}
+							</view>
+						</view>
+						<view class="car_province_1">
+							<view @tap.stop="handleCarKerboardClick(item)"
+								:class=" (formatCarProvinceFirst(item) === -1 && computedDefaultValueLength ===0 )  ? 'province_item1' :
+								 ((newCar && computedDefaultValueLength ===7 && formatCarProvinceFirst(item) !== -1) || 
+								 (!newCar && computedDefaultValueLength ===6 && formatCarProvinceFirst(item) !== -1) ) ? 'province_item1' :  'province_item_disable'"
+								:hover-class=" (formatCarProvinceFirst(item) === -1 && computedDefaultValueLength ===0) ? 'province_item_active' : 'none'"
+								:hover-stay-time="100" :style="{'margin-left' : computeItemSpace + '%'}"
+								v-for="(item,index) in sliceSecondProvinceArr" :key="index">
+								{{item}}
+							</view>
+						</view>
+					</block>
+					<block v-else="carType === 1">
+						<view class="car_latter">
+							<view @tap.stop="handleCarKerboardClick(item)"
+								:class=" (computedDefaultValueLength ===1 && formatCarProvinceSecond(item) >-1 || computedDefaultValueLength ===0) ? 'province_item_disable' : 'latter_item'"
+								:hover-class=" (computedDefaultValueLength ===1 && formatCarProvinceSecond(item) >-1 || computedDefaultValueLength ===0) ? 'none' : 'province_item_active'"
+								:hover-stay-time="100" v-for="(item,index) in sliceLatterArr" :key="index">
+								<text>{{item}}</text>
+							</view>
+						</view>
+						<view class="car_province_1">
+							<view @tap.stop="handleCarKerboardClick(item)"
+								:class=" (computedDefaultValueLength ===1 && formatCarProvinceSecond(item) >-1 || computedDefaultValueLength ===0)  ? 'province_item_disable' : 'province_item1'"
+								:hover-class=" (computedDefaultValueLength ===1 && formatCarProvinceSecond(item) >-1 || computedDefaultValueLength ===0) ? 'none' : 'province_item_active'"
+								:hover-stay-time="100" :style="{'margin-left' : computeItemSpace + '%'}"
+								v-for="(item,index) in sliceSecondLatterArr" :key="index">
+								{{item}}
+							</view>
+						</view>
+					</block>
+					<view @tap.stop="handleCarKerboardDeleteClick" class="car_delete" hover-class="car_delete_active"
+						:hover-stay-time="100"
+						:style="{'top':computeDeleteTop + 'rpx','right' :computeItemSpace + '%' }">
+						<image class="delete_img" src="../../static/icon_delete.png"></image>
+					</view>
+				</view>
+			</view>
+		</block>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: "master-keyboard",
+		props: {
+			keyboardtype: {
+				type: String,
+				default: 'number' // number=数字键盘 digit=带小数点的数字键盘  idcard=身份证号键盘  car=车牌号键盘
+			},
+			defaultValue: {
+				type: String,
+				default: ''
+			},
+			newCar: {
+				type: Boolean,
+				default: false
+			},
+			randomNumber: {
+				type: Boolean,
+				default: false
+			}
+		},
+		data() {
+			return {
+				numberArr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'],
+				carProvinceArr: ['京', '津', '渝', '沪', '冀', '晋', '辽', '吉', '黑', '苏', '浙', '皖', '闽', '赣', '鲁', '豫',
+					'鳄', '湘', '粤', '琼', '川', '贵', '云', '陕', '甘', '青', '蒙', '桂', '宁', '新', '藏', '使',
+					'领', '警', '学', '港', '澳'
+				],
+				carLatterArr: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+					'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',
+					'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
+				],
+				carTabArr: ['省份', '字母'],
+				carType: 0,
+				show: false,
+			};
+		},
+		computed: {
+			sliceProvinceArr: function() {
+				return this.carProvinceArr.slice(0, 30)
+			},
+			sliceSecondProvinceArr: function() {
+				return this.carProvinceArr.slice(30, this.carProvinceArr.length)
+			},
+			sliceLatterArr: function() {
+				return this.carLatterArr.slice(0, 30)
+			},
+			sliceSecondLatterArr: function() {
+				return this.carLatterArr.slice(30, this.carLatterArr.length)
+			},
+			computeDeleteTop: function() {
+				return 80 * 3 + 10 * 3
+			},
+			computeItemSpace: function() {
+				return (1 - 0.095 * 10) / 11 * 100
+			},
+			computedDefaultValueLength: function() {
+				return this.$props.defaultValue.length
+			},
+			randomNumberArr: function() {
+				if(this.$props.randomNumber){
+					this.numberArr.sort(function() {
+						return 0.5 - Math.random()
+					})
+				}
+				const size = this.numberArr.length
+				this.numberArr.splice(size - 1, 0, "-1")
+				this.numberArr.push("-2")
+				return this.numberArr
+			}
+		},
+		watch: {
+			show: function(value) {
+
+			}
+		},
+		onLoad() {},
+		methods: {
+			formatCarProvinceFirst(value) {
+				const list = ['使', '领', '警', '学', '港', '澳', ]
+				return list.indexOf(value)
+			},
+			formatCarProvinceSecond(value) {
+				const list = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
+				return list.indexOf(value)
+			},
+			handleCloseKeyboard() {
+				this.open(false)
+			},
+			open(value) {
+				this.show = value
+			},
+			//车牌tab点击事件
+			handleCarTabItemClick(index) {
+				this.carType = index
+			},
+			//车牌键盘点击事件
+			handleCarKerboardClick(e) {
+				const keyValue = e
+				let value = this.$props.defaultValue
+				if (/^[\u4e00-\u9fa5]*$/.test(value) && value.length >= 2) {
+					value = ''
+				}
+				var pattern = new RegExp("[\u4E00-\u9FA5]+");
+				var pattern2 = new RegExp("[A-Za-z]+");
+				var pattern3 = new RegExp("[0-9]+");
+
+				if (value.length == 0) {
+					if (!pattern.test(keyValue) || this.formatCarProvinceFirst(keyValue) !== -1) {
+						return
+					}
+					this.carType = 1
+				} else if (value.length == 1) {
+					if (!pattern2.test(keyValue)) {
+						return
+					}
+				} else {
+					if (value.length === (this.$props.newCar ? 7 : 6) && pattern.test(keyValue) && this
+						.formatCarProvinceFirst(keyValue) == -1) {
+						return
+					}
+					if (pattern.test(keyValue) && value.length !== (this.$props.newCar ? 7 : 6)) {
+						return
+					}
+				}
+
+				if (value.length < 7 && !this.$props.newCar) {
+					this.$emit('keyboardClick', {
+						value: value + keyValue
+					})
+				}
+				if (value.length < 8 && this.$props.newCar) {
+					this.$emit('keyboardClick', {
+						value: value + keyValue
+					})
+				}
+			},
+			//车牌键盘删除事件
+			handleCarKerboardDeleteClick() {
+				let deleteValue = this.$props.defaultValue
+				if (deleteValue == '' || (/^[\u4e00-\u9fa5]*$/.test(deleteValue) && deleteValue.length !== 1)) {
+					return
+				}
+				if (deleteValue.length > 0) {
+					let count = deleteValue.length
+					this.$emit('keyboardClick', {
+						value: deleteValue.substr(0, count - 1)
+					})
+				}
+			},
+			//数字键盘点击事件
+			handleNumberKeyboardClick(e) {
+				const keyValue = e
+				if (this.$props.keyboardtype == 'number' || this.$props.keyboardtype == 'digit' || this.$props
+					.keyboardtype == 'idcard') {
+					switch (keyValue) {
+						case '-1':
+							if (this.$props.keyboardtype == 'number' || this.$props.defaultValue == '') {
+								return
+							}
+							let value = this.$props.defaultValue
+							if (/^[\u4e00-\u9fa5]*$/.test(value) || value.indexOf('.') > -1 || value.indexOf('X') > -1) {
+								return
+							}
+							if (this.$props.keyboardtype == 'idcard') {
+								if (value.length === 17) {
+									this.$emit('keyboardClick', {
+										value: value + 'X'
+									})
+								}
+							}
+							if (this.$props.keyboardtype == 'digit') {
+								this.$emit('keyboardClick', {
+									value: value + '.'
+								})
+							}
+							break
+						case '-2':
+							let deleteValue = this.$props.defaultValue
+							if (deleteValue == '' || /^[\u4e00-\u9fa5]*$/.test(deleteValue)) {
+								return
+							}
+							if (deleteValue.length > 0) {
+								let count = deleteValue.length
+								this.$emit('keyboardClick', {
+									value: deleteValue.substr(0, count - 1)
+								})
+							}
+							break
+						default:
+							let initValue = this.$props.defaultValue
+							if (/^[\u4e00-\u9fa5]*$/.test(initValue)) {
+								initValue = ''
+							}
+							if (this.$props.keyboardtype == 'idcard') {
+								if (initValue.length < 18) {
+									this.$emit('keyboardClick', {
+										value: initValue + keyValue
+									})
+								}
+								return
+							}
+							this.$emit('keyboardClick', {
+								value: initValue + keyValue
+							})
+							break
+					}
+				}
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	@import './master-keyboard.scss';
+</style>

+ 2 - 2
config/index.js

@@ -1,7 +1,7 @@
 const dev = {
 	baseUrl: 'https://www.zthymaoyi.com',
-	// baseUrlNew: 'http://api1.eliangeyun.com/',
-	baseUrlNew: 'http://192.168.1.117:8090/',
+	baseUrlNew: 'http://api1.eliangeyun.com/',
+	// baseUrlNew: 'http://192.168.1.119:9100/',
 	// baseUrlNew: 'http://192.168.1.119:9100/',
 	// baseUrlNew: 'http://api1.eliangeyun.com/',
 	h5Appid: 'wxb66b599f7f61b46f',

+ 11 - 2
pages/erpbusiness/add_quality_testing.vue

@@ -28,7 +28,8 @@
 			<view class="c-row ">
 				<view class="title">车牌号</view>
 				<view class="con-list">
-					<input v-model='gridList.carNumber' placeholder="请输入车牌号" name="input"></input>
+					<input v-model='gridList.carNumber' @click="handleShowKeyboard":disabled="true" placeholder="请输入车牌号" name="input"></input>
+					<master-keyboard ref="keyboard" keyboardtype="car" :randomNumber="true" :newCar="false" :defaultValue="gridList.carNumber" @keyboardClick="handleClick"></master-keyboard>
 				</view>
 			</view>
 			<view v-if="gridList.paramType != '1'" class="c-row ">
@@ -167,6 +168,7 @@
 
 <script>
 	import dragButton from "@/components/drag-button/drag-button.vue";
+	import keyboard from "@/components/master-keyboard/master-keyboard.vue";
 	import {
 		mapState
 	} from 'vuex';
@@ -175,7 +177,8 @@
 		pageAtTop = true;
 	export default {
 		components: {
-			dragButton
+			dragButton,
+			keyboard
 		},
 		data() {
 			return {
@@ -364,6 +367,12 @@
 			})
 		},
 		methods: {
+			handleShowKeyboard(){
+				this.$refs.keyboard.open(true)//true 键盘显示 false 键盘隐藏
+			},
+			handleClick(e){
+				this.gridList.carNumber = e.value //键盘输入值
+			},
 			// confirmInfo() {
 			// 	this.isShowAlert = true	
 			// },

BIN
static/icon_delete.png


BIN
static/icon_down.png