2022-07-30 08:05:50 +00:00
|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<image class="width100" src="/static/icon/welcome-img.jpg" mode="widthFix"></image>
|
|
|
|
<view class="fon60 bold mar-s50 mar-x50 tcenter" style="color: #010101;">洛河民意通</view>
|
|
|
|
<view class="fon30 col6 tcenter" style="max-width: 560rpx;margin: 0 auto;">
|
|
|
|
我是说明文案我是说明文案我是说明文案我是说明文案我是说明文案我是说明文案
|
|
|
|
</view>
|
|
|
|
<view class="disjcac mar-s120">
|
|
|
|
<view class="disjcac enter-btn posir" @tap="goLogin">
|
|
|
|
进入
|
|
|
|
</view>
|
|
|
|
<!-- <view class="disjcac enter-btn posir">
|
|
|
|
进入
|
|
|
|
<button :disabled="ifFlag" @click="bindGetUserInfo" class="posia syxzo">立即授权</button>
|
|
|
|
</view> -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
userInfo:'',
|
|
|
|
ifFlag:false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
// 前往登录页
|
|
|
|
goLogin(){
|
2022-07-30 08:07:12 +00:00
|
|
|
uni.navigateTo({
|
|
|
|
url:'/pagesA/login/login'
|
|
|
|
})
|
2022-07-30 08:05:50 +00:00
|
|
|
// 群众入口
|
|
|
|
// uni.navigateTo({
|
|
|
|
// url:'/pagesA/my-opinion-list/my-opinion-list'
|
|
|
|
// })
|
|
|
|
// 社区入口
|
2022-07-30 08:07:12 +00:00
|
|
|
// uni.navigateTo({
|
|
|
|
// url:'/pagesA/community/opinion-handle/opinion-handle'
|
|
|
|
// })
|
2022-07-30 08:05:50 +00:00
|
|
|
// 管理员
|
|
|
|
// uni.navigateTo({
|
|
|
|
// url:'/pagesA/manager/examine-list/examine-list'
|
|
|
|
// })
|
|
|
|
},
|
|
|
|
//调起登录授权
|
|
|
|
bindGetUserInfo() {
|
|
|
|
if(!this.ifFlag){
|
|
|
|
this.$toolAll.tools.showToast('正在调起授权','none',6000);
|
|
|
|
this.ifFlag = true;
|
|
|
|
wx.getSetting({
|
|
|
|
success: (result)=> {
|
|
|
|
uni.hideToast();
|
|
|
|
// 判断是否授权
|
|
|
|
if (result.authSetting['scope.userInfo']) {
|
|
|
|
// 已授权
|
|
|
|
this.getUserInfoEv();
|
|
|
|
} else {
|
|
|
|
// 未授权
|
|
|
|
this.getUserInfoEv();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 获取用户信息事件
|
|
|
|
getUserInfoEv(){
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
// 微信新版获取用户信息方式(也可用于授权手机号)
|
|
|
|
wx.getUserProfile({
|
|
|
|
lang:'zh_CN',
|
|
|
|
desc:'获取亲的昵称、头像及性别',
|
|
|
|
success: (resEnd)=> {
|
|
|
|
//用户已经授权过,添加用户信息
|
|
|
|
uni.login({
|
|
|
|
provider: 'weixin',
|
|
|
|
success: (rescode)=> {
|
|
|
|
uni.reLaunch({
|
|
|
|
url:'/pagesA/passageway/passageway'
|
|
|
|
})
|
|
|
|
// this.updateUserInfo(rescode.code);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
complete: () => {
|
|
|
|
this.ifFlag = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// #endif
|
|
|
|
},
|
|
|
|
//调用登录接口
|
|
|
|
updateUserInfo(code) {
|
|
|
|
var params = {
|
|
|
|
code:code,
|
|
|
|
nickname: this.userInfo.nickName,//用户昵称
|
|
|
|
headimgurl: this.userInfo.avatarUrl,//用户头像
|
|
|
|
country: this.userInfo.country,//用户所在国家
|
|
|
|
province: this.userInfo.province,//用户所在省份
|
|
|
|
city: this.userInfo.city,//用户所在城市
|
|
|
|
gender: this.userInfo.gender,//用户性别
|
|
|
|
language:this.userInfo.language,//语言
|
|
|
|
is_active:1
|
|
|
|
}
|
|
|
|
this.$requst.post('user/login',params).then(res => {
|
|
|
|
if(res.data.token!=''){
|
|
|
|
if(uni.getStorageSync('urlparams')) {
|
|
|
|
uni.reLaunch({ // 重新进入当前页面
|
|
|
|
url:uni.getStorageSync('urlparams')
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
uni.reLaunch({
|
|
|
|
url:'/pages/tabbar/pagehome/pagehome'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},error => {})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<style>
|
|
|
|
.enter-btn{
|
|
|
|
width: 480rpx;padding: 20rpx 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
</style>
|