Commit f0d1c0ef authored by 关振斌's avatar 关振斌

update

parent 3699105f
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
......@@ -58,25 +60,38 @@ android {
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.debug
// signingConfig signingConfigs.release //TODO
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
//
// signingConfigs {
// release {
// keyAlias keystoreProperties['keyAlias']
// keyPassword keystoreProperties['keyPassword']
// storeFile file(keystoreProperties['storeFile'])
// storePassword keystoreProperties['storePassword']
// }
// }
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
// buildTypes {
// // release {
// // signingConfig signingConfigs.debug
// // // signingConfig signingConfigs.release //TODO
// // // TODO: Add your own signing config for the release build.
// // // Signing with the debug keys for now, so `flutter run --release` works.
// // //
}
}
// // }
// }
}
flutter {
......
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.6.20'
repositories {
google()
mavenCentral()
......
{
"images" : [
{
"filename" : "logo-removebg-preview (4) 1.png",
"filename" : "launchimag.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "logo-removebg-preview (4) 2.png",
"filename" : "launchimag2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "logo-removebg-preview (4).png",
"filename" : "launchimag3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
......@@ -21,7 +21,9 @@ class UserStore extends GetxController {
// 令牌 token
String token = '';
// 用户 profile
final _profile = IntegralEntity(id: '', token: '', username: '').obs;
final _profile = IntegralEntity(
id: '', token: '', username: '', integral: 0, expireTime: null)
.obs;
bool get isLogin => _isLogin.value;
IntegralEntity get profile => _profile.value;
......@@ -34,8 +36,21 @@ class UserStore extends GetxController {
var profileOffline = StorageService.to.getString(STORAGE_USER_PROFILE_KEY);
if (profileOffline.isNotEmpty) {
var l = jsonDecode(profileOffline);
Map<String, dynamic> map = json.decode(l);
_profile.value = _profile(IntegralEntity.fromMap(map));
final copiedMap = Map.from(l);
// Map<String, dynamic> map = json.decode(l);
copiedMap.update("expireTime",
(value) => value == null ? null : DateTime?.parse(value));
// copiedMap
final value = IntegralEntity(
expireTime: copiedMap['expireTime'],
id: copiedMap['id'],
token: copiedMap['token'],
username: copiedMap['username'],
integral: copiedMap['integral']);
_profile.value = _profile(value);
if (profile.id != '') {
_isLogin.value = true;
......@@ -49,8 +64,13 @@ class UserStore extends GetxController {
handleLogin(IntegralEntity res) async {
await setToken(res.token);
// IntegralEntity userInfo = await UserAPI.getUserIntegral();
await getUserInfo(
IntegralEntity(id: res.id, username: res.username, token: res.token));
await getUserInfo(IntegralEntity(
id: res.id,
username: res.username,
token: res.token,
integral: res.integral,
expireTime: res.expireTime,
));
_isLogin.value = true;
Get.back();
// Get.put(ApplicationController());
......@@ -59,7 +79,7 @@ class UserStore extends GetxController {
getUserInfo(IntegralEntity userInfo) async {
await setToken(userInfo.token);
_profile.value = userInfo;
await saveProfile(userInfo);
// token = StorageService.to.getString(STORAGE_USER_TOKEN_KEY);
......@@ -95,7 +115,13 @@ class UserStore extends GetxController {
// 保存 profile
Future<void> saveProfile(IntegralEntity profile) async {
StorageService.to.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(profile));
_profile.value = profile;
var copiedMap = Map.from(profile.toMap());
copiedMap.update("expireTime", (value) => value?.toIso8601String());
StorageService.to
.setString(STORAGE_USER_PROFILE_KEY, jsonEncode(copiedMap));
}
// // 保存 profile
// Future<void> saveProfile(UserLoginResponseEntity profile) async {
......@@ -109,9 +135,8 @@ class UserStore extends GetxController {
await StorageService.to.remove(STORAGE_USER_TOKEN_KEY);
_isLogin.value = false;
token = '';
_profile.value = IntegralEntity(id: '', username: '', token: '');
saveProfile(IntegralEntity(id: '', username: '', token: ''));
saveProfile(IntegralEntity(
id: '', username: '', token: '', expireTime: null, integral: 0));
Get.toNamed(AppRoutes.Application);
}
}
// baidu yapi
// const SERVER_API_URL = 'https://yapi.baidu.com/mock/41008';
// const SERVER_API_URL = 'https://yapi.ducafecat.tech/mock/11';
const SERVER_API_URL = 'http://101.34.153.228:8083/api';
const SERVER_API_URL = 'http://101.34.153.228:8083/api';//线上
// const SERVER_API_URL = 'http://192.168.2.178:8083/api';
// const SERVER_API_URL = 'http://192.168.110.57:8083/api';
//
......
......@@ -5,26 +5,42 @@
import 'dart:convert';
class LoginEntity {
LoginEntity({required this.username, required this.id, required this.token});
var expireTime;
LoginEntity(
{required this.username,
required this.id,
required this.integral,
required this.token,
this.expireTime});
final String username;
final int id;
final String token;
// final DateTime expireTime;
final int integral;
factory LoginEntity.fromJson(String str) =>
LoginEntity.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
// jsonData['uploadedDate'] != null
// ? DateTime.parse(jsonData['uploadedDate'].toString()).toLocal()
// : null,
factory LoginEntity.fromMap(Map<String, dynamic> json) => LoginEntity(
username: json["username"],
id: json["id"],
token: json['token'],
integral: json['integral'],
expireTime: json['expireTime'] != null
? DateTime.parse(json["expireTime"])
: null,
);
Map<String, dynamic> toMap() => {
"username": username,
"id": id,
"token": token,
"expireTime": expireTime,
"integral": integral
};
}
......@@ -103,11 +103,19 @@ class UserEntity {
class IntegralEntity {
IntegralEntity(
{required this.id, required this.username, required this.token});
{required this.id,
required this.username,
required this.token,
required this.expireTime,
required this.integral});
final dynamic id;
final String username;
final String token;
final dynamic expireTime;
final int integral;
// expireTime: res.expireTime,
// integral: res.integral
factory IntegralEntity.fromJson(String str) =>
IntegralEntity.fromMap(json.decode(str));
......@@ -115,10 +123,19 @@ class IntegralEntity {
String toJson() => json.encode(toMap());
factory IntegralEntity.fromMap(Map<String, dynamic> json) => IntegralEntity(
id: json["id"], username: json["username"], token: json['token']);
id: json["id"],
username: json["username"],
token: json['token'],
integral: json['integral'],
expireTime: DateTime.parse(json["expireTime"]));
Map<String, dynamic> toMap() =>
{"id": id, "username": username, "token": token};
Map<String, dynamic> toMap() => {
"id": id,
"username": username,
"token": token,
"integral": integral,
"expireTime": expireTime
};
}
// To parse this JSON data, do
......
......@@ -79,7 +79,6 @@ class PayListController extends GetxController {
_purchaseUpdatedSubscription =
FlutterInappPurchase.purchaseUpdated.listen((productItem) async {
print("支付1次");
ApplePayEntity? res = await UserAPI.notifyApplePay({
'receipt': productItem?.transactionReceipt,
'userId': UserStore.to.profile.id,
......@@ -91,8 +90,23 @@ class PayListController extends GetxController {
EasyLoading.showSuccess('${res?.message}');
Vibrate.feedback(FeedbackType.success);
EasyLoading.dismiss();
// equired this.id,
// required this.username,
// required this.token,
// required this.expireTime,
// required this.integral
// DateTime.parse(json["expireTime"]))
await UserStore.to.saveProfile(IntegralEntity(
expireTime: res.data['expireTime'] == null
? null
: DateTime.parse(res.data["expireTime"]),
username: res.data['username'],
id: res.data['id'],
integral: res.data['integral'],
token: UserStore.to.token));
Get.back();
await FlutterInappPurchase.instance.clearTransactionIOS();
// Get.offAndToNamed(AppRoutes.Application);
// Get.put(ApplicationController());
} else {
......
......@@ -10,6 +10,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
// import 'package:markdown_widget/markdown_widget.dart';
import 'index.dart';
import 'widgets/widgets.dart';
......@@ -168,14 +170,15 @@ class ProductPage extends GetView<ProductController> {
)
],
)
: Text(
"${idx.text}",
style: TextStyle(
fontSize: 18,
color: Colors.white,
// fontWeight: FontWeight.bold
),
);
: Markdown(data: "${idx.text}");
// Text(
// "${idx.text}",
// style: TextStyle(
// fontSize: 18,
// color: Colors.white,
// // fontWeight: FontWeight.bold
// ),
// );
return text;
}).toList(),
......
......@@ -11,6 +11,7 @@ import 'package:chart/common/widgets/widgets.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:social_login_buttons/social_login_buttons.dart';
import 'package:get/get.dart';
// import 'package:fluwx/fluwx.dart';
import '../../../entity/login_entity.dart';
import '../../../entity/user_entity.dart';
......@@ -46,6 +47,10 @@ class SignInController extends GetxController {
// 密码的控制器
final TextEditingController passController = TextEditingController();
// final a = registerWxApi(
// appId: "wxd930ea5d5a228f5f",
// universalLink: "https://your.univerallink.com/link/");
// print("aaaa");
// final MyRepository repository;
// SignInController({@required this.repository}) : assert(repository != null);
......@@ -69,26 +74,50 @@ class SignInController extends GetxController {
EasyLoading.show(status: '登录中...');
// Map<String, dynamic> routeParams =
// ModalRoute.of(context)!.settings?.arguments as Map<String, dynamic>;
// final DateTime expireTime;
// final int integral;
try {
LoginEntity? res = await UserAPI.login({
"smsCode": codeController.text,
"phone": mobileMemberController.text,
// "id": UserStore.to.profile.id,
});
Vibrate.feedback(FeedbackType.success);
EasyLoading.showSuccess("登录成功");
if (res?.token != null) {
// UserStore.to.handleLogin(res);
EasyLoading.showSuccess("登录成功!");
// Navigator.of(context).pushNamed('/');
} else {
EasyLoading.showError("登录失败");
}
EasyLoading.dismiss();
UserStore.to.handleLogin(IntegralEntity(
id: res.id,
username: res.username,
token: res.token,
expireTime: res.expireTime,
integral: res.integral));
// appLogin
} catch (e) {
Vibrate.feedback(FeedbackType.error);
EasyLoading.showError("登录失败");
EasyLoading.dismiss();
}
// try {
// LoginEntity? res = await UserAPI.login({
// "smsCode": codeController.text,
// "phone": mobileMemberController.text,
// // "id": UserStore.to.profile.id,
// });
// if (res?.token != null) {
// // UserStore.to.handleLogin(res);
// EasyLoading.showSuccess("登录成功!");
// // Navigator.of(context).pushNamed('/');
// } else {
// EasyLoading.showError("登录失败");
// }
// EasyLoading.dismiss();
// } catch (e) {
// EasyLoading.showError("登录失败");
// EasyLoading.dismiss();
// }
// UserLoginRequestEntity params = UserLoginRequestEntity(
// email: emailController.value.text,
......@@ -232,8 +261,12 @@ class SignInController extends GetxController {
EasyLoading.showSuccess("登录成功");
EasyLoading.dismiss();
UserStore.to.handleLogin(
IntegralEntity(id: res.id, username: res.username, token: res.token));
UserStore.to.handleLogin(IntegralEntity(
id: res.id,
username: res.username,
token: res.token,
expireTime: res.expireTime,
integral: res.integral));
// appLogin
} catch (e) {
......
This diff is collapsed.
This diff is collapsed.
......@@ -101,7 +101,7 @@ class UserDetailPage extends GetView<UserDetailController> {
height: 1.5,
fontWeight: FontWeight.bold),
),
margin: EdgeInsets.only(right: 16),
// margin: EdgeInsets.only(right: 16),
)),
Container(
width: 60,
......@@ -116,70 +116,98 @@ class UserDetailPage extends GetView<UserDetailController> {
),
)
]),
Row(children: [
Container(
// width: 80,
height: 25,
padding: EdgeInsets.symmetric(
horizontal: 10, vertical: 4),
margin: EdgeInsets.only(top: 16),
decoration: BoxDecoration(
// rgba(233, 234, 244, 1.00)
color: Color.fromRGBO(255, 255, 255, .2),
borderRadius: BorderRadius.circular(20),
// image: DecorationImage(
// image: Image.asset("assets/images/vip6.png")
// .image,
// fit: BoxFit.contain),
),
child: Row(children: [
Image.asset(
"assets/images/jifen.png",
fit: BoxFit.cover,
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
"100",
style: TextStyle(
color:
Color.fromRGBO(255, 255, 255, 1)),
),
)
]),
),
Container(
// width: 80,
height: 25,
padding: EdgeInsets.symmetric(
horizontal: 10, vertical: 4),
margin: EdgeInsets.only(top: 16, left: 16),
decoration: BoxDecoration(
// rgba(233, 234, 244, 1.00)
color: Color.fromRGBO(255, 255, 255, .2),
borderRadius: BorderRadius.circular(20),
// image: DecorationImage(
// image: Image.asset("assets/images/vip6.png")
// .image,
// fit: BoxFit.contain),
),
child: Row(children: [
Image.asset(
"assets/images/jifen1.png",
fit: BoxFit.cover,
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
"300",
style: TextStyle(
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Obx(() => Container(
// width: 80,
// height: 25,
padding: EdgeInsets.symmetric(
horizontal: 10, vertical: 4),
margin: EdgeInsets.only(top: 16),
decoration: BoxDecoration(
// rgba(233, 234, 244, 1.00)
color:
Color.fromRGBO(255, 255, 255, 1)),
),
)
]),
)
])
Color.fromRGBO(255, 255, 255, .2),
borderRadius: BorderRadius.circular(20),
// image: DecorationImage(
// image: Image.asset("assets/images/vip6.png")
// .image,
// fit: BoxFit.contain),
),
child: c.profile.expireTime != null
? Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset(
"assets/images/jifen.png",
fit: BoxFit.cover,
height: 20,
),
Text(
"会员日期至:${c.profile.expireTime.year}-${c.profile.expireTime.month}-${c.profile.expireTime.day}",
style: TextStyle(
color: Color.fromRGBO(
255, 255, 255, 1)),
)
],
)
: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset(
"assets/images/jifen1.png",
fit: BoxFit.cover,
height: 20,
),
Text(
"积分剩余:",
style: TextStyle(
color: Color.fromRGBO(
255, 255, 255, 1)),
),
Text(
"${c.profile.integral}",
style: TextStyle(
color: Color.fromRGBO(
255, 255, 255, 1)),
),
]),
)),
// Container(
// // width: 80,
// height: 25,
// padding: EdgeInsets.symmetric(
// horizontal: 10, vertical: 4),
// margin: EdgeInsets.only(top: 16, left: 16),
// decoration: BoxDecoration(
// // rgba(233, 234, 244, 1.00)
// color: Color.fromRGBO(255, 255, 255, .2),
// borderRadius: BorderRadius.circular(20),
// // image: DecorationImage(
// // image: Image.asset("assets/images/vip6.png")
// // .image,
// // fit: BoxFit.contain),
// ),
// child: Row(children: [
// Image.asset(
// "assets/images/jifen1.png",
// fit: BoxFit.cover,
// ),
// Container(
// margin: EdgeInsets.only(left: 5),
// child: Text(
// "300",
// style: TextStyle(
// color:
// Color.fromRGBO(255, 255, 255, 1)),
// ),
// )
// ]),
// )
])
],
),
],
......
......@@ -438,6 +438,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
flutter_markdown:
dependency: "direct main"
description:
name: flutter_markdown
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.14"
flutter_parsed_text:
dependency: transitive
description:
......@@ -686,6 +693,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
markdown:
dependency: transitive
description:
name: markdown
url: "https://pub.dartlang.org"
source: hosted
version: "7.0.1"
matcher:
dependency: transitive
description:
......
......@@ -110,6 +110,8 @@ dependencies:
sign_in_with_apple: ^4.3.0
flutter_vibrate: ^1.3.0
social_login_buttons: ^1.0.7
flutter_markdown: ^0.6.14
# package:bubble/bubble.dart
dev_dependencies:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment