App({ | App({ | ||||
onLaunch: function () { | onLaunch: function () { | ||||
// 展示本地存储能力 | // 展示本地存储能力 | ||||
// var openid = wx.getStorageSync('openid') || ""; | |||||
// if (!openid) { | |||||
// // 登录 | |||||
// this.wxLogin(); | |||||
// } else { | |||||
// this.globalData.openid = openid; | |||||
// this.getRegionList(); | |||||
// } | |||||
var openid = wx.getStorageSync('openid') || ""; | |||||
if (!openid) { | |||||
// 登录 | |||||
this.wxLogin(); | |||||
} else { | |||||
this.globalData.openid = openid; | |||||
// this.getRegionList(); | |||||
} | |||||
}, | }, | ||||
wxLogin() { | wxLogin() { | ||||
wx.login({ | wx.login({ | ||||
// urlRoot: "",//接口根目录 | // urlRoot: "",//接口根目录 | ||||
urlStatic:"https://www.jiyou-tech.com/2020/496_qichen/static",//静态资源根目录 | urlStatic:"https://www.jiyou-tech.com/2020/496_qichen/static",//静态资源根目录 | ||||
openid: "",//OPENID | openid: "",//OPENID | ||||
session_key: "",//session_key | |||||
userInfo: null,//用户信息 | userInfo: null,//用户信息 | ||||
openidSuccessFuc: null,//方法回调 | openidSuccessFuc: null,//方法回调 | ||||
nowPage:'1',//当前tabBar | |||||
}, | }, | ||||
// 获取openId | // 获取openId | ||||
getOpenid: function (code) { | getOpenid: function (code) { | ||||
title: '加载中', | title: '加载中', | ||||
mask: true, | mask: true, | ||||
}) | }) | ||||
this.wxRequest(this.globalData.urlRoot + "/login/getOpenid", { code: code }, res => { | |||||
this.wxRequest(this.globalData.urlRoot + "wxInfo/getOpenid", { code: code }, res => { | |||||
wx.hideLoading(); | wx.hideLoading(); | ||||
console.log(res); | |||||
if (res.code == 200) { | if (res.code == 200) { | ||||
wx.setStorageSync("openid", res.openid); | |||||
this.globalData.openid = res.openid; | |||||
this.getRegionList(); | |||||
wx.setStorageSync("openid", res.data.openid); | |||||
wx.setStorageSync("session_key", res.data.session_key); | |||||
this.globalData.openid = res.data.openid; | |||||
this.globalData.session_key = res.data.session_key; | |||||
// this.getRegionList(); | |||||
if (this.globalData.openidSuccessFuc) { | if (this.globalData.openidSuccessFuc) { | ||||
this.globalData.openidSuccessFuc(); | this.globalData.openidSuccessFuc(); | ||||
} | } |
/**app.wxss**/ | /**app.wxss**/ | ||||
.container { | .container { | ||||
height: 100%; | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
padding: 200rpx 0; | |||||
box-sizing: border-box; | |||||
padding-bottom:150rpx; | |||||
} | } | ||||
image{ | image{ | ||||
display: block; | display: block; |
// pages/component/tabBar/index.js | |||||
const app = getApp(); | |||||
Component({ | |||||
/** | |||||
* 组件的属性列表 | |||||
*/ | |||||
properties: { | |||||
}, | |||||
/** | |||||
* 组件的初始数据 | |||||
*/ | |||||
data: { | |||||
imgUrl: app.globalData.urlStatic,//图片路径 | |||||
nowPage: app.globalData.nowPage,//当前tabBar | |||||
btnSwitch:true,//按钮开关 | |||||
}, | |||||
ready:function(e){ | |||||
this.setData({ | |||||
btnSwitch:true, | |||||
nowPage: app.globalData.nowPage | |||||
}) | |||||
}, | |||||
/** | |||||
* 组件的方法列表 | |||||
*/ | |||||
methods: { | |||||
cutPage: function(e) {//打开遮罩 | |||||
let page = e.currentTarget.dataset.page; | |||||
if (page == this.data.nowPage){ | |||||
return; | |||||
} | |||||
this.data.btnSwitch = false; | |||||
app.globalData.nowPage = page; | |||||
if (page == '1') { | |||||
wx.redirectTo({ | |||||
url: '../index/index' | |||||
}) | |||||
} else if (page == '2'){ | |||||
wx.redirectTo({ | |||||
url: '../star/star' | |||||
}) | |||||
} else if (page == '3'){ | |||||
wx.showToast({ | |||||
title: '暂未开启', | |||||
icon:'none' | |||||
}) | |||||
// wx.redirectTo({ | |||||
// url: '../index/index' | |||||
// }) | |||||
} else if (page == '4'){ | |||||
wx.redirectTo({ | |||||
url: '../myCenter/myCenter' | |||||
}) | |||||
} | |||||
} | |||||
} | |||||
}) |
{ | |||||
"component": true, | |||||
"usingComponents": {} | |||||
} |
<!--pages/component/tabBar/index.wxml--> | |||||
<view class="tabBarFrame"> | |||||
<view class="tabBarOption" bindtap="cutPage" data-page="1"> | |||||
<image class="tabBar1" src="{{imgUrl+'/tabBar/1_'+(nowPage==1?2:1)+'.png'}}"></image> | |||||
<view class="tabBarText {{nowPage==1?'tabBarText2':''}}">启辰星</view> | |||||
</view> | |||||
<view class="tabBarOption" bindtap="cutPage" data-page="2"> | |||||
<image class="tabBar2" src="{{imgUrl+'/tabBar/2_'+(nowPage==2?2:1)+'.png'}}"></image> | |||||
<view class="tabBarText {{nowPage==2?'tabBarText2':''}}">星探计划</view> | |||||
</view> | |||||
<view class="tabBarOption" bindtap="cutPage" data-page="3"> | |||||
<image class="tabBar3" src="{{imgUrl+'/tabBar/3_'+(nowPage==3?2:1)+'.png'}}"></image> | |||||
<view class="tabBarText {{nowPage==3?'tabBarText2':''}}">幸运星抓手</view> | |||||
</view> | |||||
<view class="tabBarOption" bindtap="cutPage" data-page="4" style="border:none;"> | |||||
<image class="tabBar4" src="{{imgUrl+'/tabBar/4_'+(nowPage==4?2:1)+'.png'}}"></image> | |||||
<view class="tabBarText {{nowPage==4?'tabBarText2':''}}">个人中心</view> | |||||
</view> | |||||
</view> |
/* pages/component/tabBar/index.wxss */ | |||||
.tabBarFrame{ | |||||
position: fixed; | |||||
left: 0; | |||||
bottom: 0; | |||||
background-color: white; | |||||
width:750rpx; | |||||
height:150rpx; | |||||
box-sizing: border-box; | |||||
border-top: 1rpx solid #B8B6B9; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
} | |||||
.tabBarOption{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
width: 175rpx; | |||||
border-right: 3rpx solid black; | |||||
height: 43rpx; | |||||
} | |||||
.tabBarText{ | |||||
font-size: 20rpx; | |||||
margin-left:10rpx; | |||||
color: black; | |||||
} | |||||
.tabBarText2{ | |||||
color: #1D7EAF; | |||||
} | |||||
.tabBar1{ | |||||
width: 46rpx; | |||||
height: 19rpx; | |||||
} | |||||
.tabBar2{ | |||||
width: 32rpx; | |||||
height: 25rpx; | |||||
} | |||||
.tabBar3{ | |||||
width: 25rpx; | |||||
height: 28rpx; | |||||
} | |||||
.tabBar4{ | |||||
width: 24rpx; | |||||
height: 27rpx; | |||||
} |
{ | { | ||||
"usingComponents": { | "usingComponents": { | ||||
"service": "../component/service/index" | |||||
"service": "../component/service/index", | |||||
"tabBar": "../component/tabBar/index" | |||||
} | } | ||||
} | } |
<!--index.wxml--> | <!--index.wxml--> | ||||
<view class="all"> | <view class="all"> | ||||
<view class="main"> | |||||
<!-- <view class="contentFrame"> | |||||
<video class="videoSty" ad-unit-id="" poster-for-crawler="" src="http://static.jiyou-tech.com/2018/327/video/video1212.mp4"></video> | |||||
<view class="main container"> | |||||
<view class="contentFrame"> | |||||
<video class="videoSty" ad-unit-id="" poster-for-crawler="" src=""></video> | |||||
<!-- <video class="videoSty" ad-unit-id="" poster-for-crawler="" src="{{imgUrl+'/video1212.mp4'}}"></video> --> | |||||
<view class="swiperFrame"> | <view class="swiperFrame"> | ||||
<swiper class="swiperSty" current="{{swiperCurrent}}" bindchange="swiperChange"> | <swiper class="swiperSty" current="{{swiperCurrent}}" bindchange="swiperChange"> | ||||
<swiper-item><image src="{{imgUrl+'/images/indexBottom.png'}}" style="width:100%;" mode="aspectFill"></image></swiper-item> | <swiper-item><image src="{{imgUrl+'/images/indexBottom.png'}}" style="width:100%;" mode="aspectFill"></image></swiper-item> | ||||
<image class="rightArrow" bindtap="nextImg" src="{{imgUrl+'/images/rightArrow.png'}}"></image> | <image class="rightArrow" bindtap="nextImg" src="{{imgUrl+'/images/rightArrow.png'}}"></image> | ||||
</view> | </view> | ||||
<image class="indexBottom" src="{{imgUrl+'/images/indexBottom.png'}}"></image> | <image class="indexBottom" src="{{imgUrl+'/images/indexBottom.png'}}"></image> | ||||
</view> --> | |||||
<image src="{{imgUrl+'/images/indexBg.jpg'}}" class='imgBg'></image> | |||||
</view> | |||||
<!-- <image src="{{imgUrl+'/images/indexBg.jpg'}}" class='imgBg'></image> --> | |||||
<view class="msgFrame"> | <view class="msgFrame"> | ||||
<view class="inputGroup"> | <view class="inputGroup"> | ||||
<input class="inputSty" placeholder="姓名"></input> | <input class="inputSty" placeholder="姓名"></input> | ||||
</view> | </view> | ||||
<view class="subscribeBtn">预约鉴赏</view> | <view class="subscribeBtn">预约鉴赏</view> | ||||
</view> | </view> | ||||
<service></service> | |||||
</view> | </view> | ||||
<service></service> | |||||
<tabBar></tabBar> | |||||
</view> | </view> |
height: 1356rpx; | height: 1356rpx; | ||||
} | } | ||||
.msgFrame{ | .msgFrame{ | ||||
position: fixed; | |||||
bottom: 0; | |||||
position: absolute; | |||||
bottom: 150rpx; | |||||
left: 0; | left: 0; | ||||
width:750rpx; | width:750rpx; | ||||
padding: 0 39rpx; | padding: 0 39rpx; |
{ | { | ||||
"usingComponents": { | "usingComponents": { | ||||
"service": "../component/service/index" | |||||
"service": "../component/service/index", | |||||
"tabBar": "../component/tabBar/index" | |||||
} | } | ||||
} | } |
<!--pages/myCenter/myCenter.wxml--> | <!--pages/myCenter/myCenter.wxml--> | ||||
<view> | <view> | ||||
<view class="main"> | |||||
<view class="main container"> | |||||
<view class="msgGroup" wx:if="{{!isLogin}}"> | <view class="msgGroup" wx:if="{{!isLogin}}"> | ||||
<view class="pageTitle">个人中心</view> | <view class="pageTitle">个人中心</view> | ||||
<view class="headGroup"> | <view class="headGroup"> | ||||
<view wx:if="{{selectNow==4}}"> | <view wx:if="{{selectNow==4}}"> | ||||
</view> | </view> | ||||
<service></service> | |||||
</view> | </view> | ||||
<service></service> | |||||
<tabBar></tabBar> | |||||
</view> | </view> |