Compare commits

...

1 Commits

5 changed files with 172 additions and 5 deletions

View File

@ -2,8 +2,8 @@
"name" : "oa考勤系统",
"appid" : "__UNI__4796942",
"description" : "",
"versionName" : "2.3.2",
"versionCode" : 232,
"versionName" : "2.3.4",
"versionCode" : 234,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@ -27,7 +27,9 @@
"LivePusher" : {},
"Push" : {},
"Barcode" : {},
"Share" : {}
"Share" : {},
"Record" : {},
"SQLite" : {}
},
/* */
"distribute" : {
@ -48,7 +50,10 @@
"<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\"/>"
],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
"autoSdkPermissions" : false,
@ -146,6 +151,22 @@
"storyboard" : "files/CustomStoryboard.zip"
}
}
},
"nativePlugins" : {
"VideoPicker" : {
"__plugin_info__" : {
"name" : "视频多选原生SDK",
"description" : "封装到js端使用",
"platforms" : "Android",
"url" : "",
"android_package_name" : "",
"ios_bundle_id" : "",
"isCloud" : false,
"bought" : -1,
"pid" : "",
"parameters" : {}
}
}
}
},
/* */
@ -172,3 +193,5 @@
},
"vueVersion" : "3"
}
/* ios *//* SDK */

Binary file not shown.

View File

@ -0,0 +1,35 @@
{
"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"
}
}
}

View File

@ -5,6 +5,7 @@
import { ref, onMounted } from 'vue'
import { onExit, onShow } from "@dcloudio/uni-app";
import config from "../../config"
import { operateSQLite } from '../../utils/sqlite.js'
onShow(() => {
// const { statusBarHeight } = uni.getSystemInfoSync()
// const wv1 = plus.webview.getWebviewById("custom-webview");
@ -22,7 +23,7 @@ onShow(() => {
// var currentWebview = page.$getAppWebview();
})
import { Communication } from '../../utils/communication.js';
const commun = new Communication()
@ -132,6 +133,35 @@ commun.registerHandler('createPushMessage', async (data) => {
uni.createPushMessage(JSON.parse(decodeURIComponent(data)))
})
commun.registerHandler('operateSQLite', async (data) => {
operateSQLite(data)
})
commun.registerHandler('VideoPicker', async () => {
console.error("=======BASE==VideoPicker")
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({

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)
}
}