|
...
|
...
|
@@ -43,8 +43,14 @@ class _FestivalEditPageState extends State<FestivalEditPage> { |
|
|
|
// await customerProvider.searchData(customerProvider.controller.text);
|
|
|
|
}
|
|
|
|
|
|
|
|
_setGuestInfocDay(String id, String cday) async {
|
|
|
|
Map<String, String> params = {"gid": widget.guest.id, 'content': cday};
|
|
|
|
_setGuestInfocDay(String id, Map content) async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
"gid": widget.guest.id,
|
|
|
|
'desc': content['desc'],
|
|
|
|
'type': content['type'],
|
|
|
|
'dtime': content['dtime'],
|
|
|
|
};
|
|
|
|
|
|
|
|
if (id != '') {
|
|
|
|
params["id"] = id;
|
|
|
|
}
|
|
...
|
...
|
@@ -113,9 +119,25 @@ class _FestivalEditPageState extends State<FestivalEditPage> { |
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: model.cday.length,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
Cday cday = model.cday[index];
|
|
|
|
String show = '';
|
|
|
|
if (cday.desc != null && cday.desc != '') {
|
|
|
|
//新数据
|
|
|
|
// 组展示文本
|
|
|
|
|
|
|
|
show = cday.desc +
|
|
|
|
':' +
|
|
|
|
cday.dtime +
|
|
|
|
(cday.type == '1' ? '(公历)' : '(农历)');
|
|
|
|
}
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
String str = model.cday[index].content;
|
|
|
|
String str = cday.content;
|
|
|
|
String yearStr = '选填';
|
|
|
|
String monthStr = '';
|
|
|
|
String dayStr = '';
|
|
|
|
bool gongli = true;
|
|
|
|
String content = '';
|
|
|
|
// str += '${name}:';
|
|
|
|
// if (yearStr != '' &&
|
|
|
|
// yearStr != null &&
|
|
...
|
...
|
@@ -125,43 +147,68 @@ class _FestivalEditPageState extends State<FestivalEditPage> { |
|
|
|
// str += '${monthStr}月';
|
|
|
|
// str += '${dayStr}日';
|
|
|
|
// str += '(${gongli ? '公历' : '农历'})';
|
|
|
|
String yearStr = '选填';
|
|
|
|
String monthStr = '';
|
|
|
|
String dayStr = '';
|
|
|
|
bool gongli = true;
|
|
|
|
String content = str.substring(0, str.indexOf(':'));
|
|
|
|
|
|
|
|
String tempStr =
|
|
|
|
str.substring(str.indexOf(':'), str.length);
|
|
|
|
if (tempStr.contains('年')) {
|
|
|
|
yearStr = tempStr.substring(
|
|
|
|
tempStr.indexOf(':') + 1,
|
|
|
|
tempStr.indexOf('年'));
|
|
|
|
}
|
|
|
|
if (tempStr.contains('月')) {
|
|
|
|
|
|
|
|
if (cday.desc != null && cday.desc != '') {
|
|
|
|
//新数据
|
|
|
|
content = cday.desc;
|
|
|
|
List<String> ymd = cday.dtime.split('-');
|
|
|
|
if (ymd.length == 3) {
|
|
|
|
//含有年
|
|
|
|
yearStr = ymd[0];
|
|
|
|
monthStr = ymd[1];
|
|
|
|
dayStr = ymd[2];
|
|
|
|
} else if (ymd.length == 2) {
|
|
|
|
//没有年
|
|
|
|
monthStr = ymd[0];
|
|
|
|
dayStr = ymd[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (monthStr.startsWith('0')) {
|
|
|
|
monthStr =
|
|
|
|
monthStr.substring(1, monthStr.length);
|
|
|
|
}
|
|
|
|
if (dayStr.startsWith('0')) {
|
|
|
|
dayStr = dayStr.substring(1, dayStr.length);
|
|
|
|
}
|
|
|
|
|
|
|
|
print(monthStr);
|
|
|
|
print(dayStr);
|
|
|
|
|
|
|
|
gongli = cday.type == '1' ? true : false;
|
|
|
|
} else {
|
|
|
|
content = str.substring(0, str.indexOf(':'));
|
|
|
|
String tempStr =
|
|
|
|
str.substring(str.indexOf(':'), str.length);
|
|
|
|
if (tempStr.contains('年')) {
|
|
|
|
monthStr = tempStr.substring(
|
|
|
|
tempStr.indexOf('年') + 1,
|
|
|
|
tempStr.indexOf('月'));
|
|
|
|
} else {
|
|
|
|
monthStr = tempStr.substring(
|
|
|
|
yearStr = tempStr.substring(
|
|
|
|
tempStr.indexOf(':') + 1,
|
|
|
|
tempStr.indexOf('月'));
|
|
|
|
tempStr.indexOf('年'));
|
|
|
|
}
|
|
|
|
if (tempStr.contains('月')) {
|
|
|
|
if (tempStr.contains('年')) {
|
|
|
|
monthStr = tempStr.substring(
|
|
|
|
tempStr.indexOf('年') + 1,
|
|
|
|
tempStr.indexOf('月'));
|
|
|
|
} else {
|
|
|
|
monthStr = tempStr.substring(
|
|
|
|
tempStr.indexOf(':') + 1,
|
|
|
|
tempStr.indexOf('月'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tempStr.contains('日')) {
|
|
|
|
dayStr = tempStr.substring(
|
|
|
|
tempStr.indexOf('月') + 1,
|
|
|
|
tempStr.indexOf('日'));
|
|
|
|
}
|
|
|
|
if (tempStr.contains('农历')) {
|
|
|
|
gongli = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tempStr.contains('日')) {
|
|
|
|
dayStr = tempStr.substring(
|
|
|
|
tempStr.indexOf('月') + 1,
|
|
|
|
tempStr.indexOf('日'));
|
|
|
|
}
|
|
|
|
if (tempStr.contains('农历')) {
|
|
|
|
gongli = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DialogUtil.festivalAlertDialog(
|
|
|
|
context, content, 520, rCallback: (name) {
|
|
|
|
print(name);
|
|
|
|
_setGuestInfocDay(model.cday[index].id, name);
|
|
|
|
context, content, 520, rCallback: (content) {
|
|
|
|
print(content);
|
|
|
|
_setGuestInfocDay(model.cday[index].id, content);
|
|
|
|
// _addCookbookClass(name, showLoading: true);
|
|
|
|
}, delCallback: () {
|
|
|
|
//弹框确认是否删除
|
|
...
|
...
|
@@ -187,7 +234,7 @@ class _FestivalEditPageState extends State<FestivalEditPage> { |
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
model.cday[index].content,
|
|
|
|
cday.content == null ? show : cday.content,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(26),
|
|
...
|
...
|
@@ -216,9 +263,9 @@ class _FestivalEditPageState extends State<FestivalEditPage> { |
|
|
|
isBold: false,
|
|
|
|
onPressed: () {
|
|
|
|
DialogUtil.festivalAlertDialog(context, '', 520,
|
|
|
|
rCallback: (name) {
|
|
|
|
print(name);
|
|
|
|
_setGuestInfocDay('', name);
|
|
|
|
rCallback: (content) {
|
|
|
|
print(content);
|
|
|
|
_setGuestInfocDay('', content);
|
|
|
|
// _addCookbookClass(name, showLoading: true);
|
|
|
|
});
|
|
|
|
},
|
...
|
...
|
|