登录组件封装

This commit is contained in:
”chenxuelian“
2023-01-06 22:19:31 +08:00
parent 91b8f57154
commit d42219873d
2 changed files with 108 additions and 35 deletions

View File

@@ -95,11 +95,21 @@
</view>
</view>
</u--form>
<view>
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view>
</template>
<script>
import login from '../my/login/login.vue'
export default {
components: {
login
},
data() {
return {
tabsList: [{
@@ -134,7 +144,8 @@
categoryPickerList: [
['类别1', '类别', '类别']
],
fileList1: []
fileList1: [],
isLoad: true
}
},
onLoad(options) {
@@ -144,6 +155,15 @@
} else if (options.index == 1) {
this.tabCurrent = 1
}
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
methods: {
tabChange(data) {
@@ -230,6 +250,22 @@
// });
// })
},
reOnLoad() {
console.log('----------------true')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试')
}
}
}
</script>