Переглянути джерело

update视频打开缓冲时间

tremble 3 роки тому
батько
коміт
ff18877e5b

+ 15 - 13
src/app.vue

@@ -62,15 +62,13 @@ import { useStore } from "vuex";
 import browser from "@/utils/browser";
 import { useApp, getApp } from "@/app";
 import common from "@/utils/common";
+import { Cache } from "@/utils/index";
+
 import * as apis from "@/apis/index.js";
 
 let jumpNewScene = (sceneFirstView) => {
   let url = window.location.href;
 
-  if (!browser.hasURLParam("novideo")) {
-    url = `${window.location.href}&novideo=1`;
-  }
-
   if (!browser.hasURLParam("pose")) {
     url += `&${sceneFirstView.sceneview}`;
   } else {
@@ -121,14 +119,19 @@ const showNavigations = computed(() => store.getters["showNavigations"]);
 const scene$ = ref(null);
 const hadVideo = ref(true);
 
-// !!browser.getURLParam("novideo")
-// m=eur-KJ-z5ZEV22AeU&pose=pano:408,qua:-0.006,0.6299,0.0049,0.7766
-if(browser.getURLParam("m")=='eur-KJ-z5ZEV22AeU'&&browser.getURLParam("pose")=='pano:408,qua:-0.006,0.6299,0.0049,0.7766'){
-  hadVideo.value = false
-}
-else{
-  hadVideo.value = true
+
+
+console.log(Cache.get('HIDENVIDEOEXPIRES'),5555555);
+
+if (!Cache.get('HIDENVIDEOEXPIRES')) {
+  if (browser.getURLParam("m") == "eur-KJ-z5ZEV22AeU" && browser.getURLParam("pose") == "pano:408,qua:-0.006,0.6299,0.0049,0.7766") {
+    Cache.set('HIDENVIDEOEXPIRES','yes',60*8*60)
+    hadVideo.value = false;
+  } else {
+    hadVideo.value = true;
+  }
 }
+
 const show = ref(false);
 const dataLoaded = ref(false);
 const refMiniMap = ref(null);
@@ -241,7 +244,7 @@ onMounted(async () => {
     scene: {
       markerOpacity: 1,
       markerURL: "https://eurs3.4dkankan.com/cdf/file/43aa29799bfd472298a47cc6370b10cc.png",
-      pathEndColor:'#FF4641'
+      pathEndColor: "#FF4641",
     },
   });
   app.use("MinMap", { theme: { camera_fillStyle: "#ED5D18" } });
@@ -429,7 +432,6 @@ onMounted(async () => {
   document.removeEventListener("visibilitychange", visibilitychangeFn);
   document.addEventListener("visibilitychange", visibilitychangeFn);
 
-
   if (browser.detectWeixin()) {
     //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
     wx.miniProgram.getEnv((res) => {

+ 0 - 3
src/components/Controls/Panel/Main.vue

@@ -272,9 +272,6 @@ const onClickCategory = (item) => {
 
 const onClickShop = (item) => {
   let url = window.location.href;
-  if (!browser.hasURLParam("novideo")) {
-    url += `&novideo=1`;
-  }
 
   if (!browser.hasURLParam("pose")) {
     url += `&${item.inPosition}`;

+ 1 - 1
src/components/Tags/goods-list.vue

@@ -121,7 +121,7 @@ const addCart = async (item) => {
   if (result.code === 0) {
     return Dialog.toast({ content: `添加成功`, type: "success" });
   } else {
-    let callbackUrl = `${window.location.origin}${window.location.pathname}?m=${browser.getURLParam("m")}&novideo=1&${getApp().Camera.getPoseUrlParams()}`;
+    let callbackUrl = `${window.location.origin}${window.location.pathname}?m=${browser.getURLParam("m")}&${getApp().Camera.getPoseUrlParams()}`;
 
     if (!browser.hasURLParam("tagid")) {
       callbackUrl += `&tagid=${tagclick.value.data.sid}`;

+ 62 - 0
src/utils/index.js

@@ -5,3 +5,65 @@ export const normalizeLink = link => {
         return link
     }
 }
+
+
+/**
+ * 数据缓存
+ */
+ export class Cache {
+
+    /**
+     * 获取缓存
+     * @param key
+     * @return {any}
+     */
+    static get(key) {
+        const result = JSON.parse(localStorage.getItem(key));
+        const date = new Date();
+        if (result && result.expires > date) {
+            return result.data;
+        } else {
+            Cache.remove(key);
+            return null;
+        }
+    }
+
+    /**
+     * 设置缓存
+     * @param {String} key 键名
+     * @param {any} value 缓存数据
+     * @param {Number} expires 过期时间 单位 s
+     */
+    static set(key, value, expires = 3600) {
+        const date = new Date();
+        try {
+            localStorage.setItem(key, JSON.stringify({
+                expires: date.valueOf() + expires * 1000,
+                data: value
+            }));
+        } catch (e) {
+            if (e.name === 'QuotaExceededError') {
+                console.log("数据已满,自动清空");
+                Cache.clear();
+                Cache.set(key, value, expires);
+            }
+        }
+    }
+
+    /**
+     * 删除键
+     * @param key
+     */
+    static remove(key) {
+        localStorage.removeItem(key);
+    }
+
+    /**
+     * 清空
+     */
+    static clear() {
+        localStorage.clear();
+    }
+}
+
+window.Cache = Cache