phizclip-uniapp-demo/finclip-uniapp-test/pages/index/index.vue

92 lines
1.9 KiB
Vue

<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<button type="primary" v-on:click="handleOpenMiniProgram">打开小程序</button>
<view class="padding-gap"></view>
<button type="primary" v-on:click="handleOpenMiniProgramByQrcode">二维码打开小程序</button>
</view>
</template>
<script>
const MopSdk = uni.requireNativePlugin('MopSdk');
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
handleOpenMiniProgram() {
const apiServer = 'https://api.finclip.com'
const appId = '62566cbd3eb8ce0001b7761c'
const startParams = null
// const startParams = {
// path: '/pages/index/index',
// query: 'a=1&b=2'
// }
const sequence = null // 小程序的上架序列号
const isSingleton = false
MopSdk.openApplet({apiServer,
appId,
startParams,
sequence,
isSingleton})
},
handleOpenMiniProgramByQrcode() {
uni.scanCode({
success: (result) => {
console.log(result)
const qrCode = result.result
const isSingleton = false
MopSdk.openAppletByQrcode({qrCode,isSingleton},
(ret) => {
console.log('onSuccess',ret)
},
(ret) => {
console.log('onFail',ret)
},
(ret) => {
console.log('onProcess',ret)
})
}
})
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.padding-gap {
height: 30rpx;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>