提交 5e74cffd authored 作者: 岳维路's avatar 岳维路

合并分支 'test' 到 'sim'

Test 查看合并请求 kiwitap/zijing-app!15
assets/images/2.0x/zijing_icon.png

22.5 KB | W: | H:

assets/images/2.0x/zijing_icon.png

13.8 KB | W: | H:

assets/images/2.0x/zijing_icon.png
assets/images/2.0x/zijing_icon.png
assets/images/2.0x/zijing_icon.png
assets/images/2.0x/zijing_icon.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/3.0x/zijing_icon.png

44.1 KB | W: | H:

assets/images/3.0x/zijing_icon.png

26.6 KB | W: | H:

assets/images/3.0x/zijing_icon.png
assets/images/3.0x/zijing_icon.png
assets/images/3.0x/zijing_icon.png
assets/images/3.0x/zijing_icon.png
  • 2-up
  • Swipe
  • Onion skin
assets/images/zijing_icon.png

8.6 KB | W: | H:

assets/images/zijing_icon.png

7.4 KB | W: | H:

assets/images/zijing_icon.png
assets/images/zijing_icon.png
assets/images/zijing_icon.png
assets/images/zijing_icon.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -174,5 +174,32 @@ abstract class CommonAPI {
return OssModel.fromJson(result.data);
}
static Future<String?> refreshToken() async {
Console.log('--------refreshToken----------------');
final result = await HttpService.to.post(
'/v1/members/login/getToken',
params: {
'access_token':StorageService.to.getString(kLocalAccessToken)
}
);
if (result.data is Map) {
final String token = result.data['token'];
final String accessToken = result.data['access_token'];
if(token.isEmpty && accessToken.isEmpty){
UserStore.to.logout();
return null;
}
await Future.wait([
UserStore.to.setToken(result.data['token']),
UserStore.to.setAccessToken(result.data['access_token']),
]);
return result.data['token'];
}
// 在这里执行刷新token的逻辑
// 如果刷新成功,返回新的token;如果刷新失败,返回null
return null;
}
}
\ No newline at end of file
......@@ -8,6 +8,8 @@ import 'package:device_info_plus/device_info_plus.dart';
import '../models/index.dart';
import '../services/index.dart';
import '../store/index.dart';
import '../utils/index.dart';
part 'account.dart';
part 'mine.dart';
part 'course.dart';
......
......@@ -357,6 +357,7 @@ class NoteModel {
this.color,
this.chapterName,
this.isMy,
this.isOpen,
});
NoteModel.fromJson(dynamic json) {
......@@ -372,10 +373,12 @@ class NoteModel {
color = json['color'];
chapterName = json['chapter_name'];
isMy = json['is_my'];
isOpen = json['is_open'];
}
num? notesId;
num? types;
num? isMy;
num? isOpen;
num? chapterId;
String? content;
String? positioning;
......@@ -388,6 +391,7 @@ class NoteModel {
num? notesId,
num? types,
num? isMy,
num? isOpen,
num? chapterId,
String? content,
String? positioning,
......@@ -399,6 +403,7 @@ class NoteModel {
notesId: notesId ?? this.notesId,
types: types ?? this.types,
isMy: isMy ?? this.isMy,
isOpen: isOpen ?? this.isOpen,
chapterId: chapterId ?? this.chapterId,
content: content ?? this.content,
positioning: positioning ?? this.positioning,
......@@ -412,6 +417,7 @@ class NoteModel {
map['notes_id'] = notesId;
map['types'] = types;
map['is_my'] = isMy;
map['is_open'] = isOpen;
map['chapter_id'] = chapterId;
map['content'] = content;
map['positioning'] = positioning;
......
......@@ -22,8 +22,11 @@ class _BaiKePageState extends State<BaiDictPage> {
),
body: InAppWebView(
initialUrlRequest: URLRequest(
// url: Uri.parse('https://hanyu.baidu.com/hanyu-page/zici/s?from=aladdin&query=${widget.keyword}&srcid=51368&wd=${widget.keyword}&ptype=zici'),
url: WebUri.uri(Uri.parse('https://hanyu.baidu.com/hanyu-page/zici/s?from=aladdin&query=${widget.keyword}&srcid=51368&wd=${widget.keyword}&ptype=zici'))
url: WebUri.uri(Uri.parse('https://dict.baidu.com/s?wd=${widget.keyword}'))
),
initialSettings:InAppWebViewSettings(
// http的请求也不做限制
mixedContentMode:MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW
),
),
);
......
......@@ -24,6 +24,10 @@ class _BaiKePageState extends State<BaiKePage> {
// url: Uri.parse('https://baike.baidu.com/item/${widget.keyword}?fromModule=lemma_search-box'),
url: WebUri.uri(Uri.parse('https://baike.baidu.com/item/${widget.keyword}?fromModule=lemma_search-box'))
),
initialSettings:InAppWebViewSettings(
// http的请求也不做限制
mixedContentMode:MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW
),
),
);
}
......
......@@ -52,10 +52,9 @@ class BuildCounter extends StatelessWidget {
GestureDetector(
onTap: () async {
if (controller.num > 0){
final result = await context.pushNamed(Routes.bookPay,extra: controller.buy);
if (result == true) {
context.pushNamed(Routes.bookPay,extra: controller.buy).then((value){
controller.onRefresh();
}
});
}
},
child: Container(
......
......@@ -115,7 +115,7 @@ class _ChangePwdPageState extends State<ChangePwdPage> {
),
Container(
margin: EdgeInsets.only(left: 5.w,top: 5.w),
child: Text('密码必须是8-20个英文字母、数字或符号(除空格)',style: TextStyle(fontSize: 10.w,color: Colours.c9),),
child: Text('密码必须是数字、字母、特殊符号两种及以上8-12位的组合',style: TextStyle(fontSize: 10.w,color: Colours.c9),),
),
Gaps.vGaps40,
CustomGradientButton(
......
......@@ -38,10 +38,9 @@ class _CoursePageState extends State<CoursePage> {
),
GestureDetector(
onTap: () async{
final result = await context.pushNamed(Routes.msgs);
if (result == true) {
context.pushNamed(Routes.msgs).then((value){
controller.getNums();
}
});
},
child: badges.Badge(
position: badges.BadgePosition.topEnd(top: -5.w, end: 0),
......@@ -112,10 +111,9 @@ class _CoursePageState extends State<CoursePage> {
onTapContinue: () async{
BookDetailModel bookDetails = await controller.getBookDetails(model.bookId.toString());
if(context.mounted){
final result = await context.pushNamed(Routes.web,queryParameters: {'book_id': bookDetails.bookId.toString(),'chapter_id': bookDetails.chapterId.toString(),'chapter_name':bookDetails.chapterName.toString()},extra:bookDetails);
if (result == true){
context.pushNamed(Routes.web,queryParameters: {'book_id': bookDetails.bookId.toString(),'chapter_id': bookDetails.chapterId.toString(),'chapter_name':bookDetails.chapterName.toString()},extra:bookDetails).then((value){
controller.getNums();
}
});
}
},
),
......
......@@ -89,7 +89,7 @@ class LoginController extends GetxController {
/// 测试账号
if (kDebugMode) {
phoneInput.text = '18810760819';
passwordInput.text = '12345678';
passwordInput.text = '1234567m';
// phoneInput.text = '17311837355';
// passwordInput.text = '12345678';
}
......
......@@ -67,7 +67,7 @@ class _LoginPageState extends State<LoginPage> {
SizedBox(height: 120.w,),
Container(
width: 180.w,
height: 50.w,
height: 42.w,
// color: Colors.cyan,
child: Image.asset(
'assets/images/zijing_icon.png',
......
......@@ -43,11 +43,9 @@ class _MinePageState extends State<MinePage> {
),
GestureDetector(
onTap: () async{
final result = await context.pushNamed(Routes.msgs);
print('---------------------------------1111$result');
if (result == true){
context.pushNamed(Routes.msgs).then((value) {
controller.getNums();
}
});
},
child: badges.Badge(
position: badges.BadgePosition.topEnd(top: -5.w, end: 0),
......@@ -78,20 +76,18 @@ class _MinePageState extends State<MinePage> {
Container(
margin: EdgeInsets.symmetric(horizontal: 10.w),
child: BuildUser(userInfo:controller.userInfo,onTap: () async{
final result = await context.pushNamed(Routes.userInfo,extra: controller.userInfo);
if (result == true){
context.pushNamed(Routes.userInfo,extra: controller.userInfo).then((value){
controller.getInfo();
}
});
},),
),
Gaps.vGaps10,
Container(
margin: EdgeInsets.symmetric(horizontal: 2.2.w),
child: BuildRead(items: controller.reads,onTap: (ReadModel model) async{
final result = await context.pushNamed(model.link??'');
if (result == true){
context.pushNamed(model.link??'').then((value){
controller.getInfo();
}
});
}),
),
controller.ads.isNotEmpty?Gaps.vGaps5:const SizedBox(),
......@@ -106,12 +102,11 @@ class _MinePageState extends State<MinePage> {
} ,
),
):const SizedBox(),
Gaps.vGaps15,
controller.ads.isNotEmpty?Gaps.vGaps15:Gaps.vGaps5,
BuildAccount(items:controller.accounts,onTap: (ReadModel model) async{
final result = await context.pushNamed(model.link??'');
if (result == true){
context.pushNamed(model.link??'').then((value){
controller.getInfo();
}
});
},),
Gaps.vGaps10,
Container(
......@@ -134,10 +129,9 @@ class _MinePageState extends State<MinePage> {
children: [
GestureDetector(
onTap:() async {
final result = await context.pushNamed(Routes.security,extra: controller.userInfo);
if (result == true){
context.pushNamed(Routes.security,extra: controller.userInfo).then((value){
controller.getInfo();
}
});
}, child: _buildItem('账户安全')
),
Container(color: Colours.cLine,margin: EdgeInsets.symmetric(horizontal: 15.w),height: 1.w,),
......
......@@ -28,6 +28,8 @@ class BuildRead extends StatelessWidget {
// top: 10.w,
left: 0,
right: 0,
top: 0,
bottom: 0,
child: Container(
padding: EdgeInsets.symmetric(vertical: 16.5.w,horizontal: 8),
color: Colors.transparent,
......@@ -50,19 +52,13 @@ class BuildRead extends StatelessWidget {
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
if (model.link != null){
if (model.link != Routes.love){
context.pushNamed(model.link!);
}
else{
if (onTap !=null) onTap!(model);
}
}
if (onTap !=null) onTap!(model);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(model.value,style: TextStyle(fontSize: 18.w,height: 1.6.w,fontWeight: Fonts.medium,color: Colours.c3),),
Text(model.name,style: TextStyle(fontSize: 13.w,height:1.6.w,color: Colours.c6))
Text(model.value,style: TextStyle(fontSize: 18.w,height: 1.5.w,fontWeight: Fonts.medium,color: Colours.c3),),
Text(model.name,style: TextStyle(fontSize: 13.w,height:1.5.w,color: Colours.c6))
],
),
),
......
......@@ -468,8 +468,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
else if(chatType == 1){
if(contentInput.text.isEmpty && discussInputImages.isEmpty && discussInputAudios.isEmpty){
Toast.show('笔记必须填写内容或选择图片或音频');
return false;
}
return false;
}
// 有网情况下 先直传oss 获取到url
......@@ -852,7 +852,11 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
return directory!.path;
}
/// 刷新token
Future<String?> refreshToken() async {
final result = await CommonAPI.refreshToken();
return result;
}
/// 获取目录信息
void _getChapters() async {
chapters = await LibraryAPI.chapters(bookId: bookId);
......@@ -991,6 +995,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 当应用程序从后台切换到前台并变为活动状态时调用。这通常在用户从其他应用程序返回到你的应用程序时发生
void onResumed(){
Console.log('onResumed');
webViewController.evaluateJavascript(source: 'activeState("1");');
// open
// 上报开始阅读时间
_addReadTime(type: 'open');
......@@ -999,12 +1004,14 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
void onPaused(){
// close
Console.log('onPaused');
webViewController.evaluateJavascript(source: 'activeState("0");');
// 上报阅读结束时间
_addReadTime(type: 'close');
}
// 当应用程序失去焦点但仍然可见时调用。通常,在用户切换到另一个应用程序或显示系统对话框时,应用程序可能会处于非活动状态,但仍然是可见的
void onInactive(){
Console.log('onInactive');
webViewController.evaluateJavascript(source: 'activeState("0");');
// close
// 上报阅读结束时间
_addReadTime(type: 'close');
......@@ -1012,6 +1019,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
// 当应用程序被挂起,可能是由于用户关闭应用程序或系统资源不足时调用。在这个状态下,应用程序的代码将不再运行,并且可能被系统终止
void onDetached(){
Console.log('onDetached');
webViewController.evaluateJavascript(source: 'activeState("0");');
// close
// 上报阅读结束时间
_addReadTime(type: 'close');
......
......@@ -78,6 +78,8 @@ class _ReadPageState extends State<ReadPage> {
),
initialSettings:InAppWebViewSettings(
clearCache:true,
// http的请求也不做限制
mixedContentMode:MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW
),
// initialOptions: InAppWebViewGroupOptions(
// crossPlatform: InAppWebViewOptions(
......@@ -87,7 +89,8 @@ class _ReadPageState extends State<ReadPage> {
contextMenu: ContextMenu(
// options: ContextMenuOptions(hideDefaultSystemContextMenuItems: true),
settings: ContextMenuSettings(
hideDefaultSystemContextMenuItems: true
hideDefaultSystemContextMenuItems: true,
)
),
onWebViewCreated: (InAppWebViewController controller){
......@@ -110,18 +113,18 @@ class _ReadPageState extends State<ReadPage> {
Console.log('传给前端的参数--------------------------------$str');
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
// // 添加单击事件
// controller.evaluateJavascript(source: '''
// document.addEventListener('click', function() {
// window.flutter_inappwebview.callHandler('onTap');
// });
// ''');
//
// // 监听js单击回调
// controller.addJavaScriptHandler(handlerName: 'onTap', callback: (args){
// readController.setShow(readController.show);
//
// });
// 添加单击事件
controller.evaluateJavascript(source: '''
document.addEventListener('click', function() {
window.flutter_inappwebview.callHandler('onTap');
});
''');
// 监听js单击回调
controller.addJavaScriptHandler(handlerName: 'onTap', callback: (args){
readController.setShow(readController.show);
});
// 监听笔记回调
controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){
......@@ -140,7 +143,7 @@ class _ReadPageState extends State<ReadPage> {
// 监听字典回调
controller.addJavaScriptHandler(handlerName: 'dictCallBack', callback: (args){
Console.log('监听百科回调------------------------------------------------$args');
Console.log('监听字典回调------------------------------------------------$args');
context.pushNamed(Routes.baiDict,queryParameters: {'keyword':args.first});
});
......@@ -206,10 +209,10 @@ class _ReadPageState extends State<ReadPage> {
Console.log('监听 上一节 下一节------------------------------------------------$args');
});
// 监听 双击回调
controller.addJavaScriptHandler(handlerName: 'dbClickCallBack', callback: (args){
readController.setShow(readController.show);
});
// // 监听 双击回调
// controller.addJavaScriptHandler(handlerName: 'dbClickCallBack', callback: (args){
// readController.setShow(readController.show);
// });
// 阅读页内容中的 外部链接
controller.addJavaScriptHandler(handlerName: 'openLinkCallback', callback: (args){
......@@ -246,6 +249,16 @@ class _ReadPageState extends State<ReadPage> {
context.pushNamed(Routes.scaleImage,queryParameters: params);
});
// 前端 token过去回调
controller.addJavaScriptHandler(handlerName: 'refreshTokenCallback', callback: (args) async {
final result = await readController.refreshToken();
Map<String, dynamic> param = {
'token': result,
};
String jsonStr = jsonEncode(param);
controller.evaluateJavascript(source: 'refreshTokenSuccess($jsonStr)');
});
/// 离线需要参数
// //
......
......@@ -198,8 +198,13 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
);
widget.controller.addDiscussInputImages(assets!.path);
},
child: Image.asset('assets/images/read_add_img.png')),
Gaps.hGaps10,
child: Container(
// color: Colors.red,
width: 25,
height: 25,
child: Image.asset('assets/images/read_add_img.png',fit: BoxFit.contain,)),
),
Gaps.hGaps15,
widget.controller.chatType ==0?const SizedBox():GestureDetector(
onTap: () async {
if(widget.controller.startRecording){
......@@ -210,7 +215,12 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
}
},
child: Image.asset(widget.controller.startRecording?'assets/images/stop.png':'assets/images/read_add_audio.png')
child: Container(
// color: Colors.red,
width: 23,
height: 23,
child: Image.asset(widget.controller.startRecording?'assets/images/stop.png':'assets/images/read_add_audio.png',fit: BoxFit.contain,),
)
),
widget.controller.chatType ==0?const SizedBox():GestureDetector(
onTap: (){
......@@ -219,10 +229,13 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Gaps.hGaps10,
Image.asset(widget.controller.isPublic?'assets/images/pay_check.png':'assets/images/pay_uncheck.png'),
Gaps.hGaps15,
SizedBox(
width: 15,
height: 15,
child: Image.asset(widget.controller.isPublic?'assets/images/pay_check.png':'assets/images/public.png',fit: BoxFit.contain,),),
SizedBox(width: 3.w,),
Text('公开',style: TextStyle(fontSize: 13.w,height: 1.3,color: Colours.c9),)
Text('公开',style: TextStyle(fontSize: 15.w,height: 1.3,color: Colours.c9),)
],
),
)
......
......@@ -144,7 +144,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
controller.delNotes(noteModel: model, bookId:widget.bookDetailModel.bookId.toString());
},
onTapEdit: (){
context.pushNamed(Routes.editNote,extra: model,queryParameters: {'book_id':widget.bookDetailModel.bookId});
context.pushNamed(Routes.editNote,extra: model,queryParameters: {'book_id':widget.bookDetailModel.bookId.toString()});
},
);
}
......
......@@ -68,7 +68,7 @@ class _ResetPwdPageState extends State<ResetPwdPage> {
),
Container(
margin: EdgeInsets.only(left: 5.w,top: 5.w),
child: Text('密码必须是8-20个英文字母、数字或符号(除空格)',style: TextStyle(fontSize: 10.w,color: Colours.c9),),
child: Text('密码必须是数字、字母、特殊符号两种及以上8-12位的组合',style: TextStyle(fontSize: 10.w,color: Colours.c9),),
),
Gaps.vGaps40,
CustomGradientButton(
......
......@@ -168,7 +168,7 @@ class _StudyReportPageState extends State<StudyReportPage> {
RichText(text: TextSpan(
children: [
TextSpan(text: '测评总数',style: TextStyle(fontSize: 14.w,height: 1.5,color: Colours.c9),),
WidgetSpan(child: SizedBox(width: 36.w),),
WidgetSpan(child: SizedBox(width: 21.5.w),),
TextSpan(text:controller.model.questionAllNums !=null? controller.model.questionAllNums.toString():'' ,style: TextStyle(fontSize: 21.w,height: 1.5,color: Colours.c3,fontWeight: Fonts.medium)),
TextSpan(text: '/条',style: TextStyle(fontSize: 13.w,height: 1.5,color: Colours.c3)),
]
......@@ -180,7 +180,7 @@ class _StudyReportPageState extends State<StudyReportPage> {
children: [
RichText(text: TextSpan(
children: [
TextSpan(text: '评论正确率',style: TextStyle(fontSize: 14.w,height: 1.5,color: Colours.c9),),
TextSpan(text: '测评正确率',style: TextStyle(fontSize: 14.w,height: 1.5,color: Colours.c9),),
WidgetSpan(child: SizedBox(width: 8.w),),
TextSpan(text:controller.model.questionAccuracy!=null?controller.model.questionAccuracy.toString():'' ,style: TextStyle(fontSize: 21.w,height: 1.5,color: Colours.c3,fontWeight: Fonts.medium)),
TextSpan(text: '%',style: TextStyle(fontSize: 13.w,height: 1.5,color: Colours.c3)),
......
......@@ -10,70 +10,64 @@ class UserCoinPage extends StatefulWidget {
class _UserCoinPageState extends State<UserCoinPage> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserCoinController>(
init: UserCoinController(),
builder: (controller) => Scaffold(
appBar: CustomAppBar(
title: const Text('紫荆币'),
actions: [
GestureDetector(
onTap: (){
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(8.w)),
),
builder: (BuildContext context) {
return const CoinRechargePage();
},
).then((value) {
controller.onRefresh();
});
},
child: Text('充值',style: TextStyle(color: Colours.c3,fontSize: 14.w,height: 1.5,fontWeight: Fonts.medium),)
)
],
),
body: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: controller.coins.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):Container(
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFFC7C7C7).withOpacity(0.5),
offset: Offset(3.w, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
return GetBuilder<UserCoinController>(
init: UserCoinController(),
builder: (controller) => Scaffold(
appBar: CustomAppBar(
title: const Text('紫荆币'),
actions: [
GestureDetector(
onTap: (){
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(8.w)),
),
],
),
child: ListView.builder(
itemBuilder: (BuildContext context, int index){
return BuildCell(model: controller.coins[index],);
},
itemCount: controller.coins.length,
),
builder: (BuildContext context) {
return const CoinRechargePage();
},
).then((value) {
controller.onRefresh();
});
},
child: Text('充值',style: TextStyle(color: Colours.c3,fontSize: 14.w,height: 1.5,fontWeight: Fonts.medium),)
)
],
),
body: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: controller.coins.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):Container(
margin: EdgeInsets.all(10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFFC7C7C7).withOpacity(0.5),
offset: Offset(3.w, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
),
],
),
child: ListView.builder(
itemBuilder: (BuildContext context, int index){
return BuildCell(model: controller.coins[index],);
},
itemCount: controller.coins.length,
),
),
),
......
......@@ -11,56 +11,50 @@ class UserCouponPage extends StatefulWidget {
class _UserCouponPageState extends State<UserCouponPage> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserCouponController>(
init: UserCouponController(),
builder:(controller) => Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('优惠券'),
),
body: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: controller.coupons.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):ListView.builder(
itemBuilder: (BuildContext context, int index){
return BuildItem(model: controller.coupons[index],);
// if (index == controller.coupons.length){
// return GestureDetector(
// onTap: (){
// // controller.getOverCoupons();
// },
// child: Container(
// alignment: Alignment.center,
// height: 40.w,
// // color: Colors.cyan,
// child: Text('过期优惠券'),
// ),
// );
// }
// else {
// return BuildItem(model: controller.coupons[index],);
// }
},
// itemCount: controller.coupons.length +1,
itemCount: controller.coupons.length,
return GetBuilder<UserCouponController>(
init: UserCouponController(),
builder:(controller) => Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('优惠券'),
),
body: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: controller.coupons.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):ListView.builder(
itemBuilder: (BuildContext context, int index){
return BuildItem(model: controller.coupons[index],);
// if (index == controller.coupons.length){
// return GestureDetector(
// onTap: (){
// // controller.getOverCoupons();
// },
// child: Container(
// alignment: Alignment.center,
// height: 40.w,
// // color: Colors.cyan,
// child: Text('过期优惠券'),
// ),
// );
// }
// else {
// return BuildItem(model: controller.coupons[index],);
// }
},
// itemCount: controller.coupons.length +1,
itemCount: controller.coupons.length,
),
),
),
......
......@@ -26,6 +26,7 @@ class UserEditNoteController extends GetxController {
@override
void onInit() {
isPublic = model.isOpen ==1?true:false;
super.onInit();
}
......@@ -220,11 +221,17 @@ class UserEditNoteController extends GetxController {
'image':images
};
String isOpen = '0';
if(isPublic){
isOpen = '1';
}
final result = MineAPI.editNotes(
content: model.content??'',
notesId: model.notesId.toString(),
bookId: bookId,
noteContent: jsonEncode(contentMap)
noteContent: jsonEncode(contentMap),
isOpen: isOpen
);
return result;
}
......
......@@ -10,54 +10,48 @@ class UserLovePage extends StatefulWidget {
class _UserLovePageState extends State<UserLovePage> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserLoveController>(
init: UserLoveController(),
builder:(controller) => Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('我的收藏'),
),
body: Container(
color: Colours.cF9,
child: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: controller.loves.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):ListView.builder(
itemBuilder: (BuildContext context, int index){
CourseModel model = controller.loves[index];
return GestureDetector(
onTap: (){
if(model.status == 0 && model.isHave == 0){
Toast.show('书籍已下架');
}
else{
context.pushNamed(Routes.bookDetail,queryParameters: {'book_id':model.bookId.toString()});
}
},
child: BuildItem(model: model,onTap: (){
controller.unLoved(bookId: model.bookId.toString());
},),
);
},
itemCount: controller.loves.length,
return GetBuilder<UserLoveController>(
init: UserLoveController(),
builder:(controller) => Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('我的收藏'),
),
body: Container(
color: Colours.cF9,
child: CustomPullScrollView(
controller: controller.refreshController,
onRefresh: controller.onRefresh,
onLoading: controller.onLoading,
child: controller.loves.isEmpty?Container(
padding: EdgeInsets.only(top: 110.w),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 152.w, width: 195.w,
child: Image.asset( 'assets/images/none.png',),),
SizedBox(height: 13.w,),
],
),
):ListView.builder(
itemBuilder: (BuildContext context, int index){
CourseModel model = controller.loves[index];
return GestureDetector(
onTap: (){
if(model.status == 0 && model.isHave == 0){
Toast.show('书籍已下架');
}
else{
context.pushNamed(Routes.bookDetail,queryParameters: {'book_id':model.bookId.toString()});
}
},
child: BuildItem(model: model,onTap: (){
controller.unLoved(bookId: model.bookId.toString());
},),
);
},
itemCount: controller.loves.length,
),
),
),
......
......@@ -22,57 +22,51 @@ class _UserNotesDesPageState extends State<UserNotesDesPage> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('笔记详情'),
),
body: DefaultTabController(
length: tabs.length,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BuildItem(model: widget.model),
ClipRRect(
borderRadius:const BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
child: Container(
width: double.infinity,
color: Colors.white,
height: 35.w,
child: TabBar(
indicator: UnderlineTabIndicator(
borderRadius: BorderRadius.circular(0.75),
borderSide: BorderSide(width: 1.5.w,color: AppTheme.primary),
insets: EdgeInsets.symmetric(horizontal: 22.w), // 设置标签下面指示器的水平内边距
),
labelPadding: EdgeInsets.symmetric(horizontal: 20.w),
indicatorSize: TabBarIndicatorSize.label,
indicatorColor: AppTheme.primary,
indicatorWeight: 1.5,
labelStyle: TextStyle(color: AppTheme.primary,fontSize: 15.w,height: 1.5,fontWeight: Fonts.medium),
unselectedLabelColor: Colours.c9,
unselectedLabelStyle: TextStyle(color: Colours.c9,fontSize: 15.w,height: 1.5),
isScrollable: true,
tabs: tabs
),
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('笔记详情'),
),
body: DefaultTabController(
length: tabs.length,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BuildItem(model: widget.model),
ClipRRect(
borderRadius:const BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
child: Container(
width: double.infinity,
color: Colors.white,
height: 35.w,
child: TabBar(
indicator: UnderlineTabIndicator(
borderRadius: BorderRadius.circular(0.75),
borderSide: BorderSide(width: 1.5.w,color: AppTheme.primary),
insets: EdgeInsets.symmetric(horizontal: 22.w), // 设置标签下面指示器的水平内边距
),
labelPadding: EdgeInsets.symmetric(horizontal: 20.w),
indicatorSize: TabBarIndicatorSize.label,
indicatorColor: AppTheme.primary,
indicatorWeight: 1.5,
labelStyle: TextStyle(color: AppTheme.primary,fontSize: 15.w,height: 1.5,fontWeight: Fonts.medium),
unselectedLabelColor: Colours.c9,
unselectedLabelStyle: TextStyle(color: Colours.c9,fontSize: 15.w,height: 1.5),
isScrollable: true,
tabs: tabs
),
),
Expanded(
child: TabBarView(
children: List.generate(tabs.length, (index){
return BuildListPage(tag:'$index',model:widget.model);
})
),
)
],
)
),
),
Expanded(
child: TabBarView(
children: List.generate(tabs.length, (index){
return BuildListPage(tag:'$index',model:widget.model);
})
),
)
],
)
),
);
);
}
}
......@@ -43,29 +43,23 @@ class _UserOrderState extends State<UserOrderPage>
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: Scaffold(
appBar: AppBar(
title: Container(
padding: EdgeInsets.only(right: 10.w),
child: CustomInputSearch(
controller: searchController,
readOnly: true,
hintText: '搜索我的订单',
onTap: () {
context.pushNamed(Routes.orderSearch);
},
),
return Scaffold(
appBar: AppBar(
title: Container(
padding: EdgeInsets.only(right: 10.w),
child: CustomInputSearch(
controller: searchController,
readOnly: true,
hintText: '搜索我的订单',
onTap: () {
context.pushNamed(Routes.orderSearch);
},
),
titleSpacing: 0,
),
body: _buildBody(),
titleSpacing: 0,
),
body: _buildBody(),
);
}
......
......@@ -12,10 +12,10 @@ class BuiltAwaiting extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: () async {
final result = await context.pushNamed(Routes.orderAwaiting,
queryParameters: {'orderNum': model.ordersnum});
if (result == true) {
controller.onRefresh(); }
context.pushNamed(Routes.orderAwaiting,
queryParameters: {'orderNum': model.ordersnum}).then((value){
controller.onRefresh();
});
},
child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.w),
......
......@@ -18,25 +18,22 @@ class BuiltCoin extends StatelessWidget {
return GestureDetector(
onTap: () async {
if(model.status == 1){
final result = await context.pushNamed(Routes.orderCoinAwaiting,
queryParameters: {'orderNum': model.ordersnum});
if(result==true){
context.pushNamed(Routes.orderCoinAwaiting,
queryParameters: {'orderNum': model.ordersnum}).then((value){
controller.onRefresh();
}
});
}
else if(model.status == 2){
final result = await context.pushNamed(Routes.orderCoinCancel,
queryParameters: {'orderNum': model.ordersnum});
if(result==true){
context.pushNamed(Routes.orderCoinCancel,
queryParameters: {'orderNum': model.ordersnum}).then((value){
controller.onRefresh();
}
});
}
else if(model.status == 3){
final result = await context.pushNamed(Routes.orderCoinCompleted,
queryParameters: {'orderNum': model.ordersnum});
if(result==true){
context.pushNamed(Routes.orderCoinCompleted,
queryParameters: {'orderNum': model.ordersnum}).then((value){
controller.onRefresh();
}
});
}
},
child: Container(
......
......@@ -15,10 +15,10 @@ class BuiltCompleted extends StatelessWidget {
return GestureDetector(
onTap: ()
async {
final result = await context.pushNamed(Routes.orderCompleted,
queryParameters: {'orderNum': model.ordersnum});
if (result == true) {
controller.onRefresh(); }
context.pushNamed(Routes.orderCompleted,
queryParameters: {'orderNum': model.ordersnum}).then((value){
controller.onRefresh();
});
},
child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 10.w),
......@@ -165,14 +165,13 @@ class BuiltCompleted extends StatelessWidget {
child: Center(
child: GestureDetector(
onTap: () async {
final result = await context.pushNamed(Routes.orderEvaluate,
context.pushNamed(Routes.orderEvaluate,
extra: OrderInfoModel(),
queryParameters: {
'orderNum': model.ordersnum
});
if (result == true) {
}).then((value){
controller.onRefresh();
}
});
},
child: Text(
judgeComments() == 1 ? '去评价' : "继续评价",
......@@ -307,14 +306,14 @@ class BuiltCompleted extends StatelessWidget {
child: Center(
child: GestureDetector(
onTap: () async {
final result = await context.pushNamed(Routes.orderEvaluate,
context.pushNamed(Routes.orderEvaluate,
extra: OrderInfoModel(),
queryParameters: {
'orderNum': model.ordersnum
});
if (result == true) {
controller.onRefresh();
}
}).then((value){
controller.onRefresh();
});
},
child: Text(
judgeComments() == 1 ? '去评价' : "继续评价",
......
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论