收藏
回答

隐私协议已经弹出告知用户,wx.chooseMedia还是报错?

errMsg: "chooseMedia:fail api scope is not declared in the privacy agreement"


<privacyPopup ref="refPrivacyPopup" />


			wx.getPrivacySetting({
				success: res => {
					// 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
					console.log('getPrivacySetting**', res)
					this.needAuthorization = res.needAuthorization
					if (res.needAuthorization) {
						console.log('需要弹出隐私协议')
						this.$refs.refPrivacyPopup.handleOpen(res.privacyContractName)
					} else {
						// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口
						console.log('用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口')
					}
				},
				fail: () => {
					console.log('getPrivacySetting fail**', res)
				},
				complete: () => {}
			})


<button id="disagree-btn" type="default" class="btns reject-btn" @click="handleDisagree">拒绝</button>
<button id="agree-btn" type="default" open-type="agreePrivacyAuthorization" class="btns agree-btn" 
    bindagreeprivacyauthorization="handleAgree">同意并继续</button>


let privacyHandler
	let privacyResolves = new Set()
	let closeOtherPagePopUpHooks = new Set()


	wx.onNeedPrivacyAuthorization(resolve => {
		if (typeof privacyHandler === 'function') {
			privacyHandler(resolve)
		}
	})


	const closeOtherPagePopUp = (closePopUp) => {
		closeOtherPagePopUpHooks.forEach(hook => {
			if (closePopUp !== hook) {
				hook()
			}
		})
	}


			// 同意
			handleAgree() {
				console.log('同意', privacyResolves)
				privacyResolves.forEach(resolve => {
					console.log('handleAgree ', resolve)
					resolve({
						event: 'agree',
						buttonId: 'agree-btn'
					})
				})
				privacyResolves.clear()
			},
			// 不同意
			handleDisagree() {
				console.log('不同意 ', privacyResolves)
				privacyResolves.forEach(resolve => {
					console.log('handleDisagree ', resolve)
					resolve({
						event: 'disagree',
					})
				})
				privacyResolves.clear()
				this.handleClose()
			}


问题:bindagreeprivacyauthorization="handleAgree"回调没有触发。

回答关注问题邀请回答
收藏
登录 后发表内容