|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import 'dart:io'; |
|
|
|
|
|
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
@ -15,6 +17,7 @@ import 'package:huixiang/retrofit/data/wx_pay.dart';
|
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/utils/flutter_utils.dart'; |
|
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
|
import 'package:huixiang/utils/min.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/mine_vip_view.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
@ -80,7 +83,7 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryVipLevel() async { |
|
|
|
|
BaseData<List<Rank>> rankData = await apiService.rankList(); |
|
|
|
|
BaseData<List<Rank>> rankData = await apiService.rankList().catchError((onError) {}); |
|
|
|
|
if (rankData != null && rankData.isSuccess) { |
|
|
|
|
ranks.clear(); |
|
|
|
|
ranks.addAll(rankData.data); |
|
|
|
@ -120,15 +123,18 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
|
|
|
|
|
///购买会员等级 |
|
|
|
|
buyRank() async { |
|
|
|
|
// if (!(await Min.isInitialize())) { |
|
|
|
|
// 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, |
|
|
|
|
// 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, |
|
|
|
|
// 故而在此初始化一下 |
|
|
|
|
// await Min.initialize(); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
if(Platform.isAndroid) { |
|
|
|
|
if (!(await Min.isInitialize())) { |
|
|
|
|
//小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, |
|
|
|
|
//然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, |
|
|
|
|
//故而在此初始化一下 |
|
|
|
|
await Min.initialize(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BaseData<dynamic> baseData = await apiService |
|
|
|
|
.rankBuy({"buyType": 2, "rankId": ranks[checkIndex].id}); |
|
|
|
|
.rankBuy({"buyType": 2, "rankId": ranks[checkIndex].id}).catchError((onError) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
WxPay wxPay = WxPay.fromJson(baseData.data); |
|
|
|
|
await registerWxApi( |
|
|
|
|