diff --git a/manifest.json b/manifest.json index bb318e9..64bcb37 100644 --- a/manifest.json +++ b/manifest.json @@ -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 @@ "", "", "", - "" + "", + "", + "", + "" ], "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配置 */ + diff --git a/nativeplugins/VideoPicker/android/VideoPicker.aar b/nativeplugins/VideoPicker/android/VideoPicker.aar new file mode 100644 index 0000000..e592e11 Binary files /dev/null and b/nativeplugins/VideoPicker/android/VideoPicker.aar differ diff --git a/nativeplugins/VideoPicker/package.json b/nativeplugins/VideoPicker/package.json new file mode 100644 index 0000000..f918d2f --- /dev/null +++ b/nativeplugins/VideoPicker/package.json @@ -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" + } + } +} \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index de61571..4f5e1b4 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -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({ diff --git a/utils/sqlite.js b/utils/sqlite.js new file mode 100644 index 0000000..ecdf9bc --- /dev/null +++ b/utils/sqlite.js @@ -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) + } +}