tremble 3 gadi atpakaļ
vecāks
revīzija
3048fbff2d

+ 18 - 19
src/app.vue

@@ -12,7 +12,7 @@
           <ui-icon type="show_map_collect"></ui-icon>
         </span>
 
-        <p class="change">
+        <p class="change" @click="changeMode('dollhouse', $event, 'focus3d')">
           <ui-icon type="show_3d_normal"></ui-icon>
           3D模型
         </p>
@@ -55,7 +55,7 @@ import LoadingLogo from "@/components/shared/Loading.vue";
 import OpenVideo from "@/components/openVideo/";
 
 import { createApp } from "@/app";
-import { ref, onMounted, computed, watch } from "vue";
+import { ref, onMounted, computed, nextTick, watch } from "vue";
 import { useStore } from "vuex";
 import browser from "@/utils/browser";
 import { useApp, getApp } from "@/app";
@@ -144,12 +144,24 @@ watch(
     deep: true,
   }
 );
-const changeMode = (name, e) => {
+const changeMode = (name, e, focus3d = false) => {
   if (!flying.value) {
-    background.value.style.width = e.srcElement.getBoundingClientRect().width + "px";
-    background.value.style.left = e.srcElement.offsetLeft + "px";
+    let width, left;
+    console.dir(e.srcElement);
     store.commit("setMode", name);
+    nextTick(() => {
+      if (focus3d) {
+        let $active = document.querySelector(".tabs>span:last-of-type");
+        console.log($active.getBoundingClientRect().width);
+        background.value.style.width = $active.getBoundingClientRect().width + "px";
+        background.value.style.left = $active.offsetLeft + "px";
+      } else {
+        background.value.style.width = width || e.srcElement.getBoundingClientRect().width + "px";
+        background.value.style.left = left || e.srcElement.offsetLeft + "px";
+      }
+    });
   }
+  // console.dir(document.querySelector(".tabs>span:last-of-type"));
 };
 const toggleMap = () => {
   isCollapse.value = !isCollapse.value;
@@ -244,20 +256,7 @@ onMounted(async () => {
               data: tag,
             });
           } else if (tag.type == "applet_link") {
-            if (browser.detectWeixin()) {
-              //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
-              wx.miniProgram.getEnv((res) => {
-                if (res.miniprogram) {
-                  //在小程序里
-                  wx.miniProgram.navigateTo({
-                    url: tag.hotContent.liveLink,
-                  });
-                } else {
-                  // 不在小程序里
-                }
-              });
-            } else {
-            }
+            browser.openLink(tag.hotContent.liveLink)
           } 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}`);

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

@@ -84,21 +84,7 @@ const emit = defineEmits(["close"]);
 const current = ref(0);
 
 const viewDetail = (item) => {
-  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 {
-        // 不在小程序里
-        window.location.href = `https://m.cdfmembers.com/shop/600667208/item?productId=${item.id}`
-      }
-    });
-  }
-  else {
-        window.location.href = `https://m.cdfmembers.com/shop/600667208/item?productId=${item.id}`
-  }
+    browser.openLink(`/pages/item/item?productId=${item.id}`,`https://m.cdfmembers.com/shop/600667208/item?productId=${item.id}`)
 };
 
 const onClickSku = (item) => {

+ 1 - 14
src/components/Tags/treasure.vue

@@ -24,20 +24,7 @@ const emit = defineEmits(["close"]);
 
 const goto_now = () => {
   emit("close");
-  if (browser.detectWeixin()) {
-    //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
-    wx.miniProgram.getEnv((res) => {
-      if (res.miniprogram) {
-        //在小程序里
-        wx.miniProgram.navigateTo({
-          url: tag.hotContent.couponLink,
-        });
-      } else {
-        // 不在小程序里
-      }
-    });
-  } else {
-  }
+  browser.openLink(tag.hotContent.couponLink)
 };
 </script>
 

+ 20 - 34
src/components/Tags/waterfall.vue

@@ -3,17 +3,17 @@
     <div class="waterfall" v-if="tagclick.type == 'waterfall'">
       <div class="waterfallcon">
         <div class="wfheader">
-          <img :src="require('@/assets/images/icon/top5.png')" alt="">
+          <img :src="require('@/assets/images/icon/top5.png')" alt="" />
           <ui-icon @click="emit('close')" type="close"></ui-icon>
         </div>
         <ul class="wfcon">
-          <li @click.stop="gotoGoods(item)" v-for="(item,i) in tagclick.data.products" :key="i">
-            <img v-if="i<=2" :src="require(`@/assets/images/icon/${i+1}.svg`)" alt="">
-            <span v-else>{{i+1}}</span>
-            <div class="wfavatar" :style="{backgroundImage:`url(${item.pic})`}"></div>
+          <li @click.stop="gotoGoods(item)" v-for="(item, i) in tagclick.data.products" :key="i">
+            <img v-if="i <= 2" :src="require(`@/assets/images/icon/${i + 1}.svg`)" alt="" />
+            <span v-else>{{ i + 1 }}</span>
+            <div class="wfavatar" :style="{ backgroundImage: `url(${item.pic})` }"></div>
             <div class="wfinfo">
-              <p>{{item.name}}</p>
-              <p>{{item.symbol}} {{item.price}} | 查看 ></p>
+              <p>{{ item.name }}</p>
+              <p>{{ item.symbol }} {{ item.price }} | 查看 ></p>
             </div>
           </li>
         </ul>
@@ -33,24 +33,9 @@ const store = useStore();
 const tagclick = computed(() => store.getters["tag/tagClickType"]);
 
 const emit = defineEmits(["close"]);
-const gotoGoods = (item) =>{
-   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 {
-        // 不在小程序里
-        window.location.href = `https://m.cdfmembers.com/shop/600667208/item?productId=${item.id}`
-      }
-    });
-  }
-  else {
-        window.location.href = `https://m.cdfmembers.com/shop/600667208/item?productId=${item.id}`
-  }
-}
-
+const gotoGoods = (item) => {
+  browser.openLink(`/pages/item/item?productId=${item.id}`, `https://m.cdfmembers.com/shop/600667208/item?productId=${item.id}`);
+};
 </script>
 
 <style lang="scss" scoped>
@@ -78,30 +63,31 @@ const gotoGoods = (item) =>{
     margin-top: 20%;
     background: rgba(0, 0, 0, 0.6);
     border-radius: 2px;
-    .wfheader{
+    .wfheader {
       display: flex;
       justify-content: space-between;
       width: 100%;
       align-items: center;
-      >img{
+      > img {
         width: 80px;
       }
     }
-    .wfcon{
+    .wfcon {
       color: #fff;
       width: 100%;
       padding-left: 10%;
       max-height: 35vh;
       overflow-y: auto;
-      >li{
+      > li {
         display: flex;
         align-items: center;
         margin: 16px 0;
-        >img, >span{
+        > img,
+        > span {
           display: inline-block;
           width: 20px;
         }
-        .wfavatar{
+        .wfavatar {
           width: 36px;
           height: 36px;
           background-size: cover;
@@ -110,11 +96,11 @@ const gotoGoods = (item) =>{
           border-radius: 4px;
           flex-shrink: 0;
         }
-        .wfinfo{
+        .wfinfo {
           text-align: left;
-          >p{
+          > p {
             font-size: 16px;
-            &:last-of-type{
+            &:last-of-type {
               color: rgba(255, 255, 255, 0.8);
               font-size: 12px;
               margin-top: 6px;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 363 - 327
src/utils/browser.js