crmeb小程序适配最新授权策略

本文档提供了crmeb小程序适配最新授权策略的详细步骤。首先,查看源码地址,根据给出的图示修改移动端相应位置的代码;然后,定位到特定文件中的方法,替换为提供的修改后代码,以确保授权功能正常运行。
摘要由CSDN通过智能技术生成

源码地址

对照下图修改对应文件中的代码

一. 移动端修改,如下图对应位置修改;

  1. 文件位置 : components/Authorize.vue
    在这里插入图片描述

如果未做二开,完整代码如下:

<template>
	<view>
		<view class='Popup' v-if='isShowAuth'>
			<view class="logo-auth">
				<image :src='logoUrl' mode="aspectFit"></image>
			</view>
			<view class='title'>授权提醒</view>
			<view class='tip'>请授权头像等信息,以便为您提供更好的服务</view>
			<view class='bottom flex'>
				<view class='item' @click='close'>随便逛逛</view>
				<!-- #ifdef APP-PLUS -->
				<button class='item grant' @click="setUserInfo">去授权</button>
				<!-- #endif -->
				<!-- #ifdef MP -->
				<button v-if="canUseGetUserProfile" class="item grant" hover-class="none"
					@tap="getUserProfile">去授权</button>
				<button v-else class='item grant' type="primary" open-type="getUserInfo" lang="zh_CN"
					@getuserinfo="setUserInfo">去授权</button>
				<!-- #endif -->
			</view>
		</view>
		<view class='mask' v-if='isShowAuth' @click='close'></view>
	</view>
</template>

<script>
	const app = getApp();
	import Cache from '../utils/cache';
	import {
    
		getLogo
	} from '../api/public';
	import {
    
		LOGO_URL
	} from '../config/cache';
	import {
    
		mapGetters
	} from 'vuex';
	import Routine from '../libs/routine';

	export default {
    
		name: 'Authorize',
		props: {
    
			isAuto: {
    
				type: Boolean,
				default: true
			},
			isGoIndex: {
    
				type: Boolean,
				default: true
			},
			isShowAuth: {
    
				type: Boolean,
				default: false
			}
		},
		data() {
    
			return {
    
				logoUrl: app.globalData.routine_logo,
				canUseGetUserProfile: false
			}
		},
		computed: mapGetters(['isLogin', 'userInfo']),
		watch: {
    
			isLogin(n) {
    
				n === true && this.$emit('onLoadFun', this.userInfo);
			}
		},
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值