Sfoglia il codice sorgente

本地缓存

This reverts commit 89cf3e8d39fba8f8facbc11e34b29d6e10ebf456.
y595705120 2 anni fa
parent
commit
0298e1091f
5 ha cambiato i file con 22 aggiunte e 13 eliminazioni
  1. 1 2
      src/App.vue
  2. 12 5
      src/components/form/index.vue
  3. 2 2
      src/components/image.vue
  4. BIN
      src/font/gb2312.ttf
  5. 7 4
      src/tailwind.css

+ 1 - 2
src/App.vue

@@ -28,7 +28,6 @@ export default {
       })
     },
     handlePreview(url){
-      console.log("handlePreview", url)
       const { data } = this.$store.state.pages;
       const { id = 'main' } = this.$route.params;
       const page = data.pages[id];
@@ -61,7 +60,7 @@ export default {
 
 <style lang="less">
 #app {
-  font-family: '楷体','楷体_GB2312';
+  font-family: Avenir, Helvetica, Arial, sans-serif;;
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
   text-align: center;

+ 12 - 5
src/components/form/index.vue

@@ -33,11 +33,18 @@ export default {
     }
   },
   created(){
-    const data = {};
+    let {uuid} = this.$route.params;
+    let param = localStorage.getItem(uuid);
+    let jsonObj = {};
+    if( param ){
+      jsonObj= JSON.parse(param);
+    }
+    var data = {};
     this.options.children.forEach(item => {
-      data[item.field] = undefined;
+      item.value = jsonObj[item.field]||'';
+      data[item.field] = jsonObj[item.field]||undefined;
     });
-    this.formData = data;
+    this.formData = data||{};
   },
   methods: {
     submit(){
@@ -52,12 +59,12 @@ export default {
           message: `请填写${errmsg}`,
         })
       }
-       let {uuid} = this.$route.params;
+      let {uuid} = this.$route.params;
       if(this.loading) return;
       this.loading = true;
       const { formId, formName, formAction} = this.options;
       let param = Object.assign({formId, formName, formAction, uuid}, this.formData );
-
+      localStorage.setItem( uuid, JSON.stringify(param) );
       fetch(formAction || '', param ).then(() => {
         this.loading = false;
         this.success = true;

+ 2 - 2
src/components/image.vue

@@ -1,6 +1,6 @@
 <template>
   <div v-if="!options.text" @click="click" class="image mb-6 last:mb-0 mx-auto">
-    <img :style="options.style" :src="options.image" @click="handleClick" />
+    <img :style="options.style" :src="options.image" />
     <div v-if="options.marks" class="mark flex justify-center items-center">
       <span :style="options.marksStyle" v-html="options.marks"></span>
     </div>
@@ -49,7 +49,7 @@ export default {
     right: 0;
     bottom: 0;
     color: #fff;
-    font-family: '楷体','楷体_GB2312';
+    font-family: 'STXinwei', Times, serif;
     font-size: 20px;
     font-weight: 600;
     letter-spacing: 2px;

BIN
src/font/gb2312.ttf


+ 7 - 4
src/tailwind.css

@@ -42,8 +42,7 @@ html {
   -o-tab-size: 4;
      tab-size: 4;
   /* 3 */
-  font-family: '楷体','楷体_GB2312';
-  /* font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; */
+  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
   /* 4 */
 }
 
@@ -184,8 +183,7 @@ input,
 optgroup,
 select,
 textarea {
-  font-family: '楷体','楷体_GB2312'; 
-  /* font-family: inherit; */
+  font-family: inherit;
   /* 1 */
   font-size: 100%;
   /* 1 */
@@ -688,3 +686,8 @@ Ensure the default browser behavior of the `hidden` attribute.
 .last\:mb-0:last-child {
   margin-bottom: 0px;
 }
+
+@font-face {
+  font-family: "楷体"; /* Project id  */
+  src: url('./font/gb2312.ttf');/* Safari, Android, iOS */
+}