浏览代码

Merge branch 'test' of git.echepei.com:sailun/sailun-tbr-web into test

caojunjie 4 年之前
父节点
当前提交
8a44444a2d
共有 1 个文件被更改,包括 21 次插入15 次删除
  1. 21 15
      pages/home/index.vue

+ 21 - 15
pages/home/index.vue

@@ -47,6 +47,7 @@
 </template>
 
 <script>
+	import {mapState} from 'vuex'
 	import {
 		request
 	} from '../../common/request/request'
@@ -76,22 +77,27 @@
 			}
 		},
 		created() {
-			uni.showLoading({
-				title: '加载中...'
-			});
-			axios.all([this.getBanners(), this.getTiceList()])
-				.then(axios.spread((one, two) => {
-					this.bannersList = one.data.data.map(t => t.imgPath)
-					console.log(this.bannersList)
-					this.noticebarList = two.data.data.map(t => t.msgContent)
-				}))
-				.catch(err => {
-					console.log(err)
-				})
-				.finally(() => {
-					this.loading = false;
-					uni.hideLoading();
+			if (this.hasLogin) {
+				uni.showLoading({
+					title: '加载中...'
+				});
+				axios.all([this.getBanners(), this.getTiceList()])
+					.then(axios.spread((one, two) => {
+						this.bannersList = one.data.data.map(t => t.imgPath)
+						console.log(this.bannersList)
+						this.noticebarList = two.data.data.map(t => t.msgContent)
+					}))
+					.catch(err => {
+						console.log(err)
+					})
+					.finally(() => {
+						this.loading = false;
+						uni.hideLoading();
 				})
+			}
+		},
+		computed: {
+			...mapState(['hasLogin'])
 		},
 		methods: {
 			//轮播图