Browse Source

样式兼容pad

master
kuaileWu 2 months ago
parent
commit
be4932df12
  1. 1
      App.vue
  2. 59
      components/FormItem.vue
  3. 170
      components/SelectYear.vue
  4. 293
      components/customeDatePicker.vue
  5. 14
      components/inputBox.vue
  6. 7
      components/preBookList.vue
  7. 1
      pages/index/index.vue
  8. 40
      pages/modify_visitor/modify_visitor.vue
  9. 6
      pages/visit_detail/visit_detail.vue
  10. 4
      pages/visitors/visitors.vue

1
App.vue

@ -242,6 +242,7 @@
}
.btn{
text-align: center;
font-size: 32rpx;
}
.primary.btn{
background-color: #39D067;

59
components/FormItem.vue

@ -2,8 +2,7 @@
<view class="form-item">
<!-- 左侧标签 + 必填提示 -->
<view class="label">
<!-- <text v-if="required" class="required">*</text> -->
<text>{{ label }}</text>
<text class="PfScMedium">{{ label }}</text>
<image v-if="required" class="required" :src="cssUrl + 'required.svg'" />
</view>
@ -12,6 +11,7 @@
v-if="type === 'input'"
class="input"
:placeholder="placeholder"
:placeholder-class="!value ? placeholderClass : '' "
:value="value"
@input="handleInput"
:disabled="disabled"
@ -23,12 +23,10 @@
class="picker"
@click="handleClick"
>
<text :class="{ 'placeholder': !value }">
<text :class="((placeholderClass && !displayValue) ? placeholderClass : ((!displayValue ? 'placeholder ':'')))">
{{ displayValue || placeholder }}
</text>
<image class="right_img" :src="cssUrl + 'input_ex.png'" />
<!-- <uni-icons type="arrowright" size="14" color="#999" /> -->
<image class="right_img" :src="cssUrl + '/input_ex.png'" />
</view>
</view>
</template>
@ -43,11 +41,22 @@
default: 'input',
validator: (val) => ['input', 'picker'].includes(val),
},
value: [String, Number], //
placeholderClass: {
type: String,
default: 'formItemPlaceholderStyle'
},
value:{
type: [String, Number, Boolean],
default: false
},//
placeholder: String, //
required: Boolean, //
disabled: Boolean, //
displayValue: String, // picker"/"
displayValue: {
type: String,
default: ''
}, // picker"/"
},
data(){
return{
@ -72,8 +81,9 @@
display: flex;
justify-content: space-between;
align-items: center;
padding: 36rpx 24rpx;
padding: 36rpx 0rpx;
border-bottom: 1rpx solid #eee;
min-height: 44rpx;
}
.right_img{
width: 26rpx;
@ -83,7 +93,6 @@
.label {
display: flex;
align-items: center;
font-family: PingFang SC;
font-size: 32rpx;
font-weight: 500;
line-height: 44rpx;
@ -98,13 +107,32 @@
width: 16rpx;
height: 16rpx;
}
.input{
height: 44rpx;
flex-grow: 1;
font-size: 32rpx;
flex: 1;
padding-left: 20rpx;
color: #000000;
display: flex;
justify-content: flex-end;
align-items: center;
flex-grow: 1;
text-align: right;
}
.input,
.picker {
flex: 1;
text-align: right;
padding-left: 20rpx;
color: #333;
color: #000000;
display: flex;
justify-content: flex-end;
align-items: center;
}
.picker text{
font-size: 32rpx;
line-height: 32rpx;
}
.placeholder {
@ -114,6 +142,11 @@
line-height: 44rpx;
text-align: right;
letter-spacing: 0.24rpx;
color: #000;
}
/deep/ .formItemPlaceholderStyle {
font-size: 32rpx;
color: #999999;
line-height: 44rpx;
}
</style>

170
components/SelectYear.vue

@ -1,170 +0,0 @@
<template>
<uni-popup ref="selectDate" :safe-area="false">
<view class="popup-container">
<view class="header">
<view class="title PfScMedium">出生年份</view>
<image class="close-icon" @tap="closePop" :src="cssUrl + 'close.svg'" />
</view>
<view class="date">请选择阳历出生年份</view>
<view class="yearPicker date-wraper">
<picker-view :value="value" @change="handleYearChange" class="picker-view">
<picker-view-column class="picker-column">
<view class="item" v-for="(item, index) in years" :key="index">{{ item }}</view>
</picker-view-column>
</picker-view>
</view>
<view class="confirm-button-wrapper btPadding">
<view class="confirm-button PfScMedium" @click="comfirmYear">
确认
</view>
</view>
</view>
</uni-popup>
</template>
<script>
export default {
data() {
const date = new Date()
const years = []
const year = date.getFullYear()
for (let i = 1900; i <= year; i++) {
years.push(i)
}
var currentYear = year - 10
var value = [years.indexOf(currentYear)]
return {
value,
currentYear,
cssUrl:this.cssUrl,
years: years,
};
},
methods: {
handleYearChange(e) {
this.currentYear = this.years[e.detail.value];
},
comfirmYear(){
this.$emit('change', this.currentYear)
this.closePop()
},
show(){
this.$refs.selectDate.open('bottom')
},
closePop() {
this.$refs.selectDate.close()
},
},
};
</script>
<style lang="scss" scoped>
.yearPicker {
height: 470rpx;
background: #F7F7F7;
.picker-view {
height: 420rpx;
margin: 0 auto;
padding: 0 35rpx;
background: #F7F7F7;
}
.item {
line-height: 70rpx;
font-size: 28rpx;
font-weight: 600;
text-align: center;
}
}
.popup-container {
position: relative;
max-height: calc(100vh - 200rpx);
overflow-y: scroll;
background: #ffffff;
border-radius: 40rpx 40rpx 0px 0px;
padding: 42rpx 54rpx 16rpx;
.header {
position: relative;
text-align: center;
.title {
font-weight: 500;
font-size: 32rpx;
color: #000000;
line-height: 36rpx;
}
.close-icon {
width: 40rpx;
height: 40rpx;
position: absolute;
right: 0;
bottom: 0;
}
}
.content-container {
padding: 24rpx 0rpx 68rpx;
font-family: PingFang SC;
.content-item {
background: #FAFAFA;
&:first-child {
border-top: none;
padding: 25rpx 24rpx;
}
padding: 19rpx 24rpx;
border-top: 2rpx solid #F0F0F0;
span {}
.bold {
font-weight: 500;
font-size: 30rpx;
color: #000000;
}
.top {
margin-top: 12rpx;
margin-bottom: 12rpx;
}
.special {
color: #949699;
letter-spacing: 2rpx;
font-size: 30rpx;
.time {
margin: 0 6rpx;
}
}
}
}
.confirm-button {
font-weight: 500;
font-size: 32rpx;
color: #ffffff;
margin-top: 46rpx;
line-height: 92rpx;
text-align: center;
width: 100%;
height: 92rpx;
background: #39d067;
border-radius: 16rpx;
}
.date {
margin: 12rpx 36rpx 42rpx;
text-align: center;
color: #000000;
font-size: 26rpx;
font-family: PingFang SC;
}
}
</style>

293
components/customeDatePicker.vue

@ -0,0 +1,293 @@
<template>
<view class="datePicker">
<uni-popup ref="updateTreatment" :safe-area="false">
<view class="popup-container">
<view class="header">
<view class="title PfScMedium">出生年份</view>
</view>
<view class="desc">请选择阳历出生年份</view>
<view class="content-container">
<view class="datepicker-wrapper">
<picker-view mask-class="datepicker-mask-class" :indicatorStyle="indicatorStyle" indicator-class="datepicker-custom-indicator" :value="dateValue" @change="onDateChange" @pickstart="pickstart" @pickend="pickend" class="datepicker-picker-view" v-if="visible">
<picker-view-column v-show="showPickerColumn(0)">
<view :class="getItemClass(0, index)+'item ft24'" v-for="(item, index) in years" :key="index">{{item}}</view>
</picker-view-column>
<picker-view-column v-show="showPickerColumn(1)">
<view :class="getItemClass(1, index)+'item ft24'" v-for="(item, index) in months" :key="index">{{item.toString().length==1?('0'+item):item}}</view>
</picker-view-column>
<picker-view-column v-show="showPickerColumn(2)">
<view :class="getItemClass(2, index)+'item ft24'" v-for="(item, index) in days" :key="index">{{item.toString().length==1?('0'+item):item}}</view>
</picker-view-column>
</picker-view>
</view>
<view class="close-up-btn" @click="closePop">
<img :src="((cssUrl+'pop_close_ic.svg').replace('/user/', '/'))" alt="" />
</view>
</view>
<view class="confirm-button-wrapper btPadding">
<view class="confirm-button PfScMedium" @click="onUpdateTreatmentConfirmButtonClick">
确认
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
name:'datePicker',
data() {
const date = new Date()
const years = []
var year = date.getFullYear()
const months = []
var month = date.getMonth() + 1
const days = []
var day = date.getDate()
for (let i = date.getFullYear()-100; i <= date.getFullYear(); i++) {
years.push(i)
}
for (let i = 1; i <= 12; i++) {
months.push(i)
}
for (let i = 1; i <= 31; i++) {
days.push(i)
}
month = 1;
day = 1;
year = year - 10
var datestr = year+'/'+(month.toString().length==1?('0'+month):month)+'/'+(day.toString().length==1?('0'+day):day)
var dateValue = [years.indexOf(year), months.indexOf(month), days.indexOf(day)];
return {
title: "datepicker-picker-view",
years,
year,
months,
month,
days,
day,
cssUrl:this.cssUrl,
dateValue,
date:datestr,
treatmentDateString:'',
indicatorStyle: 'height: '+uni.upx2px(68)+'px;',
visible: true,
timetimer:null,
dateChangeFlag:true
}
},
props: {
defaultDate:{
type:String,
default:''
},
format:{
type:String,
default:'yyyy'
}
},
computed: {
},
methods: {
showPickerColumn(columnIndex) {
if (columnIndex === 0 && this.format.indexOf('yyyy') !== -1) return true
if (columnIndex === 1 && this.format.indexOf('mm')!== -1) return true
if (columnIndex === 2 && this.format.indexOf('dd')!== -1) return true
return false
},
getItemClass(columnIndex, index) {
var curindex = this.dateValue[columnIndex]
if(index == curindex) return 'selected PfScMedium ';
var abs = Math.abs(index-curindex)
if(abs <= 3) return 'style'+abs+' ';
return '';
},
open(direction){
this.visible = false;
this.$nextTick(() => {
this.visible = true;
this.$refs.updateTreatment.open(direction);
});
},
pickstart(e) {
this.dateChangeFlag = false
},
pickend(e) {
this.dateChangeFlag = true
},
onDateChange(e) {
var datainfo = e.detail.value
var year = this.years[datainfo[0]]
var month = this.months[datainfo[1]]
var day = this.days[datainfo[2]]
this.dateValue = [datainfo[0], datainfo[1], datainfo[2]];
this.date = year+'/'+(month.toString().length==1?('0'+month):month)+'/'+(day.toString().length==1?('0'+day):day)
},
closePop() {
this.$refs.updateTreatment.close();
this.visible = false;
},
onUpdateTreatmentConfirmButtonClick() {
if(!this.dateChangeFlag) return
this.treatmentDateString = this.date;
this.$emit('getDateString', this.treatmentDateString);
this.$refs.updateTreatment.close();
this.visible = false;
},
}
}
</script>
<style scoped lang="scss">
.datePicker{
.popup-container {
position: relative;
max-height: calc(100vh - 50rpx);
overflow-y: scroll;
background: #ffffff;
border-radius: 40rpx 40rpx 0px 0px;
padding: 42rpx 32rpx 0;
.header {
display: flex;
align-items: center;
justify-content: center;
position: relative;
.title {
font-size: 36rpx;
color: #000000;
height: 50px;
line-height: 50px;
display: flex;
align-items: center;
justify-content: center;
}
.close-icon {
position: absolute;
z-index: 1;
top: 50%;
transform: translateY(-50%);
right: 0;
width: 40rpx;
height: 40rpx;
}
}
.desc{
font-size: 28rpx;
font-weight: normal;
line-height: 38rpx;
height: 38rpx;
color: #666666;
text-align: center;
margin-top: 12rpx;
}
.content-container{
width: 100%;
padding: 0 25rpx;
box-sizing: border-box;
margin-bottom: 42rpx;
background: #F7F7F7;
.datepicker-wrapper{
width: calc(100% - 80rpx);
margin: 0 auto;
}
.close-up-btn{
position: absolute;
right: 44rpx;
top: 44rpx;
z-index: 9;
width: 40rpx;
height: 40rpx;
img{
width: 40rpx;
height: 40rpx;
}
}
.item{
line-height: 68rpx;
height: 68rpx;
color: #E5E5E5;
&.selected {
font-size: 28rpx !important;
color: #000000 !important;
}
&.style1 {
font-size: 26rpx !important;
color: #999999 !important;
}
&.style2 {
color: #BEBEBE !important;
font-size: 24rpx !important;
}
&.style3 {
color: #E5E5E5 !important;
font-size: 24rpx !important;
}
}
}
.datepicker-picker-view {
margin-top: 46rpx;
width: 100%;
height: 470rpx;
background: #F7F7F7;
}
.item {
line-height: 100rpx;
text-align: center;
}
.confirm-button-wrapper{
box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(181,181,181,0.13);
height: 124rpx;
width: 750rpx;
margin-left: -32rpx;
background: #FFFFFF;
overflow: hidden;
position: relative;
z-index: 888;
.confirm-button {
margin: 16rpx 54rpx;
height: 92rpx;
background: #39d067;
border-radius: 16rpx;
font-size: 32rpx;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
}
}
}
</style>
<style>
>>> .datepicker-mask-class{
background-image: none;
}
.datepicker-custom-indicatorr::before{
border-top: 3rpx solid #D7D7D7 !important;
}
.datepicker-custom-indicatorr::after{
border-bottom: 3rpx solid #D7D7D7 !important;
}
</style>

14
components/inputBox.vue

@ -1,10 +1,10 @@
<template>
<view class="input-com">
<view :class="'input-wrapper'+(errormsg?' error':'')">
<view :class="'input-wrapper'+(errormsg?' error':'')" :style="inputstyle">
<view class="top-wrapper flex">
<view class="left PfScMedium">
<view>{{label}}</view>
<view class="PfScMedium">{{label}}</view>
<image v-if="required" class="required" :src="cssUrl + 'required.svg'" />
</view>
<view class="right">
@ -37,6 +37,10 @@ export default {
type: String,
default: ""
},
inputstyle: {
type: String,
default: ""
},
holder: {
type: String,
default: ''
@ -149,7 +153,6 @@ export default {
font-size: 32rpx;
line-height: 32rpx;
letter-spacing: 1rpx;
align-items: center;
margin: 0;
}
&.error{
@ -168,9 +171,7 @@ export default {
view{
color: #000000;
letter-spacing: 2rpx;
font-family: PingFang SC;
font-size: 32rpx;
font-weight: 500;
line-height: 44rpx;
color: #000000;
}
@ -187,6 +188,9 @@ export default {
position: relative;
.input{
color: #222222;
height: 100%;
font-size: 32rpx;
&::placeholder{
font-size: 32rpx;
font-weight: normal;

7
components/preBookList.vue

@ -99,9 +99,9 @@ export default {
margin-bottom: 12rpx
}
.loction{
max-width: 500rpx;
min-height: 40rpx;
line-height: 40rpx;
font-size: 28rpx;
color: #949699;
}
}
@ -130,9 +130,8 @@ export default {
align-items: center;
justify-content: center;
border-radius: 6rpx;
padding: 2rpx 18rpx;
height: 32rpx;
line-height: 32rpx;
padding: 0rpx 18rpx;
height: 40rpx;
text-align: center;
font-size: 22rpx;
}

1
pages/index/index.vue

@ -748,6 +748,7 @@ export default {
color: #000000;
font-size: 34rpx;
line-height: 40rpx;
height: 40rpx;
font-family: PingFang SC;
font-weight: normal;
letter-spacing: normal;

40
pages/modify_visitor/modify_visitor.vue

@ -2,11 +2,7 @@
<view class="visitor-form-page">
<view class="block">
<input-box class="inputcom-wrapper" v-model="name" holder="必填项" label="姓名"
@blurEvent="nameBlurEvent" required></input-box>
<!-- <input-box class="inputcom-wrapper" v-model="idcard" holder="填写身份证号码" label="身份证号" @blurEvent="idCardBlurEvent" rule="idcard"></input-box> -->
<!-- <input-box class="inputcom-wrapper" v-model="phone" holder="方便预约后联系,非必填" label="手机号"
@blurEvent="phoneBlurEvent" rule="phone"></input-box> -->
<!-- <FormItem label="姓名" type="input" v-model="name" placeholder="必填项" required /> -->
@blurEvent="nameBlurEvent" required inputstyle="border-radius:0;width:100%;"></input-box>
<FormItem label="性别" type="picker" :display-value="genders[sex] || ''" placeholder="必选" required
@click="showGenderPicker" />
<FormItem label="出生年份" type="picker" :display-value="year ? `${year}` : ''" placeholder="必选"
@ -30,7 +26,7 @@
<view class="btn primary btn1" hover-class="hover" @click="submit">确认</view>
</view>
</view>
<SelectYear ref="yearPicker" @change="handleYearChange" />
<CustomeDatePicker ref="customeDatePicker" @getDateString="handleYearChange" />
<SexPop ref="genderPopup" v-model="sex" @confirm="handleConfirm" />
@ -40,7 +36,7 @@
<script>
import InputBox from '@/components/inputBox.vue';
import FormItem from '@/components/FormItem.vue';
import SelectYear from '@/components/SelectYear.vue';
import CustomeDatePicker from '@/components/customeDatePicker.vue';
import SexPop from '@/components/SexPop.vue';
export default {
@ -50,12 +46,6 @@ export default {
cssUrl: this.cssUrl,
year: '',
name: '',
// form: {
// year: '',
// name: '',
// sex: '',
// phone: ''
// },
sex:'',
nameRule: false,
idcard: '',
@ -76,7 +66,7 @@ export default {
InputBox,
FormItem,
SexPop,
SelectYear
CustomeDatePicker
},
onLoad(option) {
if (option.type) this.type = option.type
@ -100,11 +90,11 @@ export default {
this.checkSubmit()
},
handleYearChange(year) {
this.year = year;
this.year = year.split('/')[0];
this.checkSubmit()
},
showYearPicker() {
this.$refs.yearPicker.show()
this.$refs.customeDatePicker.open('bottom')
},
showGenderPicker() {
this.$refs.genderPopup.show();
@ -166,16 +156,6 @@ export default {
this.nameRule = res
this.checkSubmit()
},
// idCardBlurEvent(value, res) {
// this.idcard = value
// this.idcardExtRule = res
// this.checkSubmit()
// },
// phoneBlurEvent(value, res) {
// this.phone = value
// this.phoneRule = res
// this.checkSubmit()
// },
checkSubmit() {
this.canSubmit = false
if (!this.name || (this.sex !=0 && this.sex!=1) || !this.year) return
@ -198,19 +178,20 @@ export default {
<style lang="scss" scoped>
.visitor-form-page {
// background: #F8F8F8;
background: #FFFFFF;
background: #F8F8F8;
height: 100vh;
overflow-y: scroll;
.block {
// background: #FFFFFF;
background: #FFFFFF;
box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.03);
border-radius: 8rpx;
width: 714rpx;
margin: 20rpx auto 0rpx;
overflow: hidden;
padding: 0 24rpx;
box-sizing: border-box;
&:nth-child(3) {
border: none !important;
@ -238,6 +219,7 @@ export default {
.submit {
margin: 0 auto;
font-size: 32rpx;
}
.fixedBot {

6
pages/visit_detail/visit_detail.vue

@ -356,7 +356,11 @@
background: #F6F6F6;
overflow-y: auto;
box-sizing: border-box;
::v-deep{
.visitor-account-com .uni-collapse-item__wrap{
background: #F8FFF7;
}
}
.ccpop{
&.bed-edit-pop{
::v-deep{

4
pages/visitors/visitors.vue

@ -577,8 +577,8 @@
width: 100%;
top: 82.41%;
.submitbtn{
// width: 646rpx;
margin: 0 auto;
font-size: 32rpx;
}
.tip{
text-align: center;
@ -677,7 +677,7 @@
.popup-container {
position: relative;
max-height: calc(100vh - 200rpx);
max-height: calc(100vh - 50rpx);
overflow-y: scroll;
background: #ffffff;
border-radius: 40rpx 40rpx 0px 0px;

Loading…
Cancel
Save