소스 검색

feat(mobile-h5): add OA form-sink web-view entry and test menu

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu 2 달 전
부모
커밋
1b02c29114
5개의 변경된 파일과 69개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 0
      mobile-h5/pages.json
  2. 9 1
      mobile-h5/pages/index/index.vue
  3. 21 0
      mobile-h5/pages/oa/form-sink/index.vue
  4. 7 0
      mobile-h5/utils/config.js
  5. 24 0
      mobile-h5/utils/oa-h5.js

+ 8 - 0
mobile-h5/pages.json

@@ -32,6 +32,14 @@
         "navigationBarTitleText": "工作台"
       }
     },
+    {
+      "path": "pages/oa/form-sink/index",
+      "style": {
+        "navigationBarTitleText": "表单水槽测试",
+        "navigationBarBackgroundColor": "#0a9f6d",
+        "navigationBarTextStyle": "white"
+      }
+    },
     {
       "path": "pages/demo/list",
       "style": {

+ 9 - 1
mobile-h5/pages/index/index.vue

@@ -95,7 +95,15 @@
         userName: '',
         postName: '',
         deptName: '',
-        menus: [],
+        menus: [
+          {
+            id: 'oa-form-sink',
+            title: '表单水槽测试',
+            icon: 'orders-o',
+            path: '/pages/oa/form-sink/index',
+            tone: ''
+          }
+        ],
         banners: [
           {
             id: 'banner-video-1',

+ 21 - 0
mobile-h5/pages/oa/form-sink/index.vue

@@ -0,0 +1,21 @@
+<template>
+  <web-view v-if="src" :src="src" @message="onMessage" />
+</template>
+
+<script>
+  import { buildFormSinkUrl } from '../../../utils/oa-h5.js'
+
+  export default {
+    data() {
+      return { src: '' }
+    },
+    onLoad() {
+      this.src = buildFormSinkUrl()
+    },
+    methods: {
+      onMessage(e) {
+        console.log('oa-h5 message', e && e.detail)
+      }
+    }
+  }
+</script>

+ 7 - 0
mobile-h5/utils/config.js

@@ -8,3 +8,10 @@
 export const API_BASE_URL = 'http://127.0.0.1:8000/api'
 
 export const REQUEST_TIMEOUT_MS = 15000
+
+/**
+ * OA 表单 H5 源(web-view)。
+ * 本地:电脑局域网 IP + Vite 端口,须与手机同网;真机/体验版改为已配置业务域名。
+ * 例:http://192.168.1.8:5178/oa-h5/
+ */
+export const OA_H5_ORIGIN = 'http://127.0.0.1:5178/oa-h5'

+ 24 - 0
mobile-h5/utils/oa-h5.js

@@ -0,0 +1,24 @@
+import { OA_H5_ORIGIN } from './config.js'
+import { getToken } from './auth.js'
+
+function trimSlash(s) {
+  return String(s || '').replace(/\/$/, '')
+}
+
+/** 水槽页 URL */
+export function buildFormSinkUrl() {
+  const base = trimSlash(OA_H5_ORIGIN)
+  const token = encodeURIComponent(getToken() || '')
+  return `${base}/oa-form-sink?token=${token}`
+}
+
+/** 正式发起页 URL(阶段二) */
+export function buildOaStartUrl({ appId, draftId }) {
+  const base = trimSlash(OA_H5_ORIGIN)
+  const q = new URLSearchParams()
+  if (appId) q.set('appId', appId)
+  if (draftId) q.set('draftId', draftId)
+  const token = getToken()
+  if (token) q.set('token', token)
+  return `${base}/oa-start?${q.toString()}`
+}