feat : 底部导航栏添加 - 本地生活
This commit is contained in:
parent
38896f2a26
commit
82b4ba8b07
@ -1,15 +1,34 @@
|
||||
<template>
|
||||
<view class="foot-fixed">
|
||||
<view v-for="(item, index) in navList" :key='index'>
|
||||
<view id="navIndex" :style="{width:foot_width}" @click="jump" :data-idx="index" :data-url="item.url"
|
||||
class="foot-item">
|
||||
|
||||
<view v-for="(item, index) in navList" :key="index">
|
||||
<view
|
||||
id="navIndex"
|
||||
:style="{ width: foot_width }"
|
||||
@click="jump"
|
||||
:data-idx="index"
|
||||
:data-url="item.url"
|
||||
class="foot-item"
|
||||
>
|
||||
<view class="foot-icon-box">
|
||||
<image class="foot-icon" :src="item.photo" mode="widthFix" v-if="current != index"></image>
|
||||
<image class="foot-icon2" :src="item.photoAc" mode="widthFix" v-if="current == index"></image>
|
||||
<image
|
||||
class="foot-icon"
|
||||
:src="item.photo"
|
||||
mode="widthFix"
|
||||
v-if="current != index"
|
||||
:style="{
|
||||
width: item.photo.includes('footer_localLife.png')
|
||||
? '70rpx'
|
||||
: '',
|
||||
}"
|
||||
></image>
|
||||
<image
|
||||
class="foot-icon2"
|
||||
:src="item.photoAc"
|
||||
mode="widthFix"
|
||||
v-if="current == index"
|
||||
></image>
|
||||
</view>
|
||||
|
||||
|
||||
<text class="foot-label" id="navIndexLabel">{{ item.nav_name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -23,117 +42,132 @@
|
||||
current: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
navList: [
|
||||
{
|
||||
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_home.png",
|
||||
photoAc:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_homeAc.png",
|
||||
photo:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_home.png",
|
||||
photoAc:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_homeAc.png",
|
||||
nav_name: "首页",
|
||||
url:"/pages/index/index"
|
||||
url: "/pages/index/index",
|
||||
},
|
||||
{
|
||||
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_community.png",
|
||||
photoAc:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_communityAc.png",
|
||||
photo:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_community.png",
|
||||
photoAc:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_communityAc.png",
|
||||
nav_name: "我的小区",
|
||||
url:"/packages/community/index/index"
|
||||
url: "/packages/community/index/index",
|
||||
},
|
||||
{
|
||||
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_shop.png",
|
||||
photoAc:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_shopAc.png",
|
||||
photo: "http://localhost:8080/footer_localLife.png",
|
||||
photoAc: "http://localhost:8080/footer_localLifeAc.png",
|
||||
nav_name: "本地生活",
|
||||
url: "/packages/localLife/index/index",
|
||||
},
|
||||
{
|
||||
photo:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_shop.png",
|
||||
photoAc:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_shopAc.png",
|
||||
nav_name: "优选商城",
|
||||
url:"/packages/shop/index/index"
|
||||
url: "/packages/shop/index/index",
|
||||
},
|
||||
{
|
||||
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_door.png",
|
||||
photoAc:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_communityAc.png",
|
||||
photo:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_door.png",
|
||||
photoAc:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_communityAc.png",
|
||||
nav_name: "到家服务",
|
||||
url:"/packages/homeServer/index/index"
|
||||
url: "/packages/homeServer/index/index",
|
||||
},
|
||||
{
|
||||
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_mine.png",
|
||||
photoAc:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_mineAc.png",
|
||||
photo:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_mine.png",
|
||||
photoAc:
|
||||
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/footer_mineAc.png",
|
||||
nav_name: "我的",
|
||||
url:"/pages/user/index"
|
||||
url: "/pages/user/index",
|
||||
},
|
||||
],
|
||||
foot_width: '20%',
|
||||
foot_width: "16.5%",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getFootnav() {
|
||||
let _that = this;
|
||||
uni.request({
|
||||
url: 'https://zhsq.hshuishang.com/Miniapi/Index/footer_nav_list',
|
||||
method: 'post',
|
||||
url: "https://zhsq.hshuishang.com/Miniapi/Index/footer_nav_list",
|
||||
method: "post",
|
||||
header: {
|
||||
'Content-type': 'application/x-www-form-urlencoded'
|
||||
"Content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
dataType: "json",
|
||||
success: (result) => {
|
||||
result.data[0].url = "/pages/index/index"
|
||||
result.data[1].url = "/pages/device/device"
|
||||
result.data[2].nav_name = "手机通行"
|
||||
result.data[2].url = "/pages/phoneGo/phoneGo"
|
||||
result.data[0].url = "/pages/index/index";
|
||||
result.data[1].url = "/pages/device/device";
|
||||
result.data[2].nav_name = "手机通行";
|
||||
result.data[2].url = "/pages/phoneGo/phoneGo";
|
||||
|
||||
result.data[3].url = `/packages/community/index/index`
|
||||
result.data[4].url = "/pages/user/index"
|
||||
result.data[3].url = `/packages/community/index/index`;
|
||||
result.data[4].url = "/pages/user/index";
|
||||
|
||||
result.data.splice(1, 2);
|
||||
let footWidth = (100 / result.data.length).toFixed(2) + '%';
|
||||
let footWidth = (100 / result.data.length).toFixed(2) + "%";
|
||||
this.navList = result.data;
|
||||
this.foot_width = footWidth;
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
//暂未开通
|
||||
NotOpen() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '此功能暂未开通!',
|
||||
title: "提示",
|
||||
content: "此功能暂未开通!",
|
||||
showCancel: false,
|
||||
complete: (res) => {
|
||||
if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
jump(e) {
|
||||
const ctoken = uni.getStorageSync('ctoken');
|
||||
const authen = ['/pages/index/index', '/pages/user/index','/pages/user/index'];
|
||||
const ctoken = uni.getStorageSync("ctoken");
|
||||
const authen = [
|
||||
"/pages/index/index",
|
||||
"/pages/user/index",
|
||||
"/pages/user/index",
|
||||
];
|
||||
// 除首页及个人中心页不需要鉴定ctoken, 其他tab页均需存在登录态才可访问
|
||||
if (authen.includes(e.currentTarget.dataset.url)) {
|
||||
uni.redirectTo({
|
||||
url: e.currentTarget.dataset.url,
|
||||
})
|
||||
return
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!ctoken) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login',
|
||||
})
|
||||
url: "/pages/login/login",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.redirectTo({
|
||||
url: e.currentTarget.dataset.url,
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
// this.getFootnav();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@ -146,7 +146,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<nav-footer :current="3" />
|
||||
<nav-footer :current="4" />
|
||||
|
||||
<!-- 回到顶部 -->
|
||||
<div class="toUp" @click="scrollToTop">
|
||||
|
||||
@ -2,6 +2,10 @@ page {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.container{
|
||||
padding-top: 100rpx;
|
||||
}
|
||||
|
||||
.local {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@ -286,7 +286,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav-footer :current="2" />
|
||||
<nav-footer :current="3" />
|
||||
|
||||
<div class="shop_car" @click="shopCar">
|
||||
<u-badge
|
||||
|
||||
@ -477,8 +477,11 @@
|
||||
{
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "本地生活",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {
|
||||
"nav-footer": "/components/nav/nav"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
<view>客服</view>
|
||||
</view>
|
||||
<view style="padding-top: 174rpx;"></view>
|
||||
<nav-footer :current="4"/>
|
||||
<nav-footer :current="5"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user