Prechádzať zdrojové kódy

Merge branch 'master' of codehub-cn-south-1.devcloud.huaweicloud.com:web3000003/web-0210402

flowaaa 1 rok pred
rodič
commit
eeff1942f3

+ 4 - 0
app-angular/src/modules/lesson/me/me.component.ts

@@ -22,6 +22,9 @@ export class MeComponent {
   }
 
   async ngOnInit() {
+   this.refresh()
+  }
+  async refresh(){
     this.myAttentionList = await this.gteAttentionData()
     this.myScienceList = await this.getScienceData()
     this.myRecommendList = await this.getRecommendDate()
@@ -56,6 +59,7 @@ export class MeComponent {
   async logout() {
     await Parse.User.logOut()
     this.currentUser = undefined
+
     let toast = await this.toastCtrl.create({
       message: "登出成功",
       position: "top",

+ 3 - 9
app-angular/src/modules/user/service-user/user.service.ts

@@ -5,16 +5,10 @@ import * as Parse from "parse"
   providedIn: 'root'
 })
 export class UserService {
-  get currentUser() {
-    try {
-      let currentUser = JSON.parse(localStorage.getItem("USER_AUTH") || "")
-      return currentUser
-    } catch (err) { }
-    return {}
-  }
-  set currentUser(v) {
-    localStorage.setItem("USER_AUTH", JSON.stringify(v))
+  get currentUser(){
+    return Parse.User.current() || {}
   }
+ 
   constructor() { }
   async checkUserPassword(user: {
     username: string