|
@@ -1,7 +1,7 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { onMounted, reactive, ref, watch } from 'vue'
|
|
import { onMounted, reactive, ref, watch } from 'vue'
|
|
import * as ww from '@wecom/jssdk'
|
|
import * as ww from '@wecom/jssdk'
|
|
-import { getWeiComQrCode } from './api'
|
|
|
|
|
|
+import { getWeiComQrCode, WeComLogin } from './api'
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
import { createWWLoginPanel } from '@wecom/jssdk'
|
|
import { createWWLoginPanel } from '@wecom/jssdk'
|
|
|
|
|
|
@@ -36,9 +36,7 @@ function createWXQRCode() {
|
|
login_type: 'CorpApp',
|
|
login_type: 'CorpApp',
|
|
appid: 'ww467ec1685e8262e6',
|
|
appid: 'ww467ec1685e8262e6',
|
|
agentid: '1000065',
|
|
agentid: '1000065',
|
|
- // redirect_uri: 'https://ads.vzzon.com/web/#/login?redirect=/¶ms={}',
|
|
|
|
- // redirect_uri: 'https://ads.vzzon.com/api/system/wechat/login/test',
|
|
|
|
- redirect_uri : "http://amzads.zositechc.cn/web/",
|
|
|
|
|
|
+ redirect_uri : "https://amzads.zositechc.cn/",
|
|
state: 'Wechat',
|
|
state: 'Wechat',
|
|
scope : "snsapi_privateinfo",
|
|
scope : "snsapi_privateinfo",
|
|
redirect_type: 'callback',
|
|
redirect_type: 'callback',
|
|
@@ -48,6 +46,8 @@ function createWXQRCode() {
|
|
},
|
|
},
|
|
onLoginSuccess({ code }) {
|
|
onLoginSuccess({ code }) {
|
|
console.log({ code })
|
|
console.log({ code })
|
|
|
|
+ const wecomCode = code
|
|
|
|
+ handleWeComLogin({ wecomCode, state: 'Wechat' })
|
|
},
|
|
},
|
|
onLoginFail(err) {
|
|
onLoginFail(err) {
|
|
console.log(err)
|
|
console.log(err)
|
|
@@ -55,6 +55,14 @@ function createWXQRCode() {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+async function handleWeComLogin(query) {
|
|
|
|
+ try {
|
|
|
|
+ const response = await WeComLogin(query)
|
|
|
|
+ } catch(error) {
|
|
|
|
+ console.log('error:', error)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
// function getQueryVariable(variable) {
|
|
// function getQueryVariable(variable) {
|
|
// const query = window.location.search.substring(1)
|
|
// const query = window.location.search.substring(1)
|
|
// const vars = query.split('&')
|
|
// const vars = query.split('&')
|