打包
This commit is contained in:
@@ -3,15 +3,15 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="filter_input pdr120"
|
class="filter_input pdr120"
|
||||||
|
confirm-type="go"
|
||||||
:value="value"
|
:value="value"
|
||||||
:focus="focusState"
|
:focus="focusState"
|
||||||
@blur="handleBlur($event)"
|
@focus="handleFocus"
|
||||||
@input="handleChange($event)">
|
@blur="handleBlur"
|
||||||
|
@confirm="handleSend">
|
||||||
<view class="zd-row buttons_wraper">
|
<view class="zd-row buttons_wraper">
|
||||||
<!-- <uni-icons @tap="toDel" type="closeempty" size="20" color="#4e6ef2"></uni-icons> -->
|
<uni-icons v-show="value.length" class="pdr10" type="clear" size="24" color="#666" @tap="toDel"></uni-icons>
|
||||||
<uni-icons class="pdr10" @tap="toScan" type="scan" size="20" :color="focusState ? '#ff6a00' : '#4e6ef2'"></uni-icons>
|
<uni-icons type="scan" size="22" :color="focusState ? '#ff6a00' : '#4e6ef2'" @tap="focusState=true"></uni-icons>
|
||||||
<uni-icons @tap="toPhone" type="camera" size="26" color="#4e6ef2"></uni-icons>
|
|
||||||
<uni-icons v-show="seaShow" @tap="toSearch" type="search" size="20" color="#4e6ef2"></uni-icons>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
cur: '',
|
|
||||||
focusState: false
|
focusState: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -30,97 +29,28 @@
|
|||||||
event: 'input'
|
event: 'input'
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: String,
|
value: String
|
||||||
seaShow: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
focused: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
focused() {
|
|
||||||
this.focusState = this.focused
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
if (this.focused) {
|
|
||||||
this.focusState = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
handleChange ($event) {
|
handleFocus () {
|
||||||
this.cur = $event.target.value
|
this.focusState = true
|
||||||
this.$emit('input', this.cur)
|
|
||||||
this.$emit('handleChange', this.cur)
|
|
||||||
if (this.focusState) {
|
|
||||||
this.focusState = false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
handleBlur () {
|
handleBlur (e) {
|
||||||
this.focusState = false
|
this.$emit('input', e.target.value)
|
||||||
},
|
// if (e.target.value.length) {
|
||||||
toSearch () {
|
// this.$emit('handleChange', e.target.value)
|
||||||
this.$emit('toSearch', this.cur)
|
// }
|
||||||
|
this.focusState = false
|
||||||
},
|
},
|
||||||
toDel () {
|
toDel () {
|
||||||
this.cur = ''
|
|
||||||
this.$emit('input', '')
|
this.$emit('input', '')
|
||||||
},
|
},
|
||||||
toScan () {
|
handleSend (e) {
|
||||||
setTimeout(() => {
|
this.$emit('input', e.target.value)
|
||||||
this.focusState = true
|
if (e.target.value.length) {
|
||||||
},0)
|
this.$emit('handleChange', e.target.value)
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideKeyboard()
|
|
||||||
}, 300)
|
|
||||||
this.cur = ''
|
|
||||||
this.$emit('input', '')
|
|
||||||
},
|
|
||||||
async toPhone() {
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
let status = await this.checkPermission();
|
|
||||||
if (status !== 1) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// #endif
|
|
||||||
uni.scanCode({
|
|
||||||
success: (res) => {
|
|
||||||
this.$emit('input', res.result)
|
|
||||||
this.$emit('handleChange', res.result)
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '出错',
|
|
||||||
// icon: 'none'
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// #ifdef APP-PLUS
|
|
||||||
,
|
|
||||||
async checkPermission(code) {
|
|
||||||
let status = permision.isIOS ? await permision.requestIOS('camera') :
|
|
||||||
await permision.requestAndroid('android.permission.CAMERA');
|
|
||||||
|
|
||||||
if (status === null || status === 1) {
|
|
||||||
status = 1;
|
|
||||||
} else {
|
|
||||||
uni.showModal({
|
|
||||||
content: "需要相机权限",
|
|
||||||
confirmText: "设置",
|
|
||||||
success: function(res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
permision.gotoAppSetting();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
142
components/SearchBox_back.vue
Normal file
142
components/SearchBox_back.vue
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
<template>
|
||||||
|
<view class="search_wraper">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="filter_input pdr120"
|
||||||
|
:value="value"
|
||||||
|
:focus="focusState"
|
||||||
|
@blur="handleBlur($event)"
|
||||||
|
@input="handleChange($event)">
|
||||||
|
<view class="zd-row buttons_wraper">
|
||||||
|
<!-- <uni-icons @tap="toDel" type="closeempty" size="20" color="#4e6ef2"></uni-icons> -->
|
||||||
|
<uni-icons class="pdr10" @tap="toScan" type="scan" size="20" :color="focusState ? '#ff6a00' : '#4e6ef2'"></uni-icons>
|
||||||
|
<uni-icons @tap="toPhone" type="camera" size="26" color="#4e6ef2"></uni-icons>
|
||||||
|
<uni-icons v-show="seaShow" @tap="toSearch" type="search" size="20" color="#4e6ef2"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import permision from "@/utils/permission.js"
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
cur: '',
|
||||||
|
focusState: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
model: {
|
||||||
|
prop: 'value',
|
||||||
|
event: 'input'
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
value: String,
|
||||||
|
seaShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
focused: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
focused() {
|
||||||
|
this.focusState = this.focused
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
if (this.focused) {
|
||||||
|
this.focusState = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleChange ($event) {
|
||||||
|
this.cur = $event.target.value
|
||||||
|
this.$emit('input', this.cur)
|
||||||
|
this.$emit('handleChange', this.cur)
|
||||||
|
if (this.focusState) {
|
||||||
|
this.focusState = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleBlur () {
|
||||||
|
this.focusState = false
|
||||||
|
},
|
||||||
|
toSearch () {
|
||||||
|
this.$emit('toSearch', this.cur)
|
||||||
|
},
|
||||||
|
toDel () {
|
||||||
|
this.cur = ''
|
||||||
|
this.$emit('input', '')
|
||||||
|
},
|
||||||
|
toScan () {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.focusState = true
|
||||||
|
},0)
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideKeyboard()
|
||||||
|
}, 300)
|
||||||
|
this.cur = ''
|
||||||
|
this.$emit('input', '')
|
||||||
|
},
|
||||||
|
async toPhone() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
let status = await this.checkPermission();
|
||||||
|
if (status !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
uni.scanCode({
|
||||||
|
success: (res) => {
|
||||||
|
this.$emit('input', res.result)
|
||||||
|
this.$emit('handleChange', res.result)
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '出错',
|
||||||
|
// icon: 'none'
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
,
|
||||||
|
async checkPermission(code) {
|
||||||
|
let status = permision.isIOS ? await permision.requestIOS('camera') :
|
||||||
|
await permision.requestAndroid('android.permission.CAMERA');
|
||||||
|
|
||||||
|
if (status === null || status === 1) {
|
||||||
|
status = 1;
|
||||||
|
} else {
|
||||||
|
uni.showModal({
|
||||||
|
content: "需要相机权限",
|
||||||
|
confirmText: "设置",
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
permision.gotoAppSetting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</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>
|
||||||
@@ -20,7 +20,10 @@
|
|||||||
"ignoreVersion" : true
|
"ignoreVersion" : true
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules" : {},
|
"modules" : {
|
||||||
|
"Barcode" : {},
|
||||||
|
"Camera" : {}
|
||||||
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
@@ -41,7 +44,8 @@
|
|||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
]
|
],
|
||||||
|
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {
|
"ios" : {
|
||||||
|
|||||||
Reference in New Issue
Block a user