123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <template>
- <view class="content">
- <view>
- <view class="zdyNav">
- <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
- <view class="nav">
- <view>欧洲维修</view>
- </view>
- </view>
- <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
- <view style="height: 44px;"></view>
-
-
- <view class="homePg">
- <view class="bg">
- <view class="logIn" @click="logIn">立即登录</view>
- <view class="logOutBtn" @click="goIndex">取消登录</view>
- </view>
-
- </view>
- </view>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- iStatusBarHeight: '',
- wxdata:"",
- wxCode:'',
- }
- },
- onLoad() {
- this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
- var userId = uni.getStorageSync("logInData").uid;
- if (userId) {
- var type = uni.getStorageSync("logInData").type;
- if(type==1){
- uni.navigateTo({
- url:'../index/index'
- })
- }else if(type==2){
- uni.navigateTo({
- url:'../shop/shopIndex/index'
- })
- }
- }
- },
- methods: {
- goIndex() {
- uni.navigateTo({
- url: '../index/index'
- })
- },
- logIn() {
- /* uni.navigateTo({
- url: '../logIn/logIn'
- })
- return false; */
- //提交正式测试
-
- var that=this;
- uni.getUserProfile({
- lang:'zh_CN',
- desc:'登录',
- success:(res)=>{
- console.log(res);
- that.wxdata=res;
- /* uni.setStorage({
- key: 'wxdata',
- data: res,
- success: function () {
-
-
- }
- }); */
- that.ipLogin()
- },
- fail:(res)=>{
- console.log(res)
- }
- });
- //#ifdef H5
-
- uni.navigateTo({
- url: '../logIn/logIn'
- })
- // #endif
-
- },
- ipLogin(){
- var that=this;
- uni.showLoading({ });
- uni.login({
- provider: 'weixin',
- success: function (loginRes) {
- console.log(loginRes)
- that.wxCode=loginRes.code
- that.getWxOpenID()
- //that.gologin()
- /* uni.navigateTo({
- url: '../logIn/logIn?code='+loginRes.code
- }) */
-
- }
- });
-
- },
- getWxOpenID(){
- var that=this;
- uni.showLoading({
- title: '请稍等'
- })
- this.$http('accompany/superusers/getWxOpenID', {
- code:this.wxCode,
- },'GET').then(res => {
- //console.log(res)
- //this.openID=res.data.openid;
- //this.session_key=res.data.session_key;
- console.log(this.openID)
- uni.setStorage({
- key: 'wxOpendata',
- data: res.data,
- success: function () {
- // that.ipLogin()
- uni.navigateTo({
- url: '../logIn/logIn'
- })
-
- }
- });
- //this.Login()
- })
- },
- }
- }
- </script>
- <style>
- .content {
- background-color: #EB5808;
- width: 100%;
- height: 100%;
- }
- /* #ifdef H5 */
- .content {
- background-color: #EB5808;
- width: 100%;
- height: 100%;
- }
- /* #endif */
- .zdyNav {
- position: fixed;
- left: 0;
- top: 0;
- background: #FFFFFF;
- z-index: 11;
- }
- .status_bar {
- background: #FFFFFF;
- }
- .nav {
- width: 100vw;
- height: 44px;
- background: #FFFFFF;
- text-align: center;
- font-size: 34rpx;
- line-height: 44px;
- font-weight: bold;
- }
- .homePg {
- position: fixed;
- width: 100vw;
- height: calc(100vh - 44px);
- background-color: #EB5808;
- }
- .bg {
- width: 100vw;
- height: calc(100vh - 44px);
- background: url('http://dmsimg.66km.com/yypb/home_yypb.png') no-repeat;
- background-size: 100%;
- position: relative;
-
- }
- .logIn{
- width: 442rpx;
- height: 88rpx;
- background-color: #FF4F00;
- border-radius: 44rpx;
- color: #FFFFFF;
- font-size: 30rpx;
- text-align: center;
- line-height: 88rpx;
- position: absolute;
- left: 154rpx;
- top: 854rpx;
-
- }
- .logOutBtn {
-
- width:750rpx;
- height: 40rpx;
- text-align: center;
- line-height: 40rpx;
- font-size: 28rpx;
- color: #999999;
- position: absolute;
- left: 0rpx;
- top: 954rpx;
- }
- </style>
|