1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <view>
- <uni-popup ref="telmodal" type="bottom" :mask-click="false">
- <view class="getphone">
- <view @click="close"><text>×</text></view>
- <view>手机号授权提醒</view>
- <view>获取司机手机号码授权,同步换电云数据</view>
- <view><button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">请授权获取手机号码</button></view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- export default {
- name:"getmobile",
- data() {
- return {
-
- };
- },
- mounted() {
- this.$refs.telmodal.open('bottom')
- },
- methods:{
- close(){
- // this.$refs.telmodal.close()
- this.$utils.switchTab('index/index');
- },
- getPhoneNumber(e){
- const userinfo=this.$store.state.users;
- // wx.login({
- // success(res){
- // console.log(res.code)
- // }
- // })
- if(userinfo && e.detail.errMsg == "getPhoneNumber:ok"){
- let params={
- encryptedData:e.detail.encryptedData,
- iv:e.detail.iv,
- openId:userinfo.openId,
- nickName:userinfo.nickName,
- avatar:userinfo.avatarUrl
- }
- this.$http.wxLogin(params).then(res=>{
- if(res.data){
- this.$store.commit("UPDATETOKEN",res.data.token);
- this.$store.commit("UPDATEMOBILE",res.data.telephone);
- this.$store.commit("UPDATEUSERS",res.data);
- this.$emit('updatetopinfo',res.data)
- this.$refs.telmodal.close();
- }
- }).catch(error=>{
- this.$utils.msg(error);
- });
- }else{
- this.$utils.navigateTo('public/login');
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .getphone{
- background-color: #fff;
- border-top-left-radius: 20rpx;
- border-top-right-radius: 20rpx;
- display: flex;
- flex-direction: column;
- text-align: center;
- position: relative;
- view:first-child{
- right: 10rpx;
- top:-10rpx;
- font-size: 54rpx;
- color: #7e7e80;
- position: absolute;
- }
- view:nth-child(2){
- font-weight: bold;
- padding-top: 30rpx;
- }
- view:nth-child(3){
- color: #7e7e80;
- padding-top: 20rpx;
- }
- button{
- width: 80%;
- margin: 25rpx auto;
- background-color:#58be6b ;
- color: #fff;
- }
- }
- </style>
|