提交 5005e23c authored 作者: 岳维路's avatar 岳维路

合并分支 'test' 到 'sim'

地址 查看合并请求 kiwitap/zijing-app!1
......@@ -356,6 +356,7 @@ class NoteModel {
this.noteContent,
this.color,
this.chapterName,
this.isMy,
});
NoteModel.fromJson(dynamic json) {
......@@ -368,9 +369,11 @@ class NoteModel {
noteContent = json['note_content'] != null ? NoteContentModel.fromJson(json['note_content']) : null;
color = json['color'];
chapterName = json['chapter_name'];
isMy = json['is_my'];
}
num? notesId;
num? types;
num? isMy;
num? chapterId;
String? content;
String? positioning;
......@@ -382,6 +385,7 @@ class NoteModel {
NoteModel copyWith({
num? notesId,
num? types,
num? isMy,
num? chapterId,
String? content,
String? positioning,
......@@ -392,6 +396,7 @@ class NoteModel {
NoteModel(
notesId: notesId ?? this.notesId,
types: types ?? this.types,
isMy: isMy ?? this.isMy,
chapterId: chapterId ?? this.chapterId,
content: content ?? this.content,
positioning: positioning ?? this.positioning,
......@@ -404,6 +409,7 @@ class NoteModel {
final map = <String, dynamic>{};
map['notes_id'] = notesId;
map['types'] = types;
map['is_my'] = isMy;
map['chapter_id'] = chapterId;
map['content'] = content;
map['positioning'] = positioning;
......@@ -530,6 +536,7 @@ class DiscussModel {
this.personName,
this.commentAll,
this.personPic,
this.isMy,
});
DiscussModel.fromJson(dynamic json) {
......@@ -550,6 +557,8 @@ class DiscussModel {
replacePersonPic = json['replace_person_pic'];
personName = json['person_name'];
personPic = json['person_pic'];
isMy = json['is_my'];
if (json['comment_all'] != null) {
commentAll = [];
json['comment_all'].forEach((v) {
......@@ -569,6 +578,7 @@ class DiscussModel {
num? personId;
num? goodNum;
num? replyNum;
num? isMy;
String? createTime;
String? replacePersonName;
String? replacePersonPic;
......@@ -588,6 +598,7 @@ class DiscussModel {
num? personId,
num? goodNum,
num? replyNum,
num? isMy,
String? createTime,
String? replacePersonName,
String? replacePersonPic,
......@@ -607,6 +618,7 @@ class DiscussModel {
personId: personId ?? this.personId,
goodNum: goodNum ?? this.goodNum,
replyNum: replyNum ?? this.replyNum,
isMy: isMy ?? this.isMy,
createTime: createTime ?? this.createTime,
replacePersonName: replacePersonName ?? this.replacePersonName,
replacePersonPic: replacePersonPic ?? this.replacePersonPic,
......@@ -631,6 +643,7 @@ class DiscussModel {
map['person_id'] = personId;
map['good_num'] = goodNum;
map['reply_num'] = replyNum;
map['is_my'] = isMy;
map['create_time'] = createTime;
map['replace_person_name'] = replacePersonName;
map['replace_person_pic'] = replacePersonPic;
......
......@@ -81,6 +81,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
late TextEditingController searchInput = TextEditingController();
just_audio.AudioPlayer audioPlayer = just_audio.AudioPlayer();
///------------------------------------------ 页面 生命周期--------------------------------------------------------
......@@ -316,7 +318,6 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
}
// 停止录音
void stopRecorder() async{
just_audio.AudioPlayer audioPlayer = just_audio.AudioPlayer();
startRecording = false;
final path = await _mRecorder.stopRecorder();
var duration = await audioPlayer.setFilePath(path!);
......@@ -354,6 +355,27 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
clearDiscussAudios();
}
// 播放音频
void playAudio(AudioModel audioModel){
if(audioPlayer.playerState.playing){
audioPlayer.stop();
audioModel.currentDuration = '0:00:00';
// if(currentPlayMediaModel.id == mediaModel.id){
// return;
// }
}
// 本地音频
audioPlayer.setFilePath(audioModel.path);
audioPlayer.play();
audioPlayer.positionStream.listen((position) {
String temp = Tools.formatDuration(position);
Console.log('播放时间---------------------$temp');
audioModel.currentDuration = temp;
update();
});
// currentPlayMediaModel = mediaModel;
}
// 添加讨论图片
void addDiscussInputImages(String path){
discussInputImages.add(path);
......@@ -874,4 +896,5 @@ class AudioModel {
AudioModel({required this.path, required this.duration});
String path;
String duration;
late String currentDuration;
}
......@@ -101,6 +101,16 @@ class NoteController extends GetxController {
bookId: bookDetailModel.bookId.toString(),
chapterId: chapterId
);
for(NoteModel noteModel in result){
if(noteModel.noteContent!.audio!.isNotEmpty){
for(MediaModel mediaModel in noteModel.noteContent!.audio!){
Duration? duration = await just_audio.AudioPlayer().setUrl(mediaModel.content??'');
mediaModel.duration = Tools.formatDuration(duration!);
}
}
}
// 如果是刷新 清理数据
if (isRefresh) notes.clear();
notes.addAll(result);
......
......@@ -61,7 +61,7 @@ class _ReadCategoryPageState extends State<ReadCategoryPage> {
child: CustomInputSearch(
controller: widget.controller.searchInput,
readOnly: false,
hintText: '搜索全文---目录',
hintText: '搜索全文',
onTap: () {
// context.pushNamed(Routes.msgs);
},
......
......@@ -62,7 +62,7 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
child: CustomInputSearch(
controller: controller.searchInput,
readOnly: false,
hintText: '搜索全文---讨论',
hintText: '搜索全文',
onTap: () {
// context.pushNamed(Routes.msgs);
},
......
......@@ -125,7 +125,12 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (BuildContext context, int index){
return Container(
AudioModel audioModel= widget.controller.discussInputAudios[index];
return GestureDetector(
onTap: (){
widget.controller.playAudio(audioModel);
},
child: Container(
height: 20.w,
margin: EdgeInsets.only(right: 130.w),
child: Container(
......@@ -144,6 +149,7 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
],
),
),
),
);
},
itemCount: widget.controller.discussInputAudios.length,
......
......@@ -60,7 +60,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
child: CustomInputSearch(
controller: controller.searchInput,
readOnly: false,
hintText: '搜索全文---笔记',
hintText: '搜索全文',
onTap: () {
// context.pushNamed(Routes.msgs);
},
......
......@@ -117,7 +117,7 @@ class _BuildDiscussState extends State<BuildDiscuss> {
type ==0? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(model.content?.text?.content??'审核中',style: TextStyle(fontSize: 13.w,height: 1.5,color: Colours.c3),),
Text(_showText(model),style: TextStyle(fontSize: 13.w,height: 1.5,color: Colours.c3),),
Gaps.vGaps10,
_buildImageGridView()
],
......@@ -174,6 +174,40 @@ class _BuildDiscussState extends State<BuildDiscuss> {
);
}
String _showText(DiscussModel discussModel){
String text = '';
// 是我的
if(discussModel.isMy == 1){
// 审核中
if(discussModel.content?.text?.privacyStatus ==0 ||discussModel.content?.text?.privacyStatus ==2){
text = '${discussModel.content?.text?.content}(审核中)';
}
// 审核未通过
else if(discussModel.content?.text?.privacyStatus ==-1){
text = '${discussModel.content?.text?.content}(审核未通过)';
}
// 审核通过
else {
text = '${discussModel.content?.text?.content}';
}
}
else {
// 审核中
if(discussModel.content?.text?.privacyStatus ==0 ||discussModel.content?.text?.privacyStatus ==2){
text = '(审核中)';
}
// 审核未通过
else if(discussModel.content?.text?.privacyStatus ==-1){
text = '(审核未通过)';
}
// 审核通过
else {
text = '${discussModel.content?.text?.content}';
}
}
return text;
}
Widget _buildListView(List<DiscussModel> data){
return ListView.builder(
physics: const NeverScrollableScrollPhysics(),
......@@ -199,7 +233,31 @@ class _BuildDiscussState extends State<BuildDiscuss> {
),
itemBuilder: (BuildContext context, int index) {
MediaModel? mediaModel = widget.model.content?.image?[index];
return CustomImage.network(url: widget.model?.content?.image?[index].content??'',fit: BoxFit.cover,);
return Stack(
children: [
Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: CustomImage.network(url: mediaModel?.content??'',fit: BoxFit.cover,)
),
Visibility(
visible: mediaModel?.privacyStatus == 0?true:false,
child: Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: Container(
alignment: Alignment.center,
color: widget.model.isMy==1?Colours.c9.withOpacity(0.5):Colours.c9.withOpacity(1),
child: Text('(审核中)',style: TextStyle(fontSize: 11.w,height: 1.5,color: AppTheme.primary),),
)
),
),
],
);
// return Container(
// color: Colors.red,
// );
......
......@@ -65,18 +65,12 @@ class BuildNote extends StatelessWidget {
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(model.noteContent?.text?.content??'',style: TextStyle(
Text(_showText(model),style: TextStyle(
fontSize: 14.w,
height: 1.5,
// color: Colors.red,
color:Colours.c3
),),
model.noteContent?.text?.privacyStatus == 0?Text('(审核中)',style: TextStyle(
fontSize: 11.w,
height: 1.5,
// color: Colors.red,
color:AppTheme.primary
),):const SizedBox(),
],
),
Gaps.vGaps13,
......@@ -103,6 +97,41 @@ class BuildNote extends StatelessWidget {
);
}
String _showText(NoteModel discussModel){
String text = '';
// 是我的
if(discussModel.isMy == 1){
// 审核中
if(discussModel.noteContent?.text?.privacyStatus ==0 ||discussModel.noteContent?.text?.privacyStatus ==2){
text = '${discussModel.noteContent?.text?.content}(审核中)';
}
// 审核未通过
else if(discussModel.noteContent?.text?.privacyStatus ==-1){
text = '${discussModel.noteContent?.text?.content}(审核未通过)';
}
// 审核通过
else {
text = '${discussModel.noteContent?.text?.content}';
}
}
else {
// 审核中
if(discussModel.noteContent?.text?.privacyStatus ==0 ||discussModel.noteContent?.text?.privacyStatus ==2){
text = '(审核中)';
}
// 审核未通过
else if(discussModel.noteContent?.text?.privacyStatus ==-1){
text = '(审核未通过)';
}
// 审核通过
else {
text = '${discussModel.noteContent?.text?.content}';
}
}
return text;
}
// 图片
Widget _buildImageGridView(){
return GridView.builder(
......@@ -135,7 +164,7 @@ class BuildNote extends StatelessWidget {
bottom: 0,
child: Container(
alignment: Alignment.center,
color: Colours.c9.withOpacity(0.5),
color: model.isMy==1?Colours.c9.withOpacity(0.5):Colours.c9.withOpacity(1),
child: Text('(审核中)',style: TextStyle(fontSize: 14.w,height: 1.5,color: AppTheme.primary),),
)
),
......
......@@ -3,7 +3,8 @@ part of utils;
// 服务器地址
// const String kServerUrl = 'https://app.vning.com';
// const String kServerUrl = 'http://192.168.11.88:81';
const String kServerUrl = 'http://1507.superge.cn:81';
const String kServerUrl = 'http://8.141.148.247:7421';
// const String kServerUrl = 'http://1507.superge.cn:81';
const String kLocalToken = 'local_token';
const String kLocalAccessToken = 'local_access_token';
const String kLocalAccount = 'local_account';
......@@ -18,13 +19,13 @@ const String kUserPriAgreement = '/html/agreement/pri_agreement.html';
const String kUserRechargeAgreement = '/html/agreement/rec_agreement.html';
// 错题详情页 html
const String kUserWrongDes = 'http://150.158.138.40:9200/evaluating_wrong.html';
const String kUserWrongDes = '$kServerUrl/html/app/evaluating_wrong.html';
// 阅读页 html
const String kReadBook = 'http://150.158.138.40:9200/read.html';
const String kReadBook = '$kServerUrl/html/app/read.html';
// 答题页
const String kAnswer = 'http://150.158.138.40:9200/evaluating.html';
const String kAnswer = '$kServerUrl/html/app/evaluating.html';
// 答题结果页
const String kAnswerResult = 'http://150.158.138.40:9200/evaluating_result.html';
const String kAnswerResult = '$kServerUrl/html/app/evaluating_result.html';
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论