tremble 3 gadi atpakaļ
vecāks
revīzija
94eedaf246
4 mainītis faili ar 37 papildinājumiem un 18 dzēšanām
  1. 1 0
      src/app.vue
  2. 3 3
      src/components/Tags/goods-list.vue
  3. 12 9
      src/main.js
  4. 21 6
      src/utils/browser.js

+ 1 - 0
src/app.vue

@@ -416,6 +416,7 @@ onMounted(async () => {
   document.removeEventListener("visibilitychange", visibilitychangeFn);
   document.addEventListener("visibilitychange", visibilitychangeFn);
 
+
   if (browser.detectWeixin()) {
     //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
     wx.miniProgram.getEnv((res) => {

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

@@ -111,10 +111,11 @@ const addCart = async (item) => {
     accessToken: browser.getURLParam("AccessToken"),
     skuId: item.currentSku.id,
     num: item.cartnum,
+    rnd:Math.random()
   });
 
   Loading.hide();
-  if (result.data.status == 200) {
+  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()}`;
@@ -124,7 +125,6 @@ const addCart = async (item) => {
     } else {
       callbackUrl = browser.replaceQueryString(callbackUrl, "tagid", tagclick.value.data.sid);
     }
-
     console.log(callbackUrl);
     //  Dialog.toast({ content: `登录状态失效,请重新登录`, type: 'error' })
     browser.openLink(
@@ -132,7 +132,6 @@ const addCart = async (item) => {
       `https://m.cdfmembers.com/shop/600667208/h5login?redirectUrl=${encodeURIComponent(callbackUrl)}`,
       `/pages/login/login?callbackHttpUrl=${encodeURIComponent(callbackUrl)}`
     );
-    return;
   }
 };
 
@@ -275,6 +274,7 @@ onMounted(() => {
             font-size: 16px;
             width: 100%;
             line-height: 1.5;
+            word-break: break-all;
           }
           > div {
             color: var(--editor-main-color);

+ 12 - 9
src/main.js

@@ -4,15 +4,18 @@ import Components from "./global_components";
 import { createApp } from "vue";
 import store from "./store";
 import App from "./app.vue";
+import browser from "@/utils/browser";
 
 if (!window.location.search) {
-  window.location.href = '/index.html?m=eur-KJ-z5ZEV22AeU&pose=pano:408,qua:-0.006,0.6299,0.0049,0.7766'
-}
-
+  window.location.href = "/index.html?m=eur-KJ-z5ZEV22AeU&pose=pano:408,qua:-0.006,0.6299,0.0049,0.7766";
+} else if (!browser.hasURLParam("pose") && browser.getURLParam("m") == "eur-KJ-z5ZEV22AeU") {
+  let url = window.location.href + `&pose=pano:408,qua:-0.006,0.6299,0.0049,0.7766`;
+  window.location.href = url;
+} else {
+  const app = createApp(App);
 
-const app = createApp(App);
-// set i18n language
-app.use(store);
-app.use(Components);
-app.directive("click-outside", ClickOutSide);
-app.mount("#app");
+  app.use(store);
+  app.use(Components);
+  app.directive("click-outside", ClickOutSide);
+  app.mount("#app");
+}

+ 21 - 6
src/utils/browser.js

@@ -353,11 +353,18 @@ var browser = {
     return "";
   },
 
-  replaceQueryString (url, name, value) {
-    const re = new RegExp(name + '=[^&]*', 'gi')
-    return url.replace(re, name + '=' + value)
+  replaceQueryString(url, name, value) {
+    const re = new RegExp(name + "=[^&]*", "gi");
+    return url.replace(re, name + "=" + value);
   },
   openLink(mglink, h5link, appLink) {
+    if (this.getURLParam("isBuyerApp") === "1") {
+      if (appLink) {
+        wx.miniProgram.navigateTo({
+          url: appLink,
+        });
+      }
+    }
     if (this.detectWeixin()) {
       //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
       wx.miniProgram.getEnv((res) => {
@@ -370,12 +377,16 @@ var browser = {
           }
         } else {
           if (h5link) {
-            window.open(h5link,'_blank')
+            if (this.detectIOS()) {
+              window.location.href = h5link;
+            } else {
+              window.open(h5link, "_blank");
+            }
           }
           // 不在小程序里
         }
       });
-    } else if(this.detectApp()){
+    } else if (this.getURLParam("isMiniApp") === "1") {
       if (appLink) {
         wx.miniProgram.navigateTo({
           url: appLink,
@@ -383,7 +394,11 @@ var browser = {
       }
     } else {
       if (h5link) {
-        window.open(h5link, '_blank')
+        if (this.detectIOS()) {
+          window.location.href = h5link;
+        } else {
+          window.open(h5link, "_blank");
+        }
       }
     }
   },