提交 47be8d3d authored 作者: yueweilu's avatar yueweilu

1、默认账号密码

2、百度字典
上级 36f5cc28
library bai_dict;
import 'package:flutter/material.dart';
import 'package:flutter_book/utils/index.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
part 'view.dart';
\ No newline at end of file
part of bai_dict;
class BaiDictPage extends StatefulWidget {
final String keyword;
const BaiDictPage({
Key? key,
required this.keyword
}) : super(key: key);
@override
State<BaiDictPage> createState() => _BaiKePageState();
}
class _BaiKePageState extends State<BaiDictPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text('$widget.keyword',style: TextStyle(fontSize: 14.w,fontWeight: Fonts.medium,color: Colours.c3),),
),
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'),
),
),
);
}
}
\ No newline at end of file
...@@ -89,7 +89,7 @@ class LoginController extends GetxController { ...@@ -89,7 +89,7 @@ class LoginController extends GetxController {
/// 测试账号 /// 测试账号
if (kDebugMode) { if (kDebugMode) {
phoneInput.text = '13521054068'; phoneInput.text = '13521054068';
passwordInput.text = '123456'; passwordInput.text = 'zj123456';
} }
super.onInit(); super.onInit();
} }
......
...@@ -53,6 +53,8 @@ class _ReadPageState extends State<ReadPage> { ...@@ -53,6 +53,8 @@ class _ReadPageState extends State<ReadPage> {
onTap: (){ onTap: (){
readController.setShowChat(true); readController.setShowChat(true);
readController.setChatType(0); readController.setChatType(0);
context.pushNamed(Routes.baiDict,queryParameters: {'keyword':'蹦'});
}, },
child: Image.asset('assets/images/chat.png'), child: Image.asset('assets/images/chat.png'),
):null, ):null,
...@@ -102,6 +104,7 @@ class _ReadPageState extends State<ReadPage> { ...@@ -102,6 +104,7 @@ class _ReadPageState extends State<ReadPage> {
// 监听笔记回调 // 监听笔记回调
controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){
Console.log('监听笔记回调------------------------------------------------$args');
readController.noteTitle = args.first; readController.noteTitle = args.first;
readController.setShowChat(true); readController.setShowChat(true);
readController.setChatType(1); readController.setChatType(1);
...@@ -110,11 +113,24 @@ class _ReadPageState extends State<ReadPage> { ...@@ -110,11 +113,24 @@ class _ReadPageState extends State<ReadPage> {
// 监听百科回调 // 监听百科回调
controller.addJavaScriptHandler(handlerName: 'baikeCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'baikeCallBack', callback: (args){
Console.log('监听百科回调------------------------------------------------$args');
context.pushNamed(Routes.baiKe,queryParameters: {'keyword':args.first}); context.pushNamed(Routes.baiKe,queryParameters: {'keyword':args.first});
}); });
// 监听字典回调
controller.addJavaScriptHandler(handlerName: 'dicCallBack', callback: (args){
Console.log('监听百科回调------------------------------------------------$args');
context.pushNamed(Routes.baiDict,queryParameters: {'keyword':args.first});
});
// 监听朗读回调
controller.addJavaScriptHandler(handlerName: 'readCallBack', callback: (args){
Console.log('监听朗读回调------------------------------------------------$args');
});
// 监听讨论回调 // 监听讨论回调
controller.addJavaScriptHandler(handlerName: 'discussCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'discussCallBack', callback: (args){
Console.log('监听讨论回调------------------------------------------------$args');
readController.setShowChat(true); readController.setShowChat(true);
readController.setChatType(0); readController.setChatType(0);
readController.titleInput.text = args.first.toString(); readController.titleInput.text = args.first.toString();
...@@ -122,7 +138,7 @@ class _ReadPageState extends State<ReadPage> { ...@@ -122,7 +138,7 @@ class _ReadPageState extends State<ReadPage> {
// 监听 上一节 下一节 // 监听 上一节 下一节
controller.addJavaScriptHandler(handlerName: 'readCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'readCallBack', callback: (args){
Console.log('监听 上一节 下一节------------------------------------------------$args');
}); });
}, },
......
...@@ -45,6 +45,7 @@ import 'package:go_router/go_router.dart'; ...@@ -45,6 +45,7 @@ import 'package:go_router/go_router.dart';
import '../models/index.dart'; import '../models/index.dart';
import '../pages/ad_detail/index.dart'; import '../pages/ad_detail/index.dart';
import '../pages/bai_dict/index.dart';
import '../pages/bai_ke/index.dart'; import '../pages/bai_ke/index.dart';
import '../pages/read_web/index.dart'; import '../pages/read_web/index.dart';
import '../pages/user_edit_note/index.dart'; import '../pages/user_edit_note/index.dart';
......
...@@ -40,7 +40,8 @@ abstract class Routes { ...@@ -40,7 +40,8 @@ abstract class Routes {
/// 图书馆模块 /// 图书馆模块
// 百科 // 百科
static const baiKe = 'bai_ke'; static const baiKe = 'bai_ke';
// 字典
static const baiDict = 'bai_dict';
/// 书架模块 /// 书架模块
static const creditPoints = 'credit_points'; static const creditPoints = 'credit_points';
...@@ -595,6 +596,17 @@ abstract class Routes { ...@@ -595,6 +596,17 @@ abstract class Routes {
child: AdDetailPage(adModel: state.extra as AdModel,), child: AdDetailPage(adModel: state.extra as AdModel,),
) )
), ),
GoRoute( // 字典
path: '/$baiDict',
name: baiDict,
pageBuilder: (context, state) =>CupertinoPage(
name: state.uri.toString(),
key: state.pageKey,
child: BaiDictPage(
keyword: state.uri.queryParameters['keyword'].toString(),
)
)
),
] ]
); );
......
...@@ -91,9 +91,9 @@ class ValidatorTool { ...@@ -91,9 +91,9 @@ class ValidatorTool {
// 密码 // 密码
static bool isValidPassword(String value) { static bool isValidPassword(String value) {
// RegExp passwordPattern = RegExp(r'^[A-Za-z0-9!@#\$%^&*()_+{}\[\]:;<>,.?~\\/-]{8,12}$'); RegExp passwordPattern = RegExp(r'^[A-Za-z0-9!@#\$%^&*()_+{}\[\]:;<>,.?~\\/-]{8,12}$');
// RegExp passwordPattern = RegExp(r'^(?=.*[A-Za-z])(?=.*\d)(?=.*[~@#%$*()_+{}\[\]:;<>,.?\\/-])[A-Za-z0-9~@#%$*()_+{}\[\]:;<>,.?\\/-]{8,12}$'); // RegExp passwordPattern = RegExp(r'^(?=.*[A-Za-z])(?=.*\d)(?=.*[~@#%$*()_+{}\[\]:;<>,.?\\/-])[A-Za-z0-9~@#%$*()_+{}\[\]:;<>,.?\\/-]{8,12}$');
RegExp passwordPattern = RegExp(r'^\d{6}$'); // RegExp passwordPattern = RegExp(r'^\d{6}$');
return passwordPattern.hasMatch(value); return passwordPattern.hasMatch(value);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论