Commit 3603e586827793b90a30da4fe717b83cab6c157d

Authored by pengye
1 parent c7e7bdc6

小程序分享卡片

@@ -524,14 +524,51 @@ Page({ @@ -524,14 +524,51 @@ Page({
524 } 524 }
525 }, 525 },
526 // 生成海报 526 // 生成海报
527 - painterBtn(img, sellerName, date, time) {  
528 - img = img.replace(/^http:/, "https:"); 527 + painterBtn(liteStyle, timeStr) {
  528 + let style = liteStyle.split('-');
  529 + let type1 = style[0];
  530 + let type2 = style[1];
  531 + let data = this.data.detail;
  532 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  533 + let d = data.ddate_solt;
  534 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  535 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  536 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  537 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  538 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  539 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  540 + time = timeStr ? timeStr : time;
  541 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  542 + let section = ''
  543 + // 老样式1234
  544 + if (type1 && !type2) {
  545 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  546 + }
  547 + // 新样式
  548 + if (type1 && type2) {
  549 + if (type1 == '1') {
  550 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  551 + }
  552 + if (type1 == '2') {
  553 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  554 + }
  555 + if (type1 == '3' || type1 == '4') {
  556 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  557 + }
  558 + }
529 this.setData({ 559 this.setData({
530 wxml: canvas({ 560 wxml: canvas({
531 imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', 561 imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
532 - sellerName,  
533 - date,  
534 - time, 562 + info: {
  563 + sellerName: data.seller.sellername,
  564 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  565 + time: section,
  566 + },
  567 + type1,
  568 + type2,
  569 + date2,
  570 + week,
  571 + day2,
535 }) 572 })
536 }) 573 })
537 }, 574 },
@@ -690,27 +727,13 @@ Page({ @@ -690,27 +727,13 @@ Page({
690 } 727 }
691 // 获取转发客人卡片设置 728 // 获取转发客人卡片设置
692 let detailInfo = this.data.detail; 729 let detailInfo = this.data.detail;
693 - if (data.lite_style == '0') { 730 + let liteStyle = data.lite_style.split('-');
  731 + if (liteStyle[0] == '0') {
694 this.setData({ 732 this.setData({
695 imgSrc: detailInfo.seller.seller_image 733 imgSrc: detailInfo.seller.seller_image
696 }) 734 })
697 } else { 735 } else {
698 - let d = detailInfo.ddate_solt;  
699 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
700 - let time2;  
701 - if (this.data.temp_ddate) {  
702 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
703 - } else {  
704 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
705 - }  
706 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
707 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
708 - this.painterBtn(  
709 - detailInfo.seller.seller_image,  
710 - detailInfo.seller.sellername,  
711 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
712 - time  
713 - ); 736 + this.painterBtn(data.lite_style);
714 } 737 }
715 }).catch(res => { 738 }).catch(res => {
716 console.log('GetSellerTemplateConf请求失败'); 739 console.log('GetSellerTemplateConf请求失败');
@@ -1122,12 +1145,13 @@ Page({ @@ -1122,12 +1145,13 @@ Page({
1122 temp_ddate: times, 1145 temp_ddate: times,
1123 }).then(res => { 1146 }).then(res => {
1124 if (res.ret == 200) { 1147 if (res.ret == 200) {
1125 - if (this.data.lite_style == '2') {  
1126 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1148 + let style =this.data.lite_style.split('-');
  1149 + let type1 =style[0];
  1150 + let type2 =style[1];
  1151 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1152 + let time = temp_ddate || this.data.timeList[index]
1127 this.painterBtn( 1153 this.painterBtn(
1128 - detailInfo.seller.seller_image,  
1129 - detailInfo.seller.sellername,  
1130 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1154 + this.data.lite_style,
1131 time 1155 time
1132 ); 1156 );
1133 } 1157 }
@@ -534,14 +534,51 @@ Page({ @@ -534,14 +534,51 @@ Page({
534 } 534 }
535 }, 535 },
536 // 生成海报 536 // 生成海报
537 - painterBtn(img, sellerName, date, time) {  
538 - img = img.replace(/^http:/, "https:"); 537 + painterBtn(liteStyle, timeStr) {
  538 + let style = liteStyle.split('-');
  539 + let type1 = style[0];
  540 + let type2 = style[1];
  541 + let data = this.data.detail;
  542 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  543 + let d = data.ddate_solt;
  544 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  545 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  546 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  547 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  548 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  549 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  550 + time = timeStr ? timeStr : time;
  551 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  552 + let section = ''
  553 + // 老样式1234
  554 + if (type1 && !type2) {
  555 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  556 + }
  557 + // 新样式
  558 + if (type1 && type2) {
  559 + if (type1 == '1') {
  560 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  561 + }
  562 + if (type1 == '2') {
  563 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  564 + }
  565 + if (type1 == '3' || type1 == '4') {
  566 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  567 + }
  568 + }
539 this.setData({ 569 this.setData({
540 wxml: canvas({ 570 wxml: canvas({
541 imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', 571 imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
542 - sellerName,  
543 - date,  
544 - time, 572 + info: {
  573 + sellerName: data.seller.sellername,
  574 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  575 + time: section,
  576 + },
  577 + type1,
  578 + type2,
  579 + date2,
  580 + week,
  581 + day2,
545 }) 582 })
546 }) 583 })
547 }, 584 },
@@ -707,27 +744,13 @@ Page({ @@ -707,27 +744,13 @@ Page({
707 } 744 }
708 // 获取转发客人卡片设置 745 // 获取转发客人卡片设置
709 let detailInfo = this.data.detail; 746 let detailInfo = this.data.detail;
710 - if (data.lite_style == '0') { 747 + let liteStyle = data.lite_style.split('-');
  748 + if (liteStyle[0] == '0') {
711 this.setData({ 749 this.setData({
712 imgSrc: detailInfo.seller.seller_image 750 imgSrc: detailInfo.seller.seller_image
713 }) 751 })
714 } else { 752 } else {
715 - let d = detailInfo.ddate_solt;  
716 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
717 - let time2;  
718 - if (this.data.temp_ddate) {  
719 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
720 - } else {  
721 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
722 - }  
723 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
724 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
725 - this.painterBtn(  
726 - detailInfo.seller.seller_image,  
727 - detailInfo.seller.sellername,  
728 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
729 - time  
730 - ); 753 + this.painterBtn(data.lite_style);
731 } 754 }
732 }).catch(res => { 755 }).catch(res => {
733 console.log('GetSellerTemplateConf请求失败'); 756 console.log('GetSellerTemplateConf请求失败');
@@ -1186,12 +1209,13 @@ Page({ @@ -1186,12 +1209,13 @@ Page({
1186 temp_ddate: times, 1209 temp_ddate: times,
1187 }).then(res => { 1210 }).then(res => {
1188 if (res.ret == 200) { 1211 if (res.ret == 200) {
1189 - if (this.data.lite_style == '2') {  
1190 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1212 + let style =this.data.lite_style.split('-');
  1213 + let type1 =style[0];
  1214 + let type2 =style[1];
  1215 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1216 + let time = temp_ddate || this.data.timeList[index]
1191 this.painterBtn( 1217 this.painterBtn(
1192 - detailInfo.seller.seller_image,  
1193 - detailInfo.seller.sellername,  
1194 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1218 + this.data.lite_style,
1195 time 1219 time
1196 ); 1220 );
1197 } 1221 }
@@ -549,14 +549,51 @@ Page({ @@ -549,14 +549,51 @@ Page({
549 } 549 }
550 }, 550 },
551 // 生成海报 551 // 生成海报
552 - painterBtn(img, sellerName, date, time) {  
553 - img = img.replace(/^http:/, "https:"); 552 + painterBtn(liteStyle, timeStr) {
  553 + let style = liteStyle.split('-');
  554 + let type1 = style[0];
  555 + let type2 = style[1];
  556 + let data = this.data.detail;
  557 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  558 + let d = data.ddate_solt;
  559 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  560 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  561 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  562 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  563 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  564 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  565 + time = timeStr ? timeStr : time;
  566 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  567 + let section = ''
  568 + // 老样式1234
  569 + if (type1 && !type2) {
  570 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  571 + }
  572 + // 新样式
  573 + if (type1 && type2) {
  574 + if (type1 == '1') {
  575 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  576 + }
  577 + if (type1 == '2') {
  578 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  579 + }
  580 + if (type1 == '3' || type1 == '4') {
  581 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  582 + }
  583 + }
554 this.setData({ 584 this.setData({
555 wxml: canvas({ 585 wxml: canvas({
556 imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', 586 imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
557 - sellerName,  
558 - date,  
559 - time, 587 + info: {
  588 + sellerName: data.seller.sellername,
  589 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  590 + time: section,
  591 + },
  592 + type1,
  593 + type2,
  594 + date2,
  595 + week,
  596 + day2,
560 }) 597 })
561 }) 598 })
562 }, 599 },
@@ -722,27 +759,13 @@ Page({ @@ -722,27 +759,13 @@ Page({
722 } 759 }
723 // 获取转发客人卡片设置 760 // 获取转发客人卡片设置
724 let detailInfo = this.data.detail; 761 let detailInfo = this.data.detail;
725 - if (data.lite_style == '0') { 762 + let liteStyle = data.lite_style.split('-');
  763 + if (liteStyle[0] == '0') {
726 this.setData({ 764 this.setData({
727 imgSrc: detailInfo.seller.seller_image 765 imgSrc: detailInfo.seller.seller_image
728 }) 766 })
729 } else { 767 } else {
730 - let d = detailInfo.ddate_solt;  
731 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
732 - let time2;  
733 - if (this.data.temp_ddate) {  
734 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
735 - } else {  
736 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
737 - }  
738 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
739 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
740 - this.painterBtn(  
741 - detailInfo.seller.seller_image,  
742 - detailInfo.seller.sellername,  
743 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
744 - time  
745 - ); 768 + this.painterBtn(data.lite_style);
746 } 769 }
747 }).catch(res => { 770 }).catch(res => {
748 console.log('GetSellerTemplateConf请求失败'); 771 console.log('GetSellerTemplateConf请求失败');
@@ -1201,12 +1224,13 @@ Page({ @@ -1201,12 +1224,13 @@ Page({
1201 temp_ddate: times, 1224 temp_ddate: times,
1202 }).then(res => { 1225 }).then(res => {
1203 if (res.ret == 200) { 1226 if (res.ret == 200) {
1204 - if (this.data.lite_style == '2') {  
1205 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1227 + let style =this.data.lite_style.split('-');
  1228 + let type1 =style[0];
  1229 + let type2 =style[1];
  1230 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1231 + let time = temp_ddate || this.data.timeList[index]
1206 this.painterBtn( 1232 this.painterBtn(
1207 - detailInfo.seller.seller_image,  
1208 - detailInfo.seller.sellername,  
1209 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1233 + this.data.lite_style,
1210 time 1234 time
1211 ); 1235 );
1212 } 1236 }
@@ -509,17 +509,54 @@ Page({ @@ -509,17 +509,54 @@ Page({
509 } 509 }
510 }, 510 },
511 // 生成海报 511 // 生成海报
512 - painterBtn(img,sellerName,date,time) {  
513 - img = img.replace(/^http:/, "https:");  
514 - this.setData({  
515 - wxml: canvas({  
516 - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',  
517 - sellerName,  
518 - date,  
519 - time,  
520 - })  
521 - })  
522 - }, 512 + painterBtn(liteStyle, timeStr) {
  513 + let style = liteStyle.split('-');
  514 + let type1 = style[0];
  515 + let type2 = style[1];
  516 + let data = this.data.detail;
  517 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  518 + let d = data.ddate_solt;
  519 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  520 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  521 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  522 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  523 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  524 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  525 + time = timeStr ? timeStr : time;
  526 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  527 + let section = ''
  528 + // 老样式1234
  529 + if (type1 && !type2) {
  530 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  531 + }
  532 + // 新样式
  533 + if (type1 && type2) {
  534 + if (type1 == '1') {
  535 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  536 + }
  537 + if (type1 == '2') {
  538 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  539 + }
  540 + if (type1 == '3' || type1 == '4') {
  541 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  542 + }
  543 + }
  544 + this.setData({
  545 + wxml: canvas({
  546 + imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
  547 + info: {
  548 + sellerName: data.seller.sellername,
  549 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  550 + time: section,
  551 + },
  552 + type1,
  553 + type2,
  554 + date2,
  555 + week,
  556 + day2,
  557 + })
  558 + })
  559 + },
523 onImgOK(e) { 560 onImgOK(e) {
524 this.setData({ 561 this.setData({
525 imgSrc: e.detail.path 562 imgSrc: e.detail.path
@@ -720,27 +757,13 @@ Page({ @@ -720,27 +757,13 @@ Page({
720 } 757 }
721 // 获取转发客人卡片设置 758 // 获取转发客人卡片设置
722 let detailInfo = this.data.detail; 759 let detailInfo = this.data.detail;
723 - if (data.lite_style == '0') { 760 + let liteStyle = data.lite_style.split('-');
  761 + if (liteStyle[0] == '0') {
724 this.setData({ 762 this.setData({
725 imgSrc: detailInfo.seller.seller_image 763 imgSrc: detailInfo.seller.seller_image
726 }) 764 })
727 } else { 765 } else {
728 - let d = detailInfo.ddate_solt;  
729 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
730 - let time2;  
731 - if(this.data.temp_ddate){  
732 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
733 - }else{  
734 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
735 - }  
736 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
737 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
738 - this.painterBtn(  
739 - detailInfo.seller.seller_image,  
740 - detailInfo.seller.sellername,  
741 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
742 - time  
743 - ); 766 + this.painterBtn(data.lite_style);
744 } 767 }
745 }).catch(res => { 768 }).catch(res => {
746 console.log('GetSellerTemplateConf请求失败'); 769 console.log('GetSellerTemplateConf请求失败');
@@ -1124,12 +1147,13 @@ Page({ @@ -1124,12 +1147,13 @@ Page({
1124 temp_ddate:times, 1147 temp_ddate:times,
1125 }).then(res => { 1148 }).then(res => {
1126 if (res.ret == 200) { 1149 if (res.ret == 200) {
1127 - if (this.data.lite_style == '2') {  
1128 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1150 + let style =this.data.lite_style.split('-');
  1151 + let type1 =style[0];
  1152 + let type2 =style[1];
  1153 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1154 + let time = temp_ddate || this.data.timeList[index]
1129 this.painterBtn( 1155 this.painterBtn(
1130 - detailInfo.seller.seller_image,  
1131 - detailInfo.seller.sellername,  
1132 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1156 + this.data.lite_style,
1133 time 1157 time
1134 ); 1158 );
1135 } 1159 }
@@ -509,17 +509,54 @@ Page({ @@ -509,17 +509,54 @@ Page({
509 } 509 }
510 }, 510 },
511 // 生成海报 511 // 生成海报
512 - painterBtn(img,sellerName,date,time) {  
513 - img = img.replace(/^http:/, "https:");  
514 - this.setData({  
515 - wxml: canvas({  
516 - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',  
517 - sellerName,  
518 - date,  
519 - time,  
520 - })  
521 - })  
522 - }, 512 + painterBtn(liteStyle, timeStr) {
  513 + let style = liteStyle.split('-');
  514 + let type1 = style[0];
  515 + let type2 = style[1];
  516 + let data = this.data.detail;
  517 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  518 + let d = data.ddate_solt;
  519 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  520 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  521 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  522 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  523 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  524 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  525 + time = timeStr ? timeStr : time;
  526 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  527 + let section = ''
  528 + // 老样式1234
  529 + if (type1 && !type2) {
  530 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  531 + }
  532 + // 新样式
  533 + if (type1 && type2) {
  534 + if (type1 == '1') {
  535 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  536 + }
  537 + if (type1 == '2') {
  538 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  539 + }
  540 + if (type1 == '3' || type1 == '4') {
  541 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  542 + }
  543 + }
  544 + this.setData({
  545 + wxml: canvas({
  546 + imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
  547 + info: {
  548 + sellerName: data.seller.sellername,
  549 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  550 + time: section,
  551 + },
  552 + type1,
  553 + type2,
  554 + date2,
  555 + week,
  556 + day2,
  557 + })
  558 + })
  559 + },
523 onImgOK(e) { 560 onImgOK(e) {
524 this.setData({ 561 this.setData({
525 imgSrc: e.detail.path 562 imgSrc: e.detail.path
@@ -675,27 +712,13 @@ Page({ @@ -675,27 +712,13 @@ Page({
675 } 712 }
676 // 获取转发客人卡片设置 713 // 获取转发客人卡片设置
677 let detailInfo = this.data.detail; 714 let detailInfo = this.data.detail;
678 - if (data.lite_style == '0') { 715 + let liteStyle = data.lite_style.split('-');
  716 + if (liteStyle[0] == '0') {
679 this.setData({ 717 this.setData({
680 imgSrc: detailInfo.seller.seller_image 718 imgSrc: detailInfo.seller.seller_image
681 }) 719 })
682 } else { 720 } else {
683 - let d = detailInfo.ddate_solt;  
684 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
685 - let time2;  
686 - if(this.data.temp_ddate){  
687 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
688 - }else{  
689 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
690 - }  
691 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
692 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
693 - this.painterBtn(  
694 - detailInfo.seller.seller_image,  
695 - detailInfo.seller.sellername,  
696 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
697 - time  
698 - ); 721 + this.painterBtn(data.lite_style);
699 } 722 }
700 }).catch(res => { 723 }).catch(res => {
701 console.log('GetSellerTemplateConf请求失败'); 724 console.log('GetSellerTemplateConf请求失败');
@@ -1079,12 +1102,13 @@ Page({ @@ -1079,12 +1102,13 @@ Page({
1079 temp_ddate:times, 1102 temp_ddate:times,
1080 }).then(res => { 1103 }).then(res => {
1081 if (res.ret == 200) { 1104 if (res.ret == 200) {
1082 - if (this.data.lite_style == '2') {  
1083 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1105 + let style =this.data.lite_style.split('-');
  1106 + let type1 =style[0];
  1107 + let type2 =style[1];
  1108 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1109 + let time = temp_ddate || this.data.timeList[index]
1084 this.painterBtn( 1110 this.painterBtn(
1085 - detailInfo.seller.seller_image,  
1086 - detailInfo.seller.sellername,  
1087 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1111 + this.data.lite_style,
1088 time 1112 time
1089 ); 1113 );
1090 } 1114 }
@@ -509,17 +509,54 @@ Page({ @@ -509,17 +509,54 @@ Page({
509 } 509 }
510 }, 510 },
511 // 生成海报 511 // 生成海报
512 - painterBtn(img,sellerName,date,time) {  
513 - img = img.replace(/^http:/, "https:");  
514 - this.setData({  
515 - wxml: canvas({  
516 - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',  
517 - sellerName,  
518 - date,  
519 - time,  
520 - })  
521 - })  
522 - }, 512 + painterBtn(liteStyle, timeStr) {
  513 + let style = liteStyle.split('-');
  514 + let type1 = style[0];
  515 + let type2 = style[1];
  516 + let data = this.data.detail;
  517 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  518 + let d = data.ddate_solt;
  519 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  520 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  521 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  522 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  523 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  524 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  525 + time = timeStr ? timeStr : time;
  526 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  527 + let section = ''
  528 + // 老样式1234
  529 + if (type1 && !type2) {
  530 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  531 + }
  532 + // 新样式
  533 + if (type1 && type2) {
  534 + if (type1 == '1') {
  535 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  536 + }
  537 + if (type1 == '2') {
  538 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  539 + }
  540 + if (type1 == '3' || type1 == '4') {
  541 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  542 + }
  543 + }
  544 + this.setData({
  545 + wxml: canvas({
  546 + imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
  547 + info: {
  548 + sellerName: data.seller.sellername,
  549 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  550 + time: section,
  551 + },
  552 + type1,
  553 + type2,
  554 + date2,
  555 + week,
  556 + day2,
  557 + })
  558 + })
  559 + },
523 onImgOK(e) { 560 onImgOK(e) {
524 this.setData({ 561 this.setData({
525 imgSrc: e.detail.path 562 imgSrc: e.detail.path
@@ -675,27 +712,14 @@ Page({ @@ -675,27 +712,14 @@ Page({
675 } 712 }
676 // 获取转发客人卡片设置 713 // 获取转发客人卡片设置
677 let detailInfo = this.data.detail; 714 let detailInfo = this.data.detail;
678 - if (data.lite_style == '0') { 715 + let liteStyle = data.lite_style.split('-');
  716 + if (liteStyle[0] == '0') {
679 this.setData({ 717 this.setData({
680 imgSrc: detailInfo.seller.seller_image 718 imgSrc: detailInfo.seller.seller_image
681 }) 719 })
682 } else { 720 } else {
683 - let d = detailInfo.ddate_solt;  
684 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
685 - let time2;  
686 - if(this.data.temp_ddate){  
687 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
688 - }else{  
689 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
690 - }  
691 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
692 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
693 - this.painterBtn(  
694 - detailInfo.seller.seller_image,  
695 - detailInfo.seller.sellername,  
696 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
697 - time  
698 - ); 721 +
  722 + this.painterBtn(data.lite_style);
699 } 723 }
700 }).catch(res => { 724 }).catch(res => {
701 console.log('GetSellerTemplateConf请求失败'); 725 console.log('GetSellerTemplateConf请求失败');
@@ -1079,12 +1103,13 @@ Page({ @@ -1079,12 +1103,13 @@ Page({
1079 temp_ddate:times, 1103 temp_ddate:times,
1080 }).then(res => { 1104 }).then(res => {
1081 if (res.ret == 200) { 1105 if (res.ret == 200) {
1082 - if (this.data.lite_style == '2') {  
1083 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1106 + let style =this.data.lite_style.split('-');
  1107 + let type1 =style[0];
  1108 + let type2 =style[1];
  1109 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1110 + let time = temp_ddate || this.data.timeList[index]
1084 this.painterBtn( 1111 this.painterBtn(
1085 - detailInfo.seller.seller_image,  
1086 - detailInfo.seller.sellername,  
1087 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1112 + this.data.lite_style,
1088 time 1113 time
1089 ); 1114 );
1090 } 1115 }
@@ -508,17 +508,54 @@ Page({ @@ -508,17 +508,54 @@ Page({
508 } 508 }
509 }, 509 },
510 // 生成海报 510 // 生成海报
511 - painterBtn(img,sellerName,date,time) {  
512 - img = img.replace(/^http:/, "https:");  
513 - this.setData({  
514 - wxml: canvas({  
515 - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',  
516 - sellerName,  
517 - date,  
518 - time,  
519 - })  
520 - })  
521 - }, 511 + painterBtn(liteStyle, timeStr) {
  512 + let style = liteStyle.split('-');
  513 + let type1 = style[0];
  514 + let type2 = style[1];
  515 + let data = this.data.detail;
  516 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  517 + let d = data.ddate_solt;
  518 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  519 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  520 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  521 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  522 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  523 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  524 + time = timeStr ? timeStr : time;
  525 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  526 + let section = ''
  527 + // 老样式1234
  528 + if (type1 && !type2) {
  529 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  530 + }
  531 + // 新样式
  532 + if (type1 && type2) {
  533 + if (type1 == '1') {
  534 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  535 + }
  536 + if (type1 == '2') {
  537 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  538 + }
  539 + if (type1 == '3' || type1 == '4') {
  540 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  541 + }
  542 + }
  543 + this.setData({
  544 + wxml: canvas({
  545 + imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
  546 + info: {
  547 + sellerName: data.seller.sellername,
  548 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  549 + time: section,
  550 + },
  551 + type1,
  552 + type2,
  553 + date2,
  554 + week,
  555 + day2,
  556 + })
  557 + })
  558 + },
522 onImgOK(e) { 559 onImgOK(e) {
523 this.setData({ 560 this.setData({
524 imgSrc: e.detail.path 561 imgSrc: e.detail.path
@@ -674,27 +711,13 @@ Page({ @@ -674,27 +711,13 @@ Page({
674 } 711 }
675 // 获取转发客人卡片设置 712 // 获取转发客人卡片设置
676 let detailInfo = this.data.detail; 713 let detailInfo = this.data.detail;
677 - if (data.lite_style == '0') { 714 + let liteStyle = data.lite_style.split('-');
  715 + if (liteStyle[0] == '0') {
678 this.setData({ 716 this.setData({
679 imgSrc: detailInfo.seller.seller_image 717 imgSrc: detailInfo.seller.seller_image
680 }) 718 })
681 } else { 719 } else {
682 - let d = detailInfo.ddate_solt;  
683 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
684 - let time2;  
685 - if(this.data.temp_ddate){  
686 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
687 - }else{  
688 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
689 - }  
690 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
691 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
692 - this.painterBtn(  
693 - detailInfo.seller.seller_image,  
694 - detailInfo.seller.sellername,  
695 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
696 - time  
697 - ); 720 + this.painterBtn(data.lite_style);
698 } 721 }
699 }).catch(res => { 722 }).catch(res => {
700 console.log('GetSellerTemplateConf请求失败'); 723 console.log('GetSellerTemplateConf请求失败');
@@ -1078,12 +1101,13 @@ Page({ @@ -1078,12 +1101,13 @@ Page({
1078 temp_ddate:times, 1101 temp_ddate:times,
1079 }).then(res => { 1102 }).then(res => {
1080 if (res.ret == 200) { 1103 if (res.ret == 200) {
1081 - if (this.data.lite_style == '2') {  
1082 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1104 + let style =this.data.lite_style.split('-');
  1105 + let type1 =style[0];
  1106 + let type2 =style[1];
  1107 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1108 + let time = temp_ddate || this.data.timeList[index]
1083 this.painterBtn( 1109 this.painterBtn(
1084 - detailInfo.seller.seller_image,  
1085 - detailInfo.seller.sellername,  
1086 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1110 + this.data.lite_style,
1087 time 1111 time
1088 ); 1112 );
1089 } 1113 }
@@ -461,17 +461,54 @@ Page({ @@ -461,17 +461,54 @@ Page({
461 } 461 }
462 }, 462 },
463 // 生成海报 463 // 生成海报
464 - painterBtn(img,sellerName,date,time) {  
465 - img = img.replace(/^http:/, "https:");  
466 - this.setData({  
467 - wxml: canvas({  
468 - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',  
469 - sellerName,  
470 - date,  
471 - time,  
472 - })  
473 - })  
474 - }, 464 + painterBtn(liteStyle, timeStr) {
  465 + let style = liteStyle.split('-');
  466 + let type1 = style[0];
  467 + let type2 = style[1];
  468 + let data = this.data.detail;
  469 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  470 + let d = data.ddate_solt;
  471 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  472 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  473 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  474 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  475 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  476 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  477 + time = timeStr ? timeStr : time;
  478 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  479 + let section = ''
  480 + // 老样式1234
  481 + if (type1 && !type2) {
  482 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  483 + }
  484 + // 新样式
  485 + if (type1 && type2) {
  486 + if (type1 == '1') {
  487 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  488 + }
  489 + if (type1 == '2') {
  490 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  491 + }
  492 + if (type1 == '3' || type1 == '4') {
  493 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  494 + }
  495 + }
  496 + this.setData({
  497 + wxml: canvas({
  498 + imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
  499 + info: {
  500 + sellerName: data.seller.sellername,
  501 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  502 + time: section,
  503 + },
  504 + type1,
  505 + type2,
  506 + date2,
  507 + week,
  508 + day2,
  509 + })
  510 + })
  511 + },
475 onImgOK(e) { 512 onImgOK(e) {
476 this.setData({ 513 this.setData({
477 imgSrc: e.detail.path 514 imgSrc: e.detail.path
@@ -631,27 +668,13 @@ Page({ @@ -631,27 +668,13 @@ Page({
631 } 668 }
632 // 获取转发客人卡片设置 669 // 获取转发客人卡片设置
633 let detailInfo = this.data.detail; 670 let detailInfo = this.data.detail;
634 - if (data.lite_style == '0') { 671 + let liteStyle = data.lite_style.split('-');
  672 + if (liteStyle[0] == '0') {
635 this.setData({ 673 this.setData({
636 imgSrc: detailInfo.seller.seller_image 674 imgSrc: detailInfo.seller.seller_image
637 }) 675 })
638 } else { 676 } else {
639 - let d = detailInfo.ddate_solt;  
640 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
641 - let time2;  
642 - if(this.data.temp_ddate){  
643 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
644 - }else{  
645 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
646 - }  
647 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
648 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
649 - this.painterBtn(  
650 - detailInfo.seller.seller_image,  
651 - detailInfo.seller.sellername,  
652 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
653 - time  
654 - ); 677 + this.painterBtn(data.lite_style);
655 } 678 }
656 }).catch(res => { 679 }).catch(res => {
657 console.log('GetSellerTemplateConf请求失败'); 680 console.log('GetSellerTemplateConf请求失败');
@@ -1035,12 +1058,13 @@ Page({ @@ -1035,12 +1058,13 @@ Page({
1035 temp_ddate:times, 1058 temp_ddate:times,
1036 }).then(res => { 1059 }).then(res => {
1037 if (res.ret == 200) { 1060 if (res.ret == 200) {
1038 - if (this.data.lite_style == '2') {  
1039 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1061 + let style =this.data.lite_style.split('-');
  1062 + let type1 =style[0];
  1063 + let type2 =style[1];
  1064 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1065 + let time = temp_ddate || this.data.timeList[index]
1040 this.painterBtn( 1066 this.painterBtn(
1041 - detailInfo.seller.seller_image,  
1042 - detailInfo.seller.sellername,  
1043 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1067 + this.data.lite_style,
1044 time 1068 time
1045 ); 1069 );
1046 } 1070 }
@@ -509,17 +509,54 @@ Page({ @@ -509,17 +509,54 @@ Page({
509 } 509 }
510 }, 510 },
511 // 生成海报 511 // 生成海报
512 - painterBtn(img,sellerName,date,time) {  
513 - img = img.replace(/^http:/, "https:");  
514 - this.setData({  
515 - wxml: canvas({  
516 - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',  
517 - sellerName,  
518 - date,  
519 - time,  
520 - })  
521 - })  
522 - }, 512 + painterBtn(liteStyle, timeStr) {
  513 + let style = liteStyle.split('-');
  514 + let type1 = style[0];
  515 + let type2 = style[1];
  516 + let data = this.data.detail;
  517 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  518 + let d = data.ddate_solt;
  519 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  520 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  521 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  522 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  523 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  524 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  525 + time = timeStr ? timeStr : time;
  526 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  527 + let section = ''
  528 + // 老样式1234
  529 + if (type1 && !type2) {
  530 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  531 + }
  532 + // 新样式
  533 + if (type1 && type2) {
  534 + if (type1 == '1') {
  535 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  536 + }
  537 + if (type1 == '2') {
  538 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  539 + }
  540 + if (type1 == '3' || type1 == '4') {
  541 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  542 + }
  543 + }
  544 + this.setData({
  545 + wxml: canvas({
  546 + imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
  547 + info: {
  548 + sellerName: data.seller.sellername,
  549 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  550 + time: section,
  551 + },
  552 + type1,
  553 + type2,
  554 + date2,
  555 + week,
  556 + day2,
  557 + })
  558 + })
  559 + },
523 onImgOK(e) { 560 onImgOK(e) {
524 this.setData({ 561 this.setData({
525 imgSrc: e.detail.path 562 imgSrc: e.detail.path
@@ -675,27 +712,13 @@ Page({ @@ -675,27 +712,13 @@ Page({
675 } 712 }
676 // 获取转发客人卡片设置 713 // 获取转发客人卡片设置
677 let detailInfo = this.data.detail; 714 let detailInfo = this.data.detail;
678 - if (data.lite_style == '0') { 715 + let liteStyle = data.lite_style.split('-');
  716 + if (liteStyle[0] == '0') {
679 this.setData({ 717 this.setData({
680 imgSrc: detailInfo.seller.seller_image 718 imgSrc: detailInfo.seller.seller_image
681 }) 719 })
682 } else { 720 } else {
683 - let d = detailInfo.ddate_solt;  
684 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
685 - let time2;  
686 - if(this.data.temp_ddate){  
687 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
688 - }else{  
689 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
690 - }  
691 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
692 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
693 - this.painterBtn(  
694 - detailInfo.seller.seller_image,  
695 - detailInfo.seller.sellername,  
696 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
697 - time  
698 - ); 721 + this.painterBtn(data.lite_style);
699 } 722 }
700 }).catch(res => { 723 }).catch(res => {
701 console.log('GetSellerTemplateConf请求失败'); 724 console.log('GetSellerTemplateConf请求失败');
@@ -1079,12 +1102,13 @@ Page({ @@ -1079,12 +1102,13 @@ Page({
1079 temp_ddate:times, 1102 temp_ddate:times,
1080 }).then(res => { 1103 }).then(res => {
1081 if (res.ret == 200) { 1104 if (res.ret == 200) {
1082 - if (this.data.lite_style == '2') {  
1083 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1105 + let style =this.data.lite_style.split('-');
  1106 + let type1 =style[0];
  1107 + let type2 =style[1];
  1108 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1109 + let time = temp_ddate || this.data.timeList[index]
1084 this.painterBtn( 1110 this.painterBtn(
1085 - detailInfo.seller.seller_image,  
1086 - detailInfo.seller.sellername,  
1087 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1111 + this.data.lite_style,
1088 time 1112 time
1089 ); 1113 );
1090 } 1114 }
@@ -508,17 +508,54 @@ Page({ @@ -508,17 +508,54 @@ Page({
508 } 508 }
509 }, 509 },
510 // 生成海报 510 // 生成海报
511 - painterBtn(img,sellerName,date,time) {  
512 - img = img.replace(/^http:/, "https:");  
513 - this.setData({  
514 - wxml: canvas({  
515 - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',  
516 - sellerName,  
517 - date,  
518 - time,  
519 - })  
520 - })  
521 - }, 511 + painterBtn(liteStyle, timeStr) {
  512 + let style = liteStyle.split('-');
  513 + let type1 = style[0];
  514 + let type2 = style[1];
  515 + let data = this.data.detail;
  516 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  517 + let d = data.ddate_solt;
  518 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  519 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  520 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  521 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  522 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  523 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  524 + time = timeStr ? timeStr : time;
  525 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  526 + let section = ''
  527 + // 老样式1234
  528 + if (type1 && !type2) {
  529 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  530 + }
  531 + // 新样式
  532 + if (type1 && type2) {
  533 + if (type1 == '1') {
  534 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  535 + }
  536 + if (type1 == '2') {
  537 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  538 + }
  539 + if (type1 == '3' || type1 == '4') {
  540 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  541 + }
  542 + }
  543 + this.setData({
  544 + wxml: canvas({
  545 + imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
  546 + info: {
  547 + sellerName: data.seller.sellername,
  548 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  549 + time: section,
  550 + },
  551 + type1,
  552 + type2,
  553 + date2,
  554 + week,
  555 + day2,
  556 + })
  557 + })
  558 + },
522 onImgOK(e) { 559 onImgOK(e) {
523 this.setData({ 560 this.setData({
524 imgSrc: e.detail.path 561 imgSrc: e.detail.path
@@ -674,27 +711,13 @@ Page({ @@ -674,27 +711,13 @@ Page({
674 } 711 }
675 // 获取转发客人卡片设置 712 // 获取转发客人卡片设置
676 let detailInfo = this.data.detail; 713 let detailInfo = this.data.detail;
677 - if (data.lite_style == '0') { 714 + let liteStyle = data.lite_style.split('-');
  715 + if (liteStyle[0] == '0') {
678 this.setData({ 716 this.setData({
679 imgSrc: detailInfo.seller.seller_image 717 imgSrc: detailInfo.seller.seller_image
680 }) 718 })
681 } else { 719 } else {
682 - let d = detailInfo.ddate_solt;  
683 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
684 - let time2;  
685 - if(this.data.temp_ddate){  
686 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
687 - }else{  
688 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
689 - }  
690 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
691 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
692 - this.painterBtn(  
693 - detailInfo.seller.seller_image,  
694 - detailInfo.seller.sellername,  
695 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
696 - time  
697 - ); 720 + this.painterBtn(data.lite_style);
698 } 721 }
699 }).catch(res => { 722 }).catch(res => {
700 console.log('GetSellerTemplateConf请求失败'); 723 console.log('GetSellerTemplateConf请求失败');
@@ -1078,12 +1101,13 @@ Page({ @@ -1078,12 +1101,13 @@ Page({
1078 temp_ddate:times, 1101 temp_ddate:times,
1079 }).then(res => { 1102 }).then(res => {
1080 if (res.ret == 200) { 1103 if (res.ret == 200) {
1081 - if (this.data.lite_style == '2') {  
1082 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1104 + let style =this.data.lite_style.split('-');
  1105 + let type1 =style[0];
  1106 + let type2 =style[1];
  1107 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1108 + let time = temp_ddate || this.data.timeList[index]
1083 this.painterBtn( 1109 this.painterBtn(
1084 - detailInfo.seller.seller_image,  
1085 - detailInfo.seller.sellername,  
1086 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1110 + this.data.lite_style,
1087 time 1111 time
1088 ); 1112 );
1089 } 1113 }
@@ -528,14 +528,51 @@ Page({ @@ -528,14 +528,51 @@ Page({
528 } 528 }
529 }, 529 },
530 // 生成海报 530 // 生成海报
531 - painterBtn(img, sellerName, date, time) {  
532 - img = img.replace(/^http:/, "https:"); 531 + painterBtn(liteStyle, timeStr) {
  532 + let style = liteStyle.split('-');
  533 + let type1 = style[0];
  534 + let type2 = style[1];
  535 + let data = this.data.detail;
  536 + let img = data.seller.seller_image.replace(/^http:/, "https:");
  537 + let d = data.ddate_solt;
  538 + let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
  539 + let date2 = util.unixtoTime(data.ddate, 'MM/DD');
  540 + let week = ' ' + util.unixtoTime(data.ddate, '周WW');
  541 + let timeSlot1 = ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
  542 + let timeSlot2 = ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
  543 + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
  544 + time = timeStr ? timeStr : time;
  545 + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
  546 + let section = ''
  547 + // 老样式1234
  548 + if (type1 && !type2) {
  549 + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
  550 + }
  551 + // 新样式
  552 + if (type1 && type2) {
  553 + if (type1 == '1') {
  554 + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
  555 + }
  556 + if (type1 == '2') {
  557 + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
  558 + }
  559 + if (type1 == '3' || type1 == '4') {
  560 + section = type2 == '1' ? timeSlot2.trim() + time : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
  561 + }
  562 + }
533 this.setData({ 563 this.setData({
534 wxml: canvas({ 564 wxml: canvas({
535 imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', 565 imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
536 - sellerName,  
537 - date,  
538 - time, 566 + info: {
  567 + sellerName: data.seller.sellername,
  568 + date: util.unixtoTime(data.ddate, 'MM月DD日'),
  569 + time: section,
  570 + },
  571 + type1,
  572 + type2,
  573 + date2,
  574 + week,
  575 + day2,
539 }) 576 })
540 }) 577 })
541 }, 578 },
@@ -708,27 +745,13 @@ Page({ @@ -708,27 +745,13 @@ Page({
708 } 745 }
709 // 获取转发客人卡片设置 746 // 获取转发客人卡片设置
710 let detailInfo = this.data.detail; 747 let detailInfo = this.data.detail;
711 - if (data.lite_style == '0') { 748 + let liteStyle = data.lite_style.split('-');
  749 + if (liteStyle[0] == '0') {
712 this.setData({ 750 this.setData({
713 imgSrc: detailInfo.seller.seller_image 751 imgSrc: detailInfo.seller.seller_image
714 }) 752 })
715 } else { 753 } else {
716 - let d = detailInfo.ddate_solt;  
717 - let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');  
718 - let time2;  
719 - if(this.data.temp_ddate){  
720 - time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate  
721 - }else{  
722 - time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')  
723 - }  
724 - let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');  
725 - let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';  
726 - this.painterBtn(  
727 - detailInfo.seller.seller_image,  
728 - detailInfo.seller.sellername,  
729 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'),  
730 - time  
731 - ); 754 + this.painterBtn(data.lite_style);
732 } 755 }
733 }).catch(res => { 756 }).catch(res => {
734 console.log('GetSellerTemplateConf请求失败'); 757 console.log('GetSellerTemplateConf请求失败');
@@ -1112,12 +1135,13 @@ Page({ @@ -1112,12 +1135,13 @@ Page({
1112 temp_ddate:times, 1135 temp_ddate:times,
1113 }).then(res => { 1136 }).then(res => {
1114 if (res.ret == 200) { 1137 if (res.ret == 200) {
1115 - if (this.data.lite_style == '2') {  
1116 - let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index]) 1138 + let style =this.data.lite_style.split('-');
  1139 + let type1 =style[0];
  1140 + let type2 =style[1];
  1141 + if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3'))){
  1142 + let time = temp_ddate || this.data.timeList[index]
1117 this.painterBtn( 1143 this.painterBtn(
1118 - detailInfo.seller.seller_image,  
1119 - detailInfo.seller.sellername,  
1120 - util.unixtoTime(detailInfo.ddate, 'MM月DD日'), 1144 + this.data.lite_style,
1121 time 1145 time
1122 ); 1146 );
1123 } 1147 }
1 // canvas.js 1 // canvas.js
2 module.exports = data => { 2 module.exports = data => {
3 - return ({  
4 - "width": "210px",  
5 - "height": "168px",  
6 - "views": [{  
7 - "type": "image",  
8 - "url": data.imgUrl,  
9 - "css": {  
10 - "width": "210px",  
11 - "height": "168px",  
12 - "top": "0px",  
13 - "left": "0px",  
14 - "mode": "aspectFill"  
15 - }  
16 - },  
17 - {  
18 - "type": "image",  
19 - "url": 'https://nosqn.colorcun.com/rectangleBj.png',  
20 - "css": {  
21 - "width": "210px",  
22 - "height": "168px",  
23 - "top": "0px",  
24 - "left": "0px",  
25 - "mode": "aspectFill"  
26 - }  
27 - },  
28 - {  
29 - "type": "text",  
30 - "text": data.sellerName,  
31 - "css": {  
32 - "color": "#FFEFC5",  
33 - "width": "190px",  
34 - "top": "10px",  
35 - "left": "10px",  
36 - "right": "10px",  
37 - "borderColor": "#000000",  
38 - "fontSize": "12px",  
39 - "fontWeight": "normal",  
40 - "maxLines": "2",  
41 - "textStyle": "fill",  
42 - "textDecoration": "none",  
43 - "fontFamily": "PingFang SC",  
44 - "textAlign": "center",  
45 - }  
46 - },  
47 - {  
48 - "type": "text",  
49 - "text": data.date,  
50 - "css": {  
51 - "color": "#FFEFC5",  
52 - "width": "210px",  
53 - "height": "168px",  
54 - "top": "70px",  
55 - "borderColor": "#000000",  
56 - "fontSize": "20px",  
57 - "fontWeight": "bold",  
58 - "maxLines": "3",  
59 - "textStyle": "fill",  
60 - "textDecoration": "none",  
61 - "fontFamily": "PingFang SC",  
62 - "textAlign": "center",  
63 - }  
64 - },  
65 - {  
66 - "type": "text",  
67 - "text": data.time,  
68 - "css": {  
69 - "color": "#FFEFC5",  
70 - "width": "210px",  
71 - "height": "168px",  
72 - "top": "100px",  
73 - "borderColor": "#000000",  
74 - "fontSize": "18px",  
75 - "fontWeight": "bold",  
76 - "maxLines": "3",  
77 - "textStyle": "fill",  
78 - "textDecoration": "none",  
79 - "fontFamily": "PingFang SC",  
80 - "textAlign": "center",  
81 - }  
82 - },  
83 - ]  
84 - }); 3 + const views = [{
  4 + "type": "image",
  5 + "url": data.imgUrl,
  6 + "css": {
  7 + "width": "210px",
  8 + "height": "168px",
  9 + "top": "0px",
  10 + "left": "0px",
  11 + "mode": "aspectFill"
  12 + }
  13 + }, ]
  14 + // 原来的样式1,2,3
  15 + if (data.type1 && !data.type2) {
  16 + views.push({
  17 + "type": "image",
  18 + "url": 'https://nosqn.colorcun.com/rectangleBj.png',
  19 + "css": {
  20 + "width": "210px",
  21 + "height": "168px",
  22 + "top": "0px",
  23 + "left": "0px",
  24 + "mode": "aspectFill"
  25 + }
  26 + }, {
  27 + "type": "text",
  28 + "text": data.info.sellerName,
  29 + "css": {
  30 + "color": "#FFEFC5",
  31 + "width": "190px",
  32 + "top": "10px",
  33 + "left": "10px",
  34 + "right": "10px",
  35 + "borderColor": "#000000",
  36 + "fontSize": "12px",
  37 + "fontWeight": "normal",
  38 + "maxLines": "2",
  39 + "textStyle": "fill",
  40 + "textDecoration": "none",
  41 + "fontFamily": "PingFang SC",
  42 + "textAlign": "center",
  43 + }
  44 + }, {
  45 + "type": "text",
  46 + "text": data.info.date,
  47 + "css": {
  48 + "color": "#FFEFC5",
  49 + "width": "210px",
  50 + "height": "168px",
  51 + "top": "70px",
  52 + "borderColor": "#000000",
  53 + "fontSize": "20px",
  54 + "fontWeight": "bold",
  55 + "maxLines": "3",
  56 + "textStyle": "fill",
  57 + "textDecoration": "none",
  58 + "fontFamily": "PingFang SC",
  59 + "textAlign": "center",
  60 + }
  61 + }, {
  62 + "type": "text",
  63 + "text": data.info.time,
  64 + "css": {
  65 + "color": "#FFEFC5",
  66 + "width": "210px",
  67 + "height": "168px",
  68 + "top": "100px",
  69 + "borderColor": "#000000",
  70 + "fontSize": "18px",
  71 + "fontWeight": "bold",
  72 + "maxLines": "3",
  73 + "textStyle": "fill",
  74 + "textDecoration": "none",
  75 + "fontFamily": "PingFang SC",
  76 + "textAlign": "center",
  77 + }
  78 + })
  79 + }
  80 + // 新的样式1-1至1-4
  81 + if (data.type1 == '1' && data.type2) {
  82 + views.push({
  83 + "type": "image",
  84 + "url": 'https://qn.colorcun.com/rectangleBj1.png',
  85 + "css": {
  86 + "width": "210px",
  87 + "height": "26px",
  88 + "top": "0px",
  89 + "left": "0px",
  90 + "mode": "aspectFill"
  91 + }
  92 + }, {
  93 + "type": "image",
  94 + "url": 'https://qn.colorcun.com/rectangleBj1.png',
  95 + "css": {
  96 + "width": "210px",
  97 + "height": "26px",
  98 + "top": "142px",
  99 + "left": "0px",
  100 + "mode": "aspectFill"
  101 + }
  102 + }, {
  103 + "type": "text",
  104 + "text": data.info.sellerName,
  105 + "css": {
  106 + "color": "#FFEFC5",
  107 + "width": "190px",
  108 + "top": "6px",
  109 + "left": "10px",
  110 + "right": "10px",
  111 + "borderColor": "#000000",
  112 + "fontSize": "12px",
  113 + "fontWeight": "normal",
  114 + "maxLines": "2",
  115 + "textStyle": "fill",
  116 + "textDecoration": "none",
  117 + "fontFamily": "PingFang SC",
  118 + "textAlign": "center",
  119 + }
  120 + }, {
  121 + "type": "text",
  122 + "text": data.info.time,
  123 + "css": {
  124 + "color": "#FFEFC5",
  125 + "width": "210px",
  126 + "height": "168px",
  127 + "top": "146px",
  128 + "borderColor": "#000000",
  129 + "fontSize": "12px",
  130 + "fontWeight": "bold",
  131 + "maxLines": "1",
  132 + "textStyle": "fill",
  133 + "textDecoration": "none",
  134 + "fontFamily": "PingFang SC",
  135 + "textAlign": "center",
  136 + }
  137 + });
  138 + }
  139 + // 新的样式2-1至2-4
  140 + if (data.type1 == '2' && data.type2) {
  141 + views.push({
  142 + "type": "image",
  143 + "url": 'https://qn.colorcun.com/rectangleBj.png',
  144 + "css": {
  145 + "width": "210px",
  146 + "height": "168px",
  147 + "top": "0px",
  148 + "left": "0px",
  149 + "mode": "aspectFill"
  150 + }
  151 + }, {
  152 + "type": "text",
  153 + "text": data.info.sellerName,
  154 + "css": {
  155 + "color": "#FFEFC5",
  156 + "width": "190px",
  157 + "top": "33px",
  158 + "left": "10px",
  159 + "right": "10px",
  160 + "borderColor": "#000000",
  161 + "fontSize": "12px",
  162 + "fontWeight": "normal",
  163 + "maxLines": "2",
  164 + "textStyle": "fill",
  165 + "textDecoration": "none",
  166 + "fontFamily": "PingFang SC",
  167 + "textAlign": "center",
  168 + }
  169 + }, {
  170 + "type": "text",
  171 + "text": data.date2,
  172 + "css": {
  173 + "color": "#FFEFC5",
  174 + "width": "190px",
  175 + "top": "80px",
  176 + "left": "10px",
  177 + "right": "10px",
  178 + "borderColor": "#000000",
  179 + "fontSize": "24px",
  180 + "fontWeight": "normal",
  181 + "maxLines": "1",
  182 + "textStyle": "fill",
  183 + "textDecoration": "none",
  184 + "fontFamily": "PingFang SC",
  185 + "textAlign": "center",
  186 + }
  187 + }, {
  188 + "type": "text",
  189 + "text": data.info.time,
  190 + "css": {
  191 + "color": "#FFEFC5",
  192 + "width": "210px",
  193 + "height": "168px",
  194 + "top": "118px",
  195 + "borderColor": "#000000",
  196 + "fontSize": "12px",
  197 + "fontWeight": "bold",
  198 + "maxLines": "1",
  199 + "textStyle": "fill",
  200 + "textDecoration": "none",
  201 + "fontFamily": "PingFang SC",
  202 + "textAlign": "center",
  203 + }
  204 + });
  205 + }
  206 + // 新的样式3-1至3-4
  207 + if (data.type1 == '3' && data.type2) {
  208 + views.push({
  209 + "type": "image",
  210 + "url": 'https://qn.colorcun.com/rectangleBj.png',
  211 + "css": {
  212 + "width": "210px",
  213 + "height": "168px",
  214 + "top": "0px",
  215 + "left": "0px",
  216 + "mode": "aspectFill"
  217 + }
  218 + }, {
  219 + "type": "text",
  220 + "text": data.info.sellerName,
  221 + "css": {
  222 + "color": "#FFEFC5",
  223 + "width": "190px",
  224 + "top": "20px",
  225 + "left": "12px",
  226 + "right": "12px",
  227 + "borderColor": "#000000",
  228 + "fontSize": "12px",
  229 + "fontWeight": "normal",
  230 + "maxLines": "2",
  231 + "textStyle": "fill",
  232 + "textDecoration": "none",
  233 + "fontFamily": "PingFang SC",
  234 + }
  235 + }, {
  236 + "type": "text",
  237 + "text": data.date2,
  238 + "css": {
  239 + "color": "#FFEFC5",
  240 + "width": "85px",
  241 + "top": "97px",
  242 + "left": "40px",
  243 + "right": "10px",
  244 + "borderColor": "#000000",
  245 + "fontSize": "24px",
  246 + "fontWeight": "normal",
  247 + "maxLines": "2",
  248 + "textStyle": "fill",
  249 + "textDecoration": "none",
  250 + "fontFamily": "PingFang SC",
  251 + }
  252 + }, {
  253 + "type": "text",
  254 + "text": '周',
  255 + "css": {
  256 + "color": "#FFEFC5",
  257 + "width": "10px",
  258 + "top": "97px",
  259 + "left": "60px",
  260 + "right": "10px",
  261 + "borderColor": "#000000",
  262 + "fontSize": "12px",
  263 + "fontWeight": "normal",
  264 + "maxLines": "2",
  265 + "textStyle": "fill",
  266 + "textDecoration": "none",
  267 + "fontFamily": "PingFang SC",
  268 + }
  269 + }, {
  270 + "type": "text",
  271 + "text": data.day2,
  272 + "css": {
  273 + "color": "#FFEFC5",
  274 + "width": "10px",
  275 + "top": "110px",
  276 + "left": "60px",
  277 + "right": "10px",
  278 + "borderColor": "#000000",
  279 + "fontSize": "12px",
  280 + "fontWeight": "normal",
  281 + "maxLines": "2",
  282 + "textStyle": "fill",
  283 + "textDecoration": "none",
  284 + "fontFamily": "PingFang SC",
  285 + }
  286 + }, {
  287 + "type": "text",
  288 + "text": data.info.time,
  289 + "css": {
  290 + "color": "#FFEFC5",
  291 + "minWidth": "90px",
  292 + "top": "133px",
  293 + "lineHeight": "16px",
  294 + "right": "18px",
  295 + "padding": "2px 6px",
  296 + "borderColor": "#000000",
  297 + "borderRadius": "3px",
  298 + "fontSize": "12px",
  299 + "maxLines": "1",
  300 + "textStyle": "fill",
  301 + "textDecoration": "none",
  302 + "fontFamily": "PingFang SC",
  303 + 'background': 'rgba(255, 239, 197, 0.4)',
  304 + "textAlign": "center",
  305 + "verticalAlign": "middle",
  306 + }
  307 + }, );
  308 + }
  309 + // 新的样式4-1至4-4
  310 + if (data.type1 == '4' && data.type2) {
  311 + views.push({
  312 + "type": "image",
  313 + "url": 'https://qn.colorcun.com/rectangleBj2.png',
  314 + "css": {
  315 + "width": "210px",
  316 + "height": "44px",
  317 + "top": "124px",
  318 + "left": "0px",
  319 + "mode": "aspectFill"
  320 + }
  321 + }, {
  322 + "type": "text",
  323 + "text": data.info.sellerName,
  324 + "css": {
  325 + "color": "#FFEFC5",
  326 + "width": "124px",
  327 + "top": "140px",
  328 + "left": "8px",
  329 + "borderColor": "#000000",
  330 + "fontSize": "12px",
  331 + "fontWeight": "normal",
  332 + "maxLines": "2",
  333 + "textStyle": "fill",
  334 + "textDecoration": "none",
  335 + "fontFamily": "PingFang SC",
  336 + }
  337 + }, {
  338 + "type": "text",
  339 + "text": data.date2 + data.week,
  340 + "css": {
  341 + "color": "#FFEFC5",
  342 + "width": "60px",
  343 + "top": "130px",
  344 + "right": "14px",
  345 + "borderColor": "#000000",
  346 + "fontSize": "10px",
  347 + "fontWeight": "normal",
  348 + "maxLines": "1",
  349 + "textStyle": "fill",
  350 + "textDecoration": "none",
  351 + "fontFamily": "PingFang SC",
  352 + }
  353 + }, {
  354 + "type": "text",
  355 + "text": data.info.time,
  356 + "css": {
  357 + "color": "#FFEFC5",
  358 + "width": "60px",
  359 + "top": "146px",
  360 + "lineHeight": "14px",
  361 + "right": "18px",
  362 + "padding": "1px 2px",
  363 + "borderColor": "#000000",
  364 + "borderRadius": "3px",
  365 + "fontSize": "10px",
  366 + "maxLines": "1",
  367 + "textStyle": "fill",
  368 + "textDecoration": "none",
  369 + "fontFamily": "PingFang SC",
  370 + 'background': 'rgba(255, 239, 197, 0.4)',
  371 + "textAlign": "center",
  372 + "verticalAlign": "middle",
  373 + }
  374 + }, );
  375 + }
  376 + return {
  377 + "width": "210px",
  378 + "height": "168px",
  379 + "views": views
  380 + };
85 } 381 }