Commit 3f723232 authored by 刘用法's avatar 刘用法

数字键盘

parent af6dd7e2
...@@ -17,6 +17,16 @@ ...@@ -17,6 +17,16 @@
type: String, type: String,
default: '请输入' default: '请输入'
}, },
item: {
type: Object,
default() {
return {}
}
},
type: {
type: String,
default: 'text'
}
// width: { // 例如:454rpx // width: { // 例如:454rpx
// type: String, // type: String,
// default: '100%' // default: '100%'
...@@ -24,32 +34,36 @@ ...@@ -24,32 +34,36 @@
}, },
data() { data() {
return { return {
maxlength: 140, inputType: 'text',
// type: 'text'
} }
}, },
computed: { computed: {
type() { // type() {
if (this.item) { // if (this.item) {
let ty = this.item.fieldsType.toLocaleLowerCase() // let ty = this.item.fieldsType.toLocaleLowerCase()
switch (ty) { // switch (ty) {
case 'text': // case 'text':
return 'textarea' // return 'textarea'
case 'password': // case 'password':
return this.item.fieldsType // return this.item.fieldsType
case 'decimal': // case 'decimal':
case 'number': // case 'number':
case 'double': // case 'double':
case 'integer': // case 'integer':
this.maxlength = 9 // this.maxlength = 9
return 'digit' // return 'digit'
case 'textarea': // case 'textarea':
default: // default:
return 'text' // return 'text'
} // }
} else { // } else {
return 'text' // return 'text'
} // }
// },
maxlength() {
return this.type == 'digit' ? 9 : 140
}, },
fieldsWidth() { fieldsWidth() {
return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%' return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%'
...@@ -71,7 +85,7 @@ ...@@ -71,7 +85,7 @@
return this.textarea return this.textarea
}, },
textarea() { textarea() {
return this.type == 'textarea' return this.inputType == 'textarea'
}, },
backgroundColor() { backgroundColor() {
return this.textarea ? 'transparent' : '#F4F5F7' return this.textarea ? 'transparent' : '#F4F5F7'
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view> <view>
<view class="list u-flex u-row-between"> <view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image> <image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view> <view class="u-m-r-20 title-text">{{item.fieldsTitle}}</view>
<view class="u-flex-1 location-name" >{{valueTxt}}</view> <view class="u-flex-1 location-name" >{{valueTxt}}</view>
</view> </view>
</view> </view>
...@@ -55,13 +55,18 @@ ...@@ -55,13 +55,18 @@
line-height: 40rpx; line-height: 40rpx;
color: #fa3534; color: #fa3534;
} }
.title-text {
font-size: 26rpx;
color: #333333;
}
.item-image { .item-image {
width: 24rpx; width: 24rpx;
height: 24rpx; height: 24rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
.location-name { .location-name {
color: #2272FF; color: #333333;
font-size: 26rpx;
text-align: right; text-align: right;
} }
.location { .location {
......
<!-- ******************* 输入框 ******************* --> <!-- ******************* 输入框 ******************* -->
<template> <template>
<view> <view>
<view class="list u-flex u-row-between"> <view class="list u-flex item-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image> <view class="item-title">
<view class="u-m-r-20">{{item.fieldsTitle}}</view> <image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-flex-1 location-name" @click="toMaterialPage"> <view class="u-m-r-20">{{item.fieldsTitle}}</view>
<u-icon name="map" color="#2979ff" size="30"></u-icon>请选择 </view>
<view class="location-name" @click="toMaterialPage">
<text class="arrow-text">{{arrowText}}</text>
<u-icon name="arrow-right" color="#2979ff" size="30"></u-icon>
</view> </view>
</view> </view>
<!-- <view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view> --> <!-- <view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view> -->
...@@ -36,6 +39,9 @@ ...@@ -36,6 +39,9 @@
computed: { computed: {
mixingImage() { mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png' return process.uniEnv.qn_base_url + 'mixing.png'
},
arrowText() {
return false ? '已选择' : '请选择'
} }
}, },
watch: {}, watch: {},
...@@ -57,7 +63,7 @@ ...@@ -57,7 +63,7 @@
} }
</script> </script>
<style scoped> <style lang="scss" scoped>
.required { .required {
padding-right: 10rpx; padding-right: 10rpx;
font-size: 28rpx; font-size: 28rpx;
...@@ -69,10 +75,29 @@ ...@@ -69,10 +75,29 @@
height: 24rpx; height: 24rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
.location-name { .item-row-between {
color: #2272FF; display: flex;
text-align: right; align-items: center;
justify-content: space-between;
.item-title {
display: flex;
font-size: 26rpx;
color: #333333;
align-items: center;
}
.location-name {
color: #2272FF;
text-align: right;
font-size: 26rpx;
display: flex;
align-items: center;
.arrow-text {
margin-right: 6rpx;
}
}
} }
.location { .location {
background: #F4F5F7; background: #F4F5F7;
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
{{item.fieldsTitle}} {{item.fieldsTitle}}
</view> </view>
<template v-if="item.fieldsType"> <template v-if="item.fieldsType">
<xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex" <xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex" :type="inputType(item.fieldsType)"
:itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""' @value-change="fieldValueChange"> :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""' @value-change="fieldValueChange">
</xh-input> </xh-input>
<xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'" <xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'"
...@@ -487,6 +487,30 @@ ...@@ -487,6 +487,30 @@
}) })
} }
}, },
inputType(type) {
var inputType = ''
let ty = type.toLocaleLowerCase()
switch (ty) {
case 'text':
inputType = 'textarea'
break
case 'password':
inputType = ty
break
case 'decimal':
case 'number':
case 'double':
case 'integer':
inputType = 'digit'
break
case 'textarea':
default:
inputType = 'text'
break
}
return inputType
},
typeToComponentType(type) { typeToComponentType(type) {
// 将fieldType类型统一转换为公共组件判定类型 // 将fieldType类型统一转换为公共组件判定类型
let formType = '' let formType = ''
......
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