From 60a8f8fcebcb104f2354a56557b1b919a59249c2 Mon Sep 17 00:00:00 2001
From: unknown <331404948@qq.com>
Date: Thu, 21 Nov 2024 18:48:34 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E7=89=88=E6=9C=AC=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App - 副本.vue | 20 +++
App.vue | 47 ++++++-
manifest.json | 42 ++++--
pages.json | 9 ++
.../student/studentDetail/comp/info.vue | 2 +-
pages/userCenter/aboutUs/aboutUs.vue | 45 +++++++
pages/userCenter/personaInfo/personaInfo.vue | 8 +-
pages/userCenter/personaInfo/setLatLng.vue | 8 +-
pages/userCenter/scanCode/scanCodeSubjiect1.vue | 2 +-
static/images/userCenter/minIcon (2).png | Bin 0 -> 2379 bytes
store/modules/user.js | 2 +-
.../uni-registerRequestPermissionTips/changelog.md | 8 ++
.../uni-registerRequestPermissionTips/package.json | 115 ++++++++++++++++
.../uni-registerRequestPermissionTips/readme.md | 95 +++++++++++++
.../utssdk/app-android/AndroidManifest.xml | 3 +
.../utssdk/app-android/config.json | 3 +
.../utssdk/app-android/index.uts | 148 +++++++++++++++++++++
.../app-android/res/anim/popupwindow_enter.xml | 6 +
.../app-android/res/anim/popupwindow_exit.xml | 5 +
.../res/drawable/dcloud_permission_background.xml | 6 +
.../utssdk/interface.uts | 19 +++
21 files changed, 576 insertions(+), 17 deletions(-)
create mode 100644 App - 副本.vue
create mode 100644 pages/userCenter/aboutUs/aboutUs.vue
create mode 100644 static/images/userCenter/minIcon (2).png
create mode 100644 uni_modules/uni-registerRequestPermissionTips/changelog.md
create mode 100644 uni_modules/uni-registerRequestPermissionTips/package.json
create mode 100644 uni_modules/uni-registerRequestPermissionTips/readme.md
create mode 100644 uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/AndroidManifest.xml
create mode 100644 uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/config.json
create mode 100644 uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/index.uts
create mode 100644 uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_enter.xml
create mode 100644 uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_exit.xml
create mode 100644 uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/drawable/dcloud_permission_background.xml
create mode 100644 uni_modules/uni-registerRequestPermissionTips/utssdk/interface.uts
diff --git a/App - 副本.vue b/App - 副本.vue
new file mode 100644
index 0000000..0b77170
--- /dev/null
+++ b/App - 副本.vue
@@ -0,0 +1,20 @@
+
+
+
diff --git a/App.vue b/App.vue
index 754a5cc..607963d 100644
--- a/App.vue
+++ b/App.vue
@@ -1,14 +1,57 @@
diff --git a/manifest.json b/manifest.json
index 809dc6d..f44ff71 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,8 @@
"name" : "洛阳学车驾校版",
"appid" : "__UNI__3347C6E",
"description" : "",
- "versionName" : "1.1.0",
- "versionCode" : 110,
+ "versionName" : "1.1.4",
+ "versionCode" : 114,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
@@ -17,7 +17,9 @@
"delay" : 0
},
/* 模块配置 */
- "modules" : {},
+ "modules" : {
+ "Maps" : {}
+ },
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
@@ -25,6 +27,7 @@
"permissions" : [
"",
"",
+ "",
"",
"",
"",
@@ -45,11 +48,24 @@
/* ios打包配置 */
"ios" : {
"dSYMs" : false,
- "idfa" : false
+ "idfa" : false,
+ "UIBackgroundModes" : "location",
+ "privacyDescription" : {
+ "NSLocationWhenInUseUsageDescription" : "该应用需要读取您的位置,以便学员找到您驾校的具体位置"
+ }
},
+ // "NSLocationAlwaysAndWhenInUseUsageDescription" : "该应用需要读取您的位置,以便学员找到您驾校的具体位置"
/* SDK配置 */
"sdkConfigs" : {
- "ad" : {}
+ "ad" : {},
+ "geolocation" : {},
+ "maps" : {
+ "amap" : {
+ "name" : "amapOV4nNDfa",
+ "appkey_ios" : "2839b2b14fdcd2983e0d6247ce9baf7a",
+ "appkey_android" : "3c5fcc5ee6aaba56e4806f3382399c16"
+ }
+ }
},
"icons" : {
"android" : {
@@ -148,8 +164,8 @@
"proxy" : {
"/api" : {
// "target" : "http://123.6.232.1:8099/",
- "target" : "http://192.168.1.106:8318",
- // "target" : "http://www.lyjppt.com/",
+ // "target" : "http://192.168.1.106:8318",
+ "target" : "http://www.lyjppt.com/",
"changeOrigin" : true,
"secure" : true,
"pathRewrite" : {
@@ -163,6 +179,16 @@
"router" : {
"mode" : "hash",
"base" : "/h5"
+ },
+ "sdkConfigs" : {
+ "maps" : {
+ "qqmap" : {
+ "key" : "JTOBZ-KLLKQ-S325W-25JZC-JLHEV-WNF5J"
+ }
+ }
}
- }
+ },
+ "locale" : "auto"
}
+/* SDK配置 */
+
diff --git a/pages.json b/pages.json
index dfa617a..6d23ab1 100644
--- a/pages.json
+++ b/pages.json
@@ -214,6 +214,15 @@
}
},
{
+ "path": "aboutUs/aboutUs",
+ "style": {
+ "navigationBarTitleText": "签名",
+ // "navigationStyle": "custom",
+ "enablePullDownRefresh": false,
+ "backgroundTextStyle": "dark"
+ }
+ },
+ {
"path": "forgetPwd/forgetPwd",
"style": {
"navigationBarTitleText": "修改密码",
diff --git a/pages/recordEntry/student/studentDetail/comp/info.vue b/pages/recordEntry/student/studentDetail/comp/info.vue
index d05435f..e2d0f2e 100644
--- a/pages/recordEntry/student/studentDetail/comp/info.vue
+++ b/pages/recordEntry/student/studentDetail/comp/info.vue
@@ -10,7 +10,7 @@
{{info.sex==1?'男':'女'}}
- 驾名名称
+ 驾校名称
{{info.schoolName}}
diff --git a/pages/userCenter/aboutUs/aboutUs.vue b/pages/userCenter/aboutUs/aboutUs.vue
new file mode 100644
index 0000000..fc6492f
--- /dev/null
+++ b/pages/userCenter/aboutUs/aboutUs.vue
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ 版本号: {{version}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/userCenter/personaInfo/personaInfo.vue b/pages/userCenter/personaInfo/personaInfo.vue
index c98181b..7afe92e 100644
--- a/pages/userCenter/personaInfo/personaInfo.vue
+++ b/pages/userCenter/personaInfo/personaInfo.vue
@@ -40,8 +40,14 @@
-
+
+ 关于我们
+
+
+
+
+
更新驾校经纬度
diff --git a/pages/userCenter/personaInfo/setLatLng.vue b/pages/userCenter/personaInfo/setLatLng.vue
index bfbca09..d3a8c64 100644
--- a/pages/userCenter/personaInfo/setLatLng.vue
+++ b/pages/userCenter/personaInfo/setLatLng.vue
@@ -6,7 +6,7 @@
{{vuex_cityInfo.city}} / {{vuex_cityInfo.name}}
获取定位信息
-
+
@@ -57,8 +57,10 @@
})
},
async setLngLatFn() {
- const res = await setLngLat({longitude: this.vuex_cityInfo.lng, latitude: this.vuex_cityInfo.lat})
- console.log(res)
+ let obj = {longitude: this.vuex_cityInfo.lng, latitude: this.vuex_cityInfo.lat}
+ console.log(obj, '参数')
+ const res = await setLngLat(obj)
+ this.$u.toast('更新经纬度成功')
}
}
}
diff --git a/pages/userCenter/scanCode/scanCodeSubjiect1.vue b/pages/userCenter/scanCode/scanCodeSubjiect1.vue
index 222e479..e831826 100644
--- a/pages/userCenter/scanCode/scanCodeSubjiect1.vue
+++ b/pages/userCenter/scanCode/scanCodeSubjiect1.vue
@@ -6,7 +6,7 @@
{{vuex_cityInfo.city}} / {{vuex_cityInfo.name}}
获取定位信息
-
+
diff --git a/static/images/userCenter/minIcon (2).png b/static/images/userCenter/minIcon (2).png
new file mode 100644
index 0000000000000000000000000000000000000000..a72429bf308b4af4eff81c6df9dd010381c92ebd
GIT binary patch
literal 2379
zcmV-R3AFZ!P)Px;1xZ9fRA@u(nhT6n)fvZsXI?w7Eb@NtvOaj12CadTqWEY+DMqR`ZLyS!;jJLB
ztJJ18u8&$@K!M-_vbz?gQj3p-l4#Oa6GIg#Y16c2QA({;&ZV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/user.js b/store/modules/user.js
index f9902c2..60ee551 100644
--- a/store/modules/user.js
+++ b/store/modules/user.js
@@ -2,7 +2,7 @@
const user = {
state: {
- identity: uni.getStorageSync('identity')?uni.getStorageSync('identity'):'理论教练',
+ identity: uni.getStorageSync('identity')?uni.getStorageSync('identity'):'实操教练',
vuex_cityInfo: uni.getStorageSync('vuex_cityInfo') ? uni.getStorageSync('vuex_cityInfo') : {city: ''},
vuex_userInfo: uni.getStorageSync('vuex_userInfo') ? uni.getStorageSync('vuex_userInfo') : {user:{}},
vuex_loginInfo: uni.getStorageSync('vuex_loginInfo') ? uni.getStorageSync('vuex_loginInfo') : {},
diff --git a/uni_modules/uni-registerRequestPermissionTips/changelog.md b/uni_modules/uni-registerRequestPermissionTips/changelog.md
new file mode 100644
index 0000000..67b6d9a
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/changelog.md
@@ -0,0 +1,8 @@
+## 1.0.3(2024-10-18)
+修复4.25版引起的插件回调只触发一次的问题。
+## 1.0.2(2024-09-05)
+修复uni.chooseImage或者其他部分情况下弹窗不显示的bug。
+## 1.0.1(2024-05-30)
+修复云打包可能报错的bug
+## 1.0.0(2024-03-09)
+支持全局监听权限申请。当申请权限时,会在页面顶部显示申请权限的目的。
diff --git a/uni_modules/uni-registerRequestPermissionTips/package.json b/uni_modules/uni-registerRequestPermissionTips/package.json
new file mode 100644
index 0000000..8708e8e
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/package.json
@@ -0,0 +1,115 @@
+{
+ "id": "uni-registerRequestPermissionTips",
+ "displayName": "uni-registerRequestPermissionTips",
+ "version": "1.0.3",
+ "description": "支持android平台全局监听权限的申请。当申请权限时,会在页面顶部显示申请权限的目的。主要解决上架华为应用市场审核要求:APP在调用终端权限时,应同步告知用户申请该权限的目的。",
+ "keywords": [
+ "权限",
+ "权限申请",
+ "上架",
+ "华为"
+ ],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^4.0"
+ },
+ "dcloudext": {
+ "type": "uts",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "无"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [
+ ],
+ "uni-ext-api": {
+ "uni": {
+ "registerRequestPermissionTipsListener": {
+ "name": "registerRequestPermissionTipsListener",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "unregisterRequestPermissionTipsListener": {
+ "name": "unregisterRequestPermissionTipsListener",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "setRequestPermissionTips": {
+ "name": "setRequestPermissionTips",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y",
+ "alipay": "y"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ },
+ "App": {
+ "app-android": "y",
+ "app-ios": "n",
+ "app-harmony": "u"
+ },
+ "H5-mobile": {
+ "Safari": "n",
+ "Android Browser": "n",
+ "微信浏览器(Android)": "n",
+ "QQ浏览器(Android)": "n"
+ },
+ "H5-pc": {
+ "Chrome": "n",
+ "IE": "n",
+ "Edge": "n",
+ "Firefox": "n",
+ "Safari": "n"
+ },
+ "小程序": {
+ "微信": "n",
+ "阿里": "n",
+ "百度": "n",
+ "字节跳动": "n",
+ "QQ": "n",
+ "钉钉": "n",
+ "快手": "n",
+ "飞书": "n",
+ "京东": "n"
+ },
+ "快应用": {
+ "华为": "n",
+ "联盟": "n"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-registerRequestPermissionTips/readme.md b/uni_modules/uni-registerRequestPermissionTips/readme.md
new file mode 100644
index 0000000..2357b46
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/readme.md
@@ -0,0 +1,95 @@
+## registerRequestPermissionTipsListener(listener?)
+注册权限监听事件
+## unregisterRequestPermissionTipsListener(listener?)
+取消注册权限监听事件
+
+## RequestPermissionTipsListener的属性值
+|名称 |类型 |描述 |必填 |
+|:-- |:-- |:-- |:-- |
+|onRequest |(permissions:Array)=>void |申请系统权限回调,permissions为触发权限申请的所有权限 |否 |
+|onConfirm |(permissions:Array)=>void |弹出系统权限授权框回调,permissions为触发弹出权限授权框的所有权限 |否 |
+|onComplete |(permissions:UTSJSONObject)=>void |权限申请完成回调,permissions包括权限及权限的状态。`grant`为权限已获取,`denied`为权限已拒绝 |否 |
+
+## setRequestPermissionTips(UTSJSONObject)
+设置权限监听的说明。支持针对权限设置具体的说明。
+
+参考:`{"android.permission.CAMERA":"相机权限申请说明
"}`
+
+安卓权限列表可参考[谷歌官方文档](https://developer.android.com/reference/android/Manifest.permission)。
+
+权限申请说明基于原生TextView实现,可以实现加载html内容,支持的标签及属性可参考:
+```
+ 或 :加粗文本。
+ 或 :斜体文本。
+:下划线文本。
+:上标文本。
+:下标文本。
+:等宽字体文本。
+:放大字体。
+:缩小字体。
+ 或 或 :带有删除线的文本。
+:段落。
+
:块级容器。
+
,,,,,:区域标题元素。
+, , - :无序列表和有序列表。
+
:换行。
+ 和 :设置文本颜色和大小。
+```
+
+## 示例
+
+```
+
+```
\ No newline at end of file
diff --git a/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/AndroidManifest.xml b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000..a807709
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/config.json b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/config.json
new file mode 100644
index 0000000..bf95925
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/config.json
@@ -0,0 +1,3 @@
+{
+ "minSdkVersion": "21"
+}
\ No newline at end of file
diff --git a/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/index.uts b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/index.uts
new file mode 100644
index 0000000..b005a53
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/index.uts
@@ -0,0 +1,148 @@
+import { UnregisterRequestPermissionTipsListener, RegisterRequestPermissionTipsListener, RequestPermissionTipsListener, SetRequestPermissionTips } from "../interface";
+import RelativeLayout from 'android.widget.RelativeLayout';
+import LinearLayout from 'android.widget.LinearLayout';
+import Color from 'android.graphics.Color';
+import TextView from 'android.widget.TextView';
+import ViewGroup from 'android.view.ViewGroup';
+import Activity from 'android.app.Activity';
+import HashMap from 'java.util.HashMap';
+import AnimationUtils from 'android.view.animation.AnimationUtils';
+import R from 'io.dcloud.uts.permissionrequest.R'
+import Html from 'android.text.Html';
+import View from 'android.view.View';
+import Runnable from "java.lang.Runnable"
+
+let PermissionTipsView : View | null = null
+let permissionTips : HashMap = new HashMap()
+var permissionListener : RequestPermissionListener | null = null
+var listener : RequestPermissionTipsListener | null = null
+
+@UTSJS.keepAlive
+export function unregisterRequestPermissionTipsListener(e : RequestPermissionTipsListener | null) {
+ listener = null;
+ if (permissionListener != null) {
+ permissionListener!.stop()
+ permissionListener = null
+ }
+ if (PermissionTipsView != null) {
+ if (PermissionTipsView!.getParent() != null) {
+ PermissionTipsView!.setAnimation(null);
+ ((PermissionTipsView!.getParent()) as ViewGroup).removeView(PermissionTipsView)
+ }
+ PermissionTipsView = null
+ }
+}
+
+@UTSJS.keepAlive
+export function registerRequestPermissionTipsListener(l : RequestPermissionTipsListener | null) {
+ listener = l
+ if (permissionListener == null) {
+ permissionListener = uni.createRequestPermissionListener()
+ permissionListener!.onRequest((permissions : Array) => {
+ if (listener != null)
+ listener!.onRequest?.invoke(permissions)
+ })
+ permissionListener!.onConfirm((permissions : Array) => {
+ UTSAndroid.getUniActivity()!.runOnUiThread(new ConfirmRunnable(permissions))
+ })
+ permissionListener!.onComplete((permissions : Array) => {
+ UTSAndroid.getUniActivity()!.runOnUiThread(new CompleteRunnable(permissions))
+ })
+ }
+}
+
+class ConfirmRunnable implements Runnable {
+ permissions : Array
+ constructor(permissions : Array) {
+ this.permissions = permissions
+ }
+ override run() {
+ let activity = UTSAndroid.getUniActivity()!
+ if (PermissionTipsView != null && PermissionTipsView!.getParent() != null) {
+ PermissionTipsView!.setAnimation(null);
+ ((PermissionTipsView!.getParent()) as ViewGroup).removeView(PermissionTipsView)
+ }
+ if (this.permissions.length > 0) {
+ try {
+ PermissionTipsView = createPermissionWindow(activity, this.permissions);
+ if (PermissionTipsView != null) {
+ (activity.findViewById(android.R.id.content) as ViewGroup).addView(PermissionTipsView!)
+ }
+ } catch (e) {
+ console.log(e)
+ }
+ }
+ if (listener != null)
+ listener!.onConfirm?.invoke(this.permissions)
+ }
+}
+
+class CompleteRunnable implements Runnable {
+ permissions : Array
+ constructor(permissions : Array) {
+ this.permissions = permissions
+ }
+ override run() {
+ let activity = UTSAndroid.getUniActivity()!
+ if (PermissionTipsView != null) {
+ PermissionTipsView!.setAnimation(AnimationUtils.loadAnimation(activity, R.anim.popupwindow_exit));
+ ((PermissionTipsView!.getParent()) as ViewGroup).removeView(PermissionTipsView!)
+ PermissionTipsView = null
+ }
+ if (listener != null) {
+ var permissionStatus = {}
+ for (var p in this.permissions) {
+ permissionStatus[p] = UTSAndroid.checkSystemPermissionGranted(UTSAndroid.getUniActivity()!, [p]) ? "grant" : "denied"
+ }
+ listener!.onComplete?.invoke(permissionStatus)
+ }
+ }
+}
+
+export const setRequestPermissionTips : SetRequestPermissionTips = (tips : UTSJSONObject) => {
+ permissionTips.clear()
+ for (var k in tips) {
+ permissionTips.put(k, tips[k] != null ? tips[k].toString() : "")
+ }
+}
+
+function createPermissionWindow(activity : Activity, permissions : Array) : ViewGroup | null {
+ let rootView = new RelativeLayout(activity);
+ rootView.setBackgroundColor(Color.TRANSPARENT);
+ let backgroundView = new LinearLayout(activity);
+ backgroundView.setPadding(30, 0, 30, 30);
+ backgroundView.setOrientation(1)
+ backgroundView.setBackgroundResource(R.drawable.dcloud_permission_background);
+ let permissionTipsList : Array = new Array()
+ for (var p in permissions) {
+ if (permissionTips.containsKey(p) && permissionTipsList.indexOf(permissionTips.get(p)) == -1) {
+ permissionTipsList.push(permissionTips.get(p)!)
+ }
+ }
+ for (var p in permissionTipsList) {
+ let text = new TextView(activity);
+ text.setText(Html.fromHtml(p, Html.FROM_HTML_SEPARATOR_LINE_BREAK_HEADING))
+ text.setPadding(0, 30, 0, 0)
+ text.setTextSize((5 * getScale()).toFloat())
+ text.setTextColor(Color.BLACK)
+ backgroundView.addView(text)
+ }
+ if (backgroundView.getChildCount() == 0) {
+ return null;
+ }
+ let rll = new RelativeLayout.LayoutParams(-1, -2)
+ rll.topMargin = (UTSAndroid.getStatusBarHeight() * getScale()).toInt();
+ rll.leftMargin = 30;
+ rll.rightMargin = 30;
+ rll.bottomMargin = 30;
+ rootView.addView(backgroundView, rll)
+ rootView.setAnimation(AnimationUtils.loadAnimation(activity, R.anim.popupwindow_enter));
+ return rootView;
+}
+
+function getScale() : Float {
+ if (UTSAndroid.getUniActivity() != null) {
+ return UTSAndroid.getUniActivity()!.resources.displayMetrics.scaledDensity
+ }
+ return (0 as number).toFloat();
+}
\ No newline at end of file
diff --git a/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_enter.xml b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_enter.xml
new file mode 100644
index 0000000..37e9c6f
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_enter.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_exit.xml b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_exit.xml
new file mode 100644
index 0000000..5054a98
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/anim/popupwindow_exit.xml
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/drawable/dcloud_permission_background.xml b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/drawable/dcloud_permission_background.xml
new file mode 100644
index 0000000..80238cc
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/utssdk/app-android/res/drawable/dcloud_permission_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-registerRequestPermissionTips/utssdk/interface.uts b/uni_modules/uni-registerRequestPermissionTips/utssdk/interface.uts
new file mode 100644
index 0000000..aacabe0
--- /dev/null
+++ b/uni_modules/uni-registerRequestPermissionTips/utssdk/interface.uts
@@ -0,0 +1,19 @@
+export type RequestPermissionTipsListener = {
+ onRequest ?: ((permissions : Array) => void) | null,
+ onConfirm ?: ((permission : Array) => void) | null,
+ onComplete ?: ((permissions : UTSJSONObject) => void) | null
+}
+
+
+export type RegisterRequestPermissionTipsListener = (listener : RequestPermissionTipsListener | null) => void
+export type UnregisterRequestPermissionTipsListener = (listener : RequestPermissionTipsListener | null) => void
+export type SetRequestPermissionTips = (tips : UTSJSONObject) => void
+
+export interface Uni {
+
+ registerRequestPermissionTipsListener : RegisterRequestPermissionTipsListener,
+
+ unregisterRequestPermissionTipsListener : UnregisterRequestPermissionTipsListener
+
+ setRequestPermissionTips : SetRequestPermissionTips
+}
\ No newline at end of file