2020-02-22 11:21:27 +08:00
|
|
|
//
|
|
|
|
// ViewController.m
|
|
|
|
// demo
|
|
|
|
//
|
|
|
|
// Created by 杨涛 on 2020/2/6.
|
|
|
|
// Copyright © 2020 finogeeks. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "ViewController.h"
|
|
|
|
#import <FinApplet/FinApplet.h>
|
|
|
|
|
|
|
|
@interface ViewController ()
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation ViewController
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
[super viewDidLoad];
|
|
|
|
// Do any additional setup after loading the view.
|
|
|
|
|
2020-03-07 20:00:19 +08:00
|
|
|
UIButton *btn1 = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 200, 40)];
|
|
|
|
[btn1 setTitle:@"打开画图小程序" forState:UIControlStateNormal];
|
|
|
|
[btn1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
[btn1 setBackgroundColor:[UIColor grayColor]];
|
|
|
|
[btn1 addTarget:self action:@selector(onCanvasClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
|
|
|
UIButton *btn2 = [[UIButton alloc] initWithFrame:CGRectMake(100, 150, 200, 40)];
|
|
|
|
[btn2 setTitle:@"打开官方小程序" forState:UIControlStateNormal];
|
|
|
|
[btn2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
[btn2 setBackgroundColor:[UIColor grayColor]];
|
|
|
|
[btn2 addTarget:self action:@selector(onDemoClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
|
|
|
UIButton *btn3 = [[UIButton alloc] initWithFrame:CGRectMake(100, 200, 200, 40)];
|
|
|
|
[btn3 setTitle:@"我的对账单" forState:UIControlStateNormal];
|
|
|
|
[btn3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
[btn3 setBackgroundColor:[UIColor grayColor]];
|
|
|
|
[btn3 addTarget:self action:@selector(onProfileClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
|
|
|
[self.view addSubview:btn1];
|
|
|
|
[self.view addSubview:btn2];
|
|
|
|
[self.view addSubview:btn3];
|
2020-02-22 11:21:27 +08:00
|
|
|
}
|
|
|
|
|
2020-03-07 20:00:19 +08:00
|
|
|
- (void)onCanvasClick:(id)sender {
|
2020-02-22 11:21:27 +08:00
|
|
|
|
2020-04-22 21:20:25 +08:00
|
|
|
NSString *appId = @"5ea03fa563cb900001d73863";
|
2020-03-07 20:00:19 +08:00
|
|
|
// 打开小程序
|
|
|
|
[[FATClient sharedClient] startRemoteApplet:appId startParams:@{
|
|
|
|
@"path": @"/pages/index/index",
|
|
|
|
@"query": @""
|
|
|
|
} InParentViewController:self completion:^(BOOL result, NSError *error) {
|
|
|
|
NSLog(@"result:%d---error:%@", result, error);
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)onDemoClick:(id)sender {
|
|
|
|
|
2020-04-22 21:20:25 +08:00
|
|
|
NSString *appId = @"5ea0401463cb900001d73865";
|
2020-02-22 11:21:27 +08:00
|
|
|
// 打开小程序
|
|
|
|
[[FATClient sharedClient] startRemoteApplet:appId startParams:nil InParentViewController:self completion:^(BOOL result, NSError *error) {
|
|
|
|
NSLog(@"result:%d---error:%@", result, error);
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
2020-03-07 20:00:19 +08:00
|
|
|
- (void)onProfileClick:(id)sender {
|
|
|
|
|
2020-04-22 21:20:25 +08:00
|
|
|
NSString *appId = @"5ea0412663cb900001d73867";
|
2020-03-07 20:00:19 +08:00
|
|
|
// 打开小程序
|
|
|
|
[[FATClient sharedClient] startRemoteApplet:appId startParams:nil InParentViewController:self completion:^(BOOL result, NSError *error) {
|
|
|
|
NSLog(@"result:%d---error:%@", result, error);
|
|
|
|
}];
|
|
|
|
}
|
2020-02-22 11:21:27 +08:00
|
|
|
@end
|