hookehuyr

feat: 添加网页视图页面并集成到首页

新增 webview 页面用于显示外部网页内容,支持通过页面参数传递 URL。在首页中将“计划书”按钮的跳转逻辑修改为打开 webview 页面并传递特定 URL,以替代原有的内部页面跳转。这允许应用内直接加载外部网页内容,提升功能灵活性。
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
8 const pages = [ 8 const pages = [
9 'pages/index/index', 9 'pages/index/index',
10 'pages/search/index', 10 'pages/search/index',
11 + 'pages/webview/index',
11 'pages/auth/index', 12 'pages/auth/index',
12 'pages/onboarding/index', 13 'pages/onboarding/index',
13 'pages/family-office/index', 14 'pages/family-office/index',
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
74 <nut-button 74 <nut-button
75 color="#2563EB" 75 color="#2563EB"
76 class="flex-1 !h-[64rpx] !rounded-[16rpx] !text-[26rpx] !m-0" 76 class="flex-1 !h-[64rpx] !rounded-[16rpx] !text-[26rpx] !m-0"
77 - @tap="go('/pages/plan/index')" 77 + @tap="openWebView('https://https://oa-dev.onwall.cn/f/custom_form/front/#/')"
78 > 78 >
79 计划书 79 计划书
80 </nut-button> 80 </nut-button>
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
107 <nut-button 107 <nut-button
108 color="#2563EB" 108 color="#2563EB"
109 class="flex-1 !h-[64rpx] !rounded-[16rpx] !text-[26rpx] !m-0" 109 class="flex-1 !h-[64rpx] !rounded-[16rpx] !text-[26rpx] !m-0"
110 - @tap="go('/pages/plan/index')" 110 + @tap="openWebView('https://https://oa-dev.onwall.cn/f/custom_form/front/#/')"
111 > 111 >
112 计划书 112 计划书
113 </nut-button> 113 </nut-button>
...@@ -208,6 +208,13 @@ const handleGridNav = (item) => { ...@@ -208,6 +208,13 @@ const handleGridNav = (item) => {
208 go(item.route); 208 go(item.route);
209 }; 209 };
210 210
211 +// Open webview with URL
212 +const openWebView = (url) => {
213 + go('/pages/webview/index', {
214 + url: encodeURIComponent(url)
215 + });
216 +};
217 +
211 useShareAppMessage(() => { 218 useShareAppMessage(() => {
212 return { 219 return {
213 title: '臻奇智荟圈', 220 title: '臻奇智荟圈',
......
1 +export default {
2 + navigationBarTitleText: '网页',
3 + enablePullDownRefresh: false,
4 + disableScroll: true,
5 + // 小程序中需要配置以下属性
6 + navigationStyle: 'custom' // 使用自定义导航栏,配合 NavHeader 组件
7 +}
1 +<template>
2 + <view class="webview-container">
3 + <!-- Navigation Header -->
4 + <NavHeader title="计划书" />
5 +
6 + <!-- WebView Content -->
7 + <web-view :src="url" class="webview-content" />
8 + </view>
9 +</template>
10 +
11 +<script setup>
12 +import { ref } from 'vue'
13 +import { useLoad } from '@tarojs/taro'
14 +import NavHeader from '@/components/NavHeader.vue'
15 +
16 +/**
17 + * WebView Page
18 + * @description 用于显示外部网页内容的页面
19 + */
20 +
21 +const url = ref('')
22 +
23 +useLoad((options) => {
24 + // 从页面参数中获取 URL,如果没有则使用默认值
25 + url.value = decodeURIComponent(options.url || 'https://www.google.com')
26 + console.log('WebView URL:', url.value)
27 +})
28 +</script>
29 +
30 +<script>
31 +export default {
32 + name: 'WebViewIndex'
33 +}
34 +</script>
35 +
36 +<style lang="less" scoped>
37 +.webview-container {
38 + width: 100%;
39 + height: 100vh;
40 + display: flex;
41 + flex-direction: column;
42 +}
43 +
44 +.webview-content {
45 + flex: 1;
46 + width: 100%;
47 +}
48 +</style>