Compare commits

...

27 Commits
newo ... master

Author SHA1 Message Date
07e83d19af 新增麦克风权限授权获取及未授权处理 2025-06-03 15:08:28 +08:00
74f5ae7eae Merge branch 'master' into wyfMaster-dev 2025-06-03 09:21:07 +08:00
ea89fc391a 将启动图配置、推送配置改回非google play上架版本 2025-06-03 09:19:17 +08:00
e52de07528 按Google Play上架要求更改启动图配置;开启fcm推送 2025-05-30 11:08:24 +08:00
680dc77917 封装IOS原生视频多选插件,实现基本多选功能。至此,module类型插件双端都已开发完毕,但交互没有component类型插件自由,且后续上传、断点续传需要继续封装进插件,否则该功能仅能多选,无法上传发送 2025-04-30 11:34:25 +08:00
22c254fffd 维护新base,增加新能力:1、启用语音record模块、sqlite模块;2、封装plus的sqlite方法,用于后续使用;3、新增获取安卓读写视频能力的权限,适配Android13前后版本;4、封装Android原生视频多选插件,实现基本多选功能 2025-04-28 19:03:09 +08:00
6227aaf931 修改版本号 2025-03-31 16:43:54 +08:00
ddfedd2058 更换云空间后,修改推送配置 2025-03-29 17:19:12 +08:00
934fe8de1f 修改ios版本号与打包配置 2025-03-24 15:18:44 +08:00
61459264ef 修改版本号与打包配置 2025-03-24 09:44:44 +08:00
59982f4f46 新增手动创建通知栏消息 2025-03-17 14:23:11 +08:00
scout
687371b1e6 fixbug 2024-12-31 09:17:33 +08:00
scout
f7b500f715 更换隐私协议 2024-12-30 16:17:42 +08:00
scout
a9d3014b28 feat(push): 添加魅族推送配置项 2024-12-24 10:40:17 +08:00
ed3ebf0b85 Merge branch 'master' of http://172.16.100.91:3000/xingyy/oa-base 2024-12-17 14:06:44 +08:00
a2b3ef0cf8 fix 2024-12-17 14:06:42 +08:00
scout
d6fb4b5688 add ver 2024-12-12 15:55:06 +08:00
scout
7bc12f11a0 add条件判断 2024-12-12 15:25:32 +08:00
67e81c1a80 Merge branch 'master' of http://172.16.100.91:3000/xingyy/oa-base 2024-12-12 10:21:09 +08:00
c0b331bfb5 启动页 更新 2024-12-12 10:21:07 +08:00
scout
acace8dc21 changemain 2024-12-12 09:31:54 +08:00
scout
446498b893 推送,分享 2024-12-11 15:31:56 +08:00
022aaa9109 Merge branch 'master' of http://172.16.100.91:3000/xingyy/oa-base 2024-12-04 16:36:57 +08:00
92d8327930 fix 2024-12-04 16:36:50 +08:00
scout
c2168272de addfile 2024-12-04 16:35:02 +08:00
scout
6d913b9288 addshare 2024-12-04 16:33:24 +08:00
scout
951aabfe55 addnetconfirm 2024-10-28 15:31:46 +08:00
35 changed files with 1060 additions and 130 deletions

View File

