feat(1.0.5):优化用户体验

developing
张帅 1 week ago
parent 3731591491
commit 88fbc6bde0

@ -47,6 +47,7 @@ func NewOrderService(repo order.AggregateRepository, articleRepo article.Article
priceRepo: priceRepo,
columnRepo: columnRepo,
payService: payService,
runLog: runLog,
orderRepo: orderRepo,
userRepo: userRepo,
couponRepo: couponRepo,

@ -50,9 +50,9 @@ export class AppComponent implements OnInit {
} else {
// 如果都没有token重定向到获取token的页面
console.log("需要获取token重定向到授权页面");
// window.location.href = "http://famyun.com/callback_test";
window.location.href = "http://famyun.com/callback_test";
// 生产环境使用微信授权
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx13bd75fbedf283e5&redirect_uri=http%3A%2F%2Ffamyun.com%2Fcallback&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
// window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx13bd75fbedf283e5&redirect_uri=http%3A%2F%2Ffamyun.com%2Fcallback&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
}
}
});

@ -34,12 +34,13 @@ export class ArticleContentComponent implements OnInit,OnDestroy {
private cdr:ChangeDetectorRef) { }
ngOnInit() {
this.getData();
this.getUsername();
this.routerSub = this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
if(event.url == "/home/special-column" || event.url == "/home") {
this.checkOrderOcc()
this.getUsername();
}
}
});
@ -127,10 +128,18 @@ export class ArticleContentComponent implements OnInit,OnDestroy {
}
getUsername(){
const token = localStorage.getItem("token")
if(token) {
getUser().subscribe((res)=>{
this.username = res.username
this.loadData()
this.cdr.detectChanges();
})
} else {
this.username = ""
this.loadData()
}
}
getNewData() {

@ -34,8 +34,7 @@ export class ArticleItemComponent implements OnInit,AfterViewInit {
}
onUnlock() {
getUser().subscribe((res)=>{
if(res.username == "") {
if(this.username == "") {
// 未登录,显示提示框
this.alertCtrl.create({
header: '提示',
@ -63,8 +62,6 @@ export class ArticleItemComponent implements OnInit,AfterViewInit {
});
})
}
this.username = res.username
})
}
getFreeReadCount():number{
@ -78,8 +75,7 @@ export class ArticleItemComponent implements OnInit,AfterViewInit {
unlockArticle(event: any) {
event.stopPropagation()
getUser().subscribe((res)=>{
if(res.username == "") {
if(this.username == "") {
// 未登录,显示提示框
this.alertCtrl.create({
header: '提示',
@ -128,8 +124,6 @@ export class ArticleItemComponent implements OnInit,AfterViewInit {
v1.present()
});
}
this.username = res.username
})
}

@ -9,14 +9,15 @@ import {
Input
} from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import {NavigationEnd, Router} from '@angular/router';
import {ModalController, NavController, ToastController} from '@ionic/angular';
import { MineService } from '../mine.service';
import {getUser, MineService} from '../mine.service';
import {
SlidePoint,
SlideRef
} from "go-captcha-angular";
import {CaptchaModalComponent} from "../component/captcha-modal/captcha-modal.component";
import {Subscription} from "rxjs";
@Component({
selector: 'app-login',
@ -34,6 +35,7 @@ export class LoginPage implements OnInit, OnDestroy,AfterViewInit {
private timer: any;
private verifyToken: string | null = null;
private returnUrl: string | null = null;
private routerSub!: Subscription;
constructor(
private fb: FormBuilder,
@ -58,16 +60,31 @@ export class LoginPage implements OnInit, OnDestroy,AfterViewInit {
}
ngOnInit() {
this.createForm();
this.routerSub = this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
if(event.url == "/mine/login") {
this.checkLoginStatus()
}
}
});
}
checkLoginStatus() {
const t = localStorage.getItem("token")
if(t!=""){
this.navCtrl.navigateBack("/mine/login")
}
}
ngAfterViewInit() {
}
ngOnDestroy() {
this.stopCountdown() ;
if (this.routerSub) {
this.routerSub.unsubscribe();
}
}
private createForm() {
// 根据登录类型动态设置验证器
this.loginForm.get('password')?.setValidators(

Loading…
Cancel
Save