Commit b976c23a authored by JingChao's avatar JingChao

Merge branch 'hmap' of https://hel.hand-china.com/easyUI/hls-easy-ui into hmap

parents 7600fa2d ba715349
...@@ -2,7 +2,7 @@ export default (Vue) => { ...@@ -2,7 +2,7 @@ export default (Vue) => {
Vue.filter('currency', function (val) { Vue.filter('currency', function (val) {
if (!val) return '0.00' if (!val) return '0.00'
var intPart = Number(val).toFixed(0) // 获取整数部分 var intPart = parseInt(Number(val)) // 获取整数部分
var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断 var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断
var floatPart = '.00' // 预定义小数部分 var floatPart = '.00' // 预定义小数部分
......
...@@ -163,14 +163,20 @@ export default { ...@@ -163,14 +163,20 @@ export default {
do { do {
if (nextElement) { if (nextElement) {
let elHeight = window.getComputedStyle(nextElement).height let elHeight = window.getComputedStyle(nextElement).height
if (elHeight) { let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) {
nextHeight += Number(elHeight.replace('px', '')) nextHeight += Number(elHeight.replace('px', ''))
} }
if (nextElement._prevClass && nextElement._prevClass.indexOf('h-bottom-tab') === 0) { if (nextElement._prevClass && nextElement._prevClass.indexOf('h-bottom-tab') === 0) {
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) { let height = nextElement.clientHeight
nextHeight += vm.fontSize * 0.68 if (detectOS() === 'ios' && height > Math.ceil(vm.fontSize * 0.88)) {
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) { nextHeight += 0
nextHeight += vm.fontSize * 0.68 } else {
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) {
nextHeight += vm.fontSize * 0.68
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) {
nextHeight += vm.fontSize * 0.68
}
} }
} }
nextElement = nextElement.nextElementSibling nextElement = nextElement.nextElementSibling
......
<template> <template>
<!--<transition :name="transition">--> <!--<transition :name="transition">-->
<div v-show="showModal" :class="active" class="modal-backdrop" @touchstart="hideModal"> <div v-show="showModal" :class="active" class="modal-backdrop" @click.capture="hideModal">
<div class="modal-backdrop-bg"/> <div class="modal-backdrop-bg"/>
<div <div
:class="[modalClass,cusClass]" :class="[modalClass,transition]"
class="modal slide-in-up" class="modal"
@touchstart="start" @touchstart="start"
@mousedown="start"> @mousedown="start">
<slot/> <slot/>
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
value: Boolean, // eslint-disable-line value: Boolean, // eslint-disable-line
position: { position: {
type: String, type: String,
default: 'bottom', default: 'top',
}, },
cusClass: { cusClass: {
type: String, type: String,
...@@ -34,7 +34,12 @@ export default { ...@@ -34,7 +34,12 @@ export default {
}, },
computed: { computed: {
transition () { transition () {
return this.position === 'bottom' ? 'slide-in-up' : 'slide-in-down' return {
'slide-in-up': this.position === 'top',
'slide-in-down': this.position === 'bottom',
'slide-in-left': this.position === 'left',
'slide-in-right': this.position === 'right',
}
}, },
active () { active () {
return this.showModal ? 'active' : 'hide' return this.showModal ? 'active' : 'hide'
...@@ -59,7 +64,7 @@ export default { ...@@ -59,7 +64,7 @@ export default {
this.state = 2 this.state = 2
setTimeout(() => { setTimeout(() => {
}, 400) }, 400)
}, 50) }, 100)
}, },
showModal (val) { showModal (val) {
// 标签用法时需要发射一个input事件,修改v-model绑定的属性值 // 标签用法时需要发射一个input事件,修改v-model绑定的属性值
...@@ -72,14 +77,23 @@ export default { ...@@ -72,14 +77,23 @@ export default {
}, },
start (e) { start (e) {
e.stopPropagation() // e.stopPropagation()
}, },
hideModal () { hideModal (e) {
this.state = 3 if(!e){
setTimeout(() => { this.state = 3
this.state = 0 setTimeout(() => {
this.showModal = false this.state = 0
}, 250) this.showModal = false
}, 250)
}
if(e && e.target && e.target.className.indexOf('modal-backdrop') === 0){
this.state = 3
setTimeout(() => {
this.state = 0
this.showModal = false
}, 250)
}
}, },
}, },
} }
......
...@@ -188,6 +188,9 @@ export default { ...@@ -188,6 +188,9 @@ export default {
bubbleY: 0, // 气泡y坐标, bubbleY: 0, // 气泡y坐标,
isIos: false, isIos: false,
fullScreen: true, fullScreen: true,
fontSize: Number(window.document.documentElement.style.fontSize.replace('px', '')),
winHeight: window.innerHeight,
winWidth: window.innerWidth,
} }
}, },
computed: { computed: {
...@@ -232,6 +235,60 @@ export default { ...@@ -232,6 +235,60 @@ export default {
}) })
}, },
methods: { methods: {
getHeaderHeight () {
let vm = this
let $el = vm.$el.previousElementSibling
let headerHeight = 0
do {
if ($el) {
let elHeight = window.getComputedStyle($el).height
let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) {
headerHeight += Number(elHeight.replace('px', ''))
}
if ($el._prevClass && $el._prevClass.indexOf('h-header') === 0) {
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) {
headerHeight += 0.8 * vm.fontSize
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) {
headerHeight += 0.8 * vm.fontSize
} else if (detectOS() === 'ios') {
headerHeight += 0.4 * vm.fontSize
}
}
$el = $el.previousElementSibling
}
} while ($el)
return headerHeight
},
getNextElementHeight () {
let vm = this
let nextElement = this.$el.nextElementSibling
let nextHeight = 0
do {
if (nextElement) {
let elHeight = window.getComputedStyle(nextElement).height
let part = /^\d+(\.\d+)?px$/
if (elHeight && part.test(elHeight)) {
nextHeight += Number(elHeight.replace('px', ''))
}
if (nextElement._prevClass && nextElement._prevClass.indexOf('h-bottom-tab') === 0) {
let height = nextElement.clientHeight
if (detectOS() === 'ios' && height > Math.ceil(vm.fontSize * 0.88)) {
nextHeight += 0
} else {
if (detectOS() === 'ios' && vm.winWidth === 375 && vm.winHeight === 812) {
nextHeight += vm.fontSize * 0.68
} else if (detectOS() === 'ios' && vm.winWidth === 414 && vm.winHeight === 896) {
nextHeight += vm.fontSize * 0.68
}
}
}
nextElement = nextElement.nextElementSibling
}
} while (nextElement)
return nextHeight
},
// 初始化scroll // 初始化scroll
initScroll () { initScroll () {
let vm = this let vm = this
...@@ -239,7 +296,10 @@ export default { ...@@ -239,7 +296,10 @@ export default {
// 设置scrollContent的最小高,实现高度不足时也有回弹效果 // 设置scrollContent的最小高,实现高度不足时也有回弹效果
if (this.$refs.scrollContent) { if (this.$refs.scrollContent) {
const headerHeight = vm.getHeaderHeight()
// const nextHeight = vm.getNextElementHeight()
this.$refs.scrollContent.style.minHeight = `${this.$refs.scroll.getBoundingClientRect().height + 1}px` this.$refs.scrollContent.style.minHeight = `${this.$refs.scroll.getBoundingClientRect().height + 1}px`
this.$refs.scrollContent.style.paddingTop = `${headerHeight}px`
if (vm.hasFoot.footFlag) { if (vm.hasFoot.footFlag) {
let height = vm.hasFoot.height || 88 let height = vm.hasFoot.height || 88
// this.$refs.scrollContent.style.minHeight = `${this.$refs.scroll.getBoundingClientRect().height - height}px` // this.$refs.scrollContent.style.minHeight = `${this.$refs.scroll.getBoundingClientRect().height - height}px`
...@@ -406,9 +466,10 @@ export default { ...@@ -406,9 +466,10 @@ export default {
//$ = vue-better-scroll //$ = vue-better-scroll
.vue-better-scroll { .vue-better-scroll {
width 100% width 100%
overflow hidden overflow hidden !important
box-sizing border-box box-sizing border-box
position relative position absolute !important
top 0
height 100% height 100%
&__wrapper { &__wrapper {
...@@ -422,7 +483,7 @@ export default { ...@@ -422,7 +483,7 @@ export default {
text-size-adjust: none; text-size-adjust: none;
-webkit-transform-origin: left top; -webkit-transform-origin: left top;
transform-origin: left top; transform-origin: left top;
padding-bottom: 0.9rem; padding-bottom: 0.4rem;
} }
&__pullup { &__pullup {
...@@ -461,20 +522,24 @@ export default { ...@@ -461,20 +522,24 @@ export default {
} }
} }
} }
.has-footer {
.vue-better-scroll__wrapper {
padding-bottom: 1rem;
}
}
.platform-ios{ .platform-ios{
.vue-better-scroll { .has-footer {
&__wrapper { .vue-better-scroll__wrapper {
// padding-bottom: 2.16rem; padding-bottom: 1rem;
} }
} }
} }
// iPhoneX适配 // iPhoneX适配
@media (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) { @media (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) {
.platform-ios { .platform-ios {
.vue-better-scroll { .has-footer {
&__wrapper { .vue-better-scroll__wrapper {
// padding-bottom: 2.84rem; padding-bottom: 1.8rem;
} }
} }
} }
...@@ -483,9 +548,9 @@ export default { ...@@ -483,9 +548,9 @@ export default {
// iPhoneX Max适配 // iPhoneX Max适配
@media (device-width: 414px) and (device-height: 896px) { @media (device-width: 414px) and (device-height: 896px) {
.platform-ios { .platform-ios {
.vue-better-scroll { .has-footer {
&__wrapper { .vue-better-scroll__wrapper {
// padding-bottom: 2.84rem; padding-bottom: 1.8rem;
} }
} }
} }
......
...@@ -2,7 +2,7 @@ export default (Vue) => { ...@@ -2,7 +2,7 @@ export default (Vue) => {
Vue.filter('currency', function (val) { Vue.filter('currency', function (val) {
if (!val) return '0.00' if (!val) return '0.00'
var intPart = Number(val).toFixed(0) // 获取整数部分 var intPart = parseInt(Number(val)) // 获取整数部分
var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断 var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断
var floatPart = '.00' // 预定义小数部分 var floatPart = '.00' // 预定义小数部分
......
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