// index.js const { miniAppPluginId } = require('../../constant'); Page({ data: { myPlugin: undefined }, onLoad(option) { wx.miniapp.loadNativePlugin({ pluginId: miniAppPluginId, success: (plugin) => { console.log('load plugin success', plugin) this.setData({ myPlugin: plugin }) }, fail: (e) => { console.log('load plugin fail', e) } }) }, onLoadPlugin() { this.data.myPlugin.initPlugin(({}), (res) => { if (res === "success") { console.log("初始化plugin成功") } else { console.log("初始化plugin失败") } }) }, onInitPermission() { let permissionArr = "android.permission.INTERNET" + "," + "android.permission.ACCESS_NETWORK_STATE" + "," + "android.permission.ACCESS_WIFI_STATE" + "," + "android.permission.RECORD_AUDIO" + "," + "android.permission.READ_EXTERNAL_STORAGE" + "," + "android.permission.WRITE_EXTERNAL_STORAGE"; this.data.myPlugin.initPermissions(({ 'permissionArr': permissionArr }), (res) => { if (res === "success") { console.log("初始化权限成功") } else { console.log("初始化权限失败") } }) }, checkRecordAudioPermission() { var test = this.data.myPlugin.checkPermission({ 'permission': 'android.permission.RECORD_AUDIO' }) console.log("是否有权限:" + test) }, getDeviceUUID() { var device_uuid = this.data.myPlugin.getDeviceUuid({}) console.log("获取的uuid:" + device_uuid) }, lenovoInitSDK() { this.data.myPlugin.lenovoInitSDK({}, (res) => { console.log('res:', res) if (res === "success") { console.log("初始化联想sdk成功") } else { console.log(res) } }) }, lenovoLogin() { this.data.myPlugin.lenovoLogin({}, (res) => { console.log('res:', res) }) }, lenovoPay() { this.data.myPlugin.lenovoPay({}, (res) => { console.log('res:', res) }) }, lenovoLogout() { this.data.myPlugin.lenovoLogout({}, (res) => { console.log('res:', res) }) }, aliPay() { this.data.myPlugin.aliPay({}, (res) => { console.log('res:', res) }) }, huaweiLogin() { this.data.myPlugin.HuaWeiLogin({}, (res) => { console.log('res:', res) }) }, huaweiLogout() { this.data.myPlugin.HuaWeiSignOut({}, (res) => { console.log('res:', res) }) } })