master
王亚玲 2 years ago
parent 83052cf5e8
commit 3bb7c372f6

@ -30,7 +30,7 @@ class API {
static _App app = _App(); static _App app = _App();
static _Pay pay = _Pay(); static _Pay pay = _Pay();
static _Exclude exclude = _Exclude(); static _Exclude exclude = _Exclude();
static _Content content=_Content(); static _Content content = _Content();
} }
class _App { class _App {
@ -56,7 +56,7 @@ class _App {
String get trialVip => '/app/user/trialVip'; String get trialVip => '/app/user/trialVip';
} }
class _Content{ class _Content {
/// ///
String get content => '/app/user/content'; String get content => '/app/user/content';
@ -70,13 +70,16 @@ class _Content{
String get find => '/app/user/content/find'; String get find => '/app/user/content/find';
/// ///
String get findByStatus =>'/app/user/content/findByStatus'; String get findByStatus => '/app/user/content/findByStatus';
///VIP ///VIP
String get updateVip => '/app/user/updateVip'; String get updateVip => '/app/user/updateVip';
/// ///
String get trialVip => '/app/user/trialVip'; String get trialVip => '/app/user/trialVip';
///
String get redeemVip => '/app/user/redeem';
} }
class _Pay { class _Pay {

@ -0,0 +1,19 @@
import 'package:project_telephony/model/network/api_client.dart';
import 'package:project_telephony/model/network/base_model.dart';
import '../../../../constants/api.dart';
import '../../../../utils/toast/cloud_toast.dart';
class UserInfoFunc {
static Future<bool> getAddVip(String code) async {
BaseModel res =
await apiClient.request(API.content.redeemVip, data: {"code": code});
if(res.code==0){
CloudToast.show("卡密兑换成功");
return true;
}else{
CloudToast.show(res.msg);
return false;
}
}
}

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/home/set/func/user_info_func.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart'; import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/toast/cloud_toast.dart'; import 'package:project_telephony/utils/toast/cloud_toast.dart';
@ -68,11 +69,15 @@ class _UserCardPageState extends State<UserCardPage> {
88.hb, 88.hb,
PloneBottom( PloneBottom(
blM: false, blM: false,
onTap: () { onTap: () async{
if(cardMi.isEmpty){ if(cardMi.isEmpty){
CloudToast.show("卡密为空"); CloudToast.show("卡密为空");
}else{ }else{
CloudToast.show("卡密兑换成功"); var res= await UserInfoFunc.getAddVip(cardMi);
if(res){
Get.back();
}
// CloudToast.show("卡密兑换成功");
} }
}, },
border: cardMi.isEmpty?true:false, border: cardMi.isEmpty?true:false,

@ -114,6 +114,7 @@ class _UserPageState extends State<UserPage> {
children: [ children: [
Expanded( Expanded(
child: EasyRefresh( child: EasyRefresh(
controller: _easyRefreshController,
firstRefresh: true, firstRefresh: true,
header: MaterialHeader(), header: MaterialHeader(),
onRefresh: () async { onRefresh: () async {
@ -475,7 +476,12 @@ class _UserPageState extends State<UserPage> {
)); ));
break; break;
case "卡密兑换": case "卡密兑换":
Get.to(()=>UserCardPage());
Navigator.of(context)
.push(
MaterialPageRoute(builder: (_) => const UserCardPage()),
)
.then((val) => _easyRefreshController.callRefresh());
break; break;
default: default:
break; break;

Loading…
Cancel
Save