12345678910111213141516171819202122232425262728293031323334 |
- // import useState from '@/store/useState';
- // const tokenID = useState(['tokenID'])
- import {getLifeData} from '@/store/liveSave.js'
- const modalText = {
- // TODO 完善异常提醒
- SUCCESS: ()=> {}
- }
- const setLoginFun = (options : ReturnLoginInfo,_this) => {
- const {status,data = {}} = options
- status ? modalText[status] : ''
- const {tokenID} = data
- if(status === 'SUCCESS'&&tokenID) {
- uni.$uv.vuex('tokenID', tokenID)
- _this.tokenID = tokenID
- authorize.tokenID = tokenID
- }
- }
- // 类型声明
- interface ReturnLoginInfo {
- status: string;
- data: object;
- }
- class authorize {
- static tokenID: string;
- static getTokenID() {
- return authorize.tokenID || getLifeData('tokenID')
- };
- constructor(data : ReturnLoginInfo){
- setLoginFun(data,this)
- }
- }
- export {
- authorize
- }
|