|
@@ -17,40 +17,38 @@ export class IndexPage implements OnInit {
|
|
|
|
|
|
constructor(private router: Router, private route: ActivatedRoute, private wxcpService: WxcpService, private userService: UserService,
|
|
constructor(private router: Router, private route: ActivatedRoute, private wxcpService: WxcpService, private userService: UserService,
|
|
private configService: ConfigService, private accountService: AccountService, private routeInfo: ActivatedRoute) {
|
|
private configService: ConfigService, private accountService: AccountService, private routeInfo: ActivatedRoute) {
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
ngOnInit() {
|
|
ngOnInit() {
|
|
}
|
|
}
|
|
|
|
|
|
ionViewWillEnter() {
|
|
ionViewWillEnter() {
|
|
-
|
|
|
|
this.configService.GetConfig().subscribe((config) => {
|
|
this.configService.GetConfig().subscribe((config) => {
|
|
this.isWxLogin = config.isWxLogin;
|
|
this.isWxLogin = config.isWxLogin;
|
|
- });
|
|
|
|
-
|
|
|
|
- const urlParams = getUrlParams() as any;
|
|
|
|
- if (this.wxcpService.isWechat() && this.isWxLogin) {
|
|
|
|
- let routePath = urlParams["routePath"] || '/tapp/tabs/tabMain'; //登录成功后跳转地址
|
|
|
|
- routePath = decodeURIComponent(routePath);
|
|
|
|
|
|
|
|
- const wxUserId = urlParams["wxUserId"] || this.userService.getWxUserID();
|
|
|
|
- if (wxUserId) {
|
|
|
|
- //根据微信用户id登录系统
|
|
|
|
- this.accountService.loginByWxUserId(wxUserId, routePath);
|
|
|
|
|
|
+ const urlParams = getUrlParams() as any;
|
|
|
|
+ if (this.wxcpService.isWechat() && this.isWxLogin) {
|
|
|
|
+ let routePath = urlParams["routePath"] || '/tapp/tabs/tabMain'; //登录成功后跳转地址
|
|
|
|
+ routePath = decodeURIComponent(routePath);
|
|
|
|
+
|
|
|
|
+ const wxUserId = urlParams["wxUserId"] || this.userService.getWxUserID();
|
|
|
|
+ if (wxUserId) {
|
|
|
|
+ //根据微信用户id登录系统
|
|
|
|
+ this.accountService.loginByWxUserId(wxUserId, routePath);
|
|
|
|
+ } else {
|
|
|
|
+ this.wxcpService.wxAuth(routePath).then(res => {
|
|
|
|
+ if (res === false) {
|
|
|
|
+ this.router.navigate(['/login'], {
|
|
|
|
+ relativeTo: this.routeInfo,
|
|
|
|
+ queryParams: {random: Math.random()}
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- this.wxcpService.wxAuth(routePath).then(res => {
|
|
|
|
- if (res === false) {
|
|
|
|
- this.router.navigate(['/login'], {
|
|
|
|
- relativeTo: this.routeInfo,
|
|
|
|
- queryParams: {random: Math.random()}
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ this.router.navigate(['/login'], {queryParams: {random: Math.random()}});
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- this.router.navigate(['/login'], {queryParams: {random: Math.random()}});
|
|
|
|
- }
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|