Browse Source

首页加一个广告判断登录

master
zhengshuiqi 3 years ago
parent
commit
4a0a899412
  1. 40
      pages/index/index.vue
  2. 10
      pages/login/index.vue

40
pages/index/index.vue

@ -12,6 +12,8 @@
export default { export default {
data() { data() {
return { return {
// register
register: -1,
typee: '', typee: '',
mycurrent: 0, mycurrent: 0,
isScrollShow: false, isScrollShow: false,
@ -580,8 +582,15 @@
} }
if (item.zone_code == 'HOMEAD') { if (item.zone_code == 'HOMEAD') {
item.blocks.map(item1 => { item.blocks.map(item1 => {
console.log(item1);
console.log(res);
console.log('HOMEAD=================================='); console.log('HOMEAD==================================');
// console.log(this.Swiper_H) // console.log(this.Swiper_H)
if (res.error != 0) {
uni.navigateTo({
url: '../login/index'
})
}
}) })
} }
if (item.zone_code == 'BANNER1') { if (item.zone_code == 'BANNER1') {
@ -608,7 +617,7 @@
} }
} }
if (item.zone_code == 'LIST1') { if (item.zone_code == 'LIST1') {
console.log(item.zone_more_link) // console.log(item.zone_more_link)
const i = item.zone_more_link.indexOf('gid=') const i = item.zone_more_link.indexOf('gid=')
// console.log(i) // console.log(i)
const ids = item.zone_more_link.substring(i + 4, item const ids = item.zone_more_link.substring(i + 4, item
@ -1007,13 +1016,32 @@
let data = { let data = {
_action: 'getinfo' _action: 'getinfo'
} }
let that = this
defaultRequest(data).then(res => { defaultRequest(data).then(res => {
////console.log(res,'') console.log(res,'用户信息')
if (res.error == -1) { if (res.error == -1) {
uni.setStorageSync('isLogin', 0) uni.setStorageSync('isLogin', 0)
} else if (res.error == 0) { } else if (res.error == 0) {
uni.setStorageSync('isLogin', 1) uni.setStorageSync('isLogin', 1)
} }
that.register = res.error
console.log(that.register);
})
},
// 广
registers() {
let data = {
_action: 'getinfo'
}
defaultRequest(data).then(res => {
console.log(res,'用户信息')
if (res.error == -1) {
uni.navigateTo({
url: '../login/index'
})
} else if (res.error == 0) {
}
}) })
}, },
@ -1326,9 +1354,13 @@
</swiper> </swiper>
</view> </view>
<!-- HOMEAD --> <!-- HOMEAD -->
<view v-if="register == -1">
<view class="HOMEAD" v-if="item.zone_code=='HOMEAD' && item.zone_status=='NORMAL'"> <view class="HOMEAD" v-if="item.zone_code=='HOMEAD' && item.zone_status=='NORMAL'">
<image :src="item.blocks[0].block_pic":style="{height:(item.zone_code=='HOMEAD')?item.zone_column+'rpx':''}" mode="" <!-- class="discount page_padding" -->
@click="imgTo(item.blocks[0])"></image> <image :src="item.blocks[0].block_pic" style="width: 92%;display: flex;justify-content: center;align-items: center;margin: 0 auto;object-fit: cover;"
:style="{height:(item.zone_code=='HOMEAD')?item.zone_column+'rpx':''}" mode=""
@click="registers"></image>
</view>
</view> </view>
<!-- TWOPIC --> <!-- TWOPIC -->
<view class="TWOPIC" v-if="item.zone_code=='TWOPIC' && item.zone_status=='NORMAL'"> <view class="TWOPIC" v-if="item.zone_code=='TWOPIC' && item.zone_status=='NORMAL'">

10
pages/login/index.vue

@ -319,6 +319,7 @@
}, },
onLoad() { onLoad() {
//
let that = this; let that = this;
let s = 0; let s = 0;
let time = setInterval(() => { let time = setInterval(() => {
@ -342,6 +343,15 @@
}, 1000); }, 1000);
this.configuration() this.configuration()
// IOS&Android
let systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'android') {
//
console.log(安卓);
} else if (systemInfo.platform === 'ios') {
// IOS
console.log(IOS);
}
} }
} }
</script> </script>

Loading…
Cancel
Save