隐藏标题

develop
ihzero 2023-11-12 18:37:19 +08:00
parent 50aed06318
commit 42b93add91
28 changed files with 90 additions and 30 deletions

View File

@ -1,13 +1,11 @@
<script>
import store from './store/index.js'
import jwt from '@/api/jwt.js'
import globalMixin from './globalMixin'
export default {
mixins: [globalMixin],
onLaunch: function (e) {
console.log('App Launch')
const { token } = e.query
if (token) {
jwt.setAccessToken(token)
}
if (!store.state.user_access_token) {
//
uni.redirectTo({
@ -33,6 +31,7 @@ export default {
<style lang="scss">
@import 'uview-ui/index.scss';
/*每个页面公共css */
body,
uni-page-body {
background-color: #f8f8f8;

View File

@ -1,12 +1,14 @@
<template>
<u-navbar
:title="title"
:title="show ? title : ''"
:background="background"
:custom-back="goback"
:title-color="titleColor"
:isBack="show"
:back-icon-color="titleColor"
>
<template #right>
<template #right
>
<slot name="right"></slot>
</template>
</u-navbar>
@ -15,6 +17,10 @@
import { navigateBack } from '@/com/utils.js'
export default {
props: {
show: {
type: Boolean,
default: true,
},
title: {
type: String,
default: '',

14
src/globalMixin.js 100644
View File

@ -0,0 +1,14 @@
import store from './store/index.js'
export default {
onLaunch(e) {
const { appbar, token } = e.query
if (token) {
jwt.setAccessToken(token)
}
if (appbar == 'hidden') {
store.commit('showAppbar', false)
} else {
store.commit('showAppbar', true)
}
}
}

View File

@ -3,6 +3,10 @@ import App from './App'
import PortalVue from 'portal-vue'
import './uni.promisify.adaptor'
import uView from "uview-ui";
import mixin from './mixin'
Vue.mixin(mixin)
Vue.use(uView);
Vue.use(PortalVue)
import {http,getFullUrl} from '@/api/index.js'

33
src/mixin.js 100644
View File

@ -0,0 +1,33 @@
import { mapGetters } from 'vuex'
export default {
data() {
return {
h5NavHeightP: 44,
// showAppbar:true
}
},
computed: {
...mapGetters(['showAppbar'])
},
onLoad({ appbar }) {
if (appbar == 'hidden') {
this.h5NavHeightP = 0
// this.showAppbar = false
this.hideNavBar()
}
},
methods: {
hideNavBar() {
/*#ifdef H5*/
this.$nextTick(() => {
let head = document.getElementsByTagName('uni-page-head')
if (head[0]) {
head[0].remove()
}
// console.log(head);
})
/*#endif*/
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<view>
<Appbar title="基地数据">
<Appbar :show="showAppbar" title="基地数据">
<template #right>
<view
v-auth="['endpoint.agricultural_basic.create']"

View File

@ -14,7 +14,7 @@
</view>
</view>
<view class="w-full h-20rpx"></view>
<u-sticky>
<u-sticky :h5NavHeight="h5NavHeightP">
<view class="bg-white">
<view class="flex items-center p-20rpx">
<u-input

View File

@ -1,6 +1,6 @@
<template>
<view>
<Appbar title="基地农作物">
<Appbar :show="showAppbar" title="基地农作物">
<template #right>
<view v-auth="['endpoint.crops.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template>

View File

@ -1,6 +1,6 @@
<template>
<view>
<Appbar title="城镇农作物">
<Appbar :show="showAppbar" title="城镇农作物">
<template #right>
<view
v-auth="['endpoint.town_crops.create']"

View File

@ -1,6 +1,6 @@
<template>
<view class="bg-page">
<u-navbar title="设备管理" :background="background" :custom-back="goback"
<u-navbar :isBack="showAppbar" :title="showAppbar?'设备管理':''" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right">
<view v-auth="['endpoint.device.create']" class="custom_btn add_btn" @click="addBtn()"></view>

View File

@ -1,7 +1,7 @@
<template>
<view class="bg-page">
<u-navbar
title="稻虾流向"
<u-navbar :isBack="showAppbar"
:title="showAppbar?'稻虾流向':''"
:background="background"
:custom-back="goback"
:title-color="titleColor"

View File

@ -1,6 +1,6 @@
<template>
<view class="bg-page">
<u-navbar title="稻虾产业" :background="background" :custom-back="goback"
<u-navbar :isBack="showAppbar" :title="showAppbar?'稻虾产业':''" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right">
<view v-auth="['endpoint.rice_shrimp_industries.create']" class="custom_btn add_btn" @click="addBtn()"></view>

View File

@ -1,6 +1,6 @@
<template>
<view class="bg-page">
<u-navbar title="大宗物资" :background="background" :custom-back="goback"
<u-navbar :isBack="showAppbar" :title="showAppbar?'大宗物资':''" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right">
<view v-auth="['endpoint.materiels.create']" class="custom_btn add_btn" @click="addBtn()"></view>

View File

@ -1,7 +1,8 @@
<template>
<view class="bg-page">
<u-navbar
title="稻虾价格"
<u-navbar :isBack="showAppbar"
:title="showAppbar?'稻虾价格':''"
:background="background"
:custom-back="goback"
:title-color="titleColor"

View File

@ -1,7 +1,7 @@
<template>
<view class="bg-page">
<u-navbar
title="稻虾每周价格"
<u-navbar :isBack="showAppbar"
:title="showAppbar?'稻虾每周价格':''"
:background="background"
:custom-back="goback"
:title-color="titleColor"

View File

@ -1,6 +1,6 @@
<template>
<view>
<u-sticky>
<u-sticky :h5NavHeight="h5NavHeightP">
<view class="bg-white">
<SearchForm
:schemas="searchFormSchema"

View File

@ -205,7 +205,6 @@ export default {
},
linknavFn(item) {
console.log(item)
uni.navigateTo({
url: `${item.url}`,
})

View File

@ -1,6 +1,6 @@
<template>
<view>
<u-sticky>
<u-sticky :h5NavHeight="h5NavHeightP">
<view class="bg-white">
<SearchForm
:schemas="searchFormSchema"

View File

@ -1,6 +1,6 @@
<template>
<view>
<u-sticky>
<u-sticky :h5NavHeight="h5NavHeightP">
<view class="bg-white">
<SearchForm
:schemas="searchFormSchema"

View File

@ -1,6 +1,6 @@
<template>
<view>
<u-sticky>
<u-sticky :h5NavHeight="h5NavHeightP">
<view class="px-26rpx">
<u-subsection
:list="list"

View File

@ -1,6 +1,6 @@
<template>
<view class="bg-page">
<u-navbar title="预警列表" :background="background" :custom-back="goback"
<u-navbar v-if="showAppbar" title="预警列表" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
</u-navbar>
<view class="secreen-section" style="background-color: #fff;">

View File

@ -1,6 +1,6 @@
<template>
<view class="role-page bg-page">
<u-sticky>
<u-sticky :h5NavHeight="h5NavHeightP">
<view class="top-title-box">
<view class="title">账号列表</view>
<view class="handle-option">

View File

@ -1,6 +1,6 @@
<template>
<view class="bg-page">
<u-navbar title="友情链接" :background="background" :custom-back="goback"
<u-navbar :isBack="showAppbar" :title="showAppbar?'友情链接':''" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right">
<view v-auth="['endpoint.friend_links.edit']" class="custom_btn add_btn" @click="addBtn()"></view>

View File

@ -1,6 +1,6 @@
<template>
<view class="role-page bg-page">
<u-sticky>
<u-sticky :h5NavHeight="h5NavHeightP">
<view class="top-title-box">
<view class="title">角色列表</view>
<view class="handle-option">

View File

@ -1,6 +1,6 @@
<template>
<view>
<Appbar title="基地产量">
<Appbar :show="showAppbar" title="基地产量">
<template #right>
<view v-auth="['endpoint.crops_output.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template>

View File

@ -1,6 +1,6 @@
<template>
<view>
<Appbar title="城镇产量">
<Appbar :show="showAppbar" title="城镇产量">
<template #right>
<view v-auth="['endpoint.town_crops_output.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template>

View File

@ -10,5 +10,8 @@ const mutations = {
[types.USERKEY](state, userkey) {
state.user_key = userkey
},
showAppbar: (state, e) => {
state.showAppbar = e
}
};
export default mutations;

View File

@ -2,6 +2,7 @@ const state = {
userInfo: {},
user_access_token: '',
user_key:'',
showAppbar:true
};
export default state;