我隐私弹窗是在项目APP.uvue里这样实现的,把 "uni-ad" : {}模块去掉重新云打包提交审核还是这样隐私不通过呢。
export default {
onLaunch: function () {
console.log('App Launch')
uni.getPrivacySetting({
success: (res) => {
if(res.needAuthorization){
uni.openDialogPage({
url: '/pages/privacy/privacy',
})
}
},
fail: (err) => {
console.log(err)
}
})
setTimeout(() => {
if(state.user.uid == 0) {
let userdata = $ux.Store.get('User')
let appdata = $ux.Store.get('Appmsg')
let apptime = $ux.Store.get('Today')
console.log(userdata);
console.log(appdata);
if(apptime != null) {
state.today = JSON.parse<Today>(JSON.stringify(apptime))!
}
if(userdata != null) {
state.user = JSON.parse<User>(JSON.stringify(userdata))!
state.appmsg = JSON.parse<Appmsg>(JSON.stringify(appdata))!
}
}
}, 100)
},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
// #ifdef APP-ANDROID
onLastPageBackPress: function () {
console.log('App LastPageBackPress')
if (firstBackTime == 0) {
uni.showToast({
title: '再按一次退出应用',
position: 'bottom',
})
firstBackTime = Date.now()
setTimeout(() => {
firstBackTime = 0
}, 2000)
} else if (Date.now() - firstBackTime < 2000) {
firstBackTime = Date.now()
uni.exit()
}
},
// #endif
onExit: function () {
console.log('App Exit')
},
methods: {
getRedirectUrl(scheme : string | null, ulink : string | null) : string | null {
//解析scheme或universal link启动直达页面:
//scheme格式:uniappx://redirect/pages/component/view/view?key=value //其中redirect后为页面路径
//universal link格式:https://uniappx.dcloud.net.cn/ulink/redirect.html?url=%2Fpages%2Fcomponent%2Fview%2Fview%3Fkey%3Dvalue //通用链接路径需固定,?后面的url参数为直达页面路径,注意url字段值需做url编码(可使用encodeURIComponent方法)
let url : string | null = null;
if (null != scheme && scheme.length > 0) {
const PATHPRE = 'redirect';
let parts : string | null = null;
let pos = scheme.search('//');
if (pos > 0) {
parts = scheme.substring(pos + 2);
}
if (null != parts && parts.startsWith(PATHPRE)) {
url = parts.substring(PATHPRE.length);
}
} else if (null != ulink && ulink.length > 0) {
const PATH = 'ulink/redirect.html';
let parts = ulink.split('?');
if (parts.length > 1 && parts[0].endsWith(PATH) && parts[1].length > 0) {
parts[1].split('&').forEach((e) => {
let params = e.split('=');
if (params.length > 1 && params[0].length > 0 && params[1].length > 0) {
if ('url' == params[0]) {
if (null == url) {
url = decodeURIComponent(params[1]);
}
}
}
});
}
}
return url;
}
}
}
赢无翳 (作者)
我连开屏广告都没有勾选,uni-ad模块去了都还隐私过不了,隐私弹窗实现是在app.uvue里弹出的隐私弹窗。
2025-01-09 15:43