ソースを参照

拼多多搜索需要授权

许雷 2 年 前
コミット
c6b6a0d2dc
共有1 個のファイルを変更した26 個の追加3 個の削除を含む
  1. 26 3
      src/pages/search/index.vue

+ 26 - 3
src/pages/search/index.vue

@@ -139,9 +139,32 @@ function searchProduct() {
139 139
       break;
140 140
     }
141 141
     case PLATFORM_NAME.PDD: {
142
-
143 142
       searchPddProduct({ keyword: searchValue.value, page: 1, limit: 10}).then(res => {
144
-        list.value = res
143
+        if(res.we_app_info){
144
+          const pddWx = res.we_app_info
145
+          console.log(pddWx)
146
+          if (pddWx) {
147
+            uni.navigateToMiniProgram({
148
+              appId: pddWx.app_id,
149
+              path: pddWx.page_path,
150
+              envVersion: 'release',
151
+              success(res) {
152
+                // 打开成功
153
+              },
154
+              fail: (error) => {
155
+                console.log(error);
156
+              }
157
+            })
158
+          } else {
159
+            uni.showToast({
160
+              title: '跳转失败请重试',
161
+              icon: 'none'
162
+            })
163
+          }
164
+        }else{
165
+          list.value = res
166
+        }
167
+
145 168
       })
146 169
       break;
147 170
     }
@@ -761,4 +784,4 @@ page {
761 784
   //position: fixed;
762 785
   background: #f8f8f8;
763 786
 }
764
-</style>
787
+</style>