UNI-API APP
Aqui você encontrará uma visão geral do que o applet phitclip SDK Integrado ao UNI-o plug -in de aplicativo oferece, bem como um detalhado Descrição da API e exmas de seu uso.
1. Inicializando a API
JavaScript
MopSdk.initialize({
'sdkKey': 'SDK Key to be filled in here',
'sdkSecret': 'Fill in the SDK secret here',
'apmServer': 'Fill in your server address here', // e.g.:https://api.PhizClip.com;
// 'apiServer': 'Fill in your server address here', // e.g.:https://api.PhizClip.com;
// 'apiPrefix': '/api/v1/mop/',
// 'cryptType': 'MD5',
// 'sdkFingerprint': '',
// 'encryptServerData': false,
// 'userId': '',
// 'customWebViewUserAgent': '',
// 'bindAppletWithMainProcess': false,
// 'maxRunningApplet': 5,
// 'apmExtension'
// 'enableAppletDebug'
// 'disablePermission': false,
// 'disableGetSuperviseInfo'
// 'disableRequestPermissions'
// Applet interface UI
uiConfig: {
// Whether to hide the close button on the applet loading screen
hideTransitionCloseButton: true,
//Mask the "Forward" button in the More menu
hideForwardMenu: false,
//Mask the "Settings" button in the More menu
hideSettingMenu: false,
//Mask the "Back to Home" button in the More menu
hideBackToHome: false,
//block the "Feedback & Complaints" button in the More menu
hideFeedbackMenu: false,
//Replace the "applet" text in the /SDK with any other name
//appletText: 'applet',
//Capsule button configuration
capsuleConfig: {
// width of the capsule view in the top right corner, default value is 88
capsuleWidth: 88,
// height of the top right capsule view, default value is 32
capsuleHeight: 32,
// right margin of the upper right capsule view
capsuleRightMargin: 7,
// Radius of the rounded corners of the upper right capsule view, default value 5
capsuleCornerRadius: 16,
// width of the border of the upper right capsule view,default value is 0.8
capsuleBorderWidth: 0.5,
//capsule background colour light
capsuleBgLightColor: '0x00000000',
//capsule background colour dark
capsuleBgDarkColor: '0x80ffffff',
// Light colour of the border of the upper right capsule view
capsuleBorderLightColor: '0x80ffffff',
// Dark colour of the border of the capsule view in theupper right corner
capsuleBorderDarkColor: '0x26000000',
// Capsule divider light colour
capsuleDividerLightColor: '0x26ffffff',
// Capsule divider dark colour
capsuleDividerDarkColor: '0x26000000',
// More buttons in the capsule of equal height and width
moreBtnWidth: 32,
// left margin of the more button in the capsule
moreBtnLeftMargin: 6,
// Width of the close button in the capsule, height equal to width
closeBtnWidth: 32,
// Left distance of the close button in the capsule
closeBtnLeftMargin: 6,
// The following properties are not supported at this time and require native engineering adjustments Image object for the light-coloured more button in the //capsule, if not passed, the default icon will be used
//moreLightImage Image object for the dark more button in the // capsule, if not passed, the default icon will be used
//moreDarkImage Image object for the light-coloured more button in the //capsule, if not passed, the default icon will be used
//closeLightImage Image object for the dark more button in the // capsule, if not passed, the default icon will be used
//closeDarkImage
},
//UI customisation of the Back to Home button in the
//Navigation bar
// navHomeConfig: {
// // Back to home button width, default 44
// width: 44,
// // Back to home button height, default 32
// height: 32,
// // The left margin of the Back to Home button, default7
// leftMargin: 7,
// // Return to the home button border rounding radius, default 5
// cornerRadius: 5,
// // Return to home button border width, default 1
// borderWidth: 0.5,
// // Back to home button light border colour, default 0X80FFFFFF
// borderLightColor: '0x80ffffff',
// // Back to home button dark border colour, default 0X26000000
// borderDarkColor: '0x26000000',
// // Back to home button light background, default 0x33000000
// bgLightColor: '0x33000000',
// // Back to home button dark background, default 0x33000000
// bgDarkColor: '0x80ffffff',
// // The following properties are not supported at this time and require native engineering adjustments
// // Light icon for the navigation bar back to home button, if not passed, the default icon will be used
// //lightImage
// // light icon for the navigation bar back to home button, if not passed, the default icon will be used
// //darkImage
// },
// Floating window sets the window size and position, typically used for smart devices such as cars, watches, and
// floatWindowConfig: {
// floatMode: true,
// x: 0,
// y: 0,
// width: 0,
// height: 0,
// }
}
},
(ret) => {
console. log('App Launch Success', ret)
},
(ret) => {
console. log('App Launch Fail', ret)
});2. Ciclo de vida do applet
JavaScript
MopSdk.setAppletLifecycleCallback(
(ret) => {
console. log('onInitComplete', ret)
},
(ret) => {
console. log('onFailure', ret)
},
(ret) => {
console. log('onCreate', ret)
},
(ret) => {
console. log('onStart', ret)
},
(ret) => {
console. log('onResume', ret)
},
(ret) => {
console. log('onPause', ret)
},
(ret) => {
console. log('onStop', ret)
},
(ret) => {
console. log('onDestroy', ret)
})3. Ouvindo o evento de applet do canto superior direito
JavaScript
MopSdk.setNavigationBarCloseButtonClicked((appId) => {
console.log('setNavigationBarCloseButtonClicked',appId)
})4. Obtenha as informações do Applet Applet Applet
JavaScript
const appId = MopSdk.currentAppletId();5. Obtenha informações sobre o applet atual
JavaScript
const appletInfo = MopSdk.currentApplet();6. Abra o applet
JavaScript
const apiServer = 'https://api.PhizClip.com'
const appId = '5eec56a41464cc0001852e9a'
const startParams = null
// const startParams = {
// path: '/pages/index/index',
// query: 'a=1&b=2'
// }
const sequence = null // The serial number of the applet on the
shelf
MopSdk.openApplet(apiServer,
appId,
startParams,
sequence)7. Código QR para abrir o applet
JavaScript
MopSdk.openAppletByQrcode(qrcode,
(ret) => {
console. log('onSuccess',ret)
},
(ret) => {
console. log('onFail',ret)
},
(ret) => {
console.log('onProcess',ret)
})8. Pesquise applet
JavaScript
MopSdk.seachApplets({
apiServer: '',
text: ''
},
(ret) = > {
console.log('onSuccess',ret)
},
(ret) = > {
console.log('onFail',ret)
},
(ret) = > {
console.log('onProcess',ret)
})9. Feche os eventos do applet, mantenha na memória
JavaScript
MopSdk.closeApplet(appId);10. Feche todos os eventos de applet e mantenha o
JavaScript
MopSdk.closeApplets();11. Evento de applet final, remova da memória
JavaScript
MopSdk.finishRunningApplet(appId);12. Termine todos os eventos de applet, remova da memória
JavaScript
MopSdk.finishRunningApplets();13. Limpe todas as informações do cache do applet
JavaScript
MopSdk.clearApplets();