@ -13,7 +13,7 @@
"h5" : { "h5" : {
"launchtype" : "local" "launchtype" : "local"
}, },
"provider" : "alipay", "provider" : "aliyun",
"type" : "uniCloud" "type" : "uniCloud"
}, },
{ {

104
App.vue
View File

@ -1,40 +1,80 @@
<script> <script>
export default {
methods:{
networkStatusChange(res){
if(res.isConnected){
uni.redirectTo({
url:'/pages/index/index'
})
}else{
uni.redirectTo({
url:'/pages/networko/index'
})
}
} export default {
}, data() {
onLaunch: function() { return {
}, //
onShow: function() { lastNetworkStatus: null
uni.getNetworkType({
success:(res)=> {
if(res.networkType==='none') {
uni.redirectTo({
url: '/pages/networko/index'
})
}
}
})
uni.onNetworkStatusChange(this.networkStatusChange);
},
onHide: function() {
uni.offNetworkStatusChange(this.networkStatusChange)
} }
},
methods: {
// APP
isFirstOpen() {
let isFirstOpen = uni.getStorageSync('isFirstOpen')
if (!isFirstOpen) {
uni.setStorageSync('isFirstOpen', true)
return true
}
return false
},
networkStatusChange(res) {
console.log(res)
if (res.isConnected) {
//
if (this.isFirstOpen()) {
uni.redirectTo({
url: '/pages/index/index'
})
}
//
if (this.lastNetworkStatus === false) {
uni.showModal({
title: "提示",
content: "当前设备网络发生更改,是否刷新页面?",
showCancel: true,
success: function (res) {
if (res.confirm || res.cancel) {
uni.redirectTo({
url: '/pages/index/index'
})
}
},
});
}
} else {
uni.redirectTo({
url: '/pages/networko/index'
})
}
this.lastNetworkStatus = res.isConnected
}
},
onLaunch: function () {
console.log('onLaunch')
},
onShow: function () {
uni.onNetworkStatusChange(this.networkStatusChange);
uni.getNetworkType({
success: (res) => {
if (res.networkType === 'none') {
uni.redirectTo({
url: '/pages/networko/index'
})
}
}
})
},
onHide: function () {
uni.offNetworkStatusChange(this.networkStatusChange)
} }
}
</script> </script>
<style> <style>
/*每个页面公共css */ /*每个页面公共css */
</style> </style>

View File

@ -1,13 +1,13 @@
{ {
"version" : "1", "version" : "1",
"prompt" : "template", "prompt" : "template",
"title" : "服务协议和隐私政策", "title" : "温馨提示",
"message" : "   请你务必审慎阅读、充分理解“平台服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的<span style=\"font-weight: bold\">设备标识</span>、<span>操作日志</span> 等信息用于分析、优化应用性能。我们需要访问你的<span style=\"font-weight: bold\">相册/或相机(摄像头)权限</span>,<span style=\"font-weight: bold\">位置权限</span>,<span style=\"font-weight: bold\">通知权限</span>用于应用内功能的基本使用<br/>  你可阅读<a href=\"https://oa-a.szjixun.cn/#/pages/login/serveInfo\">《用户服务协议》</a>和<a href=\"https://oa.szjixun.cn/#/pages/login/privateInfo\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", "message" : "   感谢您对oa考勤系统的信赖!在使用前请务必阅读并同意<a href=\"https://oa-a.szjixun.cn/#/pages/setting/severInfo\">《用户服务协议》</a>和<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>,我们将按照协议和政策内容为您提供服务。<br/>oa考勤系统系统的基本功能为打卡、审批等考勤管理及协同办公服务。基于您的授权及服务之必要基本功能的必要个人信息包括移动电话号码、账号信息等。您同意<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>仅代表同意oa考勤系统在您使用基本功能时处理相关必要信息。附加功能如需处理个人信息将单独征求您的同意。",
"buttonAccept" : "同意并接受", "buttonAccept" : "同意并接受",
"buttonRefuse" : "不同意", "buttonRefuse" : "不同意",
"second" : { "second" : {
"title" : "确认提示", "title" : "  您需要同意本隐私政策才能继续使用oa考勤系统",
"message" : "  进入应用前,你需先同意<a href=\"https://oa-a.szjixun.cn/#/pages/login/serveInfo\">《用户服务协议》</a>和<a href=\"https://oa-a.szjixun.cn/#/pages/login/privateInfo\">《隐私政策》</a>,否则将退出应用。", "message" : "  若您不同意本<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>,很遗憾我们将无法为您提供服务",
"buttonAccept" : "同意并继续", "buttonAccept" : "同意并继续",
"buttonRefuse" : "退出应用" "buttonRefuse" : "退出应用"
}, },

View File

@ -1,20 +1,20 @@
const env = 'prod'; const env = 'prod';
const configs = { const configs = {
LocalTest: { LocalTest: {
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend', apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
h5Url:'http://192.168.88.29:8080/#/' h5Url: 'http://192.168.88.61:2367/#/'
}, },
dev: { dev: {
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend', apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
h5Url:'http://192.168.88.47:2367/#/' h5Url: 'http://192.168.88.47:2367/#/'
}, },
test: { test: {
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend', apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
h5Url:'http://114.218.158.24:8042/#/' h5Url: 'http://114.218.158.24:8042/#/'
}, },
prod: { prod: {
apiBaseUrl: 'https://oa-a.szjixun.cn/api', apiBaseUrl: 'https://oa-a.szjixun.cn/api',
h5Url:'https://oa-a.szjixun.cn/#/' h5Url: 'https://oa-a.szjixun.cn/#/'
}, },
}; };
const config = configs[env]; const config = configs[env];

Binary file not shown.

View File

@ -33,12 +33,12 @@
<rect key="frame" x="150.66666666666666" y="391.66666666666669" width="112.66666666666666" height="112.66666666666669"/> <rect key="frame" x="150.66666666666666" y="391.66666666666669" width="112.66666666666666" height="112.66666666666669"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="hello uniapp" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QBH-Ne-rcx"> <!-- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="hello uniapp" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QBH-Ne-rcx">
<rect key="frame" x="168" y="835" width="78.333333333333314" height="17"/> <rect key="frame" x="168" y="835" width="78.333333333333314" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label> -->
</subviews> </subviews>
<viewLayoutGuide key="safeArea" id="IW3-oA-Ytg"/> <viewLayoutGuide key="safeArea" id="IW3-oA-Ytg"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 KiB

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 KiB

After

Width:  |  Height:  |  Size: 226 KiB

BIN
files/pushicon/18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
files/pushicon/24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
files/pushicon/36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
files/pushicon/48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
files/pushicon/72.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -2,8 +2,8 @@
"name" : "oa考勤系统", "name" : "oa考勤系统",
"appid" : "__UNI__4796942", "appid" : "__UNI__4796942",
"description" : "", "description" : "",
"versionName" : "2.1.6", "versionName" : "2.3.4",
"versionCode" : 216, "versionCode" : 234,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
@ -26,7 +26,10 @@
"Maps" : {}, "Maps" : {},
"LivePusher" : {}, "LivePusher" : {},
"Push" : {}, "Push" : {},
"Barcode" : {} "Barcode" : {},
"Share" : {},
"Record" : {},
"SQLite" : {}
}, },
/* */ /* */
"distribute" : { "distribute" : {
@ -47,7 +50,11 @@
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>", "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>" "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.READ_MEDIA_VIDEO\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>"
], ],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ], "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
"autoSdkPermissions" : false, "autoSdkPermissions" : false,
@ -61,7 +68,8 @@
"NSLocationWhenInUseUsageDescription" : "我们的应用需要在您进行考勤打卡时获取位置信息,以确保打卡记录的准确性和验证打卡地点。", "NSLocationWhenInUseUsageDescription" : "我们的应用需要在您进行考勤打卡时获取位置信息,以确保打卡记录的准确性和验证打卡地点。",
"NSPhotoLibraryUsageDescription" : "我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。", "NSPhotoLibraryUsageDescription" : "我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。",
"NSPhotoLibraryAddUsageDescription" : "我们需要获取写入权限,以便我们能够将您通过应用程序拍摄的照片或视频保存到您的设备相册中。", "NSPhotoLibraryAddUsageDescription" : "我们需要获取写入权限,以便我们能够将您通过应用程序拍摄的照片或视频保存到您的设备相册中。",
"NSCameraUsageDescription" : "我们的应用使用摄像头来拍照,以便在进行外勤打卡时确认您的身份和打卡环境,确保打卡数据的真实性和准确性。" "NSCameraUsageDescription" : "我们的应用使用摄像头来拍照,以便在进行外勤打卡时确认您的身份和打卡环境,确保打卡数据的真实性和准确性。",
"NSMicrophoneUsageDescription" : "我们需要获取您的麦克风权限,以便您能够使用语音方便快捷地输入或发送语音消息。"
} }
}, },
/* SDK */ /* SDK */
@ -74,14 +82,28 @@
"ad" : {}, "ad" : {},
"share" : { "share" : {
"weixin" : { "weixin" : {
"appid" : "", "appid" : "wx3a0f78634d074b23",
"UniversalLinks" : "" "UniversalLinks" : "https://warehouse.szjixun.cn/oa_backend/static/aretree/"
} }
}, },
"push" : { "push" : {
"unipush" : { "unipush" : {
"offline" : true, "offline" : true,
"version" : "2" "oppo" : {},
"vivo" : {},
"mi" : {},
"honor" : {},
"version" : "2",
"icons" : {
"small" : {
"ldpi" : "unpackage/pushicon/18.png",
"mdpi" : "unpackage/pushicon/24.png",
"hdpi" : "unpackage/pushicon/36.png",
"xhdpi" : "unpackage/pushicon/48.png",
"xxhdpi" : "unpackage/pushicon/72.png"
}
},
"meizu" : {}
} }
}, },
"maps" : {} "maps" : {}
@ -120,17 +142,33 @@
}, },
"splashscreen" : { "splashscreen" : {
"useOriginalMsgbox" : true, "useOriginalMsgbox" : true,
"androidStyle" : "common", "androidStyle" : "default",
"android" : { "android" : {
"hdpi" : "static/image/sy.png", "hdpi" : "static/image/drawable-hdpi/sy.9.png",
"xhdpi" : "static/image/sy.png", "xhdpi" : "static/image/drawable-xhdpi/sy.9.png",
"xxhdpi" : "static/image/sy.png" "xxhdpi" : "static/image/drawable-xxhdpi/sy.9.png"
}, },
"iosStyle" : "common", "iosStyle" : "storyboard",
"ios" : { "ios" : {
"storyboard" : "files/CustomStoryboard.zip" "storyboard" : "files/CustomStoryboard.zip"
} }
} }
},
"nativePlugins" : {
"VideoPicker" : {
"__plugin_info__" : {
"name" : "视频多选原生SDK",
"description" : "封装到js端使用",
"platforms" : "Android,iOS",
"url" : "",
"android_package_name" : "",
"ios_bundle_id" : "",
"isCloud" : false,
"bought" : -1,
"pid" : "",
"parameters" : {}
}
}
} }
}, },
/* */ /* */
@ -157,3 +195,5 @@
}, },
"vueVersion" : "3" "vueVersion" : "3"
} }
/* ios *//* SDK */

