Karsa 11 månader sedan
förälder
incheckning
a5c30040ef

+ 1 - 0
package.json

@@ -25,6 +25,7 @@
     "@vitejs/plugin-vue": "^1.9.3",
     "sass": "^1.44.0",
     "vite": "^2.6.4",
+    "vite-plugin-compression": "^0.5.1",
     "vite-plugin-style-import": "^1.4.0"
   }
 }

+ 4 - 0
src/main.js

@@ -9,12 +9,16 @@ import '@vant/touch-emulator';//vant
 import 'vant/lib/index.css';
 import '@/utils/rem.js';
 
+import {injectSdk} from '@/views/utils/wxShare.js';
+
 import VConsole from 'vconsole'
 console.log(import.meta.env.MODE)
 if(import.meta.env.MODE!=='production') {
   new VConsole()
 }
 
+injectSdk()
+
 const app=createApp(App)
 app.use(router).use(store).mount('#app')
 

+ 2 - 2
src/views/report/reportDetail.vue

@@ -196,9 +196,9 @@ export default {
     });
   },
   mounted() {
-    injectSdk().then(res => {
+    // injectSdk().then(res => {
       this.getShareData()
-    })
+    // })
     window.addEventListener('scroll', this.loadMoreHandle);
   },
 

+ 2 - 2
src/views/reportEn/detail.vue

@@ -139,9 +139,9 @@ export default {
     });
   },
   mounted() {
-    injectSdk().then(res => {
+    // injectSdk().then(res => {
       this.getreportdetail()
-    })
+    // })
     window.addEventListener('scroll', this.loadMoreHandle);
   },
   destroyed() {

+ 2 - 2
src/views/smartReport/detail.vue

@@ -130,9 +130,9 @@ export default {
     });
   },
   mounted() {
-    injectSdk().then(res => {
+    // injectSdk().then(res => {
       this.getShareData()
-    })
+    // })
     window.addEventListener("scroll", this.loadMoreHandle);
     window.addEventListener('resize',this.pageResize)
   },

+ 5 - 1
src/views/utils/wxShare.js

@@ -68,7 +68,7 @@ export function wxShare(shareurl,title,desc,imgurl,hide){
 
         setTimeout(() => {
           wx.showOptionMenu();
-        },1000)
+        },2000)
       });
       
       wx.error(function(res){
@@ -101,6 +101,10 @@ export  function injectSdk() {
         });
 
         resove(res)
+
+        wx.ready(function(){
+          wx.hideOptionMenu();
+        });
       }else {
         console.log(res)
         if(res.Ret!==4003){

+ 5 - 0
vite.config.js

@@ -1,11 +1,16 @@
 import { defineConfig,loadEnv } from 'vite'
 import vue from '@vitejs/plugin-vue'
 import path from "path";
+import viteCompression from 'vite-plugin-compression'
+
 // https://vitejs.dev/config/
 export default ({mode})=>defineConfig({
   base:loadEnv(mode, process.cwd()).VITE_APP_BASE_URL,
   plugins: [
     vue(),
+    viteCompression({
+      threshold: 1024000 // 对大于 1mb 的文件进行压缩
+    })
   ],
   resolve: {
     alias: {