恒森类似项目
This commit is contained in:
87
components/LinkScan.vue
Normal file
87
components/LinkScan.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<view class="search_wraper">
|
||||
<input
|
||||
type="text"
|
||||
class="filter_input pdr120"
|
||||
confirm-type="go"
|
||||
:value="value"
|
||||
:focus="focusState"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
@confirm="handleSend">
|
||||
<view class="filter_num">{{editValue.toString()}}</view>
|
||||
<view class="zd-row buttons_wraper">
|
||||
<uni-icons v-show="editValue.length > 0" class="pdr10" type="clear" size="24" color="#666" @tap="linkDel"></uni-icons>
|
||||
<uni-icons v-show="value !== '' && value !== null && value !== undefined" class="pdr10" type="clear" size="24" color="#666" @tap="toDel"></uni-icons>
|
||||
<uni-icons type="scan" size="22" :color="focusState ? '#ff6a00' : '#4e6ef2'" @tap="focusState=true"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import permision from "@/utils/permission.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
focusState: false
|
||||
};
|
||||
},
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'input'
|
||||
},
|
||||
props: {
|
||||
value: String,
|
||||
editValue: Array
|
||||
},
|
||||
methods: {
|
||||
handleFocus () {
|
||||
this.focusState = true
|
||||
},
|
||||
handleBlur (e) {
|
||||
this.$emit('input', e.target.value)
|
||||
// if (e.target.value.length) {
|
||||
// this.$emit('handleChange', e.target.value)
|
||||
// }
|
||||
this.focusState = false
|
||||
},
|
||||
toDel () {
|
||||
this.$emit('input', '')
|
||||
this.$emit('handleDel')
|
||||
},
|
||||
linkDel () {
|
||||
this.$emit('linkDel')
|
||||
},
|
||||
handleSend (e) {
|
||||
this.$emit('input', e.target.value)
|
||||
if (e.target.value.length) {
|
||||
this.$emit('handleChange', e.target.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '../common/style/mixin.styl';
|
||||
.search_wraper
|
||||
position relative
|
||||
_wh(100%, 80rpx)
|
||||
.pdr120
|
||||
padding-right: 50%;
|
||||
.buttons_wraper
|
||||
position absolute
|
||||
top 0
|
||||
right 10rpx
|
||||
_wh(auto, 80rpx)
|
||||
.pdr10
|
||||
padding-right 10rpx
|
||||
.filter_num
|
||||
position absolute
|
||||
top 0
|
||||
right 50px
|
||||
width calc(50% - 50px)
|
||||
overflow hidden
|
||||
text-overflow ellipsis
|
||||
line-height 80rpx
|
||||
</style>
|
||||
64
components/NavBar.vue
Normal file
64
components/NavBar.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<view class="zd-row jcflexstart header">
|
||||
<view class="zd-col-4">
|
||||
<uni-icons @tap="goBack" type="back" size="26" color="#fff"></uni-icons>
|
||||
</view>
|
||||
<view class="zd-col-16 page_name">{{title}}</view>
|
||||
<view v-if="searchActive" class="zd-col-4" style="text-align: right">
|
||||
<uni-icons @tap="toSearch" type="search" size="26" color="#fff"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
props: {
|
||||
title: String,
|
||||
inner: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
inner2: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
searchActive: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack () {
|
||||
if (this.inner) {
|
||||
uni.navigateBack()
|
||||
} else if (this.inner2) {
|
||||
this.$emit('goIn')
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
}
|
||||
},
|
||||
toSearch () {
|
||||
this.$emit('toSearch')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
@import '@/common/style/mixin.styl';
|
||||
.header
|
||||
position fixed
|
||||
_wh(100%, calc(var(--status-bar-height) + 72rpx))
|
||||
// background: linear-gradient(to bottom, #ff6800 0%, #ff6400 100%)
|
||||
background-color $red
|
||||
z-index 200
|
||||
padding var(--status-bar-height) 20rpx 0
|
||||
.page_name
|
||||
_font(32rpx, 32rpx, #fff,700,center)
|
||||
</style>
|
||||
34
components/NumberInput.vue
Normal file
34
components/NumberInput.vue
Normal file
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<input
|
||||
class="filter_input"
|
||||
type="number"
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@input="onInput"
|
||||
@confirm="onInput"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: [Number, String],
|
||||
default: '',
|
||||
},
|
||||
placeholder: String
|
||||
},
|
||||
methods: {
|
||||
onInput(event) {
|
||||
// 获取输入值
|
||||
const value = event.detail ? event.detail.value : event.target.value;
|
||||
// 格式化输入值
|
||||
let formattedValue = value.replace(/[^0-9.]/g, '')
|
||||
formattedValue = parseFloat(formattedValue)
|
||||
formattedValue = formattedValue > 0 ? formattedValue : ''
|
||||
this.$emit('input', formattedValue);
|
||||
event.target.value = formattedValue
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
73
components/SearchBox.vue
Normal file
73
components/SearchBox.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<view class="search_wraper">
|
||||
<input
|
||||
type="text"
|
||||
class="filter_input pdr120"
|
||||
confirm-type="go"
|
||||
:value="value"
|
||||
:focus="focusState"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
@confirm="handleSend">
|
||||
<view class="zd-row buttons_wraper">
|
||||
<uni-icons v-show="value !== '' && value !== null && value !== undefined" class="pdr10" type="clear" size="24" color="#666" @tap="toDel"></uni-icons>
|
||||
<uni-icons type="scan" size="22" :color="focusState ? '#ff6a00' : '#4e6ef2'" @tap="focusState=true"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import permision from "@/utils/permission.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
focusState: false
|
||||
};
|
||||
},
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'input'
|
||||
},
|
||||
props: {
|
||||
value: String
|
||||
},
|
||||
methods: {
|
||||
handleFocus () {
|
||||
this.focusState = true
|
||||
},
|
||||
handleBlur (e) {
|
||||
this.$emit('input', e.target.value)
|
||||
// if (e.target.value.length) {
|
||||
// this.$emit('handleChange', e.target.value)
|
||||
// }
|
||||
this.focusState = false
|
||||
},
|
||||
toDel () {
|
||||
this.$emit('input', '')
|
||||
this.$emit('handleDel')
|
||||
},
|
||||
handleSend (e) {
|
||||
this.$emit('input', e.target.value)
|
||||
if (e.target.value.length) {
|
||||
this.$emit('handleChange', e.target.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
@import '../common/style/mixin.styl';
|
||||
.search_wraper
|
||||
position relative
|
||||
_wh(100%, 80rpx)
|
||||
.pdr120
|
||||
padding-right: 120rpx;
|
||||
.buttons_wraper
|
||||
position absolute
|
||||
top 0
|
||||
right 10rpx
|
||||
_wh(auto, 80rpx)
|
||||
.pdr10
|
||||
padding-right 10rpx
|
||||
</style>
|
||||
Reference in New Issue
Block a user