| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <template>
- <!-- <web-view src="https://uniapp.dcloud.io/static/web-view.html" @message="onMessage"></web-view> -->
- <!-- <web-view src="https://www.chengxiangjiaoyu.com/indexAli.html" @message="onMessage"></web-view> -->
- <web-view :src="webViewUrl" @message="onMessage"></web-view>
- </template>
- <script>
- export default {
- data() {
- return {
- webViewUrl: ''
- }
- },
- onLoad(options) {
- console.log('接收到参数:', options);
- // 构造web-view的URL,传递code参数
- let url = 'https://www.chengxiangjiaoyu.com/h5/pages/Login/clientIndex';
- if (options.code) {
- // 将code参数拼接到URL中
- url += `?code=${options.code}`;
- console.log('生成的URL:', url);
- }
- this.webViewUrl = url;
- },
- methods: {
- onMessage(e) {
- console.log('e.detail.data[0]', e.detail);
- console.log('e.detail.data111', e.detail.data);
- const captchaVerifyParam = e.detail.data[0];
- // 通过事件通道,触发在业务页面中定义的 'getCaptchaVerifyParam' 事件,并把验证参数发送至业务页面
- const eventChannel = this.getOpenerEventChannel();
- eventChannel && eventChannel.emit('getCaptchaVerifyParam', captchaVerifyParam);
- setTimeout(() => {
- console.log('back');
- // uni.navigateBack();
- }, 300);
- }
- }
- }
- </script>
|