Binary file not shown.

View File

@ -0,0 +1,45 @@
{
"name": "视频多选原生SDK",
"id": "VideoPicker",
"version": "1.0.0",
"description": "封装到js端使用",
"_dp_type": "nativeplugin",
"_dp_nativeplugin": {
"android": {
"plugins": [{
"type": "module",
"name": "VideoPicker",
"class": "io.dcloud.uniplugin.VideoPicker"
}],
"integrateType": "aar",
"dependencies": [
"com.alibaba:fastjson:1.2.83",
"com.facebook.fresco:fresco:1.13.0",
"androidx.localbroadcastmanager:localbroadcastmanager:1.0.0",
"androidx.core:core:1.1.0",
"androidx.fragment:fragment:1.1.0",
"androidx.recyclerview:recyclerview:1.0.0",
"androidx.legacy:legacy-support-v4:1.0.0",
"androidx.appcompat:appcompat:1.0.0"
],
"compileOptions": {
"sourceCompatibility": "1.8",
"targetCompatibility": "1.8"
},
"abis": [
"armeabi-v7a","arm64-v8a","x86"
],
"minSdkVersion": "21"
},
"ios": {
"plugins": [{
"type": "module",
"name": "VideoPickerUniPlugin-VideoPickerModule",
"class": "VideoPickerModule"
}],
"frameworks": ["VideoPickerUniPlugin.framework"],
"integrateType": "framework",
"deploymentTarget": "11.0"
}
}
}

