纽迪希亚平板
This commit is contained in:
72
components/NavBar.vue
Normal file
72
components/NavBar.vue
Normal file
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<view class="zd-row header">
|
||||
<view class="zd-col-8 home_title">{{title}}</view>
|
||||
<view class="zd-col-8 zd-row jcflexend home_userinfo">
|
||||
<view v-if="type === '1'" class="exit_text" @tap="Quit">退出</view>
|
||||
<view v-if="type === '2'" class="exit_text" @tap="toHome">返回</view>
|
||||
<view v-if="type === '3'" class="exit_text" @tap="toBack">返回</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
props: {
|
||||
title: String,
|
||||
type: {
|
||||
type: String,
|
||||
default: '1'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
Quit () {
|
||||
this.$store.dispatch('delUserInfo', '')
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
},
|
||||
toHome () {
|
||||
uni.redirectTo({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
},
|
||||
toBack () {
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
@import '@/common/style/mixin.styl';
|
||||
.header
|
||||
position fixed
|
||||
top 0
|
||||
left 0
|
||||
_wh(100%, .77rem)
|
||||
padding 0 0.4rem
|
||||
align-items flex-start
|
||||
justify-content flex-end
|
||||
_bis(,'../static/images/bg_header.png', 100%, 100%,bottom)
|
||||
.home_title
|
||||
_font(0.4rem,.77rem, #8DBFEE, bold, center)
|
||||
font-family 'SourceHanSansCN-Bold'
|
||||
font-style italic
|
||||
background linear-gradient(0deg, #A2C3E3 0%, #5E9ED9 11.9140625%, #A2C3E3 100%)
|
||||
-webkit-background-clip text
|
||||
-webkit-text-fill-color transparent
|
||||
border-bottom 0
|
||||
padding 0
|
||||
.home_userinfo
|
||||
height 100%
|
||||
.exit_text
|
||||
height .43rem
|
||||
padding 0 .14rem
|
||||
border 1px solid #68AFF4
|
||||
background linear-gradient(to bottom, #152B56, #1B4181)
|
||||
_font(.2rem,.43rem, #fff,,)
|
||||
</style>
|
||||
114
components/SearchBox.vue
Normal file
114
components/SearchBox.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<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.length" class="pdr10" type="clear" size="24" color="#fff" @tap="toDel"></uni-icons>
|
||||
<uni-icons type="scan" size="22" color="#4e6ef2" @tap="toScan"></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', '')
|
||||
},
|
||||
handleSend (e) {
|
||||
this.$emit('input', e.target.value)
|
||||
if (e.target.value.length) {
|
||||
this.$emit('handleChange', e.target.value)
|
||||
}
|
||||
},
|
||||
async toScan() {
|
||||
// #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>
|
||||
Reference in New Issue
Block a user