浏览代码

fix: 修复bug

huangziyang 2 天之前
父节点
当前提交
8f15728d99

+ 0 - 0
.env.release → .env.test


+ 3 - 0
.gitignore

@@ -15,6 +15,9 @@ coverage
 *.local
 
 form
+form.zip
+
+.gitignore
 
 /cypress/videos/
 /cypress/screenshots/

二进制
form.zip


+ 8 - 8
form/index.html

@@ -1,9 +1,9 @@
 <!DOCTYPE html><html lang=""><head>
     <meta charset="UTF-8">
-    <link rel="icon" href="/favicon.ico">
+    <link rel="icon" href="/saas/form/favicon.ico">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>Vite App</title>
-    <script crossorigin="">import('/static/index.Dmzf96Bk.js').finally(() => {
+    <script crossorigin="">import('/saas/form/static/index.IlBjmAfx.js').finally(() => {
             
     const qiankunLifeCycle = window.moudleQiankunAppLifeCycles && window.moudleQiankunAppLifeCycles['curstom-form'];
     if (qiankunLifeCycle) {
@@ -14,12 +14,12 @@
     }
   
           })</script>
-    <link rel="modulepreload" crossorigin="" href="/static/.pnpm.CRLYFuod.js">
-    <link rel="modulepreload" crossorigin="" href="/static/lodash-es.C-xrcuFl.js">
-    <link rel="modulepreload" crossorigin="" href="/static/element-plus.Dozcb0Co.js">
-    <link rel="modulepreload" crossorigin="" href="/static/@form-create/designer.BQ8hZRqe.js">
-    <link rel="stylesheet" crossorigin="" href="/static/element-plus.D92rDM1h.css">
-    <link rel="stylesheet" crossorigin="" href="/static/index.nPkbAqeq.css">
+    <link rel="modulepreload" crossorigin="" href="/saas/form/static/.pnpm.CRLYFuod.js">
+    <link rel="modulepreload" crossorigin="" href="/saas/form/static/lodash-es.C-xrcuFl.js">
+    <link rel="modulepreload" crossorigin="" href="/saas/form/static/element-plus.Dozcb0Co.js">
+    <link rel="modulepreload" crossorigin="" href="/saas/form/static/@form-create/designer.BQ8hZRqe.js">
+    <link rel="stylesheet" crossorigin="" href="/saas/form/static/element-plus.D92rDM1h.css">
+    <link rel="stylesheet" crossorigin="" href="/saas/form/static/index.nPkbAqeq.css">
   </head>
   <body>
     <div id="app"></div>

+ 1 - 1
scripts/build.js

@@ -28,7 +28,7 @@ process.env.npm_lifecycle_script
   })
 
 const buildPlatform = async () => {
-  await execa('vite', ['build', '--mode', map.mode])
+  await execa('vite', ['build', '--mode', map.mode], { stdio: 'inherit' })
 }
 
 ;(async () => {

+ 4 - 0
src/App.vue

@@ -15,6 +15,7 @@ import { MenuOptions } from './plugins/menu/options.ts'
 import type { FcDesignerInstance } from '@form-create/designer' // 注册组件
 import type { Options, Rule } from '@form-create/element-ui'
 import type { Option } from './components/rc-options/createOptions.ts'
+import formCreate from '@form-create/element-ui'
 
 /**
  * @see https://view.form-create.com/methods
@@ -65,6 +66,8 @@ onMounted(async () => {
   designer.value?.addComponent(RcSelect)
   designer.value?.addComponent(RcRadio)
   designer.value?.addComponent(RcCheckbox)
+  console.log(designer.value)
+
   const des = designer.value
   window.__QIANKUN__EVENT__.on('formCoverChange', (cover: string) => {
     const newRule = des?.getRule() as Rule[]
@@ -104,6 +107,7 @@ onMounted(async () => {
 <template>
   <fc-designer
     ref="designer"
+    name="form"
     :height="height"
     :handle="handle"
     :config="config"

+ 2 - 6
src/components/H5-form/H5-form.vue

@@ -21,6 +21,7 @@ onMounted(async () => {
     method: 'post',
     data: {
       id,
+      access_token_openwork: localStorage.getItem('access_token_openwork'),
     },
   })
   res.data.form_field = res.data.form_field.map((item) => {
@@ -80,12 +81,7 @@ onMounted(async () => {
         </el-form-item>
       </el-form>
       <el-form-item>
-        <el-button
-          type="primary"
-          style="width: 100%"
-          :loading="loading"
-          >提交</el-button
-        >
+        <el-button type="primary" style="width: 100%" :loading="loading">提交</el-button>
       </el-form-item>
     </div>
   </el-scrollbar>

+ 1 - 1
src/components/rc-checkbox/rc-checkbox.vue

@@ -20,7 +20,7 @@ onMounted(() => {
 </script>
 <template>
   <RcCreateOption :formCreateInject="formCreateInject" v-slot="{ options }">
-    <el-checkbox-group v-model="checkList">
+    <el-checkbox-group v-model="checkList" v-bind="$attrs">
       <el-checkbox
         v-for="item in options"
         size="large"

+ 1 - 1
src/components/rc-radio/rc-radio.vue

@@ -20,7 +20,7 @@ onMounted(() => {
 </script>
 <template>
   <RcCreateOption :formCreateInject="formCreateInject" v-slot="{ options }">
-    <el-radio-group v-model="radioValue">
+    <el-radio-group v-model="radioValue" v-bind="$attrs">
       <el-radio v-for="item in options" size="large" :key="item.key" :value="item.label">{{
         item.label
       }}</el-radio>

+ 15 - 18
src/form.config.ts

@@ -96,8 +96,8 @@ export const formConfig: Config = {
           {
             type: 'input',
             field: 'defaultValue',
-            label: '默认值',
-            title: '默认值',
+            label: '提示词',
+            title: '提示词',
             on: {
               change: (val: string) => {
                 rule.value = val
@@ -107,22 +107,20 @@ export const formConfig: Config = {
         ]
       },
     },
-    input: {
-      append: true,
-      rule(rule) {
-        return [
-          {
-            type: 'rc-switch',
-            field: 'synchronize_field',
-            label: '高级功能',
-            title: '高级功能',
-            props: {
-              rule,
-            },
+    input: (rule) => {
+      return [
+        {
+          type: 'rc-switch',
+          field: 'synchronize_field',
+          label: '高级功能',
+          title: '高级功能',
+          props: {
+            rule,
           },
-        ]
-      },
+        },
+      ]
     },
+
     textarea: {
       append: true,
       rule(rule) {
@@ -189,8 +187,6 @@ const formatOptions = (result: any) => {
     options: result.original.options,
     form_content: result.rule
       .map((item: any) => {
-        console.log(item)
-
         const formContentValue = {
           field_name: item.title, // 字段名称
           field_type: item.type.startsWith('rc-') ? item.type.substring(3) : item.type, // rc- 前缀
@@ -202,6 +198,7 @@ const formatOptions = (result: any) => {
             tags: op.tags.map((i: any) => i.tag_id),
           })),
           synchronize_field: item.synchronize_field,
+          submit_count: 0,
         }
 
         if (item.props?.type === 'textarea') {

+ 0 - 1
src/main.ts

@@ -59,7 +59,6 @@ const initQianKun = () => {
     },
   })
 }
-
 // 判断当前应用是否在主应用中
 if (qiankunWindow.__POWERED_BY_QIANKUN__) {
   // 生命周期钩子 - bootstrap

+ 1 - 0
src/plugins/components/rc-checkbox.config.ts

@@ -17,6 +17,7 @@ export const RcCheckbox: DragRule = {
       title: '多选框',
       props: {
         clearable: true,
+        value: [1],
       },
     }
   },

+ 1 - 0
src/plugins/components/rc-radio.config.ts

@@ -17,6 +17,7 @@ export const RcRadio: DragRule = {
       title: '单选框',
       props: {
         clearable: true,
+        value: '1',
       },
     }
   },

+ 2 - 1
vite.config.ts

@@ -8,8 +8,9 @@ import qiankun from 'vite-plugin-qiankun'
 // https://vite.dev/config/
 export default defineConfig(({ mode }) => {
   const chunkName = ['lodash-es', 'element-plus', '@form-create/designer']
+
   // 根据环境变量设置 base
-  const base = mode === 'release' ? '/saas/form/' : '/'
+  const base = mode === 'test' ? '/saas/form/' : '/'
   return {
     plugins: [
       vue(),