feat: 工作台改版并区分东大与新大陆扫码
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<u-popup v-model="visible" mode="bottom" :safe-area-inset-bottom="true" border-radius="16">
|
||||
<view class="search-select">
|
||||
<view class="search-select" :style="{ maxHeight: panelMaxHeight + 'px' }">
|
||||
<view class="search-select__bar">
|
||||
<text class="search-select__title">{{ title }}</text>
|
||||
<text class="search-select__cancel" @click="visible = false">取消</text>
|
||||
@@ -8,7 +8,12 @@
|
||||
<view class="search-select__search">
|
||||
<u-search v-model="keyword" :placeholder="placeholder" :show-action="false" />
|
||||
</view>
|
||||
<scroll-view scroll-y class="search-select__list">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="search-select__list"
|
||||
:style="{ height: listHeight + 'px' }"
|
||||
:enable-back-to-top="false"
|
||||
>
|
||||
<view v-if="!filteredList.length" class="search-select__empty">暂无匹配数据</view>
|
||||
<view
|
||||
v-for="item in filteredList"
|
||||
@@ -32,6 +37,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
keyword: '',
|
||||
panelMaxHeight: 520,
|
||||
listHeight: 360,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -47,10 +54,28 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
show(val) {
|
||||
if (val) this.keyword = '';
|
||||
if (val) {
|
||||
this.keyword = '';
|
||||
this.calcHeight();
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.calcHeight();
|
||||
},
|
||||
methods: {
|
||||
calcHeight() {
|
||||
try {
|
||||
const sys = uni.getSystemInfoSync();
|
||||
const winH = sys.windowHeight || 600;
|
||||
// 弹层约占屏高 65%,列表为弹层去掉标题+搜索后的剩余高度
|
||||
this.panelMaxHeight = Math.floor(winH * 0.65);
|
||||
this.listHeight = Math.max(220, this.panelMaxHeight - 140);
|
||||
} catch (e) {
|
||||
this.panelMaxHeight = 520;
|
||||
this.listHeight = 360;
|
||||
}
|
||||
},
|
||||
confirm(item) {
|
||||
this.visible = false;
|
||||
this.$emit('confirm', item);
|
||||
@@ -63,8 +88,13 @@ export default {
|
||||
.search-select {
|
||||
background: #fff;
|
||||
padding-bottom: 20rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
.search-select__bar {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
@@ -80,10 +110,12 @@ export default {
|
||||
color: #888;
|
||||
}
|
||||
.search-select__search {
|
||||
flex-shrink: 0;
|
||||
padding: 0 24rpx 12rpx;
|
||||
}
|
||||
.search-select__list {
|
||||
height: 640rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.search-select__empty {
|
||||
padding: 80rpx 0;
|
||||
|
||||
Reference in New Issue
Block a user