Commit 2a6ef164 authored by 杜欣's avatar 杜欣

add activity

parent bb96ff8c
/*
* @author dx
* @date 2019-09-17
**/
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/ActivityReportRepository.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/remote/entity/ActivityReportEntity.dart';
import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart';
import 'package:gmalpha_flutter/commonModel/live/LiveData.dart';
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
class ActivityReportModel extends BaseModel {
LiveData<ActivityReportEntity> activityReportLive = new LiveData();
final String cookie;
final int id;
final int type;
ActivityReportModel(this.cookie, this.id, this.type);
init(BuildContext context) {
Map<String, dynamic> headMap = new Map();
headMap.putIfAbsent("Cookie", () => cookie);
DioUtil.addHeadMap = headMap;
ActivityReportRepository.getInstance().getActivityReport(id, type).listen((value) {
if (value != null) {
activityReportLive.notifyView(value);
}
}).onError((error) {
Toast.show(context, "${error.toString()}");
print(error);
});
}
@override
void dispose() {
activityReportLive.dispost();
}
}
\ No newline at end of file
/*
* @author dx
* @date 2019-09-17
**/
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/ActivityReportRepository.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/remote/entity/ActivityReportEntity.dart';
import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart';
import 'package:gmalpha_flutter/commonModel/live/LiveData.dart';
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
class ActivityReportModel extends BaseModel {
LiveData<ActivityReportEntity> activityReportLive = new LiveData();
final String cookie;
final int id;
final int type;
ActivityReportModel(this.cookie, this.id, this.type);
init(BuildContext context) {
Map<String, dynamic> headMap = new Map();
headMap.putIfAbsent("Cookie", () => cookie);
DioUtil.addHead = headMap;
ActivityReportRepository.getInstance().getActivityReport(id, type).listen((value) {
if (value != null) {
activityReportLive.notifyView(value);
}
}).onError((error) {
Toast.show(context, "${error.toString()}");
print(error);
});
}
@override
void dispose() {
activityReportLive.dispost();
}
}
\ No newline at end of file
/*
* @author dx
* @date 2019-09-17
**/
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/ActivityReportRepository.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/remote/entity/ActivityReportEntity.dart';
import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart';
import 'package:gmalpha_flutter/commonModel/live/LiveData.dart';
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
class ActivityReportModel extends BaseModel {
LiveData<ActivityReportEntity> activityReportLive = new LiveData();
final String cookie;
final int id;
final int type;
ActivityReportModel(this.cookie, this.id, this.type);
init(BuildContext context) {
Map<String, dynamic> headMap = new Map();
headMap.putIfAbsent("Cookie", () => cookie);
DioUtil*().addHead = headMap;
ActivityReportRepository.getInstance().getActivityReport(id, type).listen((value) {
if (value != null) {
activityReportLive.notifyView(value);
}
}).onError((error) {
Toast.show(context, "${error.toString()}");
print(error);
});
}
@override
void dispose() {
activityReportLive.dispost();
}
}
\ No newline at end of file
/*
* @author dx
* @date 2019-09-17
**/
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/ActivityReportRepository.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/remote/entity/ActivityReportEntity.dart';
import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart';
import 'package:gmalpha_flutter/commonModel/live/LiveData.dart';
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
class ActivityReportModel extends BaseModel {
LiveData<ActivityReportEntity> activityReportLive = new LiveData();
final String cookie;
final int id;
final int type;
ActivityReportModel(this.cookie, this.id, this.type);
init(BuildContext context) {
Map<String, dynamic> headMap = new Map();
headMap.putIfAbsent("Cookie", () => cookie);
DioUtil*.addHead = headMap;
ActivityReportRepository.getInstance().getActivityReport(id, type).listen((value) {
if (value != null) {
activityReportLive.notifyView(value);
}
}).onError((error) {
Toast.show(context, "${error.toString()}");
print(error);
});
}
@override
void dispose() {
activityReportLive.dispost();
}
}
\ No newline at end of file
/*
* @author dx
* @date 2019-09-17
**/
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/ActivityReportRepository.dart';
import 'package:gmalpha_flutter/ActivityReportModel/service/remote/entity/ActivityReportEntity.dart';
import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart';
import 'package:gmalpha_flutter/commonModel/live/LiveData.dart';
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
class ActivityReportModel extends BaseModel {
LiveData<ActivityReportEntity> activityReportLive = new LiveData();
final String cookie;
final int id;
final int type;
ActivityReportModel(this.cookie, this.id, this.type);
init(BuildContext context) {
Map<String, dynamic> headMap = new Map();
headMap.putIfAbsent("Cookie", () => cookie);
DioUtil().addHead = headMap;
ActivityReportRepository.getInstance().getActivityReport(id, type).listen((value) {
if (value != null) {
activityReportLive.notifyView(value);
}
}).onError((error) {
Toast.show(context, "${error.toString()}");
print(error);
});
}
@override
void dispose() {
activityReportLive.dispost();
}
}
\ No newline at end of file
/*
* @author dx
* @date 2019-09-17
**/
class ActivityReportEntity {
String message;
int error;
int errorCode;
Data data;
ActivityReportEntity({this.message, this.error, this.errorCode, this.data});
ActivityReportEntity.fromJson(Map<String, dynamic> json) {
message = json['message'];
error = json['error'];
errorCode = json['error_code'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['message'] = this.message;
data['error'] = this.error;
data['error_code'] = this.errorCode;
if (this.data != null) {
data['data'] = this.data.toJson();
}
return data;
}
}
class Data {
int surveyRecordId;
String type;
Report report;
Data({this.surveyRecordId, this.type, this.report});
Data.fromJson(Map<String, dynamic> json) {
surveyRecordId = json['survey_record_id'];
type = json['type'];
report =
json['report'] != null ? new Report.fromJson(json['report']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['survey_record_id'] = this.surveyRecordId;
data['type'] = this.type;
if (this.report != null) {
data['report'] = this.report.toJson();
}
return data;
}
}
class Report {
Share share;
List<Cards> cards;
Report({this.share, this.cards});
Report.fromJson(Map<String, dynamic> json) {
share = json['share'] != null ? new Share.fromJson(json['share']) : null;
if (json['cards'] != null) {
cards = new List<Cards>();
json['cards'].forEach((v) {
cards.add(new Cards.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.share != null) {
data['share'] = this.share.toJson();
}
if (this.cards != null) {
data['cards'] = this.cards.map((v) => v.toJson()).toList();
}
return data;
}
}
class Share {
double total_cost;
double beat;
double rank;
String range;
Share({this.total_cost, this.beat, this.rank, this.range});
Share.fromJson(Map<String, dynamic> json) {
total_cost = json['total_cost'];
beat = json['beat'];
rank = json['rank'];
range = json['range'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['total_cost'] = this.total_cost;
data['beat'] = this.beat;
data['rank'] = this.rank;
data['range'] = this.range;
return data;
}
}
class Cards {
int id;
String name;
String description;
String guide;
String protocol;
List<Drafts> drafts;
Cards(
{this.id,
this.name,
this.description,
this.guide,
this.protocol,
this.drafts});
Cards.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
description = json['description'];
guide = json['guide'];
protocol = json['protocol'];
if (json['drafts'] != null) {
drafts = new List<Drafts>();
json['drafts'].forEach((v) {
drafts.add(new Drafts.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['description'] = this.description;
data['guide'] = this.guide;
data['protocol'] = this.protocol;
if (this.drafts != null) {
data['drafts'] = this.drafts.map((v) => v.toJson()).toList();
}
return data;
}
}
class Drafts {
int id;
Image image;
Drafts({this.id, this.image});
Drafts.fromJson(Map<String, dynamic> json) {
id = json['id'];
image = json['image'] != null ? new Image.fromJson(json['image']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
if (this.image != null) {
data['image'] = this.image.toJson();
}
return data;
}
}
class Image {
String imageUrl;
String videoUrl;
int width;
int height;
Image({this.imageUrl, this.videoUrl, this.width, this.height});
Image.fromJson(Map<String, dynamic> json) {
imageUrl = json['image_url'];
videoUrl = json['video_url'];
width = json['width'];
height = json['height'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['image_url'] = this.imageUrl;
data['video_url'] = this.videoUrl;
data['width'] = this.width;
data['height'] = this.height;
return data;
}
}
\ No newline at end of file
/*
* @author dx
* @date 2019-09-17
**/
class ActivityReportEntity {
int error;
String message;
Null extra;
Data data;
ActivityReportEntity({this.error, this.message, this.extra, this.data});
ActivityReportEntity.fromJson(Map<String, dynamic> json) {
error = json['error'];
message = json['message'];
extra = json['extra'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
data['extra'] = this.extra;
if (this.data != null) {
data['data'] = this.data.toJson();
}
return data;
}
}
class Data {
String surveyRecordId;
Report report;
Data({this.surveyRecordId, this.report});
Data.fromJson(Map<String, dynamic> json) {
surveyRecordId = json['survey_record_id'];
report =
json['report'] != null ? new Report.fromJson(json['report']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['survey_record_id'] = this.surveyRecordId;
if (this.report != null) {
data['report'] = this.report.toJson();
}
return data;
}
}
class Report {
Share share;
List<Cards> cards;
Report({this.share, this.cards});
Report.fromJson(Map<String, dynamic> json) {
share = json['share'] != null ? new Share.fromJson(json['share']) : null;
if (json['cards'] != null) {
cards = new List<Cards>();
json['cards'].forEach((v) {
cards.add(new Cards.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.share != null) {
data['share'] = this.share.toJson();
}
if (this.cards != null) {
data['cards'] = this.cards.map((v) => v.toJson()).toList();
}
return data;
}
}
class Share {
int totalCost;
int beat;
int rank;
Share({this.totalCost, this.beat, this.rank});
Share.fromJson(Map<String, dynamic> json) {
totalCost = json['total_cost'];
beat = json['beat'];
rank = json['rank'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['total_cost'] = this.totalCost;
data['beat'] = this.beat;
data['rank'] = this.rank;
return data;
}
}
class Cards {
int id;
String name;
String guide;
String protocol;
List<Drafts> drafts;
Cards({this.id, this.name, this.guide, this.protocol, this.drafts});
Cards.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
guide = json['guide'];
protocol = json['protocol'];
if (json['drafts'] != null) {
drafts = new List<Drafts>();
json['drafts'].forEach((v) {
drafts.add(new Drafts.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['guide'] = this.guide;
data['protocol'] = this.protocol;
if (this.drafts != null) {
data['drafts'] = this.drafts.map((v) => v.toJson()).toList();
}
return data;
}
}
class Drafts {
Null id;
String content;
String image;
Drafts({this.id, this.content, this.image});
Drafts.fromJson(Map<String, dynamic> json) {
id = json['id'];
content = json['content'];
image = json['image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['content'] = this.content;
data['image'] = this.image;
return data;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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