基础库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 regels
1.1 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_alibc/alibc_model.dart';
  3. import 'package:flutter_alibc/flutter_alibc.dart';
  4. import 'package:zhiying_comm/util/taobao/taobao_auth_alert.dart';
  5. import 'package:zhiying_comm/zhiying_comm.dart';
  6. class TaobaoAuth {
  7. // 淘宝授权
  8. static auth(BuildContext context) async {
  9. bool isConfirm = await showDialog(
  10. context: context,
  11. builder: (BuildContext context) {
  12. return TaobaoAuthAlert();
  13. });
  14. if (isConfirm != null && isConfirm == true) {
  15. Map<String, dynamic> data = Map<String, dynamic>.from(
  16. await NetUtil.post('/api/v1/taobao/auth', method: NetMethod.GET));
  17. Logger.debug(data);
  18. String url = data['data']['redirect_url'];
  19. TradeResult result = await FlutterAlibc.openByUrl(url: url);
  20. // TradeResult result = await FlutterAlibc.openByUrl(url: '');
  21. Logger.debug('${result.errorCode} ${result.errorMessage} ');
  22. }
  23. }
  24. // 返回是否授权
  25. static Future<bool> isAuth() {
  26. return Future.delayed(Duration.zero, () => false);
  27. }
  28. }