View File

@ -1,101 +1,257 @@
<template> <template>
<!-- <web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view> --> <web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue' import { ref, onMounted } from 'vue'
import {onExit } from "@dcloudio/uni-app"; import { onExit, onShow } from "@dcloudio/uni-app";
import config from "../../config" import config from "../../config"
const wv = plus.webview.create(config.h5Url,"custom-webview") import { operateSQLite } from '../../utils/sqlite.js'
const currentPages=getCurrentPages() import permission from '../../utils/permission.js'
const currentWebview = currentPages[currentPages.length-1].$getAppWebview() onShow(() => {
currentWebview.append(wv) // const { statusBarHeight } = uni.getSystemInfoSync()
const {statusBarHeight} = uni.getSystemInfoSync() // const wv1 = plus.webview.getWebviewById("custom-webview");
wv.setStyle({ // let wv = null;
top: statusBarHeight, // if (wv1) {
bottom: 0, // wv = wv1;
// } else {
// wv = plus.webview.create(config.h5Url, "custom-webview", {
// top: statusBarHeight,
// bottom: 0,
// });
// }
// var pages = getCurrentPages();
// var page = pages[pages.length - 1];
// var currentWebview = page.$getAppWebview();
}) })
import { Communication } from '../../utils/communication.js'; import { Communication } from '../../utils/communication.js';
const commun=new Communication() const commun = new Communication()
const shareH5 = () => {
uni.share({
provider: 'weixin',
scene: "WXSceneSession",
type: 0,// 5
imageUrl: 'https://th.bing.com/th?id=ORMS.41c34644e7e67f95a14620e77064b5d9&pid=Wdp&w=268&h=140&qlt=90&c=1&rs=1&dpr=1&p=0', //
title: '分享的标题',
href: 'https://www.baidu.com/',
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
}
});
}
//#ifdef APP-ANDROID
import {
registerRequestPermissionTipsListener,
unregisterRequestPermissionTipsListener,
setRequestPermissionTips
} from "@/uni_modules/uni-registerRequestPermissionTips"
import { const PermissionTips = {
registerRequestPermissionTipsListener, "android.permission.READ_PHONE_STATE": "<h4 style=\"font-size:40px;\">正在读取网络状态权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意</font>",
unregisterRequestPermissionTipsListener, "android.permission.CAMERA": "<h4 style=\"font-size:40px;\">正在访问相机权限</h4><font color=#cccccc>需要扫描二维码或拍照,是否允许打开相机?</font>",
setRequestPermissionTips "android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">正在读取相册权限</h4><font color=#cccccc>我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。</font>",
} from "@/uni_modules/uni-registerRequestPermissionTips" "android.permission.ACCESS_FINE_LOCATION": "<h4 style=\"font-size:40px;\">正在访问位置权限</h4><font color=#cccccc>需要获取您的位置信息,以便您能够进行考勤打卡。</font>",
"android.permission.ACCESS_COARSE_LOCATION": "<h4 style=\"font-size:40px;\">正在访问位置权限</h4><font color=#cccccc>需要获取您的位置信息,以便您能够进行考勤打卡。</font>",
const PermissionTips = { "android.permission.RECORD_AUDIO": "<h4 style=\"font-size:40px;\">正在访问麦克风权限</h4><font color=#cccccc>需要获取您的麦克风权限,以便您能够使用语音方便快捷地输入或发送语音消息。</font>"
"android.permission.READ_PHONE_STATE": "<h4 style=\"font-size:40px;\">正在读取网络状态权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意</font>", }
"android.permission.CAMERA": "<h4 style=\"font-size:40px;\">正在访问相机权限</h4><font color=#cccccc>需要扫描二维码或拍照,是否允许打开相机?</font>", onExit(() => {
"android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">正在读取相册权限</h4><font color=#cccccc>我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。</font>"
}
onExit(()=>{
unregisterRequestPermissionTipsListener() unregisterRequestPermissionTipsListener()
}) })
const brand = uni.getSystemInfoSync().deviceBrand const brand = uni.getSystemInfoSync().deviceBrand
setRequestPermissionTips(PermissionTips) setRequestPermissionTips(PermissionTips)
registerRequestPermissionTipsListener({ registerRequestPermissionTipsListener({
onRequest: (e) => { onRequest: (e) => {
console.log('onRequest',e) console.log('onRequest', e)
}, },
onConfirm: (e) => { onConfirm: (e) => {
commun.sendToH5('permission-application',{action:'open-permission',data:e}); // commun.sendToH5('permission-application', { action: 'open-permission', data: e });
}, },
onComplete: (e) => { onComplete: (e) => {
commun.sendToH5('permission-application',{action:'close-permission',data:e}); commun.sendToH5('permission-application', { action: 'close-permission', data: e });
// //
if (brand.toLowerCase() === "huawei") { if (brand.toLowerCase() === "huawei") {
const tips = {} const tips = {}
let hasDeniedPermission = false let hasDeniedPermission = false
for (let k in PermissionTips) { for (let k in PermissionTips) {
if (e[k] !== "denied") { if (e[k] !== "denied") {
tips[k] = PermissionTips[k] tips[k] = PermissionTips[k]
} else { } else {
hasDeniedPermission = true hasDeniedPermission = true
} }
} }
setRequestPermissionTips(tips) // setRequestPermissionTips(tips) //
if (hasDeniedPermission) if (hasDeniedPermission)
uni.showModal({ uni.showModal({
content: "权限已经被拒绝,请前往设置中开启" content: "权限已经被拒绝,请前往设置中开启"
}) })
} }
} }
}) })
//#endif
const webLoad = (e) => {
const message = e.detail.data?.[0] || '';
commun.handleMessage(message);
};
function initializeWebView() { function initializeWebView() {
const currentWebview = getCurrentPages().pop().$getAppWebview() const currentWebview = getCurrentPages().pop().$getAppWebview()
commun.setWebView(currentWebview.children()[0]) commun.setWebView(currentWebview.children()[0])
} }
//load-complete //load-complete
commun.registerHandler('load-complete',()=>{ commun.registerHandler('load-complete', () => {
initializeWebView() initializeWebView()
const {statusBarHeight} = uni.getSystemInfoSync() const { statusBarHeight } = uni.getSystemInfoSync()
commun.webViewObj.setStyle({ commun.webViewObj.setStyle({
top: statusBarHeight, top: statusBarHeight,
bottom: 0, bottom: 0,
}) })
}) })
commun.registerHandler('getLocation',(data)=>{
commun.registerHandler('getLocation', (data) => {
uni.getLocation({ uni.getLocation({
type:'gcj02', type: 'gcj02',
geocode:true, geocode: true,
isHighAccuracy:true, isHighAccuracy: true,
...data, ...data,
success: (res) => { success: (res) => {
console.log('getLocation',res) console.log('getLocation', res)
commun.sendToH5('getLocation',res); commun.sendToH5('getLocation', res);
}, },
}) })
}) })
const webLoad = (e) => { commun.registerHandler('goCard', async (data) => {
const message = e.detail.data?.[0] || ''; await getCard(data.phone)
commun.handleMessage(message); })
};
commun.registerHandler('createPushMessage', async (data) => {
uni.createPushMessage(JSON.parse(decodeURIComponent(data)))
})
commun.registerHandler('operateSQLite', async (data) => {
operateSQLite(data)
})
const handleRequestPerAppMicro = async () => {
const recordStatus = permission.isIOS
? await permission.requestIOS('record')
: await permission.requestAndroid('android.permission.RECORD_AUDIO')
let allWebview = plus.webview.all()
allWebview.forEach((webview) => {
if (webview.id === 'chat') {
//webview
webview.evalJS(
`handleAppMicro('${recordStatus}')`,
)
}
})
}
commun.registerHandler('handleRequestAndroidPermission', async (data) => {
if (data.type === 'micro') {
handleRequestPerAppMicro()
} else if (data.type === 'settings') {
permission.gotoAppSetting()
}
})
commun.registerHandler('VideoPicker', async () => {
console.error('=======BASE==VideoPicker')
console.error(uni.getSystemInfoSync().osName)
if (uni.getSystemInfoSync().osName === 'ios') {
//IOS
uni
.requireNativePlugin('VideoPickerUniPlugin-VideoPickerModule')
.pickVideos(
{ maxCount: 9 },
(res) => {
console.log('选中的视频列表:', res.videoList)
let allWebview = plus.webview.all()
allWebview.forEach((webview) => {
if (webview.id === 'chat') {
//webview
console.log('找到聊天的webview', webview)
webview.evalJS(
`getBaseMulVideo('${encodeURIComponent(
JSON.stringify(res.videoList),
)}')`,
)
}
})
},
(ret) => {
console.error('调用异步方法 ' + ret)
},
)
} else {
//
uni.requireNativePlugin('VideoPicker').pickVideos(
{ maxCount: 9 },
(res) => {
console.log('选中的视频:', res.paths)
let allWebview = plus.webview.all()
allWebview.forEach((webview) => {
if (webview.id === 'chat') {
//webview
console.log('找到聊天的webview', webview)
webview.evalJS(
`getBaseMulVideo('${encodeURIComponent(
JSON.stringify(res.paths),
)}')`,
)
}
})
},
(err) => {
console.error('选择失败:', err)
},
)
}
})
//
async function getCard(phone) {
uni.request({
url: 'https://blockchain.szjixun.cn/api/e_card/info-phone',
method: 'POST',
data: {
phone: phone
},
success: (res) => {
const resData = res.data.data
uni.share({
provider: 'weixin',
scene: "WXSceneSession",
type: 5,// 5
imageUrl: 'https://e-cdn.fontree.cn/fonchain-main/prod/image/139/avatar/ababc42c-7654-47f8-b22b-29dc589c71f0.png', //
title: `${resData.name}的电子名片`,
miniProgram: {
id: "gh_97094c34debd",
path: `/pages/mine/index?uid=${resData.uid}&userType=${resData.userType}`,
type: 0,
webUrl: `/pages/mine/index?uid=${resData.uid}&userType=${resData.userType}`,
},
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
}
});
},
fail: (err) => {
console.log('getCard', err)
}
})
}
</script> </script>
<style> <style></style>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 KiB

