|
|
@ -26,7 +26,7 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import { login, userBinding, getSessionKey, queryPartnerAccount, douYinLogin } from '@/apis/modules/user.js' |
|
|
|
import { login, userBinding, getSessionKey, queryPartnerAccount, douYinLogin, douYinLoginByOpenid } from '@/apis/modules/user.js' |
|
|
|
import WXBizDataCrypt from '@/libs/WXBizDataCrypt' |
|
|
|
import WXBizDataCrypt from '@/libs/WXBizDataCrypt' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
@ -71,7 +71,7 @@ |
|
|
|
desc: '登录', |
|
|
|
desc: '登录', |
|
|
|
success: ({ userInfo }) => { |
|
|
|
success: ({ userInfo }) => { |
|
|
|
uni.login({ |
|
|
|
uni.login({ |
|
|
|
success: ({ code }) => { |
|
|
|
success: async ({ code }) => { |
|
|
|
if (code) { |
|
|
|
if (code) { |
|
|
|
this.submiting = true |
|
|
|
this.submiting = true |
|
|
|
|
|
|
|
|
|
|
@ -84,25 +84,29 @@ |
|
|
|
if (this.isDy) { |
|
|
|
if (this.isDy) { |
|
|
|
fn = douYinLogin |
|
|
|
fn = douYinLogin |
|
|
|
param = code |
|
|
|
param = code |
|
|
|
|
|
|
|
const res1 = await douYinLoginByOpenid('_000P6jr9bt8gW0ySNSzGsNBnCB0er4KtN3M') |
|
|
|
|
|
|
|
uni.setStorageSync('token', res1.data.token) |
|
|
|
|
|
|
|
this.toIndex() |
|
|
|
|
|
|
|
// fn(param).then(async res => { |
|
|
|
|
|
|
|
// const { data, status } = res |
|
|
|
|
|
|
|
// this.submiting = false |
|
|
|
|
|
|
|
// this.sessionKey = data.sessionKey |
|
|
|
|
|
|
|
// this.openid = data.openid |
|
|
|
|
|
|
|
// this.unionid = data.unionid |
|
|
|
|
|
|
|
// uni.setStorageSync('sessionKey', data.sessionKey) |
|
|
|
|
|
|
|
// uni.setStorageSync('openid', data.openid) |
|
|
|
|
|
|
|
|
|
|
|
fn(param).then(res => { |
|
|
|
// const res1 = await douYinLoginByOpenid('_000P6jr9bt8gW0ySNSzGsNBnCB0er4KtN3M') |
|
|
|
const { data, status } = res |
|
|
|
// // 如果没有绑定手机号,则显示绑定按钮,引导用户绑定,否则,直接跳到首页 |
|
|
|
this.submiting = false |
|
|
|
// // if (data.state === 'login') { |
|
|
|
this.sessionKey = data.sessionKey |
|
|
|
// // this.toIndex() |
|
|
|
this.openid = data.openid |
|
|
|
// // uni.setStorageSync('token', data.token) |
|
|
|
this.unionid = data.unionid |
|
|
|
// // } else { |
|
|
|
uni.setStorageSync('sessionKey', data.sessionKey) |
|
|
|
// // this.isLogin = true |
|
|
|
uni.setStorageSync('openid', data.openid) |
|
|
|
// // } |
|
|
|
// 如果没有绑定手机号,则显示绑定按钮,引导用户绑定,否则,直接跳到首页 |
|
|
|
// }).catch(e => { |
|
|
|
if (data.state === 'login') { |
|
|
|
// this.submiting = false |
|
|
|
this.toIndex() |
|
|
|
// }) |
|
|
|
uni.setStorageSync('token', data.token) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.isLogin = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(e => { |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
fn(param).then((res) => { |
|
|
|
fn(param).then((res) => { |
|
|
|
const { data, status } = res |
|
|
|
const { data, status } = res |
|
|
|