64 lines
1.4 KiB
JavaScript
64 lines
1.4 KiB
JavaScript
import request from '@/utils/request'
|
|
const baseUrl = 'https://api.weixin.qq.com/sns/oauth2/authorize'
|
|
let scope = 'snsapi_base '
|
|
const appId = '10037e6f6a4e6da4016a62a47e51000c'
|
|
let redirectUri = 'www.51xingka.net'
|
|
export default {
|
|
getmyCode () {
|
|
return request({
|
|
url: `${baseUrl}?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=${scope}#wechat_redirect `,
|
|
method: 'get'
|
|
|
|
})
|
|
},
|
|
getWeixinLocation (accessToken) {
|
|
return request({
|
|
url: `https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=${accessToken}&type=jsapi`,
|
|
method: 'get'
|
|
})
|
|
},
|
|
// 获取微信accessToken
|
|
getToken (code, accountSource) {
|
|
return request({
|
|
url: `/driver/loginWeixinOil`,
|
|
method: 'post',
|
|
data: {
|
|
code,
|
|
accountSource
|
|
}
|
|
})
|
|
},
|
|
login (data) {
|
|
return request({
|
|
url: `/driver/loginAccount`,
|
|
method: 'post',
|
|
data: data
|
|
})
|
|
},
|
|
logout (data) {
|
|
return request({
|
|
url: `/driver/logout`,
|
|
method: 'post',
|
|
data: data
|
|
})
|
|
},
|
|
loginAccountBySms (data) {
|
|
return request({
|
|
url: `/driver/loginAccountBySms`,
|
|
method: 'post',
|
|
data: data
|
|
})
|
|
},
|
|
unifiedOrder (data) {
|
|
return request({
|
|
url: `/pay/unifiedorder`,
|
|
method: 'post',
|
|
data: data,
|
|
headers: {
|
|
'Content-Type': 'application/xml'
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|