After

Width:  |  Height:  |  Size: 226 KiB

View File

@ -0,0 +1,14 @@
[
{
"IndexName": "index_device_id",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "device_id",
"Direction": "1"
}
],
"MgoIsUnique": true
}
}
]

View File

@ -0,0 +1,142 @@
{
"bsonType": "object",
"required": [],
"permission": {
"read": false,
"create": false,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "ID系统自动生成"
},
"appid": {
"bsonType": "string",
"description": "DCloud appid"
},
"device_id": {
"bsonType": "string",
"description": "设备唯一标识"
},
"vendor": {
"bsonType": "string",
"description": "设备厂商"
},
"push_clientid": {
"bsonType": "string",
"description": "推送设备客户端标识"
},
"imei": {
"bsonType": "string",
"description": "国际移动设备识别码IMEI(International Mobile Equipment Identity)"
},
"oaid": {
"bsonType": "string",
"description": "移动智能设备标识公共服务平台提供的匿名设备标识符(OAID)"
},
"idfa": {
"bsonType": "string",
"description": "iOS平台配置应用使用广告标识(IDFA)"
},
"imsi": {
"bsonType": "string",
"description": "国际移动用户识别码(International Mobile Subscriber Identification Number)"
},
"model": {
"bsonType": "string",
"description": "设备型号"
},
"platform": {
"bsonType": "string",
"description": "平台类型"
},
"uni_platform": {
"bsonType": "string",
"description": "uni-app 运行平台,与条件编译平台相同。"
},
"os_name": {
"bsonType": "string",
"description": "ios|android|windows|mac|linux "
},
"os_version": {
"bsonType": "string",
"description": "操作系统版本号 "
},
"os_language": {
"bsonType": "string",
"description": "操作系统语言 "
},
"os_theme": {
"bsonType": "string",
"description": "操作系统主题 light|dark"
},
"pixel_ratio": {
"bsonType": "string",
"description": "设备像素比 "
},
"network_model": {
"bsonType": "string",
"description": "设备网络型号wifi/3G/4G/"
},
"window_width": {
"bsonType": "string",
"description": "设备窗口宽度 "
},
"window_height": {
"bsonType": "string",
"description": "设备窗口高度"
},
"screen_width": {
"bsonType": "string",
"description": "设备屏幕宽度"
},
"screen_height": {
"bsonType": "string",
"description": "设备屏幕高度"
},
"rom_name": {
"bsonType": "string",
"description": "rom 名称"
},
"rom_version": {
"bsonType": "string",
"description": "rom 版本"
},
"location_latitude": {
"bsonType": "double",
"description": "纬度"
},
"location_longitude": {
"bsonType": "double",
"description": "经度"
},
"location_country": {
"bsonType": "string",
"description": "国家"
},
"location_province": {
"bsonType": "string",
"description": "省份"
},
"location_city": {
"bsonType": "string",
"description": "城市"
},
"create_date": {
"bsonType": "timestamp",
"description": "创建时间",
"forceDefaultValue": {
"$env": "now"
}
},
"last_update_date": {
"bsonType": "timestamp",
"description": "最后一次修改时间",
"forceDefaultValue": {
"$env": "now"
}
}
},
"version": "0.0.1"
}

