|
@@ -12,7 +12,7 @@ import iconStudent from '@common/images/icon_student.png'
|
|
import logo from '@common/images/logo.png'
|
|
import logo from '@common/images/logo.png'
|
|
import ColPopup from '@/components/col-popup'
|
|
import ColPopup from '@/components/col-popup'
|
|
import InviteCode from './invite-code'
|
|
import InviteCode from './invite-code'
|
|
-import { state } from '@/state'
|
|
|
|
|
|
+import { setLogin, state } from '@/state'
|
|
import request from '@/student/home-layout-orchestra/request-home'
|
|
import request from '@/student/home-layout-orchestra/request-home'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
@@ -28,14 +28,20 @@ export default defineComponent({
|
|
removeAuth()
|
|
removeAuth()
|
|
|
|
|
|
listenerMessage('webViewOnResume', () => {
|
|
listenerMessage('webViewOnResume', () => {
|
|
- promisefiyPostMessage({ api: 'getUserAccount' }).then((res: any) => {
|
|
|
|
- const content = res.content
|
|
|
|
- state.orchestraInfo.token = content.token
|
|
|
|
- state.orchestraInfo.phone = content.phone
|
|
|
|
- state.orchestraInfo.nickname = content.nickname
|
|
|
|
- state.orchestraInfo.avatar = content.avatar
|
|
|
|
- state.orchestraInfo.unionId = content.unionId || 0
|
|
|
|
- })
|
|
|
|
|
|
+ promisefiyPostMessage({ api: 'getUserAccount' }).then(
|
|
|
|
+ async (res: any) => {
|
|
|
|
+ const content = res.content
|
|
|
|
+ state.orchestraInfo.token = content.token
|
|
|
|
+ state.orchestraInfo.phone = content.phone
|
|
|
|
+ state.orchestraInfo.nickname = content.nickname
|
|
|
|
+ state.orchestraInfo.avatar = content.avatar
|
|
|
|
+ state.orchestraInfo.unionId = content.unionId || 0
|
|
|
|
+ this.username = state.orchestraInfo.phone
|
|
|
|
+ if (content.unionId && this.$route.path === '/home-auth') {
|
|
|
|
+ this.getUserInfo()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ )
|
|
})
|
|
})
|
|
},
|
|
},
|
|
unmounted() {
|
|
unmounted() {
|
|
@@ -52,13 +58,47 @@ export default defineComponent({
|
|
Toast('授权成功')
|
|
Toast('授权成功')
|
|
}, 100)
|
|
}, 100)
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
|
+ this.getUserInfo()
|
|
// this.$router.push('/home')
|
|
// this.$router.push('/home')
|
|
- window.location.href = location.origin + location.pathname + '#/home'
|
|
|
|
|
|
+ // window.location.href = location.origin + location.pathname + '#/home'
|
|
// setTimeout(() => {
|
|
// setTimeout(() => {
|
|
- window.location.reload()
|
|
|
|
|
|
+ // window.location.reload()
|
|
// }, 100)
|
|
// }, 100)
|
|
}, 1000)
|
|
}, 1000)
|
|
},
|
|
},
|
|
|
|
+ async getUserInfo() {
|
|
|
|
+ try {
|
|
|
|
+ const res = await request.post('/api-auth/smsLogin', {
|
|
|
|
+ requestType: 'form',
|
|
|
|
+ data: {
|
|
|
|
+ clientId: 'student',
|
|
|
|
+ clientSecret: 'student',
|
|
|
|
+ phone: state.orchestraInfo.phone,
|
|
|
|
+ token: state.orchestraInfo.token,
|
|
|
|
+ isSurportRegister: true
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ const { authentication } = res.data
|
|
|
|
+ setAuth(authentication.token_type + ' ' + authentication.access_token)
|
|
|
|
+ promisefiyPostMessage({
|
|
|
|
+ api: 'setCache',
|
|
|
|
+ content: {
|
|
|
|
+ key: 'h5-colexiu-token',
|
|
|
|
+ value: authentication.token_type + ' ' + authentication.access_token
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ const userCash = await request.get(
|
|
|
|
+ '/api-student/student/queryUserInfo',
|
|
|
|
+ {
|
|
|
|
+ initRequest: true // 初始化接口
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ setLogin(userCash.data)
|
|
|
|
+ this.$router.push('/home')
|
|
|
|
+ } catch {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async onLogin() {
|
|
async onLogin() {
|
|
try {
|
|
try {
|
|
const res = await request.post('/api-auth/smsLogin', {
|
|
const res = await request.post('/api-auth/smsLogin', {
|
|
@@ -92,7 +132,11 @@ export default defineComponent({
|
|
<div class={styles.login}>
|
|
<div class={styles.login}>
|
|
<div class={styles.container}>
|
|
<div class={styles.container}>
|
|
<div class={[styles.userInfo, styles.loginCenter]}>
|
|
<div class={[styles.userInfo, styles.loginCenter]}>
|
|
- <Image src={iconStudent} class={styles.img} />
|
|
|
|
|
|
+ <Image
|
|
|
|
+ src={state.orchestraInfo.avatar || iconStudent}
|
|
|
|
+ class={styles.img}
|
|
|
|
+ fit="cover"
|
|
|
|
+ />
|
|
|
|
|
|
<p class={styles.name}>{state.orchestraInfo.name}</p>
|
|
<p class={styles.name}>{state.orchestraInfo.name}</p>
|
|
</div>
|
|
</div>
|