diff --git a/App.uvue b/App.uvue
index 831d2ac3089b8f2918a0bb93ea709da1955bd193..bd361ebd823c1ec30977c1879da0e41f1cb0a572 100644
--- a/App.uvue
+++ b/App.uvue
@@ -28,7 +28,8 @@
path: ''
} as OnShowOptions
},
- onLaunch: function (res : OnLaunchOptions) {
+ onLaunch: function (res : OnLaunchOptions) {
+
this.globalData.launchOptions = res
// 自动化测试
@@ -55,7 +56,31 @@
}, fail(err) {
console.log(err);
}
- })
+ })
+ // #ifdef APP
+ if (process.env.NODE_ENV === 'development') {
+ //真机运行可以去掉此注释
+ // uni.getPrivacySetting({
+ // success(res){
+ // if(res.needAuthorization){
+ // uni.openDialogPage({
+ // url: '/pages/API/dialog-page/dialog-privacytest',
+ // })
+ // }
+ // }
+ // })
+ }else {
+ uni.getPrivacySetting({
+ success(res1){
+ if(res1.needAuthorization){
+ uni.openDialogPage({
+ url: '/pages/API/dialog-page/dialog-privacytest',
+ })
+ }
+ }
+ })
+ }
+ // #endif
},
onShow: function (res : OnShowOptions) {
this.globalData.onShowOption = res
diff --git a/pages.json b/pages.json
index 165a2d8f1c0c291ef2ee46421f045feb68acc910..c22aa3eb9c08cfded4f96d12429ef454da02c506 100644
--- a/pages.json
+++ b/pages.json
@@ -1861,6 +1861,13 @@
"navigationBarTitleText": "",
"backgroundColorContent": "#fffae8"
}
+ },
+ {
+ "path" : "pages/API/dialog-page/dialog-privacytest",
+ "style" :
+ {
+ "navigationBarTitleText" : ""
+ }
}
],
"globalStyle": {
diff --git a/pages/API/dialog-page/dialog-privacytest.uvue b/pages/API/dialog-page/dialog-privacytest.uvue
index 582097f4c91f62989aee1222000058977f37d0dd..18dc793b315533938d00e0ab163450a98cac6e2e 100644
--- a/pages/API/dialog-page/dialog-privacytest.uvue
+++ b/pages/API/dialog-page/dialog-privacytest.uvue
@@ -1,10 +1,14 @@
- 隐私协议弹框
-
@@ -15,27 +19,24 @@
}
},
- methods: {
- agree() {
- // #ifdef APP-ANDROID
+ onLoad() {
+ uni.onPrivacyAuthorizationChange((callback) => {
uni.showToast({
- title: 'isPrivacyAgree:' + UTSAndroid.isPrivacyAgree()
+ title: 'isPrivacyAgree:' + !callback.needAuthorization
})
+ })
+ },
+ methods: {
+ agree() {
uni.closeDialogPage({
dialogPage: this.$page as UniDialogPage
})
- // #endif
},
reject() {
- // #ifdef APP-ANDROID
- UTSAndroid.setPrivacyAgree(false)
- uni.showToast({
- title: 'isPrivacyAgree:' + UTSAndroid.isPrivacyAgree()
- })
+ uni.resetPrivacyAuthorization()
uni.closeDialogPage({
dialogPage: this.$page as UniDialogPage
})
- // #endif
}
}
}
diff --git a/pages/component/open-type/open-type.uvue b/pages/component/open-type/open-type.uvue
index e043d57bf555af878ea501669d698979857e75d6..9ff2f4be9bbb78c7be2592ea6a0fd7afbb555352 100644
--- a/pages/component/open-type/open-type.uvue
+++ b/pages/component/open-type/open-type.uvue
@@ -2,7 +2,8 @@
- agreePrivacyAuthorization
+ agreePrivacyAuthorization
@@ -16,17 +17,15 @@
log: "",
}
},
+ onLoad() {
+ uni.onPrivacyAuthorizationChange((callback) => {
+ this.isAgreeRes = !callback.needAuthorization
+ uni.showToast({
+ title: 'isPrivacyAgree:' + this.isAgreeRes
+ })
+ })
+ },
methods: {
- agree() {
- // #ifdef APP-ANDROID
-
- let res = UTSAndroid.isPrivacyAgree()
- this.isAgreeRes = res
- uni.showToast({
- title:'isPrivacyAgree:'+res
- })
- // #endif
- }
}
}