Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
07e83d19af | |||
74f5ae7eae | |||
ea89fc391a | |||
e52de07528 | |||
680dc77917 | |||
22c254fffd | |||
6227aaf931 | |||
ddfedd2058 | |||
934fe8de1f | |||
61459264ef | |||
59982f4f46 | |||
|
687371b1e6 | ||
|
f7b500f715 | ||
|
a9d3014b28 | ||
ed3ebf0b85 | |||
a2b3ef0cf8 | |||
|
d6fb4b5688 | ||
|
7bc12f11a0 | ||
67e81c1a80 | |||
c0b331bfb5 | |||
|
acace8dc21 | ||
|
446498b893 | ||
022aaa9109 | |||
92d8327930 | |||
|
c2168272de | ||
|
6d913b9288 | ||
|
951aabfe55 | ||
a7bc5506de | |||
|
e6833725e7 | ||
|
1bd2bffedf | ||
86dbbcd6a7 | |||
6e8d2d38e3 | |||
b9a7864433 | |||
5e0d4bea19 | |||
524bfb97fa | |||
8be6d5316d | |||
b44bd80ecd | |||
695f33d77b | |||
c955087e49 |
@ -13,7 +13,7 @@
|
||||
"h5" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"provider" : "alipay",
|
||||
"provider" : "aliyun",
|
||||
"type" : "uniCloud"
|
||||
},
|
||||
{
|
||||
|
76
App.vue
@ -1,25 +1,65 @@
|
||||
<script>
|
||||
export default {
|
||||
methods:{
|
||||
networkStatusChange(res){
|
||||
if(res.isConnected){
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 上一次网络状态
|
||||
lastNetworkStatus: null
|
||||
}
|
||||
},
|
||||
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'
|
||||
})
|
||||
}else{
|
||||
uni.redirectTo({
|
||||
url:'/pages/networko/index'
|
||||
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() {
|
||||
onLaunch: function () {
|
||||
console.log('onLaunch')
|
||||
|
||||
},
|
||||
onShow: function() {
|
||||
onShow: function () {
|
||||
uni.onNetworkStatusChange(this.networkStatusChange);
|
||||
uni.getNetworkType({
|
||||
success:(res)=> {
|
||||
if(res.networkType==='none') {
|
||||
success: (res) => {
|
||||
if (res.networkType === 'none') {
|
||||
uni.redirectTo({
|
||||
url: '/pages/networko/index'
|
||||
})
|
||||
@ -27,14 +67,14 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
uni.onNetworkStatusChange(this.networkStatusChange);
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
onHide: function () {
|
||||
uni.offNetworkStatusChange(this.networkStatusChange)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/*每个页面公共css */
|
||||
/*每个页面公共css */
|
||||
</style>
|
||||
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"version" : "1",
|
||||
"prompt" : "template",
|
||||
"title" : "服务协议和隐私政策",
|
||||
"message" : " 请你务必审慎阅读、充分理解“平台服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href=\"https://oa.szjixun.cn/#/pages/login/serveInfo\">《用户服务协议》</a>和<a href=\"https://oa.szjixun.cn/#/pages/login/privateInfo\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
|
||||
"title" : "温馨提示",
|
||||
"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" : "同意并接受",
|
||||
"buttonRefuse" : "不同意",
|
||||
"second" : {
|
||||
"title" : "确认提示",
|
||||
"message" : " 进入应用前,你需先同意<a href=\"https://oa.szjixun.cn/#/pages/login/serveInfo\">《用户服务协议》</a>和<a href=\"https://oa.szjixun.cn/#/pages/login/privateInfo\">《隐私政策》</a>,否则将退出应用。",
|
||||
"title" : " 您需要同意本隐私政策才能继续使用oa考勤系统",
|
||||
"message" : " 若您不同意本<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>,很遗憾我们将无法为您提供服务",
|
||||
"buttonAccept" : "同意并继续",
|
||||
"buttonRefuse" : "退出应用"
|
||||
},
|
||||
|
@ -1,20 +1,20 @@
|
||||
const env = 'test';
|
||||
const env = 'prod';
|
||||
const configs = {
|
||||
LocalTest: {
|
||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
||||
h5Url:'http://192.168.88.51:8080/#/'
|
||||
h5Url: 'http://192.168.88.61:2367/#/'
|
||||
},
|
||||
dev: {
|
||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
||||
h5Url:'https://192.168.88.27:8080/#/'
|
||||
h5Url: 'http://192.168.88.47:2367/#/'
|
||||
},
|
||||
test: {
|
||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
||||
h5Url:'https://192.168.88.29:8080/#/'
|
||||
h5Url: 'http://114.218.158.24:8042/#/'
|
||||
},
|
||||
prod: {
|
||||
apiBaseUrl: 'https://oa-a.szjixun.cn/api',
|
||||
h5Url:'https://oa-a.szjixun.cn/#/'
|
||||
h5Url: 'https://oa-a.szjixun.cn/#/'
|
||||
},
|
||||
};
|
||||
const config = configs[env];
|
||||
|
@ -33,12 +33,12 @@
|
||||
<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"/>
|
||||
</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"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</label> -->
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="IW3-oA-Ytg"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
|
Before Width: | Height: | Size: 732 KiB After Width: | Height: | Size: 226 KiB |
Before Width: | Height: | Size: 732 KiB After Width: | Height: | Size: 226 KiB |
@ -1,3 +1,3 @@
|
||||
Android 包名 : uni.UNI4796942
|
||||
Android 包名 : uni.UNI70C49A3
|
||||
证书别名:oaapp
|
||||
密钥密码:12345678
|
||||
|
BIN
files/icon.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
files/pushicon/18.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
files/pushicon/24.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
files/pushicon/36.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
BIN
files/pushicon/48.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
files/pushicon/72.png
Normal file
After Width: | Height: | Size: 19 KiB |
@ -1 +1,5 @@
|
||||
|
||||
Android 包名 : uni.UNI70C49A3
|
||||
证书别名:oaapp
|
||||
密钥密码:12345678
|
||||
Bundle ID:com.fonchain.attendance
|
||||
IOS:私钥证书密码 dis dev 都是 12345678
|
||||
|
@ -2,11 +2,14 @@
|
||||
"name" : "oa考勤系统",
|
||||
"appid" : "__UNI__4796942",
|
||||
"description" : "",
|
||||
"versionName" : "2.1.1",
|
||||
"versionCode" : 211,
|
||||
"versionName" : "2.3.4",
|
||||
"versionCode" : 234,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"compatible" : {
|
||||
"ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
@ -21,7 +24,12 @@
|
||||
"Camera" : {},
|
||||
"Geolocation" : {},
|
||||
"Maps" : {},
|
||||
"LivePusher" : {}
|
||||
"LivePusher" : {},
|
||||
"Push" : {},
|
||||
"Barcode" : {},
|
||||
"Share" : {},
|
||||
"Record" : {},
|
||||
"SQLite" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
@ -32,23 +40,26 @@
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
|
||||
"<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" ],
|
||||
"autoSdkPermissions" : false,
|
||||
"targetSdkVersion" : 34
|
||||
"targetSdkVersion" : 34,
|
||||
"minSdkVersion" : 21
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {
|
||||
@ -57,7 +68,8 @@
|
||||
"NSLocationWhenInUseUsageDescription" : "我们的应用需要在您进行考勤打卡时获取位置信息,以确保打卡记录的准确性和验证打卡地点。",
|
||||
"NSPhotoLibraryUsageDescription" : "我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。",
|
||||
"NSPhotoLibraryAddUsageDescription" : "我们需要获取写入权限,以便我们能够将您通过应用程序拍摄的照片或视频保存到您的设备相册中。",
|
||||
"NSCameraUsageDescription" : "我们的应用使用摄像头来拍照,以便在进行外勤打卡时确认您的身份和打卡环境,确保打卡数据的真实性和准确性。"
|
||||
"NSCameraUsageDescription" : "我们的应用使用摄像头来拍照,以便在进行外勤打卡时确认您的身份和打卡环境,确保打卡数据的真实性和准确性。",
|
||||
"NSMicrophoneUsageDescription" : "我们需要获取您的麦克风权限,以便您能够使用语音方便快捷地输入或发送语音消息。"
|
||||
}
|
||||
},
|
||||
/* SDK配置 */
|
||||
@ -65,33 +77,37 @@
|
||||
"geolocation" : {
|
||||
"system" : {
|
||||
"__platform__" : [ "ios", "android" ]
|
||||
},
|
||||
"baidu" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appkey_ios" : "5zzMAq3ofL5H5KfxRcf0zDMLTimvGIb0",
|
||||
"appkey_android" : "ahdcPcBfatf61zRAgNl9SpBGUEURsnXN"
|
||||
}
|
||||
},
|
||||
"ad" : {},
|
||||
"share" : {
|
||||
"weixin" : {
|
||||
"appid" : "",
|
||||
"UniversalLinks" : ""
|
||||
"appid" : "wx3a0f78634d074b23",
|
||||
"UniversalLinks" : "https://warehouse.szjixun.cn/oa_backend/static/aretree/"
|
||||
}
|
||||
},
|
||||
"push" : {
|
||||
"unipush" : {
|
||||
"offline" : true,
|
||||
"oppo" : {},
|
||||
"vivo" : {},
|
||||
"mi" : {},
|
||||
"honor" : {},
|
||||
"version" : "2",
|
||||
"offline" : true
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"maps" : {
|
||||
"baidu" : {
|
||||
"appkey_ios" : "5zzMAq3ofL5H5KfxRcf0zDMLTimvGIb0",
|
||||
"appkey_android" : "ahdcPcBfatf61zRAgNl9SpBGUEURsnXN"
|
||||
}
|
||||
"meizu" : {}
|
||||
}
|
||||
},
|
||||
"maps" : {}
|
||||
},
|
||||
"icons" : {
|
||||
"android" : {
|
||||
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||
@ -126,17 +142,33 @@
|
||||
},
|
||||
"splashscreen" : {
|
||||
"useOriginalMsgbox" : true,
|
||||
"androidStyle" : "common",
|
||||
"androidStyle" : "default",
|
||||
"android" : {
|
||||
"hdpi" : "static/image/sy.png",
|
||||
"xhdpi" : "static/image/sy.png",
|
||||
"xxhdpi" : "static/image/sy.png"
|
||||
"hdpi" : "static/image/drawable-hdpi/sy.9.png",
|
||||
"xhdpi" : "static/image/drawable-xhdpi/sy.9.png",
|
||||
"xxhdpi" : "static/image/drawable-xxhdpi/sy.9.png"
|
||||
},
|
||||
"iosStyle" : "common",
|
||||
"iosStyle" : "storyboard",
|
||||
"ios" : {
|
||||
"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" : {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
@ -163,3 +195,5 @@
|
||||
},
|
||||
"vueVersion" : "3"
|
||||
}
|
||||
/* ios打包配置 *//* SDK配置 */
|
||||
|
||||
|
BIN
nativeplugins/VideoPicker/android/VideoPicker.aar
Normal file
45
nativeplugins/VideoPicker/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
@ -2,37 +2,78 @@
|
||||
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import config from "../../config";
|
||||
import {onExit } from "@dcloudio/uni-app";
|
||||
import { Communication } from '../../utils/communication.js';
|
||||
const commun=new Communication()
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { onExit, onShow } from "@dcloudio/uni-app";
|
||||
import config from "../../config"
|
||||
import { operateSQLite } from '../../utils/sqlite.js'
|
||||
import permission from '../../utils/permission.js'
|
||||
onShow(() => {
|
||||
// const { statusBarHeight } = uni.getSystemInfoSync()
|
||||
// const wv1 = plus.webview.getWebviewById("custom-webview");
|
||||
// let wv = null;
|
||||
// if (wv1) {
|
||||
// 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 {
|
||||
|
||||
|
||||
})
|
||||
import { Communication } from '../../utils/communication.js';
|
||||
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"
|
||||
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
||||
|
||||
const PermissionTips = {
|
||||
"android.permission.CAMERA": "<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>"
|
||||
}
|
||||
onExit(()=>{
|
||||
const PermissionTips = {
|
||||
"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>",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">正在读取相册权限</h4><font color=#cccccc>我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。</font>",
|
||||
"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>",
|
||||
"android.permission.RECORD_AUDIO": "<h4 style=\"font-size:40px;\">正在访问麦克风权限</h4><font color=#cccccc>需要获取您的麦克风权限,以便您能够使用语音方便快捷地输入或发送语音消息。</font>"
|
||||
}
|
||||
onExit(() => {
|
||||
unregisterRequestPermissionTipsListener()
|
||||
})
|
||||
|
||||
const brand = uni.getSystemInfoSync().deviceBrand
|
||||
setRequestPermissionTips(PermissionTips)
|
||||
registerRequestPermissionTipsListener({
|
||||
const brand = uni.getSystemInfoSync().deviceBrand
|
||||
setRequestPermissionTips(PermissionTips)
|
||||
registerRequestPermissionTipsListener({
|
||||
onRequest: (e) => {
|
||||
console.log('onRequest',e)
|
||||
console.log('onRequest', e)
|
||||
},
|
||||
onConfirm: (e) => {
|
||||
commun.sendToH5('permission-application',{action:'open-permission',data:e});
|
||||
// commun.sendToH5('permission-application', { action: 'open-permission', data: 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") {
|
||||
@ -52,39 +93,165 @@ onExit(()=>{
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//#endif
|
||||
const webLoad = (e) => {
|
||||
const message = e.detail.data?.[0] || '';
|
||||
commun.handleMessage(message);
|
||||
};
|
||||
function initializeWebView() {
|
||||
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
||||
commun.setWebView(currentWebview.children()[0])
|
||||
}
|
||||
//load-complete 注册函数
|
||||
commun.registerHandler('load-complete',()=>{
|
||||
commun.registerHandler('load-complete', () => {
|
||||
|
||||
initializeWebView()
|
||||
const {statusBarHeight} = uni.getSystemInfoSync()
|
||||
const { statusBarHeight } = uni.getSystemInfoSync()
|
||||
commun.webViewObj.setStyle({
|
||||
top: statusBarHeight,
|
||||
bottom: 0,
|
||||
})
|
||||
|
||||
})
|
||||
commun.registerHandler('getLocation',(data)=>{
|
||||
|
||||
commun.registerHandler('getLocation', (data) => {
|
||||
uni.getLocation({
|
||||
type:'gcj02',
|
||||
geocode:true,
|
||||
isHighAccuracy:true,
|
||||
type: 'gcj02',
|
||||
geocode: true,
|
||||
isHighAccuracy: true,
|
||||
...data,
|
||||
success: (res) => {
|
||||
console.log('getLocation',res)
|
||||
commun.sendToH5('getLocation',res);
|
||||
console.log('getLocation', res)
|
||||
commun.sendToH5('getLocation', res);
|
||||
},
|
||||
})
|
||||
})
|
||||
const webLoad = (e) => {
|
||||
const message = e.detail.data?.[0] || '';
|
||||
commun.handleMessage(message);
|
||||
};
|
||||
commun.registerHandler('goCard', async (data) => {
|
||||
await getCard(data.phone)
|
||||
})
|
||||
|
||||
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>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
|
BIN
static/image/drawable-hdpi/sy.9.png
Normal file
After Width: | Height: | Size: 175 KiB |
BIN
static/image/drawable-xhdpi/sy.9.png
Normal file
After Width: | Height: | Size: 227 KiB |
BIN
static/image/drawable-xxhdpi/sy.9.png
Normal file
After Width: | Height: | Size: 525 KiB |
Before Width: | Height: | Size: 732 KiB After Width: | Height: | Size: 226 KiB |
14
uniCloud-aliyun/database/opendb-device.index.json
Normal file
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"IndexName": "index_device_id",
|
||||
"MgoKeySchema": {
|
||||
"MgoIndexKeys": [
|
||||
{
|
||||
"Name": "device_id",
|
||||
"Direction": "1"
|
||||
}
|
||||
],
|
||||
"MgoIsUnique": true
|
||||
}
|
||||
}
|
||||
]
|
142
uniCloud-aliyun/database/opendb-device.schema.json
Normal 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"
|
||||
}
|
26
uniCloud-aliyun/database/opendb-tempdata.schema.json
Normal 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"
|
||||
}
|
38
uniCloud-aliyun/database/uni-id-device.index.json
Normal 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
|
||||
}
|
||||
}
|
||||
]
|
87
uniCloud-aliyun/database/uni-id-device.schema.json
Normal 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
@ -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
@ -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)
|
||||
}
|
||||
}
|