소스 검색

获取banner

htc 3 일 전
부모
커밋
acd9e43848
1개의 변경된 파일18개의 추가작업 그리고 5개의 파일을 삭제
  1. 18 5
      pages/home.vue

+ 18 - 5
pages/home.vue

@@ -121,11 +121,9 @@
 				current:0,
 				perillPJ:null,
 				perillBG:null,
-				bannarList:[
-					this.$imgBase+'home_lb.png',
-					this.$imgBase+'home_lb.png',
-					this.$imgBase+'home_lb.png'
-				],
+				defaultBanner:this.$imgBase+'home_lb.png',
+				bannerOrigin:[],
+				bannarList:[],
 				newUserFreeShow:false,
 				teamKindShow:false,
 				teamKindMsg:'',
@@ -133,6 +131,7 @@
 			}
 		},
 		onLoad(options) {
+			this.getBannerList();
 			if(options.q){
 				try{
 					const decodedUrl = decodeURIComponent(options.q);
@@ -170,6 +169,20 @@
 			if(uni.getStorageSync('newUser')) this.newUserFreeShow = true;
 		},
 		methods:{
+			getBannerList(){
+				//space	广告位置: 1首页 2发布问卷
+				//type	类型: 1 banner区 2弹框
+				this.$api.get('//core/advertisement/manage/page',{
+					space:1,
+					type:1
+				}).then(({data:res})=>{
+					if(res.code!==0) return this.$showToast(res.msg)
+					if(res.data&&res.data.length){
+						this.bannerOrigin = res.data;
+						this.bannarList = res.data.map(d=>d.fileUrl);
+					} else this.bannarList = [this.defaultBanner]
+				})
+			},
 			toTurn(url){
 				if(!url) return 
 				if(url!=='/pages/dialog'&&!this.isLogin()) return