整合api请求、添加购买会员卡页面、登陆页面
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<view class="webview-container">
|
||||
<web-view :src="url" @message="handleMessage"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const url = ref('')
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.url) {
|
||||
url.value = decodeURIComponent(options.url)
|
||||
}
|
||||
})
|
||||
|
||||
function handleMessage(e) {
|
||||
console.log('[webview] 收到消息:', e.detail)
|
||||
// 处理支付回调消息
|
||||
const data = e.detail.data
|
||||
if (data && data.payResult) {
|
||||
if (data.payResult === 'success') {
|
||||
// 支付成功
|
||||
uni.showToast({ title: '支付成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({ title: '支付失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webview-container {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user