View File

@ -0,0 +1,26 @@
{
"bsonType": "object",
"required": [
"value",
"expired"
],
"permission": {
"read": false,
"create": false,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "ID系统自动生成"
},
"value": {
"description": "值"
},
"expired": {
"description": "过期时间",
"bsonType": "timestamp"
}
},
"version": "0.0.1"
}

View File

@ -0,0 +1,38 @@
[
{
"IndexName": "device_id",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "device_id",
"Direction": "1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "oaid",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "oaid",
"Direction": "1"
}
],
"MgoIsUnique": false
}
},
{
"IndexName": "imei",
"MgoKeySchema": {
"MgoIndexKeys": [
{
"Name": "imei",
"Direction": "1"
}
],
"MgoIsUnique": false
}
}
]

View File

@ -0,0 +1,87 @@
{
"bsonType": "object",
"required": [
"user_id"
],
"properties": {
"_id": {
"description": "ID系统自动生成"
},
"user_id": {
"bsonType": "string",
"description": "用户id参考uni-id-users表"
},
"ua": {
"bsonType": "string",
"description": "userAgent"
},
"uuid": {
"bsonType": "string",
"description": "设备唯一标识(需要加密存储)"
},
"os_name": {
"bsonType": "string",
"description": "ios|android|windows|mac|linux "
},
"os_version": {
"bsonType": "string",
"description": "操作系统版本号 "
},
"os_language": {
"bsonType": "string",
"description": "操作系统语言 "
},
"os_theme": {
"bsonType": "string",
"description": "操作系统主题 light|dark"
},
"vendor": {
"bsonType": "string",
"description": "设备厂商"
},
"push_clientid": {
"bsonType": "string",
"description": "推送设备客户端标识"
},
"device_id": {
"bsonType": "string",
"description": "设备id"
},
"imei": {
"bsonType": "string",
"description": "国际移动设备识别码IMEI(International Mobile Equipment Identity)"
},
"oaid": {
"bsonType": "string",
"description": "移动智能设备标识公共服务平台提供的匿名设备标识符(OAID)"
},
"idfa": {
"bsonType": "string",
"description": "iOS平台配置应用使用广告标识(IDFA)"
},
"model": {
"bsonType": "string",
"description": "设备型号"
},
"platform": {
"bsonType": "string",
"description": "平台类型"
},
"create_date": {
"bsonType": "timestamp",
"description": "创建时间",
"forceDefaultValue": {
"$env": "now"
}
},
"last_active_date": {
"bsonType": "timestamp",
"description": "最后登录时间"
},
"last_active_ip": {
"bsonType": "string",
"description": "最后登录IP"
}
},
"version": "0.0.1"
}

