pyqMass.html 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
  8. <title>发布企微朋友圈</title>
  9. <!-- 引入样式文件 -->
  10. <link rel="stylesheet"
  11. href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1758012584633/vant.css" />
  12. <link rel="stylesheet" href="../css/select-tag.css">
  13. <link rel="stylesheet" href="../css/page-return.css">
  14. <!-- 必须先引入vue, 后使用vant-ui -->
  15. <script
  16. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
  17. <!-- 引入vant的组件库-->
  18. <!-- 引入 Vant 的 JS 文件 -->
  19. <script
  20. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1758012748487/vant.min.js"></script>
  21. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  22. <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
  23. <script src="../js/select-tag.js"></script>
  24. <script src="../js/page-return.js"></script>
  25. <!-- <script src="js/vconsole.min.js"></script>
  26. <script>
  27. var vConsole = new window.VConsole();
  28. </script> -->
  29. </head>
  30. <style>
  31. body {
  32. margin: 0;
  33. padding: 0;
  34. }
  35. .box {
  36. width: 100vw;
  37. min-height: 100vh;
  38. box-sizing: border-box;
  39. background: #F7F9FC;
  40. }
  41. .page5 {
  42. width: 100vw;
  43. box-sizing: border-box;
  44. padding-bottom: 39px;
  45. }
  46. .task_content {
  47. padding: 15px 10px;
  48. }
  49. .send_item {
  50. width: 100%;
  51. background: #FFFFFF;
  52. border-radius: 15px;
  53. box-sizing: border-box;
  54. padding: 15px 10px;
  55. margin-bottom: 15px;
  56. }
  57. .client_tag {
  58. font-size: 12px;
  59. line-height: 17px;
  60. }
  61. .status1 {
  62. color: #136DFB;
  63. }
  64. .status2 {
  65. color: #FFA041;
  66. }
  67. .status3 {
  68. color: #FF4141;
  69. }
  70. .mem_title {
  71. display: flex;
  72. justify-content: space-between;
  73. align-items: center;
  74. }
  75. .mem_title_left {
  76. font-size: 14px;
  77. color: #222222;
  78. line-height: 20px;
  79. padding-left: 5px;
  80. position: relative;
  81. display: flex;
  82. align-items: center;
  83. }
  84. .mem_title_left::after {
  85. position: absolute;
  86. left: 0;
  87. content: '';
  88. width: 2px;
  89. height: 12px;
  90. background: #136DFB;
  91. border-radius: 1px;
  92. }
  93. .mem_title_right {
  94. display: flex;
  95. align-items: center;
  96. font-size: 12px;
  97. color: #136DFB;
  98. line-height: 17px;
  99. }
  100. .mem_title_right img {
  101. width: 16px;
  102. height: 16px;
  103. }
  104. .mem_tag_list {
  105. display: flex;
  106. flex-wrap: wrap;
  107. align-items: center;
  108. gap: 10px;
  109. max-height: 52px;
  110. overflow: hidden;
  111. }
  112. .mem_tag {
  113. margin-top: 15px;
  114. }
  115. .mem_tag span {
  116. padding: 2px 8px;
  117. background: rgba(19, 109, 251, 0.05);
  118. border-radius: 5px;
  119. font-size: 12px;
  120. line-height: 17px;
  121. color: #136DFB;
  122. }
  123. .condition_mem_tag1 {
  124. margin-top: 10px;
  125. }
  126. .condition_mem_tag2 {
  127. margin-top: 10px;
  128. }
  129. .condition_mem_tag3 {
  130. margin-top: 18px;
  131. }
  132. .condition_mem_tag1 span {
  133. padding: 2px 8px;
  134. background: #F2F6FC;
  135. border-radius: 5px;
  136. font-size: 12px;
  137. line-height: 17px;
  138. color: #7D97BF;
  139. }
  140. .condition_mem_tag2 span {
  141. padding: 2px 8px;
  142. background: #FCF7F2;
  143. border-radius: 5px;
  144. font-size: 12px;
  145. line-height: 17px;
  146. color: #BFA17D;
  147. }
  148. .condition_mem_tag3 span {
  149. padding: 2px 8px;
  150. background: #FCF2F2;
  151. border-radius: 5px;
  152. font-size: 12px;
  153. line-height: 17px;
  154. color: #BF7D7D;
  155. }
  156. .send_centent {
  157. padding: 20px 15px;
  158. }
  159. .send_text {
  160. font-size: 14px;
  161. color: #222222;
  162. line-height: 20px;
  163. padding-bottom: 10px;
  164. }
  165. .send_contentText {
  166. font-size: 14px;
  167. line-height: 23px;
  168. color: #666666;
  169. padding-bottom: 20px;
  170. }
  171. .img_list {
  172. display: flex;
  173. flex-wrap: nowrap;
  174. overflow-x: auto;
  175. gap: 10px;
  176. padding: 10px 5px 10px;
  177. }
  178. .img_box {
  179. position: relative;
  180. width: 105px;
  181. height: 140px;
  182. }
  183. .close_imgMater {
  184. width: 24px;
  185. height: 24px;
  186. position: absolute;
  187. top: -8px;
  188. right: -8px;
  189. }
  190. .img_url {
  191. width: 105px;
  192. height: 140px;
  193. border-radius: 10px;
  194. object-fit: cover;
  195. }
  196. .video_container {
  197. position: relative;
  198. width: 105px;
  199. height: 140px;
  200. }
  201. .play_button {
  202. width: 24px;
  203. height: 24px;
  204. position: absolute;
  205. top: 50%;
  206. left: 50%;
  207. transform: translate(-50%, -50%);
  208. }
  209. .matters_item {
  210. width: calc(50% - 5px);
  211. height: 60px;
  212. border-radius: 10px;
  213. display: flex;
  214. align-items: center;
  215. padding: 10px;
  216. margin-bottom: 10px;
  217. box-sizing: border-box;
  218. border: 1px solid #EFEFEF;
  219. position: relative;
  220. }
  221. .matters_item_img {
  222. width: 40px;
  223. height: 40px;
  224. flex-shrink: 0;
  225. margin-right: 8px;
  226. }
  227. .close_mater {
  228. width: 24px;
  229. height: 24px;
  230. position: absolute;
  231. top: -8px;
  232. right: -8px;
  233. }
  234. .matters_item_info {
  235. flex: 1;
  236. min-width: 0;
  237. display: flex;
  238. flex-direction: column;
  239. font-size: 12px;
  240. color: #999999;
  241. line-height: 17px;
  242. }
  243. .matters_item_title {
  244. font-size: 12px;
  245. color: #222222;
  246. line-height: 17px;
  247. /* 必须设置宽度,此处宽度继承父元素 */
  248. overflow: hidden;
  249. white-space: nowrap;
  250. text-overflow: ellipsis;
  251. padding-bottom: 4px;
  252. }
  253. .matters_list {
  254. display: flex;
  255. justify-content: space-between;
  256. flex-wrap: wrap;
  257. }
  258. .mem_centent {
  259. padding: 10px 15px;
  260. }
  261. .filter_list {
  262. display: flex;
  263. flex-wrap: nowrap;
  264. white-space: nowrap;
  265. width: 100%;
  266. overflow-x: auto;
  267. gap: 10px;
  268. }
  269. .filter_span {
  270. height: 25px;
  271. box-sizing: border-box;
  272. font-size: 12px;
  273. color: #999999;
  274. padding: 4px 12px;
  275. background: #FAFAFA;
  276. border-radius: 10px;
  277. }
  278. .active {
  279. height: 25px;
  280. box-sizing: border-box;
  281. font-size: 12px;
  282. color: #1677FF;
  283. background: rgba(22, 119, 255, 0.1);
  284. padding: 4px 12px;
  285. border-radius: 10px;
  286. }
  287. .send_num_data {
  288. display: flex;
  289. align-items: center;
  290. padding: 15px 5px 10px;
  291. font-size: 12px;
  292. color: #222222;
  293. line-height: 17px;
  294. }
  295. .color1 {
  296. color: #1677FF;
  297. padding-right: 20px;
  298. }
  299. .color2 {
  300. color: #FFA041;
  301. padding-right: 20px;
  302. }
  303. .color3 {
  304. color: #FF4E4E;
  305. padding-right: 20px;
  306. }
  307. .color4 {
  308. color: #7D97BF;
  309. padding-right: 20px;
  310. }
  311. .send_mem_item {
  312. height: 100px;
  313. display: flex;
  314. flex-direction: column;
  315. justify-content: space-between;
  316. padding: 15px;
  317. background: #FAFAFA;
  318. border-radius: 15px;
  319. box-sizing: border-box;
  320. margin-bottom: 10px;
  321. }
  322. .send_mem_name {
  323. font-weight: 500;
  324. font-size: 14px;
  325. color: #222222;
  326. line-height: 20px;
  327. }
  328. .send_mem_data {
  329. display: flex;
  330. align-items: center;
  331. font-size: 12px;
  332. color: #999999;
  333. line-height: 17px;
  334. }
  335. .send_mem_time {
  336. font-size: 12px;
  337. color: #999999;
  338. line-height: 17px;
  339. }
  340. .van-cell {
  341. padding: 15px 5px 0;
  342. }
  343. .matter_btn_box {
  344. padding-top: 20px;
  345. }
  346. .cond_btn_box {
  347. padding-top: 15px;
  348. }
  349. .matter_btn {
  350. height: 50px;
  351. padding: 15px 0;
  352. background: rgba(19, 109, 251, 0.1);
  353. border-radius: 20px;
  354. font-weight: 500;
  355. font-size: 14px;
  356. color: #136DFB;
  357. text-align: center;
  358. box-sizing: border-box;
  359. }
  360. .send_btn_box {
  361. padding: 15px 25px 10px;
  362. }
  363. .send_btn {
  364. height: 50px;
  365. padding: 15px 0;
  366. background: #1677FF;
  367. border-radius: 20px;
  368. font-weight: 500;
  369. font-size: 14px;
  370. color: #FFFFFF;
  371. text-align: center;
  372. box-sizing: border-box;
  373. }
  374. textarea {
  375. height: 68px !important;
  376. line-height: 23px;
  377. }
  378. .van-radio__icon {
  379. width: 16px;
  380. height: 16px;
  381. }
  382. .van-radio__label {
  383. font-size: 14px;
  384. line-height: 20px;
  385. color: #222222;
  386. }
  387. .van-radio--horizontal {
  388. margin-right: 40px;
  389. }
  390. .van-radio-group {
  391. margin-top: 15px;
  392. }
  393. .check_div {
  394. width: 16px;
  395. height: 16px;
  396. border-radius: 50%;
  397. border: 1px solid #CCCCCC;
  398. box-sizing: border-box;
  399. margin-right: 8px;
  400. }
  401. .check_div_active {
  402. width: 16px;
  403. height: 16px;
  404. border-radius: 50%;
  405. border: 1px solid #136DFB;
  406. box-sizing: border-box;
  407. margin-right: 8px;
  408. }
  409. .check_div_active:after {
  410. content: "";
  411. display: block;
  412. width: 10px;
  413. height: 10px;
  414. border-radius: 50%;
  415. background: #136DFB;
  416. position: relative;
  417. top: 2px;
  418. left: 2px;
  419. }
  420. .send_item_name {
  421. font-size: 14px;
  422. line-height: 20px;
  423. color: #666666;
  424. padding-top: 20px;
  425. }
  426. .data_item {
  427. display: flex;
  428. align-items: center;
  429. justify-content: space-between;
  430. padding: 20px 20px 10px;
  431. }
  432. .data_title {
  433. font-size: 14px;
  434. color: #222222;
  435. line-height: 20px;
  436. display: -webkit-box;
  437. -webkit-line-clamp: 2;
  438. -webkit-box-orient: vertical;
  439. overflow: hidden;
  440. text-overflow: ellipsis;
  441. }
  442. .condition_box1 {
  443. padding: 15px;
  444. background: rgba(245, 249, 255, 0.5);
  445. border-radius: 10px;
  446. border: 1px solid #E2EAFF;
  447. box-sizing: border-box;
  448. margin-bottom: 10px;
  449. }
  450. .condition_box2 {
  451. padding: 15px;
  452. background: rgba(255, 252, 245, 0.5);
  453. border-radius: 10px;
  454. border: 1px solid #FFF5E2;
  455. box-sizing: border-box;
  456. margin-bottom: 10px;
  457. }
  458. .condition_box3 {
  459. padding: 15px;
  460. background: rgba(255, 245, 245, 0.5);
  461. border-radius: 10px;
  462. border: 1px solid #FFE2E2;
  463. box-sizing: border-box;
  464. }
  465. .con_data {
  466. display: flex;
  467. align-items: center;
  468. }
  469. .con_data_title {
  470. font-weight: 500;
  471. font-size: 12px;
  472. color: #222222;
  473. padding-right: 24px;
  474. }
  475. .con_data_edit {
  476. font-size: 12px;
  477. color: #136DFB;
  478. padding-right: 15px;
  479. }
  480. .con_data_del {
  481. font-size: 12px;
  482. color: #FF4141;
  483. }
  484. .tag_radio {
  485. margin-top: 10px;
  486. }
  487. .tag_radio_bo {
  488. margin-bottom: 10px;
  489. }
  490. .tag_radio_item {
  491. margin-right: 32px;
  492. }
  493. .condition_list {
  494. margin-top: 15px;
  495. }
  496. .exc_title {
  497. padding-right: 24px;
  498. }
  499. .filter_list {
  500. height: 146px;
  501. display: flex;
  502. align-items: center;
  503. gap: 15px;
  504. }
  505. .filter_or {
  506. font-weight: 500;
  507. font-size: 16px;
  508. color: #FFA041;
  509. width: 100%;
  510. text-align: center;
  511. background: rgba(255, 160, 65, 0.05);
  512. padding: 49px 0 48px;
  513. border-radius: 15px;
  514. }
  515. .filter_exc_active {
  516. font-weight: 500;
  517. font-size: 16px;
  518. color: #FF4141;
  519. width: 100%;
  520. text-align: center;
  521. padding: 49px 0 48px;
  522. background: rgba(255, 65, 65, 0.05);
  523. border-radius: 15px;
  524. }
  525. .filter_exc {
  526. font-weight: 500;
  527. font-size: 16px;
  528. color: #999999;
  529. width: 100%;
  530. text-align: center;
  531. padding: 49px 0 48px;
  532. background: #FAFAFA;
  533. border-radius: 15px;
  534. }
  535. .dev_left {
  536. margin-left: 15px;
  537. }
  538. .dev_right {
  539. margin-right: 15px;
  540. }
  541. .page_box {
  542. padding: 15px 15px 0;
  543. height: 446px;
  544. box-sizing: border-box;
  545. }
  546. .path_list {
  547. display: flex;
  548. align-items: center;
  549. flex-wrap: nowrap;
  550. white-space: nowrap;
  551. width: 100%;
  552. overflow-x: auto;
  553. margin-bottom: 25px;
  554. height: 17px;
  555. }
  556. .path_span {
  557. font-size: 12px;
  558. color: #999999;
  559. line-height: 17px;
  560. }
  561. .path_line {
  562. font-size: 12px;
  563. color: #999999;
  564. line-height: 17px;
  565. padding: 0 10px;
  566. }
  567. .path_item:last-child {
  568. color: #222222;
  569. }
  570. .data_list {
  571. height: 404px;
  572. gap: 25px;
  573. overflow-y: auto;
  574. }
  575. .mem_item {
  576. display: flex;
  577. align-items: center;
  578. justify-content: space-between;
  579. margin-bottom: 20px;
  580. }
  581. .mem_item img {
  582. width: 40px;
  583. height: 40px;
  584. margin-right: 10px;
  585. }
  586. .mem_title {
  587. width: 224px;
  588. font-size: 14px;
  589. color: #222222;
  590. line-height: 20px;
  591. width: 238px;
  592. white-space: nowrap;
  593. overflow: hidden;
  594. text-overflow: ellipsis;
  595. }
  596. .dept_item {
  597. display: flex;
  598. align-items: center;
  599. }
  600. .time_list {
  601. overflow-y: auto;
  602. padding: 10px 20px 29px;
  603. box-sizing: border-box;
  604. }
  605. .time_box {
  606. height: 50px;
  607. box-sizing: border-box;
  608. display: flex;
  609. align-items: center;
  610. justify-content: space-between;
  611. padding: 15px;
  612. border-radius: 15px;
  613. border: 1px solid #F1F1F1;
  614. }
  615. .time_box img {
  616. width: 16px;
  617. height: 16px;
  618. }
  619. .date_box {
  620. height: 210px;
  621. box-sizing: border-box;
  622. display: flex;
  623. align-items: center;
  624. justify-content: space-between;
  625. border-radius: 15px;
  626. border: 1px solid #F1F1F1;
  627. }
  628. .date_box .van-ellipsis {
  629. /* width: 100px; */
  630. width: 102px;
  631. text-align: center;
  632. font-size: 14px;
  633. color: #222222;
  634. white-space: wrap;
  635. }
  636. .time_date {
  637. display: flex;
  638. align-items: center;
  639. font-size: 14px;
  640. color: #222222;
  641. line-height: 20px;
  642. }
  643. .time_date_center {
  644. padding: 0 10px;
  645. }
  646. .date_select {
  647. display: flex;
  648. align-items: center;
  649. justify-content: space-between;
  650. margin-top: 20px;
  651. }
  652. .select_time {
  653. width: 76px;
  654. height: 37px;
  655. line-height: 37px;
  656. background: #FAFAFA;
  657. border-radius: 10px;
  658. font-size: 12px;
  659. color: #222222;
  660. text-align: center;
  661. }
  662. .select_time_ac {
  663. width: 76px;
  664. height: 37px;
  665. line-height: 37px;
  666. background: rgba(19, 109, 251, 0.05);
  667. border-radius: 10px;
  668. border: 1px solid #136DFB;
  669. font-size: 12px;
  670. color: #136DFB;
  671. text-align: center;
  672. box-sizing: border-box;
  673. }
  674. .now_date {
  675. display: flex;
  676. align-items: center;
  677. font-weight: 500;
  678. font-size: 16px;
  679. color: #222222;
  680. padding: 12px 20px;
  681. background: #FAFAFA;
  682. border-radius: 15px;
  683. justify-content: space-between;
  684. margin-top: 20px;
  685. }
  686. </style>
  687. <body>
  688. <div id="box" class="box">
  689. <div class="page5">
  690. <van-dialog v-model="showReturn" title="提示" show-cancel-button :before-close="beforeClose"
  691. confirm-button-text="确定" cancel-button-text="取消">
  692. <div style="padding: 20px; text-align: center;">确认返回吗?</div>
  693. </van-dialog>
  694. <!-- 选择群发时间 -->
  695. <van-popup v-model="showTime" duration="0.2" round position="bottom" :close-on-click-overlay="false"
  696. :style="{ width: '100%', height: showDateColumns ? '426px' : '266px' }">
  697. <div class="clientTag_title">
  698. <div class="close_icon"></div>
  699. <div>选择时间</div>
  700. <img class="close_icon" src="../img/qw/close_icon.png" alt="" @click="showTime = false" />
  701. </div>
  702. <div class="time_list" :style="{ height: showDateColumns ? '306px' : '146px' }">
  703. <div class="date_box" v-if="showDateColumns">
  704. <van-picker ref="vanPicker" :columns="dateColumns" @change="handleChangeDate" visible-item-count="4" />
  705. </div>
  706. <div class="time_box" @click="handleShowDateColumns" v-else>
  707. <div class="close_icon"></div>
  708. <div class="time_date">
  709. <span>{{nowDate[0]}}</span>
  710. <span class="time_date_center">{{nowDate[1]}}</span>
  711. <span>{{nowDate[2]}}</span>
  712. </div>
  713. <img src="../img/qw/select_icon.png" alt="" @click="showTime = false">
  714. </div>
  715. <div class="date_select">
  716. <span :class="dateIndex === 'hour' ? 'select_time_ac' : 'select_time'"
  717. @click="getTimeInfo('hour')">一小时后</span>
  718. <span :class="dateIndex === 'day' ? 'select_time_ac' : 'select_time'" @click="getTimeInfo('day')">一天后</span>
  719. <span :class="dateIndex === 'week' ? 'select_time_ac' : 'select_time'"
  720. @click="getTimeInfo('week')">一周后</span>
  721. <span :class="dateIndex === 'month' ? 'select_time_ac' : 'select_time'"
  722. @click="getTimeInfo('month')">一个月后</span>
  723. </div>
  724. </div>
  725. <div class="tag_footers">
  726. <div class="tag_re_btn" @click="showTime = false">取消</div>
  727. <div class="tag_ok_btn" @click="handleTime">保存</div>
  728. </div>
  729. </van-popup>
  730. <!-- 成员数据 -->
  731. <van-popup v-model="showMem" duration="0.2" round position="bottom" :close-on-click-overlay="false"
  732. :style="{ width: '100%', height: '566px' }">
  733. <div class="clientTag_title">
  734. <div class="close_icon"></div>
  735. <div>添加成员</div>
  736. <img class="close_icon" src="../img/qw/close_icon.png" alt="" @click="handleCancelMem">
  737. </div>
  738. <div class="page_box">
  739. <div class="path_list">
  740. <div class="path_span">
  741. <span @click="getTreeData(0)">全部</span>
  742. <span class="path_item" v-for="(item, index) in pathList" :key="index" @click="handlePathClick(item)">
  743. <span class="path_line">/</span>{{item.text}}</span>
  744. </div>
  745. </div>
  746. <div class="data_list">
  747. <!-- 部门 -->
  748. <div class="mem_item" v-for="item in treeData" :key="item.id">
  749. <div class="dept_item" @click="handleDeptClick(item)">
  750. <img src="../img/qw/dept_icon.png" alt="" />
  751. <div class="mem_title">{{item.text}}</div>
  752. </div>
  753. </div>
  754. <!-- 成员 -->
  755. <van-checkbox-group v-model="checkedMemIds" @change="onChangeMem">
  756. <div class="mem_item" v-for="item in itemList" :key="item.memberId">
  757. <div class="dept_item">
  758. <img src="../img/qw/mem_icon.png" alt="" />
  759. <div class="mem_title">{{item.name}}</div>
  760. </div>
  761. <van-checkbox :name="item.memberId">
  762. <template #icon="props">
  763. <div :class="props.checked ? 'check_div_active' : 'check_div'"></div>
  764. </template>
  765. </van-checkbox>
  766. </div>
  767. </van-checkbox-group>
  768. </div>
  769. </div>
  770. <div class="tag_footer">
  771. <div class="tag_re_btn" @click="handleCancelMem">取消</div>
  772. <div class="tag_ok_btn" @click="handleMem">保存</div>
  773. </div>
  774. </van-popup>
  775. <!-- 标签筛选组件 -->
  776. <select-tag :tenancy-Id="tenancyId" :show-Client-Tag.sync="showClientTag" :show-Label-Filter="false"
  777. :select-Tag-List.sync="formValidate.tags" @add="handleAdd"></select-tag>
  778. <div class="task_content">
  779. <div class="send_item">
  780. <div class="mem_title_left">朋友圈名称</div>
  781. <van-field v-model="formValidate.name" maxlength="20" show-word-limit placeholder="请输入朋友圈名称" />
  782. </div>
  783. <div class="send_item">
  784. <div class="mem_title_left">生效成员</div>
  785. <div class="mem_tag mem_tag_list">
  786. <span v-for="(item, index) in SelectWachAuthor" :key="index">{{item.name}}</span>
  787. </div>
  788. <div class="matter_btn_box">
  789. <div class="matter_btn" @click="handleAddMem">{{SelectWachAuthor.length ? '编辑' : '添加'}}成员</div>
  790. </div>
  791. </div>
  792. <div class="send_item">
  793. <div class="mem_title_left">企业标签</div>
  794. <div class="mem_tag mem_tag_list">
  795. <span v-for="(item, index) in formValidate.tags" :key="index">{{item.name}}</span>
  796. </div>
  797. <div class="matter_btn_box">
  798. <div class="matter_btn" @click="handleAddTag">{{formValidate.tags.length ? '编辑' : '添加'}}标签</div>
  799. </div>
  800. </div>
  801. <div class="send_item">
  802. <div class="mem_title_left">朋友圈内容</div>
  803. <van-field v-model="formValidate.contentText" maxlength="500" show-word-limit type="textarea"
  804. placeholder="请输入要发送给客户的文本" />
  805. </div>
  806. <div class="send_item">
  807. <div class="mem_title_left">素材</div>
  808. <van-radio-group class="tag_radio tag_radio_bo" v-model="materialType" direction="horizontal">
  809. <van-radio :name="1">
  810. 素材库选择
  811. <template #icon="props">
  812. <div :class="props.checked ? 'check_div_active' : 'check_div'"></div>
  813. </template>
  814. </van-radio>
  815. <!-- <van-radio :name="2">
  816. 自定义上传
  817. <template #icon="props">
  818. <div :class="props.checked ? 'check_div_active' : 'check_div'"></div>
  819. </template>
  820. </van-radio> -->
  821. </van-radio-group>
  822. <template v-if="formValidate.ctOthers && formValidate.ctOthers.length > 0">
  823. <div class="img_list" v-if="formValidate.ctOthers[0].matterType === 1">
  824. <div class="img_box" v-for="(item, index) in formValidate.ctOthers" :key="index">
  825. <img class="img_url" :src="item.url" alt="">
  826. <img class="close_imgMater" src="../img/qw/close_img.png" alt="" @click="handleCloseMatter(item)">
  827. </div>
  828. </div>
  829. <div class="video_container" v-if="formValidate.ctOthers[0].matterType === 2">
  830. <video id="myVideo" style="width: 105px; height: 140px;"
  831. :src="formValidate.ctOthers[0].videoPath"></video>
  832. <img id="playButton" class="play_button" src="../img/qw/play_icon.png" alt="" @click="playPause">
  833. </div>
  834. <div class="matters_item" v-if="formValidate.ctOthers[0].matterType === 5">
  835. <img class="matters_item_img" src="../img/qw/link.png" alt="">
  836. <div class="matters_item_info">
  837. <div class="matters_item_title">{{formValidate.ctOthers[0].linkTitle}}</div>
  838. <div>自定义链接</div>
  839. </div>
  840. <img class="close_mater" src="../img/qw/close_mater.png" alt="" @click="handleCloseMatter(item)">
  841. </div>
  842. </template>
  843. <template v-if="formValidate.matters && formValidate.matters.length > 0">
  844. <div class="img_list" v-if="matterImgList.length > 0">
  845. <div class="img_box" v-for="(item, index) in matterImgList" :key="index">
  846. <img class="img_url" :src="item.url" alt="">
  847. <img class="close_imgMater" src="../img/qw/close_img.png" alt="" @click="handleCloseMatter(item)">
  848. </div>
  849. </div>
  850. <div class="matters_list">
  851. <div class="matters_item" v-for="(item, index) in matterOthersList" :key="index">
  852. <img class="matters_item_img" v-if="item.contentType === 0" src="../img/qw/article.png" alt="">
  853. <img class="matters_item_img" v-else-if="item.contentType === 2" src="../img/qw/form.png" alt="">
  854. <img class="matters_item_img" v-else-if="item.contentType === 3" src="../img/qw/file.png" alt="">
  855. <img class="matters_item_img" v-else src="../img/qw/link.png" alt="">
  856. <div class="matters_item_info">
  857. <div class="matters_item_title">{{item.name || item.title}}</div>
  858. <div>{{matterTypeList.find(type => type.contentType === item.contentType)?.name || '未知类型'}}</div>
  859. </div>
  860. <img class="close_mater" src="../img/qw/close_mater.png" alt="" @click="handleCloseMatter(item)">
  861. </div>
  862. </div>
  863. </template>
  864. <div class="matter_btn_box">
  865. <div class="matter_btn" @click="handleAddMatter">添加素材</div>
  866. </div>
  867. </div>
  868. <div class="send_item">
  869. <div class="mem_title_left">群发时间</div>
  870. <van-radio-group class="tag_radio" v-model="formValidate.type" direction="horizontal"
  871. @change="handleRadioType">
  872. <van-radio :name="1">
  873. 立即群发
  874. <template #icon="props">
  875. <div :class="props.checked ? 'check_div_active' : 'check_div'"></div>
  876. </template>
  877. </van-radio>
  878. <van-radio :name="2" @click="handleRadioType(2)">
  879. 定时群发
  880. <template #icon="props">
  881. <div :class="props.checked ? 'check_div_active' : 'check_div'"></div>
  882. </template>
  883. </van-radio>
  884. </van-radio-group>
  885. <div class="now_date" v-if="showDateTime.length > 0" @click="showTime = true">
  886. <span>{{showDateTime[0]}}</span>
  887. <span>{{showDateTime[1]}}</span>
  888. <span>{{showDateTime[2]}}</span>
  889. </div>
  890. </div>
  891. <div class="send_btn_box">
  892. <div class="send_btn" @click="sendMass">一键群发</div>
  893. </div>
  894. </div>
  895. </div>
  896. <!-- 底部返回栏 -->
  897. <page-return></page-return>
  898. </div>
  899. </body>
  900. <script>
  901. new Vue({
  902. el: '#box',
  903. data() {
  904. return {
  905. httpUrl: '',
  906. bId: null,
  907. env: '',
  908. memberId: null,
  909. tenancyId: null,
  910. token: null,
  911. userId: null,
  912. showReturn: false,
  913. isConfirmingBack: false, // 标记是否已确认返回
  914. pushStateCount: 0, // 记录 pushState 的次数
  915. initialHistoryLength: 0, // 记录初始历史记录长度
  916. materialType: 1,
  917. formValidate: {
  918. name: '',
  919. contentText: '',
  920. memberIds: [],
  921. ctOthers: [],
  922. matters: [],
  923. type: 1,
  924. sendTime: '',
  925. tags: [],
  926. },
  927. matterImgList: [],
  928. matterOthersList: [],
  929. matterTypeList: [
  930. { contentType: 0, name: '文章' },
  931. { contentType: 2, name: '表单' },
  932. { contentType: 3, name: '文件' },
  933. { contentType: 4, name: '外部链接' },
  934. { contentType: 15, name: '视频' },
  935. { contentType: 17, name: '图集链接' },
  936. ],
  937. showMem: false,
  938. checkedMemIds: [], // 选中的成员id
  939. memList: [], // 成员列表
  940. SelectMem: [], // 选中的成员
  941. treeData: [], // 总部门树数据
  942. selectedMems: [], // 选中的所有成员数据
  943. itemList: [], // 当前树下的数据
  944. pathList: [], // 当前路径
  945. SelectWachAuthor: [], // 选好的微信成员
  946. showClientTag: false,
  947. showTime: false,
  948. dateIndex: 'hour',
  949. showDateColumns: false,
  950. dateColumns: [],
  951. nowDate: [], // 当前选中的日期
  952. NewDate: '', // 最终的日期
  953. showDateTime: [], // 外面展示的日期格式
  954. }
  955. },
  956. mounted() {
  957. // 监听浏览器返回按钮
  958. if (window.history && window.history.pushState) {
  959. // 记录初始历史记录长度
  960. this.initialHistoryLength = window.history.length;
  961. history.pushState(null, null, document.URL);
  962. this.pushStateCount = 1; // 记录初始 pushState
  963. window.addEventListener('popstate', this.handleBack, false);
  964. }
  965. // 监听微信/企业微信返回按钮
  966. if (typeof wx !== 'undefined' && wx.ready) {
  967. wx.ready(() => {
  968. wx.hideOptionMenu();
  969. });
  970. }
  971. if (typeof ww !== 'undefined' && ww.ready) {
  972. ww.ready(() => {
  973. ww.hideOptionMenu();
  974. });
  975. }
  976. },
  977. beforeDestroy() {
  978. // 移除事件监听
  979. window.removeEventListener('popstate', this.handleBack, false);
  980. },
  981. created() {
  982. this.bId = this.getQueryParam('bId')
  983. this.env = this.getQueryParam('env')
  984. if (!this.env || this.env === 'prod') {
  985. this.httpUrl = 'https://wlapi.wefanbot.com'
  986. } else {
  987. this.httpUrl = 'http://test.wefanbot.com:18993'
  988. }
  989. this.memberId = this.getQueryParam('memberId')
  990. this.token = localStorage.getItem('tokenValue')
  991. this.tenancyId = localStorage.getItem('tenancyIdValue')
  992. this.userId = localStorage.getItem('userId')
  993. this.formValidate = localStorage.getItem('clientMassData') ? JSON.parse(localStorage.getItem('clientMassData')) : {
  994. name: '',
  995. contentText: '',
  996. memberIds: [],
  997. ctOthers: [],
  998. matters: [],
  999. type: 1,
  1000. sendTime: '',
  1001. tags: [],
  1002. }
  1003. this.SelectWachAuthor = localStorage.getItem('selectedMems') ? JSON.parse(localStorage.getItem('selectedMems')) : []
  1004. this.formValidate.matters = JSON.parse(localStorage.getItem('selectedMaters')) || []
  1005. if (this.formValidate.matters && this.formValidate.matters.length > 0) {
  1006. this.formValidate.matters.forEach(item => {
  1007. if (item.contentType === 19) {
  1008. this.matterImgList.push(item)
  1009. } else {
  1010. this.matterOthersList.push(item)
  1011. }
  1012. })
  1013. }
  1014. },
  1015. methods: {
  1016. handleBack(e) {
  1017. // 如果已经确认返回,直接返回,不显示弹框
  1018. if (this.isConfirmingBack) {
  1019. return;
  1020. }
  1021. // 如果弹框已经显示,阻止默认返回行为,但不重复显示弹框
  1022. if (this.showReturn) {
  1023. // 阻止返回,重新添加历史记录
  1024. if (window.history && window.history.pushState) {
  1025. history.pushState(null, null, document.URL);
  1026. this.pushStateCount++;
  1027. }
  1028. return;
  1029. }
  1030. // 阻止默认返回行为
  1031. if (window.history && window.history.pushState) {
  1032. history.pushState(null, null, document.URL);
  1033. this.pushStateCount++;
  1034. }
  1035. // 显示确认弹框
  1036. this.showReturn = true;
  1037. },
  1038. beforeClose(action, done) {
  1039. if (action === 'confirm') {
  1040. // 点击确定,设置确认返回标志
  1041. this.isConfirmingBack = true;
  1042. // 清理数据
  1043. localStorage.removeItem('selectedMaters');
  1044. localStorage.removeItem('selectedMems');
  1045. localStorage.removeItem('clientMassData');
  1046. // 移除事件监听,避免触发弹框
  1047. window.removeEventListener('popstate', this.handleBack, false);
  1048. // 关闭弹框
  1049. done();
  1050. // 直接跳转到 WeCom.html 页面
  1051. setTimeout(() => {
  1052. // 获取当前 URL 的查询参数,保留必要的参数
  1053. const params = new URLSearchParams(window.location.search);
  1054. const memberId = params.get('memberId') || this.memberId;
  1055. const bId = params.get('bId') || this.bId;
  1056. const env = params.get('env') || this.env;
  1057. // 构建跳转 URL
  1058. let targetUrl = 'pyqMassList.html';
  1059. if (memberId || bId || env) {
  1060. const queryParams = [];
  1061. if (memberId) queryParams.push(`memberId=${memberId}`);
  1062. if (bId) queryParams.push(`bId=${bId}`);
  1063. if (env) queryParams.push(`env=${env}`);
  1064. if (queryParams.length > 0) {
  1065. targetUrl += '?' + queryParams.join('&');
  1066. }
  1067. }
  1068. window.location.href = targetUrl;
  1069. }, 150);
  1070. } else {
  1071. // 点击取消,关闭弹框,重新添加历史记录防止返回
  1072. done();
  1073. if (window.history && window.history.pushState) {
  1074. history.pushState(null, null, document.URL);
  1075. this.pushStateCount++;
  1076. }
  1077. }
  1078. },
  1079. // 打开成员选择
  1080. handleAddMem() {
  1081. this.showMem = true
  1082. this.getTreeData(0)
  1083. },
  1084. // 打开标签选择
  1085. handleAddTag() {
  1086. localStorage.setItem('clientMassData', JSON.stringify(this.formValidate))
  1087. this.showClientTag = true
  1088. },
  1089. // 接收标签数据
  1090. handleAdd(labelFilter, tagList) {
  1091. this.formValidate.tags = tagList.map(item => {
  1092. return {
  1093. id: item.id,
  1094. name: item.name,
  1095. }
  1096. })
  1097. this.showClientTag = false
  1098. },
  1099. // 获取树数据
  1100. getTreeData(id) {
  1101. this.treeData = []
  1102. if (id === 0) {
  1103. this.pathList = []
  1104. this.itemList = []
  1105. }
  1106. const headers = new Headers()
  1107. headers.append('tenancyId', this.tenancyId)
  1108. headers.append('token', this.token)
  1109. headers.append('userId', this.userId)
  1110. fetch(this.httpUrl + `/scrm/v1/wxcp-dept/m/findByParentId?parentId=${id}`, {
  1111. method: 'GET',
  1112. headers: headers
  1113. }).then(res => {
  1114. return res.json()
  1115. }).then(result => {
  1116. let { data, code, msg } = result
  1117. if (code === 1) {
  1118. this.treeData = data || []
  1119. } else {
  1120. vant.Toast.fail(msg)
  1121. }
  1122. })
  1123. },
  1124. // 点击树路径
  1125. handlePathClick(item) {
  1126. // 找到目标元素的索引
  1127. const index = this.pathList.findIndex(arr => arr.id === item.id)
  1128. // 如果找到了该元素
  1129. if (index !== -1) {
  1130. // 从该索引位置开始删除到数组末尾
  1131. this.pathList.splice(index)
  1132. this.handleDeptClick(item)
  1133. }
  1134. },
  1135. //点击部门
  1136. handleDeptClick(item) {
  1137. this.pathList.push(item)
  1138. this.treeData = []
  1139. this.itemList = []
  1140. this.getTreeData(item.id)
  1141. fetch(this.httpUrl + '/scrm/v1/wxcp-dept/m/findActiveDeptMemberListByPage', {
  1142. method: 'post',
  1143. body: JSON.stringify({
  1144. deptId: item.id,
  1145. page: 1,
  1146. pageCount: 1000,
  1147. }),
  1148. headers: {
  1149. 'Content-Type': 'application/json',
  1150. 'tenancyId': this.tenancyId,
  1151. 'token': this.token,
  1152. 'userId': this.userId,
  1153. }
  1154. }).then(res => {
  1155. return res.json()
  1156. }).then(result => {
  1157. let { data, code, msg } = result
  1158. if (code === 1) {
  1159. this.itemList = data.records || []
  1160. if (this.itemList.length > 0) {
  1161. // 回显已选择的数据
  1162. this.checkedMemIds = this.extractSameIds(this.itemList, this.selectedMems)
  1163. }
  1164. } else {
  1165. vant.Toast.fail(msg)
  1166. }
  1167. })
  1168. },
  1169. extractSameIds(itemList, selectedMems) {
  1170. const arr2Ids = new Set(selectedMems.map(item => item.memberId))
  1171. return itemList.filter(item => arr2Ids.has(item.memberId))
  1172. .map(item => item.memberId)
  1173. },
  1174. // 成员选择改变
  1175. onChangeMem(item) {
  1176. const currentSelected = this.itemList
  1177. .filter(item => this.checkedMemIds.includes(item.memberId))
  1178. .map(item => ({
  1179. ...item,
  1180. }))
  1181. // 先删除当前页面未选中的数据
  1182. const currentPageIds = new Set(this.itemList.map(item => item.memberId))
  1183. this.selectedMems = this.selectedMems.filter(item => {
  1184. // 如果是当前页面的数据,但未选中,则删除
  1185. if (currentPageIds.has(item.memberId)) {
  1186. return this.checkedMemIds.includes(item.memberId)
  1187. }
  1188. // 如果不是当前页面的数据,保留
  1189. return true
  1190. })
  1191. // 合并当前选中的和之前选中的,基于 id 去重(当前选中的优先,使用最新的类型)
  1192. const existingIdsMap = new Map()
  1193. this.selectedMems.forEach(item => {
  1194. existingIdsMap.set(item.memberId, item)
  1195. })
  1196. // 更新或添加当前选中的数据(优先使用当前页面的数据和类型)
  1197. currentSelected.forEach(item => {
  1198. existingIdsMap.set(item.memberId, item)
  1199. })
  1200. this.selectedMems = Array.from(existingIdsMap.values())
  1201. console.log('当前选中的所有成员数据: ', this.selectedMems)
  1202. localStorage.setItem('selectedMems', JSON.stringify(this.selectedMems))
  1203. },
  1204. // 取消成员选择
  1205. handleCancelMem() {
  1206. this.showMem = false
  1207. this.selectedMems = this.SelectWachAuthor
  1208. localStorage.setItem('selectedMems', JSON.stringify(this.selectedMems))
  1209. },
  1210. // 确定成员选择
  1211. handleMem() {
  1212. let selectData = this.selectedMems.map((item) => {
  1213. return {
  1214. name: item.name,
  1215. memberId: item.memberId,
  1216. }
  1217. })
  1218. const strings = selectData.map((item) => JSON.stringify(item))
  1219. this.SelectWachAuthor = [...new Set(strings)].map((item) => JSON.parse(item))
  1220. this.formValidate.memberIds = [...new Set(this.selectedMems)].map((item) => item.memberId)
  1221. this.formValidate.memberIds = Array.from(new Set(this.formValidate.memberIds))
  1222. console.log('最终成员选择: ', this.formValidate.memberIds)
  1223. this.showMem = false
  1224. },
  1225. handleRadioType(val) {
  1226. if (val === 2) {
  1227. this.showTime = true
  1228. if (!this.nowDate.length) {
  1229. this.getTimeInfo('hour')
  1230. }
  1231. this.dateColumns = [
  1232. {
  1233. values: this.generateDateArray(),
  1234. },
  1235. {
  1236. values: this.generateHourArrayEnhanced(),
  1237. },
  1238. {
  1239. values: this.generateMinuteArrayWithLoop(),
  1240. }
  1241. ]
  1242. } else {
  1243. }
  1244. },
  1245. // 生成日期数组第一组数据
  1246. generateDateArray() {
  1247. const result = [];
  1248. const today = new Date();
  1249. // 星期映射
  1250. const weekDays = ['日', '一', '二', '三', '四', '五', '六'];
  1251. // 前三天特殊处理
  1252. const dayNames = ['今天', '明天', '后天'];
  1253. for (let i = 0; i < 365; i++) {
  1254. const currentDate = new Date(today);
  1255. currentDate.setDate(today.getDate() + i);
  1256. const year = currentDate.getFullYear();
  1257. const month = currentDate.getMonth() + 1;
  1258. const date = currentDate.getDate();
  1259. const day = currentDate.getDay();
  1260. // 获取星期几的中文
  1261. const weekDay = `周${weekDays[day]}`;
  1262. if (i < 3) {
  1263. // 前三天用特殊格式
  1264. result.push(`${dayNames[i]} ${weekDay}`);
  1265. } else {
  1266. // 从第四天开始用正常日期格式
  1267. // 年份只显示后两位
  1268. const shortYear = year.toString().slice(-2);
  1269. result.push(`${shortYear}年${month}月${date}日 ${weekDay}`);
  1270. }
  1271. }
  1272. return result;
  1273. },
  1274. // 生成小时数组
  1275. generateHourArrayEnhanced() {
  1276. const now = new Date();
  1277. const currentHour = now.getHours(); // 获取当前小时(0-23)
  1278. const currentMinute = now.getMinutes(); // 获取当前分钟(0-59)
  1279. const result = [];
  1280. // 计算开始小时:如果当前分钟≥55,从下一小时开始
  1281. let startHour = currentHour;
  1282. if (currentMinute >= 55) {
  1283. startHour = currentHour + 1;
  1284. }
  1285. // 如果开始小时大于23,返回空数组(因为已经超过今天的小时范围)
  1286. if (startHour > 23) {
  1287. return [];
  1288. }
  1289. // 从开始小时到23时
  1290. for (let hour = startHour; hour <= 23; hour++) {
  1291. result.push(`${hour}时`);
  1292. }
  1293. return result;
  1294. },
  1295. // 生成分钟数组,从当前分钟开始,循环到59分
  1296. generateMinuteArrayWithLoop() {
  1297. const now = new Date();
  1298. const currentMinute = now.getMinutes(); // 获取当前分钟(0-59)
  1299. const startMinute = (currentMinute + 5) % 60; // 计算开始分钟,如果超过59则从0开始
  1300. const result = [];
  1301. // 从开始分钟到59分
  1302. for (let minute = startMinute; minute <= 59; minute++) {
  1303. result.push(`${minute}分`);
  1304. }
  1305. return result;
  1306. },
  1307. handleChangeDate(values, index) {
  1308. if (index[0].substring(0, 2) === '今天') {
  1309. this.dateColumns[1].values = this.generateHourArrayEnhanced()
  1310. index[1] = this.dateColumns[1].values[0]
  1311. this.dateColumns[2].values = this.generateMinuteArrayWithLoop()
  1312. index[2] = this.dateColumns[2].values[0]
  1313. } else {
  1314. this.dateColumns[1].values = Array.from({ length: 24 }, (_, i) => `${i}时`)
  1315. this.dateColumns[2].values = Array.from({ length: 60 }, (_, i) => `${i}分`)
  1316. }
  1317. this.dateIndex = ''
  1318. this.NewDate = this.convertArrayToDateTime(index)
  1319. },
  1320. // 将那4个选项转为相应的数据
  1321. getTimeInfo(interval) {
  1322. const weekDays = ['日', '一', '二', '三', '四', '五', '六'];
  1323. const now = new Date();
  1324. const result = new Date(now);
  1325. // 时间间隔映射
  1326. const intervals = {
  1327. 'hour': () => result.setHours(result.getHours() + 1, result.getMinutes() + 5),
  1328. 'day': () => result.setDate(result.getDate() + 1),
  1329. 'week': () => result.setDate(result.getDate() + 7),
  1330. 'month': () => result.setMonth(result.getMonth() + 1)
  1331. };
  1332. // 应用时间间隔
  1333. intervals[interval]?.();
  1334. if (interval !== 'hour') result.setMinutes(result.getMinutes() + 5);
  1335. // 将秒数设置为0(确保格式化为 "00" 秒)
  1336. result.setSeconds(0, 0);
  1337. // 格式化为 "2026-01-01 00:00:00" 格式
  1338. const year = result.getFullYear();
  1339. const month = String(result.getMonth() + 1).padStart(2, '0');
  1340. const day = String(result.getDate()).padStart(2, '0');
  1341. const hours = String(result.getHours()).padStart(2, '0');
  1342. const minutes = String(result.getMinutes()).padStart(2, '0');
  1343. // 赋值给 NewDate 变量
  1344. this.NewDate = `${year}-${month}-${day} ${hours}:${minutes}:00`;
  1345. // 格式化(原有逻辑保持不变)
  1346. const dayOfWeek = weekDays[result.getDay()];
  1347. const time = `${hours}:${minutes}`;
  1348. // 日期描述
  1349. let dateDesc = '';
  1350. if (interval === 'hour') {
  1351. const isSameDay = now.toDateString() === result.toDateString();
  1352. dateDesc = isSameDay ? '今天' : '明天';
  1353. } else if (interval === 'day') {
  1354. dateDesc = '明天';
  1355. } else {
  1356. dateDesc = `${result.getMonth() + 1}月${result.getDate()}日`;
  1357. }
  1358. this.dateIndex = interval;
  1359. this.nowDate = [dateDesc, `周${dayOfWeek}`, time];
  1360. this.showDateColumns = false;
  1361. },
  1362. // 将选择的日期时间数组转换为标准格式
  1363. convertArrayToDateTime(arr) {
  1364. // 获取当前日期和时间
  1365. const now = new Date();
  1366. const currentYear = now.getFullYear();
  1367. const currentMonth = now.getMonth() + 1;
  1368. const currentDate = now.getDate();
  1369. let targetDate;
  1370. const firstPart = arr[0];
  1371. // 解析小时和分钟
  1372. const hourStr = arr[1].replace('时', '');
  1373. const minuteStr = arr[2].replace('分', '');
  1374. const hour = parseInt(hourStr);
  1375. const minute = parseInt(minuteStr);
  1376. // 判断是哪种情况
  1377. if (firstPart.includes('今天')) {
  1378. // 今天的情况
  1379. targetDate = new Date(currentYear, currentMonth - 1, currentDate, hour, minute, 0);
  1380. } else if (firstPart.includes('明天')) {
  1381. // 明天的情况
  1382. const tomorrow = new Date(now);
  1383. tomorrow.setDate(currentDate + 1);
  1384. targetDate = new Date(tomorrow.getFullYear(), tomorrow.getMonth(), tomorrow.getDate(), hour, minute, 0);
  1385. } else if (firstPart.includes('后天')) {
  1386. // 后天的情况
  1387. const dayAfterTomorrow = new Date(now);
  1388. dayAfterTomorrow.setDate(currentDate + 2);
  1389. targetDate = new Date(dayAfterTomorrow.getFullYear(), dayAfterTomorrow.getMonth(), dayAfterTomorrow.getDate(), hour, minute, 0);
  1390. } else {
  1391. // 具体日期的情况,如 '26年1月1日 周四'
  1392. // 提取日期部分(去掉星期几)
  1393. const dateStr = firstPart.split(' ')[0];
  1394. // 解析日期字符串,如 "26年1月1日"
  1395. const dateMatch = dateStr.match(/(\d+)年(\d+)月(\d+)日/);
  1396. if (dateMatch) {
  1397. let year = parseInt(dateMatch[1]);
  1398. const month = parseInt(dateMatch[2]);
  1399. const day = parseInt(dateMatch[3]);
  1400. // 处理两位数年份:假设20xx年
  1401. if (year < 100) {
  1402. year += 2000;
  1403. }
  1404. targetDate = new Date(year, month - 1, day, hour, minute, 0);
  1405. } else {
  1406. throw new Error('日期格式解析错误');
  1407. }
  1408. }
  1409. // 格式化为 "YYYY-MM-DD HH:mm:00"
  1410. const year = targetDate.getFullYear();
  1411. const month = String(targetDate.getMonth() + 1).padStart(2, '0');
  1412. const day = String(targetDate.getDate()).padStart(2, '0');
  1413. const hours = String(targetDate.getHours()).padStart(2, '0');
  1414. const minutes = String(targetDate.getMinutes()).padStart(2, '0');
  1415. return `${year}-${month}-${day} ${hours}:${minutes}:00`;
  1416. },
  1417. // 将"2026-01-01 00:00:00"这种格式的数据转为['2026年1月1日',‘周四’,‘0时0分’]这种格式
  1418. formatDateTimeToArray(dateTimeStr) {
  1419. // 解析输入的时间字符串
  1420. let date;
  1421. try {
  1422. // 处理 "YYYY-MM-DD HH:mm:ss" 格式
  1423. date = new Date(dateTimeStr.replace(' ', 'T'));
  1424. // 验证日期是否有效
  1425. if (isNaN(date.getTime())) {
  1426. throw new Error('无效的日期时间格式');
  1427. }
  1428. } catch (error) {
  1429. throw new Error(`日期解析失败: ${error.message}`);
  1430. }
  1431. // 获取年、月、日
  1432. const year = date.getFullYear();
  1433. const month = date.getMonth() + 1; // getMonth() 返回 0-11
  1434. const day = date.getDate();
  1435. // 获取小时和分钟(24小时制)
  1436. const hour = date.getHours(); // 0-23
  1437. const minute = date.getMinutes(); // 0-59
  1438. // 获取星期几
  1439. const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
  1440. const weekDay = weekDays[date.getDay()];
  1441. // 构建数组
  1442. this.showDateTime = [
  1443. `${year}年${month}月${day}日`,
  1444. weekDay,
  1445. `${hour}时${minute}分`
  1446. ];
  1447. },
  1448. handleShowDateColumns() {
  1449. this.showDateColumns = true
  1450. },
  1451. handleTime() {
  1452. this.formatDateTimeToArray(this.NewDate)
  1453. this.formValidate.sendTime = this.NewDate
  1454. this.showTime = false
  1455. },
  1456. handleCloseMatter(item) {
  1457. this.formValidate.matters = this.removeItemFromArray(this.formValidate.matters, item)
  1458. this.matterOthersList = this.removeItemFromArray(this.matterOthersList, item)
  1459. this.matterImgList = this.removeItemFromArray(this.matterImgList, item)
  1460. this.deleteItemFromLocalStorage('selectedMaters', item.id)
  1461. },
  1462. // 从localStorage中删除指定id的对象项
  1463. deleteItemFromLocalStorage(storageKey, idToDelete) {
  1464. try {
  1465. // 1. 从localStorage获取数据
  1466. const storedData = localStorage.getItem(storageKey);
  1467. if (!storedData) {
  1468. console.warn(`未找到键为 "${storageKey}" 的数据`);
  1469. return false;
  1470. }
  1471. // 2. 解析JSON数据
  1472. const dataArray = JSON.parse(storedData);
  1473. if (!Array.isArray(dataArray)) {
  1474. console.error(`"${storageKey}" 中存储的不是数组`);
  1475. return false;
  1476. }
  1477. // 3. 过滤掉要删除的项
  1478. const filteredArray = dataArray.filter(item => item.id !== idToDelete);
  1479. // 4. 检查是否有删除
  1480. if (filteredArray.length === dataArray.length) {
  1481. console.warn(`未找到id为 "${idToDelete}" 的项`);
  1482. return false;
  1483. }
  1484. // 5. 将过滤后的数组存回localStorage
  1485. localStorage.setItem(storageKey, JSON.stringify(filteredArray));
  1486. console.log(`成功删除id为 "${idToDelete}" 的项`);
  1487. return true;
  1488. } catch (error) {
  1489. console.error('删除localStorage项时出错:', error);
  1490. return false;
  1491. }
  1492. },
  1493. // 播放暂停视频
  1494. playPause() {
  1495. const video = document.getElementById('myVideo')
  1496. const playButton = document.getElementById("playButton")
  1497. if (video.paused) {
  1498. video.play()
  1499. } else {
  1500. video.pause()
  1501. }
  1502. },
  1503. // 一键群发
  1504. sendMass() {
  1505. if (!this.formValidate.name) {
  1506. vant.Toast.fail('请填写任务名称')
  1507. return
  1508. }
  1509. if (this.formValidate.memberIds && this.formValidate.memberIds.length === 0) {
  1510. vant.Toast.fail('请选择成员')
  1511. return
  1512. }
  1513. if (!this.formValidate.contentText && this.formValidate.ctOthers.length === 0 && this.formValidate.matters.length === 0) {
  1514. vant.Toast.fail('请添加要发送的内容')
  1515. return
  1516. }
  1517. if (this.formValidate.type === 2 && !this.formValidate.sendTime) {
  1518. vant.Toast.fail('请设置群发时间再提交')
  1519. return
  1520. }
  1521. if (this.formValidate.type === 1) {
  1522. this.formValidate.sendTime = ''
  1523. }
  1524. if (this.formValidate.matters && this.formValidate.matters.length) {
  1525. this.formValidate.matters = this.formValidate.matters.map(matter => {
  1526. return {
  1527. contentId: matter.id,
  1528. contentType: matter.contentType,
  1529. headUrl: matter.cover || '',
  1530. title: matter.title || matter.name,
  1531. }
  1532. })
  1533. if (!this.validateMaterials(this.formValidate.matters).valid) {
  1534. vant.Toast.fail(this.validateMaterials(this.formValidate.matters).message)
  1535. return
  1536. }
  1537. }
  1538. fetch(this.httpUrl + '/scrm/v1/wxcp-moment/m/add', {
  1539. method: 'post',
  1540. body: JSON.stringify({
  1541. ...this.formValidate,
  1542. }),
  1543. headers: {
  1544. 'Content-Type': 'application/json',
  1545. 'token': this.token,
  1546. 'tenancyId': this.tenancyId,
  1547. 'userId': this.userId,
  1548. }
  1549. }).then(res => {
  1550. return res.json()
  1551. }).then(result => {
  1552. let { data, code, msg } = result
  1553. if (code === 1) {
  1554. vant.Toast.success('发布成功')
  1555. localStorage.removeItem('selectedMems')
  1556. localStorage.removeItem('clientMassData')
  1557. localStorage.removeItem('selectedMaters')
  1558. this.beforeClose('confirm', () => { })
  1559. } else {
  1560. vant.Toast.fail(msg)
  1561. }
  1562. })
  1563. },
  1564. validateMaterials(materials) {
  1565. // 分离 type 为 19 和不为 19 的项
  1566. const type19Items = materials.filter(item => item.type === 19);
  1567. const otherTypeItems = materials.filter(item => item.type !== 19);
  1568. // 检查条件
  1569. if (type19Items.length > 0 && otherTypeItems.length > 0) {
  1570. return {
  1571. valid: false,
  1572. message: "图片和别的素材只能传一种"
  1573. };
  1574. }
  1575. // 检查其他类型是否有多条
  1576. if (otherTypeItems.length > 1) {
  1577. return {
  1578. valid: false,
  1579. message: "同一类型的素材只能上传一条"
  1580. };
  1581. }
  1582. return {
  1583. valid: true,
  1584. };
  1585. },
  1586. // 创建删除函数生成器
  1587. removeItemFromArray (array, item) {
  1588. return array.filter(element => {
  1589. // 如果 element 有 id,则用 id 比较
  1590. if (element.id) {
  1591. return element.id !== item.id
  1592. }
  1593. // 如果 element 有 contentId,则用 contentId 比较
  1594. if (element.contentId) {
  1595. return element.contentId !== item.id
  1596. }
  1597. // 如果都没有,保留元素
  1598. return true
  1599. })
  1600. },
  1601. processData(data) {
  1602. return data.map(obj => {
  1603. // 过滤掉tags为空的条件项
  1604. const filteredTagCondList = obj.tagCondList.filter(cond => cond.tags.length > 0)
  1605. // 如果过滤后tagCondList不为空则保留该对象
  1606. return filteredTagCondList.length > 0
  1607. ? { ...obj, tagCondList: filteredTagCondList }
  1608. : null
  1609. }).filter(obj => obj !== null) // 剔除空对象
  1610. },
  1611. // 添加素材
  1612. handleAddMatter() {
  1613. if (this.materialType === 1) {
  1614. localStorage.setItem('clientMassData', JSON.stringify(this.formValidate))
  1615. window.location.href = `material.html?memberId=${this.memberId}&bId=${this.bId}&env=${this.env}&hideType=3`
  1616. } else {
  1617. // 创建一个input元素,用于选择相册中的图片
  1618. const input = document.createElement('input');
  1619. input.type = 'file';
  1620. input.accept = 'image/*';
  1621. // 添加change事件监听,当选择图片后触发回调函数
  1622. input.addEventListener('change', this.handleFileSelect);
  1623. // 触发input的点击事件,打开相册
  1624. input.click();
  1625. }
  1626. },
  1627. handleFileSelect(event) {
  1628. // 获取选择的图片
  1629. const file = event.target.files[0];
  1630. // 使用FileReader读取图片数据
  1631. const reader = new FileReader();
  1632. reader.onload = (e) => {
  1633. // 将读取的图片数据赋值给selectedImage,用于展示选择的图片
  1634. // this.selectedImage = e.target.result;
  1635. console.log('等待', e.target.result);
  1636. };
  1637. reader.readAsDataURL(file);
  1638. },
  1639. // 截取url中的数据
  1640. getQueryParam(paramName) {
  1641. // 获取当前URL的查询字符串部分
  1642. const queryString = window.location.search;
  1643. // 创建一个URLSearchParams对象
  1644. const urlParams = new URLSearchParams(queryString);
  1645. // 返回指定参数的值,如果不存在则返回null
  1646. return urlParams.get(paramName);
  1647. },
  1648. }
  1649. })
  1650. </script>
  1651. </html>