<template>
|
<view>
|
<view class="cu-custom flex align-center zindex" :style="[{height:CustomBar + 'px'}]">
|
<view class="cu-bar fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor]">
|
<view class="action" @tap="BackPage" v-if="isBack">
|
<text class="iconfont icon-fanhui"></text>
|
<slot name="backText"></slot>
|
</view>
|
<view class="action" @tap="$emit('account')" v-if="isHead">
|
<text class="iconfont icon-touxiang"></text>
|
|
</view>
|
<view class="content" :style="[{top:StatusBar + 'px'}]">
|
<slot name="content"></slot>
|
</view>
|
<slot name="right">
|
<!-- <image class="ingLany" src="/static/lanya.png" mode="aspectFit" @click="getLanya"></image> -->
|
</slot>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
StatusBar: this.StatusBar,
|
CustomBar: this.CustomBar
|
};
|
},
|
name: 'cu-custom',
|
computed: {
|
style() {
|
var StatusBar = this.StatusBar;
|
var CustomBar = this.CustomBar;
|
var bgImage = this.bgImage;
|
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
|
if (this.bgImage) {
|
style = `${style}background-image:url(${bgImage});`;
|
}
|
return style
|
}
|
},
|
props: {
|
bgColor: {
|
type: String,
|
default: ''
|
},
|
isBack: {
|
type: [Boolean, String],
|
default: false
|
},
|
isHead: {
|
type: [Boolean, String],
|
default: false
|
},
|
bgImage: {
|
type: String,
|
default: ''
|
},
|
},
|
mounted() {
|
|
},
|
methods: {
|
BackPage() {
|
|
// if (getCurrentPages().length < 2 && 'undefined' !== typeof __wxConfig) {
|
// let url = '/' + __wxConfig.pages[0]
|
// return uni.redirectTo({
|
// url
|
// })
|
// }
|
let pages = getCurrentPages();//获取打开的所有页面
|
console.log("打开的所有页面")
|
console.log(pages)
|
let route = pages[pages.length - 1].route; //当前页面
|
console.log("当前页面" + route)
|
if(route == 'pages/sort/pickorder' || route == 'pages/sort/kittingSort'){
|
uni.showModal({
|
title: '提示',
|
content: '是否确认返回?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
uni.redirectTo({
|
url: '/pages/index/index'
|
})
|
} else if (res.cancel) {
|
return
|
}
|
})
|
});
|
return
|
}
|
|
if (route == 'pages/takeMaterial/orderpiece/orderpiecePo' || route == 'pages/recommend/recommend' || route == 'pages/check/check/index' || route == 'pages/check/square' || route == 'pages/hander/handerIn' || route == 'pages/hander/handerOut' || route == 'pages/sort/pickorder'|| route == 'pages/sort/kittingSort' || route == 'pages/artificial/artificial' || route == 'pages/deliver/deliver' || route == 'pages/deliver/deliverDo') {
|
uni.redirectTo({
|
url: '/pages/index/index'
|
})
|
return
|
}
|
|
if(route == 'pages/takeMaterial/orderpiece/poYueku'){
|
uni.redirectTo({
|
url: '/pages/takeMaterial/orderpiece/orderpiecePo'
|
})
|
return
|
}
|
uni.navigateBack({
|
delta: 1
|
});
|
},
|
getLanya() {
|
uni.showModal({
|
title: '提示',
|
content: '是否重新连接蓝牙?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
uni.navigateTo({
|
url: '../print/bluetoothConnection'
|
})
|
} else if (res.cancel) {}
|
})
|
});
|
},
|
}
|
}
|
</script>
|
|
<style>
|
.zindex {
|
/* z-index: 10; */
|
}
|
|
.ingLany{
|
width: 28px;
|
height: 28px;
|
border-radius: 100%;
|
margin-right: 1%;
|
}
|
</style>
|