263
utils/permission.js Normal file
View File

@ -0,0 +1,263 @@
/// null = 未请求1 = 已允许0 = 拒绝|受限, 2 = 系统未开启
var isIOS
function album() {
var result = 0;
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
var authStatus = PHPhotoLibrary.authorizationStatus();
if (authStatus === 0) {
result = null;
} else if (authStatus == 3) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(PHPhotoLibrary);
return result;
}
function camera() {
var result = 0;
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
if (authStatus === 0) {
// uni.chooseImage({
// count: 1,
// sourceType: ['camera'],
// success: () => {},
// fail: (err) => {
// if (err.errMsg.includes('authorize:fail')) {
// console.log('用户未授权访问相机');
// }
// }
// });
result = null;
} else if (authStatus == 3) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(AVCaptureDevice);
return result;
}
function location() {
var result = 0;
var cllocationManger = plus.ios.import("CLLocationManager");
var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus();
if (!enable) {
result = 2;
} else if (status === 0) {
result = null;
} else if (status === 3 || status === 4) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(cllocationManger);
return result;
}
function push() {
var result = 0;
var UIApplication = plus.ios.import("UIApplication");
var app = UIApplication.sharedApplication();
var enabledTypes = 0;
if (app.currentUserNotificationSettings) {
var settings = app.currentUserNotificationSettings();
enabledTypes = settings.plusGetAttribute("types");
if (enabledTypes == 0) {
result = 0;
console.log("推送权限没有开启");
} else {
result = 1;
console.log("已经开启推送功能!")
}
plus.ios.deleteObject(settings);
} else {
enabledTypes = app.enabledRemoteNotificationTypes();
if (enabledTypes == 0) {
result = 3;
console.log("推送权限没有开启!");
} else {
result = 4;
console.log("已经开启推送功能!")
}
}
plus.ios.deleteObject(app);
plus.ios.deleteObject(UIApplication);
return result;
}
function contact() {
var result = 0;
var CNContactStore = plus.ios.import("CNContactStore");
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
if (cnAuthStatus === 0) {
result = null;
} else if (cnAuthStatus == 3) {
result = 1;
} else {
result = 0;
}
plus.ios.deleteObject(CNContactStore);
return result;
}
function record() {
return new Promise((resolve) => {
// var result = null;
var avaudiosession = plus.ios.import("AVAudioSession");
var avaudio = avaudiosession.sharedInstance();
var status = avaudio.recordPermission();
console.log("permissionStatus:" + status);
if (status === 1970168948) {
avaudio.requestRecordPermission(function(granted) {
plus.ios.deleteObject(avaudiosession);
resolve(record());
});
} else {
if (status === 1735552628) {
resolve(1);
} else {
resolve(0);
}
plus.ios.deleteObject(avaudiosession);
// return result;
}
})
}
function calendar() {
var result = null;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
if (ekAuthStatus == 3) {
result = 1;
console.log("日历权限已经开启");
} else {
console.log("日历权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
function memo() {
var result = null;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
if (ekAuthStatus == 3) {
result = 1;
console.log("备忘录权限已经开启");
} else {
console.log("备忘录权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
function requestIOS(permissionID) {
return new Promise((resolve, reject) => {
switch (permissionID) {
case "push":
resolve(push());
break;
case "location":
resolve(location());
break;
case "record":
resolve(record());
break;
case "camera":
resolve(camera());
break;
case "album":
resolve(album());
break;
case "contact":
resolve(contact());
break;
case "calendar":
resolve(calendar());
break;
case "memo":
resolve(memo());
break;
default:
resolve(0);
break;
}
});
}
function requestAndroid(permissionID) {
return new Promise((resolve, reject) => {
// console.log(permissionID)
plus.android.requestPermissions(
[permissionID],
function(resultObj) {
var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i];
// console.log('已获取的权限:' + grantedPermission);
result = 1
}
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1
}
resolve(result);
},
function(error) {
console.log('result error: ' + error.message)
resolve({
code: error.code,
message: error.message
});
}
);
});
}
function gotoAppPermissionSetting() {
if (permission.isIOS) {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
}
const permission = {
get isIOS() {
return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios')
},
requestIOS: requestIOS,
requestAndroid: requestAndroid,
gotoAppSetting: gotoAppPermissionSetting
}
export default permission

79
utils/sqlite.js Normal file
View File

@ -0,0 +1,79 @@
import { Communication } from './communication.js'
const commun = new Communication()
// 操作数据库
export const operateSQLite = (data) => {
const options = JSON.parse(decodeURIComponent(data))
console.error('operateSQLite', options)
if (options.eventType === 'openDatabase') {
// 打开数据库
let params = Object.assign({}, options.eventParams, {
success: function (e) {
console.log('打开数据库成功!' + JSON.stringify(e))
},
fail: function (e) {
console.log('打开数据库失败: ' + JSON.stringify(e))
},
})
plus.sqlite.openDatabase(params)
} else if (options.eventType === 'executeSql') {
// 执行增删改等操作的sql语句
let params = Object.assign({}, options.eventParams, {
success: function (e) {
console.log('执行增删改等操作sql语句成功!' + JSON.stringify(e))
},
fail: function (e) {
console.log('执行增删改等操作sql语句失败: ' + JSON.stringify(e))
},
})
plus.sqlite.executeSql(params)
} else if (options.eventType === 'selectSql') {
// 执行查询的sql语句
let params = Object.assign({}, options.eventParams, {
success: function (e) {
console.log('执行查询sql语句成功!' + JSON.stringify(e))
},
fail: function (e) {
console.log('执行查询sql语句失败: ' + JSON.stringify(e))
},
})
plus.sqlite.selectSql(params)
} else if (options.eventType === 'closeDatabase') {
// 关闭数据库
let params = Object.assign({}, options.eventParams, {
success: function (e) {
console.log('关闭数据库成功!' + JSON.stringify(e))
},
fail: function (e) {
console.log('关闭数据库失败: ' + JSON.stringify(e))
},
})
plus.sqlite.selectSql(params)
} else if (options.eventType === 'isOpenDatabase') {
// 判断数据库是否打开
const isOpen = plus.sqlite.isOpenDatabase(options.eventParams)
console.log('判断数据库是否打开:' + isOpen)
let allWebview = plus.webview.all()
allWebview.forEach((webview) => {
if (webview.id === 'webviewId1') {
//找到OA的webview
webview.evalJS(
`getBaseMessage('${encodeURIComponent(
JSON.stringify({ action: 'isOpenDatabase', data: isOpen }),
)}')`,
)
}
})
} else if (options.eventType === 'transaction') {
// 执行事务
let params = Object.assign({}, options.eventParams, {
success: function (e) {
console.log('执行事务成功!' + JSON.stringify(e))
},
fail: function (e) {
console.log('执行事务失败: ' + JSON.stringify(e))
},
})
plus.sqlite.transaction(params)
}
}