|
@@ -2,7 +2,12 @@ import { defineComponent } from 'vue'
|
|
|
import { Button, Image, Toast } from 'vant'
|
|
|
import { removeAuth, setAuth } from './utils'
|
|
|
import styles from './index.module.less'
|
|
|
-import { postMessage } from '@/helpers/native-message'
|
|
|
+import {
|
|
|
+ listenerMessage,
|
|
|
+ postMessage,
|
|
|
+ promisefiyPostMessage,
|
|
|
+ removeListenerMessage
|
|
|
+} from '@/helpers/native-message'
|
|
|
import iconStudent from '@common/images/icon_student.png'
|
|
|
import logo from '@common/images/logo.png'
|
|
|
import ColPopup from '@/components/col-popup'
|
|
@@ -21,6 +26,22 @@ export default defineComponent({
|
|
|
mounted() {
|
|
|
this.username = state.orchestraInfo.phone
|
|
|
removeAuth()
|
|
|
+
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ unmounted() {
|
|
|
+ removeListenerMessage('webViewOnResume', () => {
|
|
|
+ //
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
onLoginSuccess() {
|
|
@@ -53,6 +74,13 @@ export default defineComponent({
|
|
|
|
|
|
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
|
|
|
+ }
|
|
|
+ })
|
|
|
this.onLoginSuccess()
|
|
|
} catch {
|
|
|
//
|