Sfoglia il codice sorgente

贷款-微信分享配置

panyong 4 anni fa
parent
commit
dc069ba9d2

+ 6 - 1
htmldev/loan/src/App.vue

@@ -8,8 +8,13 @@
 </template>
 
 <script>
+  import { funWxShare } from './utils/wxShareConfig'
+
   export default {
-    name: 'App'
+    name: 'App',
+    mounted () {
+      funWxShare('', '', location.href, '')
+    }
   }
 </script>
 

+ 12 - 0
htmldev/loan/src/api/wx.js

@@ -14,3 +14,15 @@ export const wxAuth = (url = location.href) => request({
     next: encodeURIComponent(url)
   }
 })
+
+/**
+ * 获取微信签名
+ */
+
+export const getWxSign = (url = location.href) => request({
+  method: 'GET',
+  url: '/wechat/signature',
+  params: {
+    url: encodeURIComponent(url)
+  }
+})

+ 13 - 12
htmldev/loan/src/utils/wxShareConfig.js

@@ -1,18 +1,19 @@
 import wx from 'weixin-js-sdk'
+import { getWxSign } from '../api/wx'
 
-const apiDomain = process.env.API_DOMAIN
-
-const wxJs = () => new Promise(resolve => {
-  window.apiPost(`${apiDomain}/Wx/getSharePackage`, {
-    // 微信二次分享参数不对
-    ShareUrl: location.href
-  }, (res) => {
-    if (res.Status === 1) {
-      resolve(res.Data)
-    }
+const wxJs = () => {
+  return new Promise((resolve, reject) => {
+    getWxSign().then(res => {
+      if (res.status) {
+        resolve(res.data)
+        return
+      }
+      reject(res)
+    }).catch(err => {
+      reject(err)
+    })
   })
-})
-
+}
 /**
  * wx-js-sdk 配置
  */

+ 0 - 1
htmldev/loan/src/views/loan/attest/components/myUploader.vue

@@ -1,6 +1,5 @@
 <template>
   <van-uploader v-model="arrUploadFile"
-                multiple
                 :max-count="maxCount"
                 :before-read="beforeRead"
                 :after-read="afterRead" @delete="handleDelete"/>