Jelajahi Sumber

feat: 留资表单完善

zhangyuhan 6 bulan lalu
induk
melakukan
1abbaf40c6
3 mengubah file dengan 23 tambahan dan 4 penghapusan
  1. 15 2
      client/plugins/SourceForm/src/index.vue
  2. 2 2
      service/config/index.js
  3. 6 0
      service/core/index.js

+ 15 - 2
client/plugins/SourceForm/src/index.vue

@@ -1,12 +1,12 @@
 <!--test.vue-->
 <template>
-  <div class="source-form-top-container">
+  <div class="source-form-top-container" :key="componentKey">
     <div class="source-form-tip-container" v-if="!canWrite">
       <div class="source-form-content-container">
         <van-empty :description="notCanWriteTip" />
       </div>
     </div>
-    <van-overlay class="show-success-dialog-container" :show="isShowSuccessDialog" @click="successDialogShow = false">
+    <van-overlay class="show-success-dialog-container" :class="{ 'is-not-edit': !isEdit }" :show="isShowSuccessDialog" @click="successDialogShow = false">
       <div @click.stop class="show-success-dialog-content-container">
         <img v-if="useSourceFormConfig.submitSuccessImage" :src="useSourceFormConfig.submitSuccessImage" />
         <van-icon class="icon-close-dialog" name="clear" @click="successDialogShow = false" />
@@ -120,6 +120,7 @@ const DEFAULT_SOURCE_CONFIG = {
     },
     data() {
       return {
+        componentKey: 1,
         successDialogShow: false,
         form: {
           name: '',
@@ -211,6 +212,7 @@ const DEFAULT_SOURCE_CONFIG = {
         return this.isTimeStart && !this.isTimeEnd
       },
       hasCacheWrite () {
+        console.log(this.componentKey, 'update key')
         if (this.isEdit) {
           return true
         }
@@ -223,6 +225,7 @@ const DEFAULT_SOURCE_CONFIG = {
         return result
       },
       isTimeStart () {
+        console.log(this.componentKey, 'update key')
         if (this.sourceFormConfig.submitTime[0]) {
           return Date.now() >= this.sourceFormConfig.submitTime[0]
         } else {
@@ -230,6 +233,7 @@ const DEFAULT_SOURCE_CONFIG = {
         }
       },
       isTimeEnd () {
+        console.log(this.componentKey, 'update key')
         if (this.sourceFormConfig.submitTime[1]) {
           return Date.now() >= this.sourceFormConfig.submitTime[1]
         } else {
@@ -238,6 +242,9 @@ const DEFAULT_SOURCE_CONFIG = {
       },
     },
     methods: {
+      updateComponent () {
+        this.componentKey = Date.now()
+      },
       saveCache () {
         try {
           localStorage.setItem(window._pageData._id, '1')
@@ -247,6 +254,7 @@ const DEFAULT_SOURCE_CONFIG = {
       },
       submitSuccessCallback () {
         this.saveCache()
+        this.updateComponent()
         switch (this.useSourceFormConfig.submitSuccessState) {
           case -1: {
             Toast(this.useSourceFormConfig.submitSuccessTip)
@@ -347,10 +355,15 @@ const DEFAULT_SOURCE_CONFIG = {
   display: flex;
   align-items: center;
   justify-content: center;
+  &.is-not-edit {
+    height: 100vh;
+    width: 100vw;
+  }
 }
 .show-success-dialog-content-container {
   max-width: 80%;
   img {
+    max-width: 100%;
     border-radius: 12px;
   }
 }

+ 2 - 2
service/config/index.js

@@ -1,8 +1,8 @@
 module.exports = {
   port: 3333,
   mongodb: {
-    url: 'mongodb://192.168.3.206:27080/zyh',
-    // url: 'mongodb://172.17.4.251:27080/h5_editor',
+    // url: 'mongodb://192.168.3.206:27080/zyh',
+    url: 'mongodb://172.17.4.251:27080/h5_editor',
     // url: 'mongodb://127.0.0.1:27080/h5_editor',
     options: {}
   },

+ 6 - 0
service/core/index.js

@@ -3,6 +3,7 @@
  */
 const path = require('path')
 const Koa = require('koa');
+// const  proxy = require('koa-proxy');
 const { initConfig, initController, initService, initModel, initRouter, initMiddleware, initExtend, initSchedule } = require('./loader');
 const views = require("koa-views");
 class Application {
@@ -28,6 +29,11 @@ class Application {
     // 初始化定时任务schedule
     initSchedule(this)
 
+    // this.$app.use(proxy({
+    //   host: 'https://jybx2-webtest.jydev.jianyu360.com', // 目标地址
+    //   match: '/salesLeads'
+    // }));
+
     // 将ctx注入到app上
     this.$app.use(async(ctx, next) => {
       this.ctx = ctx;