|
@@ -110,33 +110,44 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</body>
|
|
|
- <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
|
|
|
+ <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.13/vue.js"></script>
|
|
|
<script src="https://g.tbcdn.cn/mtb/lib-flexible/0.3.2/??flexible_css.js,flexible.js"></script>
|
|
|
<script src="https://cdn.bootcdn.net/ajax/libs/axios/1.3.6/axios.min.js"></script>
|
|
|
<script>
|
|
|
- let xhr = new XMLHttpRequest()
|
|
|
-
|
|
|
let app = new Vue({
|
|
|
el: '#container',
|
|
|
data: {
|
|
|
products: [],
|
|
|
product: {},
|
|
|
- active: ''
|
|
|
+ active: '',
|
|
|
+ code: ''
|
|
|
},
|
|
|
mounted() {
|
|
|
- axios({
|
|
|
- method: 'get',
|
|
|
- url: 'https://reader-api.efunbox.cn/wx/v3/product/learn',
|
|
|
- headers: {
|
|
|
- uid: 'd83d947655f6455a96f4197d31afa6d4',
|
|
|
- channelCode: '3001'
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- this.products = res.data.data.productList
|
|
|
- console.log(this.products)
|
|
|
- this.active = res.data.data.productList[0].id
|
|
|
- this.product = res.data.data.productList[0]
|
|
|
- })
|
|
|
+ // 原始URL
|
|
|
+ var url = location.search
|
|
|
+ // 创建URLSearchParams对象
|
|
|
+ console.log(url, 'zzzzzzzzzzzzzzzzz')
|
|
|
+ var searchParams = new URLSearchParams(url)
|
|
|
+ // 获取code参数的值
|
|
|
+ var code = searchParams.get('code')
|
|
|
+ console.log(searchParams, '=======', code) // 输出:021gINll25JRUb49AYll2au8ga0gINl-
|
|
|
+ if (code) {
|
|
|
+ this.code = code
|
|
|
+ axios({
|
|
|
+ method: 'get',
|
|
|
+ url: 'https://reader-api.efunbox.cn/wx/v3/product/learn',
|
|
|
+ headers: {
|
|
|
+ uid: 'd83d947655f6455a96f4197d31afa6d4',
|
|
|
+ channelCode: '3001'
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ this.products = res.data.data.productList
|
|
|
+ this.active = res.data.data.productList[0].id
|
|
|
+ this.product = res.data.data.productList[0]
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.getWxCode()
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
selected(e) {
|
|
@@ -187,8 +198,8 @@
|
|
|
})
|
|
|
},
|
|
|
getWxCode() {
|
|
|
- const appId = 'wx35303262fa755a18'
|
|
|
- const redirect_uri = encodeURIComponent('https://zxtx-web.efunbox.cn/login')
|
|
|
+ const appId = 'wxf05800eea975a68b'
|
|
|
+ const redirect_uri = encodeURIComponent('https://h5-pay.ai160.com/reader-ios')
|
|
|
const url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appId + '&redirect_uri=' + redirect_uri + '&response_type=code&scope=snsapi_base#wechat_redirect'
|
|
|
location.href = url
|
|
|
}
|