隐藏标题

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

View File

@ -1,12 +1,14 @@
<template> <template>
<u-navbar <u-navbar
:title="title" :title="show ? title : ''"
:background="background" :background="background"
:custom-back="goback" :custom-back="goback"
:title-color="titleColor" :title-color="titleColor"
:isBack="show"
:back-icon-color="titleColor" :back-icon-color="titleColor"
> >
<template #right> <template #right
>
<slot name="right"></slot> <slot name="right"></slot>
</template> </template>
</u-navbar> </u-navbar>
@ -15,6 +17,10 @@
import { navigateBack } from '@/com/utils.js' import { navigateBack } from '@/com/utils.js'
export default { export default {
props: { props: {
show: {
type: Boolean,
default: true,
},
title: { title: {
type: String, type: String,
default: '', 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 PortalVue from 'portal-vue'
import './uni.promisify.adaptor' import './uni.promisify.adaptor'
import uView from "uview-ui"; import uView from "uview-ui";
import mixin from './mixin'
Vue.mixin(mixin)
Vue.use(uView); Vue.use(uView);
Vue.use(PortalVue) Vue.use(PortalVue)
import {http,getFullUrl} from '@/api/index.js' 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> <template>
<view> <view>
<Appbar title="基地数据"> <Appbar :show="showAppbar" title="基地数据">
<template #right> <template #right>
<view <view
v-auth="['endpoint.agricultural_basic.create']" v-auth="['endpoint.agricultural_basic.create']"

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="bg-page"> <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"> :title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right"> <view class="nav_slot_right_box" slot="right">
<view v-auth="['endpoint.device.create']" class="custom_btn add_btn" @click="addBtn()"></view> <view v-auth="['endpoint.device.create']" class="custom_btn add_btn" @click="addBtn()"></view>

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="bg-page"> <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"> :title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right"> <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 v-auth="['endpoint.rice_shrimp_industries.create']" class="custom_btn add_btn" @click="addBtn()"></view>

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="bg-page"> <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"> :title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right"> <view class="nav_slot_right_box" slot="right">
<view v-auth="['endpoint.materiels.create']" class="custom_btn add_btn" @click="addBtn()"></view> <view v-auth="['endpoint.materiels.create']" class="custom_btn add_btn" @click="addBtn()"></view>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="bg-page"> <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"> :title-color="titleColor" :back-icon-color="titleColor">
</u-navbar> </u-navbar>
<view class="secreen-section" style="background-color: #fff;"> <view class="secreen-section" style="background-color: #fff;">

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="bg-page"> <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"> :title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right"> <view class="nav_slot_right_box" slot="right">
<view v-auth="['endpoint.friend_links.edit']" class="custom_btn add_btn" @click="addBtn()"></view> <view v-auth="['endpoint.friend_links.edit']" class="custom_btn add_btn" @click="addBtn()"></view>

View File

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

View File

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

View File

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

View File

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

View File

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