소스 검색

修复bug

tremble 3 년 전
부모
커밋
2914ae4614
4개의 변경된 파일49개의 추가작업 그리고 18개의 파일을 삭제
  1. 27 10
      src/app.vue
  2. 4 4
      src/components/Controls/Panel/Main.vue
  3. 13 2
      src/components/Tags/goods-list.vue
  4. 5 2
      src/components/openVideo/index.vue

+ 27 - 10
src/app.vue

@@ -59,6 +59,7 @@ import { ref, onMounted, computed, watch } from "vue";
 import { useStore } from "vuex";
 import browser from "@/utils/browser";
 import { useApp, getApp } from "@/app";
+import common from "@/utils/common";
 
 const musicPlayer = useMusicPlayer();
 
@@ -179,12 +180,11 @@ const onClickTagInfo = (el) => {
 };
 
 onMounted(async () => {
- 
   app = createApp({
     num: browser.getURLParam("m"),
     dom: scene$.value,
     mobile: true,
-    isLoadTags:false
+    isLoadTags: false,
   });
   app.use("MinMap", { theme: { camera_fillStyle: "#ED5D18" } });
   app.use("Tag");
@@ -192,8 +192,8 @@ onMounted(async () => {
     .use("TagView", {
       render(data) {
         if (data.type == "waterfall") {
-          let arr = data.products.map(item=>item.price)
-          let range = `${data.products[0].symbol} ${Math.min.apply(null,arr)} - ${Math.max.apply(null,arr)}`
+          let arr = data.products.map((item) => item.price);
+          let range = `${data.products[0].symbol} ${Math.min.apply(null, arr)} - ${Math.max.apply(null, arr)}`;
           return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
                       <div class="tag-body">
                         <div data-id="${data.sid}" class="tag-commodity">
@@ -207,12 +207,17 @@ onMounted(async () => {
         } else if (data.type == "coupon") {
           return `<span class="tag-icon coupon animate" style="background-image:url({{icon}})"></span>`;
         } else if (data.type == "applet_link") {
-          return `<span class="tag-icon applet_link" style="background-image:url({{icon}})"></span>`;
+          try {
+            data.hotContent = JSON.parse(data.hotContent);
+          } catch (error) {}
+          return `<span class="tag-icon applet_link animate" style="background-image:url(${
+            data.hotContent.liveIcon.src ? common.changeUrl(data.hotContent.liveIcon.src) : "{{icon}}"
+          })"></span>`;
         } else if (data.type == "link_scene") {
-          return `<span class="tag-icon animate" style="background-image:url(${data.hotContent.liveIcon.src||'{{icon}}'})"></span>`;
+          return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>`;
         } else if (data.type == "commodity") {
-          let arr = data.products.map(item=>item.price)
-          let range = `${data.products[0].symbol} ${Math.min.apply(null,arr)}-${Math.max.apply(null,arr)}`
+          let arr = data.products.map((item) => item.price);
+          let range = `${data.products[0].symbol} ${Math.min.apply(null, arr)}-${Math.max.apply(null, arr)}`;
           return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
                       <div class="tag-body">
                         <div data-id="${data.sid}" class="tag-commodity">
@@ -239,7 +244,19 @@ onMounted(async () => {
               data: tag,
             });
           } else if (tag.type == "applet_link") {
-            // wx.miniProgram.navigateTo({url: `/pages/shared/shared?img_url=${encodeURIComponent(uploadRes.data.url)}&companyId=${this.serve.info.companyId}&shareImg=${encodeURIComponent(this.serve.info.shareWxQrCode)}&vrLink=${encodeURIComponent(`${window.location.origin}${location.pathname}?m=${this.$config.projectNum}`)}`})
+            if (browser.detectWeixin()) {
+              //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
+              wx.miniProgram.getEnv((res) => {
+                if (res.miniprogram) {
+                  //在小程序里
+                  wx.miniProgram.navigateTo({
+                    url: tag.hotContent.liveLink,
+                  });
+                } else {
+                  // 不在小程序里
+                }
+              });
+            }
           } else if (tag.type == "link_scene") {
             let sceneFirstView = tag.hotContent.sceneFirstView;
             window.location.href = "".concat(window.location.pathname, "?").concat(`m=${sceneFirstView.num}&novideo=1&${sceneFirstView.sceneview}`);
@@ -273,7 +290,7 @@ onMounted(async () => {
   app.Scene.on("loaded", (pano) => {
     refMiniMap.value = "[xui_min_map]";
     store.commit("setFloorId", pano.floorIndex);
-    app.resource.tags( `${process.env.VUE_APP_RESOURCE_URL}cdf/hot/${browser.getURLParam("m")}/hot.json?rnd=${Math.random()}`)
+    app.resource.tags(`${process.env.VUE_APP_RESOURCE_URL}cdf/hot/${browser.getURLParam("m")}/hot.json?rnd=${Math.random()}`);
     useMusicPlayer();
   });
   app.Scene.on("panorama.videorenderer.resumerender", () => {

+ 4 - 4
src/components/Controls/Panel/Main.vue

@@ -113,10 +113,10 @@ const menulist = ref([
     icon: "customer_service",
     name: "客服",
   },
-  {
-    icon: "guided_shopping",
-    name: "导购",
-  },
+  // {
+  //   icon: "guided_shopping",
+  //   name: "导购",
+  // },
   {
     icon: "shopping",
     name: "购物",

+ 13 - 2
src/components/Tags/goods-list.vue

@@ -71,6 +71,7 @@ import { useApp, getApp } from "@/app";
 import { useStore } from "vuex";
 import * as apis from "@/apis/index.js";
 import { Loading } from "@/global_components/";
+import browser from "@/utils/browser";
 
 // get_product_info
 const store = useStore();
@@ -82,7 +83,17 @@ const emit = defineEmits(["close"]);
 const current = ref(0);
 
 const viewDetail = (item) => {
-  // wx.miniProgram.navigateTo({url: `/pages/shared/shared?img_url=${encodeURIComponent(uploadRes.data.url)}&companyId=${this.serve.info.companyId}&shareImg=${encodeURIComponent(this.serve.info.shareWxQrCode)}&vrLink=${encodeURIComponent(`${window.location.origin}${location.pathname}?m=${this.$config.projectNum}`)}`})
+  if (browser.detectWeixin()) {
+              //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
+              wx.miniProgram.getEnv((res) => {
+                if (res.miniprogram) {
+                  //在小程序里
+                  wx.miniProgram.navigateTo({url: `/pages/item/item?productId=${item.id}`})
+                } else {
+                  // 不在小程序里
+                }
+              });
+            }
 };
 
 const onClickSku = (item) => {
@@ -103,7 +114,7 @@ const addCart = async (item) => {
   Loading.show();
 
   await apis.inCat({
-    accessToken: "",
+    accessToken: browser.getURLParam("AccessToken"),
     skuId: item.currentSku.id,
     num: item.cartnum,
   });

+ 5 - 2
src/components/openVideo/index.vue

@@ -1,7 +1,7 @@
 <template>
     <transition appear name="custom-classes-transition" leave-active-class="animated fadeOut faster">
         <div class="open-video">
-            <video ref="openvideo$" controls autoplay :src="videourl"></video>
+            <video x5-playsinline="true" playsinline="true" webkit-playsinline="true"  ref="openvideo$" preload autoplay :src="videourl"></video>
             <div @click.stop="emit('close')" class="jump">跳過</div>
         </div>
     </transition>
@@ -24,7 +24,10 @@ onMounted(()=>{
         openvideo$.value.addEventListener('ended',()=>{
             emit('close')
         })
-
+        
+        document.addEventListener("WeixinJSBridgeReady",()=> { 
+            openvideo$.value.play(); 
+        }, false);
     })
 })