邓洁 : 登录功能及拦截

This commit is contained in:
dengj
2023-11-15 12:51:37 +08:00
parent b93daa7c35
commit dd05376541
7 changed files with 393 additions and 100 deletions

View File

@@ -46,7 +46,9 @@
styleIsolation: 'shared', // 解除样式隔离
},
created() {
this.open()
if (this.type !== '0') {
this.open()
}
},
methods: {
getUserLocation() {

View File

@@ -3,24 +3,32 @@
<view class="tabbar-bug"></view>
<view class="tabbar-container">
<block>
<view class="tabbar-item" v-for="(item,index) in tabbarList" :class="[item.centerItem ? ' center-item' : '']"
@click="changeItem(item)">
<view class="item-top">
<image :src="currentItem==item.id?item.selectIcon:item.icon"></image>
<view class="tabbar-item" v-for="(item,index) in tabbarList" :class="[item.centerItem ? ' center-item' : '']"
@click="changeItem(item)">
<view class="item-top">
<image :src="currentItem==item.id?item.selectIcon:item.icon"></image>
</view>
<view class="item-bottom" :class="[currentItem==item.id ? 'item-active' : '']">
<text>{{item.text}}</text>
</view>
</view>
<view class="item-bottom" :class="[currentItem==item.id ? 'item-active' : '']">
<text>{{item.text}}</text>
</view>
</view>
</block>
<publishSlide v-if="slideVisit" @quitSlide="quitSlide"></publishSlide>
</block>
<publishSlide v-if="slideVisit" @quitSlide="quitSlide"></publishSlide>
</view>
<view>
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view>
</template>
<script>
import login from 'pages/my/login/login'
export default {
components: {
login
},
props: {
currentPage: {
type: Number,
@@ -31,6 +39,7 @@
return {
slideVisit: false,
currentItem: 0,
isLoad: true,
tabbarList: [{
id: 0,
path: "/pages/index/index",
@@ -72,18 +81,37 @@
uni.hideTabBar();
},
methods: {
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
return
}
this.isLoad = true
if (this.isLoad) {
this.slideVisit = true
}
},
failToLoad() {
uni.reLaunch({
url: '/pages/index/index'
})
},
quitSlide() {
this.slideVisit = false;
},
changeItem(item) {
if (item.id == 2) {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
return
}
this.isLoad = true
this.slideVisit = true
}
let _this = this;
uni.switchTab({
url: item.path
});
}
}
}
@@ -94,6 +122,7 @@
width: 100%;
height: 98rpx;
}
view {
padding: 0;
margin: 0;