瀏覽代碼

添加h5跳转

tremble 3 年之前
父節點
當前提交
b3784bf712
共有 2 個文件被更改,包括 22 次插入16 次删除
  1. 2 0
      src/app.vue
  2. 20 16
      src/components/Tags/goods-list.vue

+ 2 - 0
src/app.vue

@@ -256,6 +256,8 @@ onMounted(async () => {
                   // 不在小程序里
                 }
               });
+            } else {
+              
             }
           } else if (tag.type == "link_scene") {
             let sceneFirstView = tag.hotContent.sceneFirstView;

+ 20 - 16
src/components/Tags/goods-list.vue

@@ -15,7 +15,8 @@
             <div class="info">
               <p>{{ i.name }}</p>
               <div v-if="i.skus">
-                <span>{{i.price[0].symbol}}</span><span>{{ i.currentSku.price }}</span>
+                <span>{{ i.price[0].symbol }}</span
+                ><span>{{ i.currentSku.price }}</span>
               </div>
               <ul>
                 <li>
@@ -84,16 +85,20 @@ 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 {
-                  // 不在小程序里
-                }
-              });
-            }
+    //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 onClickSku = (item) => {
@@ -275,7 +280,7 @@ onMounted(() => {
             > li {
               margin: 10px 0;
               color: #909090;
-              &:last-of-type{
+              &:last-of-type {
                 display: flex;
                 justify-content: space-between;
                 align-items: center;
@@ -289,7 +294,7 @@ onMounted(() => {
                   display: inline-block;
                   > span {
                     display: inline-block;
-                    border: 1px solid #EBEBEB;
+                    border: 1px solid #ebebeb;
                     padding: 2px 4px;
                     min-width: 73px;
                     height: 30px;
@@ -311,18 +316,17 @@ onMounted(() => {
                 display: flex;
                 i {
                   font-size: 12px;
-                  border: 1px solid #EBEBEB;
+                  border: 1px solid #ebebeb;
                   padding: 2px 8px;
                   border-radius: 15px;
                 }
                 input {
                   max-width: 40px;
                   text-align: center;
-                  color: #131D34;
+                  color: #131d34;
                 }
               }
             }
-
           }
         }
         .goods-button {