Commit 8ee18287 authored by hanfeng zhang's avatar hanfeng zhang

321

parent 42937986
import {Service} from './Service' import {Service} from './Service'
import {LoginDto} from '@/types/Dto' import {LoginDto} from '@/types/Dto'
import { token } from '@/util/userInfoUtils'
export class UserService extends Service { export class UserService extends Service {
router = { router = {
sendCode:{ path:'/verificationCode/send/sms', dataType:'application/x-www-form-urlencoded'}, sendCode:{ path:'/verificationCode/send/sms', dataType:'application/x-www-form-urlencoded'},
login:{ path:'/user/login'}, login:{ path:'/user/login'},
isRegisterd:{ path:'/user/isRegister', dataType:'application/x-www-form-urlencoded'}, isRegisterd:{ path:'/user/isRegister', dataType:'application/x-www-form-urlencoded'},
isPwdSet:{ path:'/user/isSetPassword', dataType:'application/x-www-form-urlencoded'}, isPwdSet:{ path:'/user/isSetPassword', dataType:'application/x-www-form-urlencoded'},
userInfo:{ path:'/user/detail',dataType:'application/x-www-form-urlencoded'}
} }
constructor(){ constructor(){
super() super()
} }
private getAuth(){
return 'Bearer '+ token.getToken()
}
/** /**
* 获取验证码 * 获取验证码
* @param phone * @param phone
...@@ -50,6 +55,14 @@ export class UserService extends Service { ...@@ -50,6 +55,14 @@ export class UserService extends Service {
return await this.service.get(`${this.router.isPwdSet.path}/${account}`) return await this.service.get(`${this.router.isPwdSet.path}/${account}`)
} }
async getUserInfo(){
return await this.service.get(this.router.userInfo.path,{
headers:{
Authorization: this.getAuth(),
"Content-Type": this.router.userInfo.dataType
}
})
}
} }
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
<Layout-Child> <Layout-Child>
<div class='w-11/12 mx-auto mt-6'> <div class='w-11/12 mx-auto mt-6'>
<div class='collection-list'> <div class='collection-list'>
<div v-if="collectionList.length>0">
<div v-if="collectionList.length>1">
<app-collectionCard :colletionData='i' v-for="i in collectionList" :key="i.id" class='mt-3' @click.native="goDetail(i.id)"></app-collectionCard> <app-collectionCard :colletionData='i' v-for="i in collectionList" :key="i.id" class='mt-3' @click.native="goDetail(i.id)"></app-collectionCard>
</div> </div>
<div v-else class="mt-12"> <div v-else class="mt-12">
......
...@@ -28,7 +28,7 @@ export default Vue.extend({ ...@@ -28,7 +28,7 @@ export default Vue.extend({
}, },
methods:{ methods:{
toggleDialog(){ toggleDialog(){
this.$dialog.alert({ this.$dialog.confirm({
message: '确定要退出登录吗', message: '确定要退出登录吗',
}).then(()=>{ }).then(()=>{
localStorage.clear(); localStorage.clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment