Header.vue 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684
  1. <template>
  2. <div class="app-header">
  3. <a class="logo" :href="enterprise.home" target="_blank">
  4. <img src="/favicon.ico" />
  5. <span> {{ enterprise.name }}</span>
  6. </a>
  7. <t-dropdown
  8. :minColumnWidth="200"
  9. :maxHeight="560"
  10. :delay2="[10, 150]"
  11. overlayClassName="header-dropdown"
  12. trigger1="click"
  13. >
  14. <a> 文件 </a>
  15. <t-dropdown-menu>
  16. <t-dropdown-item @click="newFile">
  17. <a>新建文件</a>
  18. </t-dropdown-item>
  19. <t-dropdown-item @click="load(true)">
  20. <a>打开文件</a>
  21. </t-dropdown-item>
  22. <t-dropdown-item divider="true" @click="load">
  23. <a>导入文件</a>
  24. </t-dropdown-item>
  25. <t-dropdown-item>
  26. <a @click="save()">保存</a>
  27. </t-dropdown-item>
  28. <t-dropdown-item>
  29. <a @click="save(SaveType.SaveAs, '', undefined, 1)">另存为</a>
  30. </t-dropdown-item>
  31. <t-dropdown-item divider="true">
  32. <a @click="downloadJson">下载JSON文件</a>
  33. </t-dropdown-item>
  34. <t-dropdown-item>
  35. <a @click="downloadZip">
  36. <div class="flex">
  37. 导出为ZIP文件 <span class="flex-grow"></span>
  38. <span><label>VIP</label></span>
  39. </div>
  40. </a>
  41. </t-dropdown-item>
  42. <t-dropdown-item>
  43. <a @click="downloadHtml">
  44. <div class="flex">
  45. 下载离线部署包 <span class="flex-grow"></span>
  46. <span><label>企</label></span>
  47. </div>
  48. </a>
  49. </t-dropdown-item>
  50. <t-dropdown-item>
  51. <a @click="downloadVue3">
  52. <div class="flex">
  53. 下载Vue3组件包 <span class="flex-grow"></span>
  54. <span><label>企</label></span>
  55. </div>
  56. </a>
  57. </t-dropdown-item>
  58. <t-dropdown-item>
  59. <a @click="downloadVue2">
  60. <div class="flex">
  61. 下载Vue2组件包 <span class="flex-grow"></span>
  62. <span><label>企</label></span>
  63. </div>
  64. </a>
  65. </t-dropdown-item>
  66. <t-dropdown-item divider="true">
  67. <a @click="downloadReact">
  68. <div class="flex">
  69. 下载React组件包 <span class="flex-grow"></span>
  70. <span><label>企</label></span>
  71. </div>
  72. </a>
  73. </t-dropdown-item>
  74. <t-dropdown-item>
  75. <a @click="downloadPng">下载为PNG</a>
  76. </t-dropdown-item>
  77. <t-dropdown-item divider="true">
  78. <a @click="downloadSvg">下载为SVG</a>
  79. </t-dropdown-item>
  80. <t-dropdown-item>
  81. <a @click="switchTheme('light')">明亮主题</a>
  82. </t-dropdown-item>
  83. <t-dropdown-item>
  84. <a @click="switchTheme('dark')">暗黑主题</a>
  85. </t-dropdown-item>
  86. </t-dropdown-menu>
  87. </t-dropdown>
  88. <t-dropdown
  89. :minColumnWidth="180"
  90. :maxHeight="500"
  91. :delay2="[10, 150]"
  92. overlayClassName="header-dropdown"
  93. >
  94. <a> 编辑 </a>
  95. <t-dropdown-menu>
  96. <t-dropdown-item>
  97. <a @click="onUndo">
  98. <div class="flex">
  99. 撤销 <span class="flex-grow"></span> Ctrl + Z
  100. </div>
  101. </a>
  102. </t-dropdown-item>
  103. <t-dropdown-item divider="true">
  104. <a @click="onRedo">
  105. <div class="flex">
  106. 恢复 <span class="flex-grow"></span> Ctrl + Y
  107. </div>
  108. </a>
  109. </t-dropdown-item>
  110. <t-dropdown-item>
  111. <a @click="onCut">
  112. <div class="flex">
  113. 剪切 <span class="flex-grow"></span> Ctrl + X
  114. </div>
  115. </a>
  116. </t-dropdown-item>
  117. <t-dropdown-item>
  118. <a @click="onCopy">
  119. <div class="flex">
  120. 复制 <span class="flex-grow"></span> Ctrl + C
  121. </div>
  122. </a>
  123. </t-dropdown-item>
  124. <t-dropdown-item divider="true">
  125. <a @click="onPaste">
  126. <div class="flex">
  127. 粘贴 <span class="flex-grow"></span> Ctrl + V
  128. </div>
  129. </a>
  130. </t-dropdown-item>
  131. <t-dropdown-item>
  132. <a @click="onAll">
  133. <div class="flex">
  134. 全选 <span class="flex-grow"></span> Ctrl + A
  135. </div>
  136. </a>
  137. </t-dropdown-item>
  138. <t-dropdown-item>
  139. <a @click="onDelete">
  140. <div class="flex">删除 <span class="flex-grow"></span> DELETE</div>
  141. </a>
  142. </t-dropdown-item>
  143. </t-dropdown-menu>
  144. </t-dropdown>
  145. <t-dropdown
  146. :minColumnWidth="180"
  147. :maxHeight="500"
  148. :delay2="[10, 150]"
  149. overlayClassName="header-dropdown"
  150. >
  151. <a> 工具 </a>
  152. <t-dropdown-menu>
  153. <t-dropdown-item>
  154. <a @click="onScaleWindow">窗口大小</a>
  155. </t-dropdown-item>
  156. <t-dropdown-item>
  157. <a @click="onScaleUp">放大</a>
  158. </t-dropdown-item>
  159. <t-dropdown-item>
  160. <a @click="onScaleDown">缩小</a>
  161. </t-dropdown-item>
  162. <t-dropdown-item divider="true">
  163. <a @click="onScaleFull">100%视图</a>
  164. </t-dropdown-item>
  165. <t-dropdown-item>
  166. <a @click="showMap">
  167. <div class="flex middle">
  168. 鹰眼地图 <span class="flex-grow"></span>
  169. <!-- <t-icon v-show="map" name="check" /> -->
  170. <check-icon v-show="map" />
  171. </div>
  172. </a>
  173. </t-dropdown-item>
  174. <t-dropdown-item divider="true">
  175. <a @click="showMagnifier">
  176. <div class="flex middle">
  177. 放大镜 <span class="flex-grow"></span>
  178. <!-- <t-icon v-show="magnifier" name="check" /> -->
  179. <check-icon v-show="magnifier" />
  180. </div>
  181. </a>
  182. </t-dropdown-item>
  183. <t-dropdown-item>
  184. <a @click="onAutoAnchor">
  185. <div class="flex middle">
  186. 自动锚点 <span class="flex-grow"></span>
  187. <!-- <t-icon v-show="autoAnchor" name="check" /> -->
  188. <check-icon v-show="autoAnchor" />
  189. </div>
  190. </a>
  191. </t-dropdown-item>
  192. <t-dropdown-item divider="true">
  193. <a @click="onDisableAnchor">
  194. <div class="flex middle">
  195. 显示锚点 <span class="flex-grow"></span>
  196. <!-- <t-icon v-show="showAnchor" name="check" /> -->
  197. <check-icon v-show="showAnchor" />
  198. </div>
  199. </a>
  200. </t-dropdown-item>
  201. <t-dropdown-item>
  202. <a @click="onToggleAnchor">
  203. <div
  204. class="flex"
  205. :style="{
  206. color: showAnchor ? '' : '#4f5b75',
  207. }"
  208. >
  209. 添加/删除锚点 <span class="flex-grow"></span> A
  210. </div>
  211. </a>
  212. </t-dropdown-item>
  213. </t-dropdown-menu>
  214. </t-dropdown>
  215. <t-dropdown
  216. :minColumnWidth="180"
  217. :maxHeight="500"
  218. :delay2="[10, 150]"
  219. overlayClassName="header-dropdown"
  220. >
  221. <a> 帮助 </a>
  222. <t-dropdown-menu>
  223. <t-dropdown-item
  224. v-for="item in enterprise.helps"
  225. :divider="item.divider"
  226. >
  227. <a :href="item.url" target="_blank">{{ item.name }}</a>
  228. </t-dropdown-item>
  229. </t-dropdown-menu>
  230. </t-dropdown>
  231. <div style="width: 148px; flex-shrink: 0"></div>
  232. <input v-model="data.name" @input="onInputName" />
  233. <a :href="enterprise.account" target="_blank">
  234. <!-- <t-icon name="home" /> -->
  235. <home-icon />
  236. 账户中心
  237. </a>
  238. <a :href="enterprise['v']" target="_blank" class="active">
  239. <!-- <t-icon name="desktop" /> -->
  240. <desktop-icon />
  241. 大屏可视化
  242. </a>
  243. <a :href="enterprise['3d']" target="_blank">
  244. <!-- <t-icon name="control-platform" /> -->
  245. <control-platform-icon />
  246. 3D可视化
  247. </a>
  248. <a :href="enterprise['2d']" target="_blank">
  249. <!-- <t-icon name="app" /> -->
  250. <app-icon />
  251. 2D可视化
  252. </a>
  253. <t-dropdown
  254. v-if="user.id"
  255. :minColumnWidth="200"
  256. :maxHeight="500"
  257. :delay2="[10, 150]"
  258. overlayClassName="custom-dropdown header"
  259. >
  260. <a style="margin-left: 32px; margin-right: 12px">
  261. <t-avatar
  262. size="small"
  263. :image="user.avatarUrl ? user.avatarUrl : baseUrl + 'img/avatar.png'"
  264. />
  265. </a>
  266. <t-dropdown-menu>
  267. <t-dropdown-item divider="true">
  268. <a :href="enterprise.account">
  269. {{ user.username }}
  270. <label
  271. class="ml-16 vip-label"
  272. :style="{
  273. color: user.limit > 1 ? '#ff4000' : '#D5C781',
  274. background: user.limit > 1 ? '#ff400030' : '#D5C78133',
  275. }"
  276. >VIP</label
  277. >
  278. </a>
  279. </t-dropdown-item>
  280. <t-dropdown-item divider="true">
  281. <a :href="`${enterprise.account}/v`" target="_blank"> 我的大屏 </a>
  282. </t-dropdown-item>
  283. <t-dropdown-item>
  284. <a :href="`${enterprise.account}/account/teams`" target="_blank">
  285. 我的团队
  286. </a>
  287. </t-dropdown-item>
  288. <t-dropdown-item>
  289. <a :href="`${enterprise.account}/account/info`" target="_blank">
  290. 账号信息
  291. </a>
  292. </t-dropdown-item>
  293. <t-dropdown-item divider="true">
  294. <a :href="`${enterprise.account}/account/security`" target="_blank">
  295. 安全设置
  296. </a>
  297. </t-dropdown-item>
  298. <t-dropdown-item>
  299. <a @click="logout">退出</a>
  300. </t-dropdown-item>
  301. </t-dropdown-menu>
  302. </t-dropdown>
  303. <div class="flex middle" v-else>
  304. <a class="button primary solid" style="width: 80px" :href="login()">
  305. 登录
  306. </a>
  307. </div>
  308. </div>
  309. <t-dialog
  310. v-if="payListDialog.show"
  311. v-model:visible="payListDialog.show"
  312. class="pay-dialog"
  313. :close-on-overlay-click="false"
  314. :top="95"
  315. :width="700"
  316. :cancel-btn="{
  317. content: '下载试用',
  318. variant: 'outline',
  319. style: {
  320. width: '100px',
  321. color:'#707B8F',
  322. marginRight:'8px'
  323. }
  324. }"
  325. confirm-btn="去支付"
  326. @cancel="downloadTrial"
  327. @close="payListDialog.show = false"
  328. @confirm="prePay"
  329. >
  330. <template #header>
  331. <div>
  332. <span style="vertical-align: middle">{{ payListDialog.title }}</span>
  333. <!-- <t-tooltip content="这是Tooltip内容"> -->
  334. <!-- @vue-ignore -->
  335. <a
  336. :href="payListDialog.href"
  337. target="_blank"
  338. class="hover"
  339. >
  340. <HelpCircleIcon class="hover" style="margin-left:12px;" />
  341. </a>
  342. <!-- </t-tooltip> -->
  343. </div>
  344. </template>
  345. <div class="pay-box">
  346. <div class="pay-title">{{ payListDialog.title }}</div>
  347. <div class="pay-price">
  348. <p>¥</p>
  349. <p>{{ data.deploy.price }}</p>
  350. </div>
  351. </div>
  352. <div class="pay-box pay-diagram">
  353. <div class="pay-up">
  354. <div class="pay-title">
  355. <t-checkbox v-model="data.payDiagram.checked"> 企业图形库
  356. </t-checkbox>
  357. <ChevronDownIcon @click="data.payDiagram.expend=false" v-if="data.payDiagram.expend" />
  358. <ChevronRightIcon @click="data.payDiagram.expend=true" v-else />
  359. </div>
  360. <div class="pay-price">
  361. <p>¥</p>
  362. <p>{{ data.payDiagram.price }}</p>
  363. </div>
  364. </div>
  365. <div v-if="data.payDiagram.expend" class="pay-down">
  366. <div v-for="item in data.payDiagram.list">
  367. <img v-if="item.img" :src="item.img" />
  368. <div v-else-if="item.svg" v-html="item.svg" ></div>
  369. <svg v-else class="l-icon" aria-hidden="true">
  370. <use :xlink:href="'#' + iotPensMap[item.name]?.icon"></use>
  371. </svg>
  372. </div>
  373. </div>
  374. </div>
  375. <div class="pay-footer">
  376. 合计
  377. <div>
  378. <p>¥</p>
  379. <p>{{ data.deploy.price+(data.payDiagram.checked?data.payDiagram.price:0) }}</p>
  380. </div>
  381. </div>
  382. </t-dialog>
  383. <t-dialog
  384. v-if="downloadZipDialog.show"
  385. v-model:visible="downloadZipDialog.show"
  386. class="pay-dialog"
  387. :close-on-overlay-click="false"
  388. :top="95"
  389. :width="700"
  390. :cancel-btn="{
  391. content: '直接下载',
  392. variant: 'outline',
  393. style: {
  394. width: '100px',
  395. color:'#707B8F',
  396. marginRight:'8px'
  397. }
  398. }"
  399. :confirm-btn="downloadZipDialog.checked?'去支付':null"
  400. @close="downloadZipDialog.show = false"
  401. @confirm="prePayDownloadZip"
  402. @cancel="doDownloadZip"
  403. >
  404. <template #header>
  405. <div>
  406. <span style="vertical-align: middle">导出为Zip文件</span>
  407. <t-tooltip content="这是Tooltip内容">
  408. <HelpCircleIcon style="margin-left:12px;" />
  409. </t-tooltip>
  410. </div>
  411. </template>
  412. <div class="pay-box pay-diagram" style="font-size: 14px;
  413. line-height: 30px;
  414. color: #6E7B91;">
  415. Zip包仅包含数据文件和图片文件,不包含js等依赖库。
  416. <div >- 注意</div>Zip包用于平台(已包含js等依赖库)的快捷导入导出项目,无法作为独立部署包使用。
  417. <p v-if="downloadZipDialog.hasJs">
  418. <p>- 当前图纸包含js企业图形依赖库。</p>
  419. 项目中打开如果没有js企业图形依赖库,对应的图元将无法显示。
  420. 推荐下载为离线部署包(包含js企业图形依赖库)。
  421. </p>
  422. </div>
  423. <div class="pay-box pay-diagram">
  424. <div class="pay-up">
  425. <div class="pay-title">
  426. <t-checkbox v-model="downloadZipDialog.checked"> 企业图形库
  427. </t-checkbox>
  428. <ChevronDownIcon @click="downloadZipDialog.expend=false" v-if="downloadZipDialog.expend" />
  429. <ChevronRightIcon @click="downloadZipDialog.expend=true" v-else />
  430. </div>
  431. <div class="pay-price">
  432. <p>¥</p>
  433. <p>{{ downloadZipDialog.price }}</p>
  434. </div>
  435. </div>
  436. <div v-if="downloadZipDialog.expend" class="pay-down">
  437. <div v-for="item in downloadZipDialog.list">
  438. <img :src="item" />
  439. </div>
  440. </div>
  441. </div>
  442. <div class="pay-footer">
  443. 合计
  444. <div>
  445. <p>¥</p>
  446. <p>{{downloadZipDialog.checked? downloadZipDialog.price:0 }}</p>
  447. </div>
  448. </div>
  449. </t-dialog>
  450. <t-dialog
  451. v-if="wechatPayDialog.show"
  452. v-model:visible="wechatPayDialog.show"
  453. class="pay-dialog"
  454. header="乐吾乐收银台"
  455. :close-on-overlay-click="false"
  456. :top="95"
  457. :width="700"
  458. confirm-btn="支付完成"
  459. :cancel-btn="null"
  460. @close="wechatPayDialog.show = false"
  461. :footer="false"
  462. >
  463. <Pay
  464. :order="data.order"
  465. :alipay-url="data.order.alipayUrl"
  466. :code-url="data.order.codeUrl"
  467. @success="onSuccess"
  468. />
  469. </t-dialog>
  470. </template>
  471. <script lang="ts" setup>
  472. import {
  473. reactive,
  474. ref,
  475. onBeforeMount,
  476. onUnmounted,
  477. nextTick,
  478. computed,
  479. } from 'vue';
  480. import { useRouter, useRoute } from 'vue-router';
  481. import { useUser } from '@/services/user';
  482. import { MessagePlugin } from 'tdesign-vue-next';
  483. import {
  484. Meta2dBackData,
  485. dealwithFormatbeforeOpen,
  486. gotoAccount,
  487. checkData,
  488. } from '@/services/utils';
  489. import { readFile } from '@/services/file';
  490. import { compareVersion, baseVer, upgrade } from '@/services/upgrade';
  491. import { parseSvg } from '@meta2d/svg';
  492. import { Pen, getGlobalColor, isShowChild } from '@meta2d/core';
  493. import { cdn, upCdn } from '@/services/api';
  494. import JSZip from 'jszip';
  495. import axios from 'axios';
  496. import { switchTheme } from '@/services/theme';
  497. import { noLoginTip } from '@/services/utils';
  498. import {
  499. save,
  500. blank,
  501. newFile,
  502. SaveType,
  503. onScaleFull,
  504. onScaleWindow,
  505. showMagnifier,
  506. showMap,
  507. drawPen,
  508. map,
  509. magnifier,
  510. useDot,
  511. delAttrs,
  512. useAssets,
  513. } from '@/services/common';
  514. import { useEnterprise } from '@/services/enterprise';
  515. import {
  516. CheckIcon,
  517. HomeIcon,
  518. DesktopIcon,
  519. ControlPlatformIcon,
  520. AppIcon,
  521. ChevronRightIcon,
  522. ChevronDownIcon,
  523. HelpCircleIcon
  524. } from 'tdesign-icons-vue-next';
  525. import {
  526. getDownloadList,
  527. getPayList,
  528. getComponentPurchased,
  529. get2dComponentJs,
  530. getTemPngs,
  531. getGoods,
  532. // preFrameDownload,
  533. zipBkImg,
  534. zipImages,
  535. Frame,
  536. img_cdn,
  537. img_upCdn,
  538. getDeployGoods,
  539. getFrameDownloadList
  540. } from '@/services/download';
  541. import { formComponents } from '@/services/defaults';
  542. import Pay from './Pay.vue';
  543. import {getNetJsDiagram} from '@/services/material';
  544. const { enterprise } = useEnterprise();
  545. const router = useRouter();
  546. const route = useRoute();
  547. const baseUrl = import.meta.env.BASE_URL || '/';
  548. // const { assets, getAssets } = useAssets();
  549. const { user, signout } = useUser();
  550. const { setDot } = useDot();
  551. const data = reactive<any>({
  552. name: '空白文件',
  553. order: {
  554. codeUrl: '',
  555. id: '', //订单id
  556. },
  557. goods: [], //所有商品类型
  558. purchasedList: [], //已经购买的列表
  559. deploy:{
  560. price:400,
  561. },
  562. payDiagram: {
  563. price: 400,
  564. checked:true,
  565. expend:false,
  566. list:[]
  567. },
  568. payGoods:{},
  569. });
  570. onBeforeMount(async () => {
  571. // getAssets();
  572. // getNetJsDiagram();
  573. });
  574. const logout = () => {
  575. signout();
  576. meta2d.emit('logout');
  577. };
  578. const onInputName = () => {
  579. (meta2d.store.data as Meta2dBackData).name = data.name;
  580. setDot();
  581. };
  582. const initMeta2dName = () => {
  583. data.name = (meta2d.store.data as Meta2dBackData).name || '';
  584. };
  585. let downloadList = new Set<any>();
  586. let iframeNum = 0;
  587. let compareNum = 0;
  588. const prePayList = reactive({
  589. pngs: new Set<string>(),
  590. jsPens: new Set<string>(),
  591. iotPens: new Set<string>(),
  592. svgPens: new Set<string>(),
  593. });
  594. let payListNum = 0;
  595. let comparePayListNum = 0;
  596. // let purchasedList = []; //已购买列表
  597. const iotPensMap = {};
  598. let downloadType: Frame = null;
  599. // const payPrice = ref(0);
  600. const getIotPensMap = () => {
  601. formComponents.forEach((item) => {
  602. item.list.forEach((_item) => {
  603. iotPensMap[_item.data.name] = { name: _item.name, icon: _item.icon };
  604. });
  605. });
  606. };
  607. nextTick(() => {
  608. meta2d.on('opened', initMeta2dName);
  609. window.addEventListener('message', dealWithMessage);
  610. getIotPensMap();
  611. });
  612. const dealWithMessage = async (e) => {
  613. if (
  614. typeof e.data !== 'string' ||
  615. !e.data ||
  616. e.data.startsWith('setImmediate')
  617. ) {
  618. return;
  619. }
  620. try {
  621. let data = JSON.parse(e.data);
  622. if (typeof data === 'object') {
  623. if (data.type) {
  624. if (data.name === 'download') {
  625. let list = data.data;
  626. let folderName =downloadType===Frame.vue3?'meta2d-vue3':downloadType===Frame.vue2?'meta2d-vue2': 'meta2d-react';
  627. list.forEach((item) => {
  628. if(item.path.startsWith('/meta3d/')){
  629. item.path = `/${folderName}/public/${item.path}`;
  630. }
  631. });
  632. downloadList = new Set([...downloadList, ...list]);
  633. compareNum += 1;
  634. if (compareNum >= iframeNum) {
  635. saveDownload();
  636. }
  637. } else if (data.name === 'payList') {
  638. prePayList.pngs = new Set([...prePayList.pngs, ...data.data.pngs]);
  639. prePayList.jsPens = new Set([
  640. ...prePayList.jsPens,
  641. ...data.data.jsPens,
  642. ]);
  643. prePayList.iotPens = new Set([
  644. ...prePayList.iotPens,
  645. ...data.data.iotPens,
  646. ]);
  647. prePayList.svgPens = new Set([
  648. ...prePayList.svgPens,
  649. ...data.data.svgPens,
  650. ]);
  651. comparePayListNum += 1;
  652. if (comparePayListNum >= payListNum) {
  653. await showPayListDialog();
  654. }
  655. }
  656. } else {
  657. meta2d.emit(data.name);
  658. }
  659. } else {
  660. meta2d.emit(data);
  661. }
  662. } catch (e) {
  663. console.info(e);
  664. }
  665. };
  666. onUnmounted(() => {
  667. meta2d.off('opened', initMeta2dName);
  668. window.removeEventListener('message', dealWithMessage);
  669. });
  670. const login = () => {
  671. return `${enterprise['account']}?cb=${encodeURIComponent(location.href)}`;
  672. };
  673. function load(isNew = false) {
  674. const input = document.createElement('input');
  675. input.type = 'file';
  676. input.onchange = (event) => {
  677. const elem = event.target as HTMLInputElement;
  678. if (elem.files && elem.files[0]) {
  679. // 路由跳转 可能在 openFile 后执行
  680. if (elem.files[0].name.endsWith('.json')) {
  681. blank();
  682. openJson(elem.files[0]);
  683. if (isNew) {
  684. router.push({
  685. path: '/',
  686. query: {
  687. r: Date.now() + '',
  688. },
  689. });
  690. }
  691. } else if (elem.files[0].name.endsWith('.svg')) {
  692. MessagePlugin.info(
  693. '可二次编辑但转换存在损失,若作为图片使用,请使用右侧属性面板的上传图片功能'
  694. );
  695. openSvg(elem.files[0]);
  696. } else if (elem.files[0].name.endsWith('.zip')) {
  697. blank();
  698. router.push({
  699. path: '/',
  700. query: {
  701. r: Date.now() + '',
  702. },
  703. });
  704. setTimeout(() => {
  705. openZip(elem.files[0]);
  706. }, 500);
  707. } else {
  708. MessagePlugin.info('打开文件只支持 json,svg,zip 格式');
  709. }
  710. }
  711. };
  712. input.click();
  713. }
  714. const openJson = async (file: File) => {
  715. const text = await readFile(file);
  716. try {
  717. let data: Meta2dBackData = JSON.parse(text);
  718. if (!data.name) {
  719. data.name = file.name.replace('.json', '');
  720. }
  721. if (!data.version || compareVersion(data.version, baseVer) === -1) {
  722. // 如果版本号不存在或者版本号 version < 1.0.0
  723. data = upgrade(data, baseVer);
  724. }
  725. dealwithFormatbeforeOpen(data);
  726. for (const k of delAttrs) {
  727. delete (data as any)[k];
  728. }
  729. meta2d.open(data);
  730. } catch (e) {
  731. console.error(e);
  732. }
  733. };
  734. const openSvg = async (file: File) => {
  735. const text = await readFile(file);
  736. const pens: Pen[] = parseSvg(text);
  737. meta2d.canvas.addCaches = pens;
  738. MessagePlugin.info('svg转换成功,请点击画布决定放置位置');
  739. };
  740. const openZip = async (file: File) => {
  741. if (!(user && user.id)) {
  742. MessagePlugin.warning(noLoginTip);
  743. return;
  744. }
  745. // if (!user.isVip) {
  746. // gotoAccount();
  747. // return;
  748. // }
  749. if (!user.vip) {
  750. MessagePlugin.info('需要开通普通会员~');
  751. gotoAccount();
  752. return;
  753. }
  754. const { default: JSZip } = await import('jszip');
  755. const zip = new JSZip();
  756. await zip.loadAsync(file);
  757. let dataStr = '';
  758. for (const key in zip.files) {
  759. if (zip.files[key].dir) {
  760. continue;
  761. }
  762. if (key.endsWith('.json')) {
  763. // 认为只有一个 json 文件
  764. // dataStr = await zip.file(key).async('string');
  765. break;
  766. }
  767. }
  768. if (!dataStr) {
  769. return false;
  770. }
  771. for (const key in zip.files) {
  772. if (zip.files[key].dir) {
  773. continue;
  774. }
  775. // let _png = key.indexOf('/png');
  776. // let _img = key.indexOf('/img');
  777. // let _image = key.indexOf('/image');
  778. // let _file = key.indexOf('/file');
  779. let _keyLower = key.toLowerCase();
  780. // if (!key.endsWith('.json') && (_png !== -1 || _img !== -1 || _image !== -1 || _file !== -1)) {
  781. if (
  782. _keyLower.endsWith('.png') ||
  783. _keyLower.endsWith('.svg') ||
  784. _keyLower.endsWith('.gif') ||
  785. _keyLower.endsWith('.jpg') ||
  786. _keyLower.endsWith('.jpeg')
  787. ) {
  788. let filename = key.substr(key.lastIndexOf('/') + 1);
  789. const extPos = filename.lastIndexOf('.');
  790. let ext = '';
  791. if (extPos > 0) {
  792. ext = filename.substr(extPos);
  793. }
  794. filename = filename.substring(0, extPos > 8 ? 8 : extPos);
  795. // 上传文件
  796. const result: any = {};
  797. // await upload(
  798. // // await zip.file(key).async('blob'),
  799. // true,
  800. // filename + ext,
  801. // "/2D/默认"
  802. // );
  803. let _key = key;
  804. // if (_png) {
  805. // _key = key.substring(_png);
  806. // } else if (_image) {
  807. // _key = key.substring(_png);
  808. // } else if (_img) {
  809. // _key = key.substring(_img);
  810. // } else if (_file) {
  811. // _key = key.substring(_file);
  812. // }
  813. if (result) {
  814. if (dataStr.replaceAll) {
  815. //'le5le.meta2d'
  816. dataStr = dataStr.replaceAll(_key.slice(12), result.url);
  817. } else {
  818. while (dataStr.includes(_key)) {
  819. dataStr = dataStr.replace(_key.slice(12), result.url);
  820. // 正则 gm 在特殊情况下报错,例如如下场景
  821. /**
  822. *    
  823. const data = '{"image":"/image/materials/IoT-Chemical(化学)/Air stripper 2(汽提塔2).svg"}';
  824. const key = '/image/materials/IoT-Chemical(化学)/Air stripper 2(汽提塔2).svg';
  825. data.replace(key, '123');
  826. data.replaceAll(key, '123')
  827. data.replace(new RegExp(key, 'gm'), '123');
  828. data.replace(new RegExp(key, 'g'), '123');
  829. */
  830. }
  831. }
  832. }
  833. }
  834. }
  835. try {
  836. let data: Meta2dBackData = JSON.parse(dataStr);
  837. if (data) {
  838. if (!data.name) {
  839. data.name = file.name.replace('.zip', '');
  840. }
  841. if (!data.version || compareVersion(data.version, baseVer) === -1) {
  842. // 如果版本号不存在或者版本号 version < 1.0.0
  843. data = upgrade(data, baseVer);
  844. }
  845. dealwithFormatbeforeOpen(data);
  846. const delAttrs = [
  847. 'userId',
  848. 'shared',
  849. 'team',
  850. 'owner',
  851. 'username',
  852. 'editor',
  853. 'editorId',
  854. 'editorName',
  855. 'createdAt',
  856. 'folder',
  857. 'image',
  858. 'id',
  859. '_id',
  860. 'view',
  861. 'updatedAt',
  862. 'star',
  863. 'recommend',
  864. ];
  865. for (const k of delAttrs) {
  866. delete (data as any)[k];
  867. }
  868. meta2d.open(data);
  869. }
  870. } catch (e) {
  871. return false;
  872. }
  873. };
  874. const downloadJson = () => {
  875. const data: Meta2dBackData = meta2d.data();
  876. if (data._id) delete data._id;
  877. if (data.id) delete data.id;
  878. checkData(data);
  879. import('file-saver').then(({ saveAs }) => {
  880. saveAs(
  881. new Blob(
  882. [JSON.stringify(data).replaceAll(cdn, '').replaceAll(upCdn, '')],
  883. {
  884. type: 'text/plain;charset=utf-8',
  885. }
  886. ),
  887. `${data.name || 'le5le.meta2d'}.json`
  888. );
  889. });
  890. };
  891. const downloadZip = async () => {
  892. if (!(user && user.id)) {
  893. MessagePlugin.warning(noLoginTip);
  894. return;
  895. }
  896. // if (!user.isVip) {
  897. // // gotoAccount();
  898. // return;
  899. // }
  900. if(!meta2d.store.data.pens.length){
  901. MessagePlugin.info('画布没有画笔!');
  902. return;
  903. }
  904. if (!user.vip) {
  905. MessagePlugin.info('需要开通会员~');
  906. gotoAccount();
  907. return;
  908. }
  909. preDownloadZip();
  910. return;
  911. MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
  912. const [{ default: JSZip }, { saveAs }] = await Promise.all([
  913. import('jszip'),
  914. import('file-saver'),
  915. ]);
  916. const zip: any = new JSZip();
  917. const data: Meta2dBackData = meta2d.data();
  918. let _fileName =
  919. (data.name && data.name.replace(/\//g, '_').replace(/:/g, '_')) ||
  920. 'le5le.meta2d';
  921. const _zip = zip.folder(`${_fileName}`);
  922. if (data._id) delete data._id;
  923. if (data.id) delete data.id;
  924. checkData(data);
  925. _zip.file(
  926. `${_fileName}.json`,
  927. JSON.stringify(data).replaceAll(cdn, '').replaceAll(upCdn, '')
  928. );
  929. await zipBkImg(_zip);
  930. await zipImages(_zip, meta2d.store.data.pens);
  931. const blob = await zip.generateAsync({ type: 'blob' });
  932. saveAs(blob, `${_fileName}.zip`);
  933. };
  934. const preDownloadZip =async () =>{
  935. const meta2dData = meta2d.data();
  936. let payList = getPayList(meta2dData);
  937. let purchased =await getComponentPurchased({
  938. pngs: payList.pngs,
  939. jsPens: [],
  940. iotPens: [],
  941. svgPens: [],
  942. });
  943. downloadZipDialog.checked = true;
  944. if(payList.jsPens.length||payList.iotPens.length||payList.svgPens.length){
  945. downloadZipDialog.hasJs = true;
  946. }else{
  947. downloadZipDialog.hasJs = false;
  948. }
  949. let names = purchased.map((item) => item.name);
  950. data.goods = await getGoods();
  951. let list = payList.pngs.filter((item) => !names.includes(item));
  952. if(!list.length){
  953. doDownloadZip();
  954. }else{
  955. let unitPrice = data.goods.find((item)=>item.type==='图片图元').unitPrice;
  956. downloadZipDialog.price = unitPrice*list.length;
  957. downloadZipDialog.show = true;
  958. downloadZipDialog.list = list;
  959. }
  960. }
  961. const prePayDownloadZip = async ()=>{
  962. if(downloadZipDialog.checked){
  963. const res: any = await axios.post('/api/order/deployment/submit', {
  964. goods:{},
  965. '2ds':downloadZipDialog.list.map((item)=>{return { type: '图片图元', name: item}}),
  966. });
  967. wechatPayDialog.show = true;
  968. wechatPayDialog.isZip = true;
  969. data.order = res;
  970. }else {
  971. doDownloadZip();
  972. }
  973. }
  974. const doDownloadZip = async ()=>{
  975. downloadZipDialog.show = false;
  976. MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
  977. const [{ default: JSZip }, { saveAs }] = await Promise.all([
  978. import('jszip'),
  979. import('file-saver'),
  980. ]);
  981. const zip: any = new JSZip();
  982. const data: Meta2dBackData = meta2d.data();
  983. let _fileName =
  984. (data.name && data.name.replace(/\//g, '_').replace(/:/g, '_')) ||
  985. 'le5le.meta2d';
  986. const _zip = zip.folder(`${_fileName}`);
  987. if (data._id) delete data._id;
  988. if (data.id) delete data.id;
  989. checkData(data);
  990. _zip.file(
  991. `${_fileName}.json`,
  992. JSON.stringify(data).replaceAll(cdn, '').replaceAll(upCdn, '')
  993. );
  994. await zipBkImg(_zip);
  995. await zipImages(_zip, meta2d.store.data.pens);
  996. const blob = await zip.generateAsync({ type: 'blob' });
  997. saveAs(blob, `${_fileName}.zip`);
  998. }
  999. // const zip3D = (name: string) => {
  1000. // const pen_3d = meta2d.store.data.pens.filter(
  1001. // (pen) =>
  1002. // pen.name === 'iframe' &&
  1003. // (pen.tags.includes('meta3d') || pen.iframe.indexOf('3d') !== -1)
  1004. // );
  1005. // if (pen_3d && pen_3d.length) {
  1006. // //存在3d场景
  1007. // pen_3d.forEach((pen) => {
  1008. // //发送消息
  1009. // let params = queryURLParams(pen.iframe.split('?')[1]);
  1010. // (
  1011. // pen.calculative.singleton.div.children[0] as HTMLIFrameElement
  1012. // ).contentWindow.postMessage(
  1013. // JSON.stringify({
  1014. // type: 1,
  1015. // name,
  1016. // id: params.id,
  1017. // }),
  1018. // '*'
  1019. // );
  1020. // });
  1021. // }
  1022. // };
  1023. // const zip2D = (name: string) => {
  1024. // const pen_2d = meta2d.store.data.pens.filter(
  1025. // (pen) =>
  1026. // pen.name === 'iframe' &&
  1027. // (pen.iframe.indexOf('2d.le5le.com') !== -1 ||
  1028. // pen.iframe.indexOf('/2d/') !== -1 ||
  1029. // pen.iframe.indexOf('v.le5le.com') !== -1 ||
  1030. // pen.iframe.indexOf('/v/') !== -1)
  1031. // );
  1032. // if (pen_2d && pen_2d.length) {
  1033. // //存在3d场景
  1034. // pen_2d.forEach((pen) => {
  1035. // //发送消息
  1036. // // let params = queryURLParams(pen.iframe.split('?')[1]);
  1037. // (
  1038. // pen.calculative.singleton.div.children[0] as HTMLIFrameElement
  1039. // ).contentWindow.postMessage(
  1040. // JSON.stringify({
  1041. // name,
  1042. // type: 1,
  1043. // }),
  1044. // '*'
  1045. // );
  1046. // });
  1047. // }
  1048. // }
  1049. function queryURLParams(value?: string) {
  1050. let url = value || window.location.href.split('?')[1];
  1051. const urlSearchParams = new URLSearchParams(url);
  1052. const params = Object.fromEntries(urlSearchParams.entries());
  1053. return params;
  1054. }
  1055. const downloadHtml = async () => {
  1056. if (!(user && user.id)) {
  1057. MessagePlugin.warning(noLoginTip);
  1058. return;
  1059. }
  1060. downloadType = Frame.html;
  1061. await preGetPayList();
  1062. };
  1063. const preGetPayList = async () => {
  1064. //图形库需要购买
  1065. const meta2dData = meta2d.data();
  1066. if(!meta2dData.pens.length){
  1067. MessagePlugin.info('画布没有画笔!');
  1068. return;
  1069. }
  1070. let list = getPayList(meta2dData);
  1071. prePayList.pngs = new Set(list.pngs);
  1072. prePayList.jsPens = new Set(list.jsPens);
  1073. prePayList.iotPens = new Set(list.iotPens);
  1074. prePayList.svgPens = new Set(list.svgPens);
  1075. downloadList = new Set();
  1076. //向iframe发送消息
  1077. payListNum = 0;
  1078. comparePayListNum = 0;
  1079. const pen_pay = meta2dData.pens.filter(
  1080. (pen) =>
  1081. pen.name === 'iframe' &&
  1082. (pen.iframe.indexOf('2d.le5le.com') !== -1 ||
  1083. pen.iframe.indexOf('/2d') !== -1 || pen.iframe.indexOf('data=2d') !== -1 ||
  1084. pen.iframe.indexOf('v.le5le.com') !== -1 ||
  1085. pen.iframe.indexOf('/view/v') !== -1 ||pen.iframe.indexOf('data=v') !== -1 ||
  1086. pen.iframe.indexOf('/preview') !== -1)
  1087. );
  1088. if (pen_pay && pen_pay.length) {
  1089. pen_pay.forEach((pen) => {
  1090. //发送消息
  1091. (
  1092. meta2d.store.pens[pen.id].calculative.singleton.div
  1093. .children[0] as HTMLIFrameElement
  1094. ).contentWindow.postMessage(
  1095. JSON.stringify({
  1096. name: 'prePayList',
  1097. type: 1,
  1098. }),
  1099. '*'
  1100. );
  1101. payListNum += 1;
  1102. });
  1103. }
  1104. if (payListNum === 0) {
  1105. await showPayListDialog();
  1106. }
  1107. };
  1108. const showPayListDialog = async () => {
  1109. //下载离线部署包
  1110. const deploys =await getDeployGoods();
  1111. const pen_3d = meta2d.store.data.pens.filter(
  1112. (pen) =>
  1113. pen.name === 'iframe' &&
  1114. (pen.iframe.indexOf('3d.le5le.com') !== -1 ||
  1115. pen.iframe.indexOf('/3d') !== -1)
  1116. );
  1117. const pen_2d = meta2d.store.data.pens.filter(
  1118. (pen) =>
  1119. pen.name === 'iframe' &&
  1120. (pen.iframe.indexOf('2d.le5le.com') !== -1 ||
  1121. pen.iframe.indexOf('/2d') !== -1||pen.iframe.indexOf('v.le5le.com') !== -1 ||
  1122. pen.iframe.indexOf('/view/v') !== -1||pen.iframe.indexOf('data=v') !== -1)
  1123. );
  1124. let price = 0;
  1125. data.payDiagram.checked = true;
  1126. data.payDiagram.expend = false;
  1127. data.payGoods ={}
  1128. deploys.forEach((item) => {
  1129. if(item.name==="3D离线部署下载"){
  1130. price+=item.price*pen_3d.length;
  1131. if(pen_3d.length){
  1132. data.payGoods[item.id]=pen_3d.length;
  1133. }
  1134. }else if(item.name==="2D离线部署下载"){
  1135. price+=item.price*(pen_2d.length+1);
  1136. data.payGoods[item.id]=pen_2d.length+1;
  1137. }
  1138. });
  1139. data.deploy.price = price;
  1140. //图形库
  1141. data.goods = await getGoods();
  1142. data.purchasedList = await getComponentPurchased(prePayList);
  1143. data.payDiagram.list =[];
  1144. data.goods.forEach((goods)=>{
  1145. let purchased = data.purchasedList?.filter(
  1146. (_item) => _item.type === goods.type
  1147. );
  1148. let names = purchased.map((item) => item.name);
  1149. let list = [];
  1150. if(goods.type==='图片图元'){
  1151. list = [...prePayList.pngs];
  1152. }else if(goods.type==='JS线性图元'){
  1153. list = [...prePayList.jsPens];
  1154. }else if(goods.type==='SVG线性图元'){
  1155. list = [...prePayList.svgPens];
  1156. }else if(goods.type==='控件'){
  1157. list = [...prePayList.iotPens];
  1158. }
  1159. let num =0;
  1160. if (goods.type==='SVG线性图元'&&purchased.length === 1 && !purchased[0].name) {
  1161. //说明已经购买全部
  1162. }else{
  1163. list.forEach((item)=>{
  1164. if(!names.includes(item)){
  1165. if(goods.type==='控件'){
  1166. data.payDiagram.list.push({
  1167. name:item
  1168. });
  1169. }else if(goods.type==='JS线性图元'){
  1170. data.payDiagram.list.push({
  1171. svg:globalThis.jsPensMap?globalThis.jsPensMap[item]:item
  1172. });
  1173. }else{
  1174. data.payDiagram.list.push({
  1175. img:item
  1176. });
  1177. }
  1178. num+=1;
  1179. }
  1180. })};
  1181. goods.num = num;
  1182. })
  1183. price = 0;
  1184. data.goods.forEach((item, index) => {
  1185. price += item.num * item.unitPrice;
  1186. });
  1187. data.payDiagram.price = price;
  1188. // data.goods.forEach((item, index) => {
  1189. // item.checked = true;
  1190. // let purchased = data.purchasedList?.filter(
  1191. // (_item) => _item.type === item.type
  1192. // );
  1193. // if (index === 0) {
  1194. // item.total = [...prePayList.pngs].length;
  1195. // item.unPurchased = item.total - purchased.length;
  1196. // } else if (index === 1) {
  1197. // item.total = [...prePayList.iotPens].length;
  1198. // item.unPurchased = item.total - purchased.length;
  1199. // } else if (index === 3) {
  1200. // item.total = [...prePayList.jsPens].length;
  1201. // item.unPurchased = item.total - purchased.length;
  1202. // } else if (index === 2) {
  1203. // if (purchased.length === 1 && !purchased[0].name) {
  1204. // //说明已经购买全部 //TODO
  1205. // item.total = item.count;
  1206. // item.unPurchased = 0;
  1207. // } else {
  1208. // //需要购买全部
  1209. // if ([...prePayList.svgPens].includes('*')) {
  1210. // item.total = item.count;
  1211. // item.unPurchased = item.total;
  1212. // } else {
  1213. // item.total = [...prePayList.svgPens].length;
  1214. // item.unPurchased = item.total - purchased.length;
  1215. // }
  1216. // }
  1217. // }
  1218. // });
  1219. payListDialog.show = true;
  1220. switch (downloadType) {
  1221. case Frame.html:
  1222. payListDialog.title = '下载离线部署包';
  1223. payListDialog.href = 'https://doc.le5le.com/document/155692631#%E4%B8%8B%E8%BD%BD%E7%A6%BB%E7%BA%BF%E9%83%A8%E7%BD%B2%E5%8C%85';
  1224. payListDialog.downloadUrl =img_cdn+ '/deployment/大厦电力管理系统(html).zip';
  1225. break;
  1226. case Frame.vue2:
  1227. payListDialog.title = '下载vue2组件包';
  1228. payListDialog.href = 'https://doc.le5le.com/document/155692631#%E4%B8%8B%E8%BD%BDVue2%E7%BB%84%E4%BB%B6%E5%8C%85';
  1229. payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(vue2).zip';
  1230. break;
  1231. case Frame.vue3:
  1232. payListDialog.title = '下载vue3组件包';
  1233. payListDialog.href = 'https://doc.le5le.com/document/155692631#%E4%B8%8B%E8%BD%BDVue3%E7%BB%84%E4%BB%B6%E5%8C%85';
  1234. payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(vue3).zip';
  1235. break;
  1236. case Frame.react:
  1237. payListDialog.title = '下载react组件包';
  1238. payListDialog.href = 'https://doc.le5le.com/document/155692631#%E4%B8%8B%E8%BD%BDReact%E7%BB%84%E4%BB%B6%E5%8C%85';
  1239. payListDialog.downloadUrl = img_cdn+ '/deployment/大厦电力管理系统(react).zip';
  1240. break;
  1241. }
  1242. // let price = 0;
  1243. // if (price === 0) {
  1244. // skipPay(); //如果计算价格为0,直接下载
  1245. // } else {
  1246. // payListDialog.show = true;
  1247. // }
  1248. };
  1249. const preDownload = () => {
  1250. iframeNum = 0;
  1251. compareNum = 0;
  1252. const meta2dData:any = meta2d.data();
  1253. meta2dData.userId = user.id;
  1254. const pen_3d = meta2dData.pens.filter(
  1255. (pen) =>
  1256. pen.name === 'iframe' &&
  1257. (pen.iframe.indexOf('3d.le5le.com') !== -1 ||
  1258. pen.iframe.indexOf('/3d') !== -1)
  1259. );
  1260. if (pen_3d && pen_3d.length) {
  1261. //存在3d场景
  1262. if (pen_3d.length === 1) {
  1263. let params = queryURLParams(pen_3d[0].iframe.split('?')[1]);
  1264. meta2d.store.pens[
  1265. pen_3d[0].id
  1266. ].calculative.singleton.div.children[0].contentWindow.postMessage(
  1267. JSON.stringify({
  1268. name: 'deploy',
  1269. // id: params.id,
  1270. type: 1, //用于区分是系统消息
  1271. path: `3d`,
  1272. }),
  1273. '*'
  1274. );
  1275. pen_3d[0].iframe = '/view?data=3d';
  1276. } else {
  1277. pen_3d.forEach((pen) => {
  1278. //发送消息
  1279. let params = queryURLParams(pen.iframe.split('?')[1]);
  1280. (
  1281. meta2d.store.pens[pen.id].calculative.singleton.div
  1282. .children[0] as HTMLIFrameElement
  1283. ).contentWindow.postMessage(
  1284. JSON.stringify({
  1285. name: 'deploy',
  1286. // id: params.id,
  1287. type: 1,
  1288. path: `3d-${params.id}`,
  1289. }),
  1290. '*'
  1291. );
  1292. pen.iframe = `/view?data=3d-${params.id}`;
  1293. });
  1294. }
  1295. iframeNum += pen_3d.length;
  1296. }
  1297. const pen_2d = meta2dData.pens.filter(
  1298. (pen) =>
  1299. pen.name === 'iframe' &&
  1300. (pen.iframe.indexOf('2d.le5le.com') !== -1 ||
  1301. pen.iframe.indexOf('/2d') !== -1)
  1302. );
  1303. if (pen_2d && pen_2d.length) {
  1304. //存在3d场景
  1305. if (pen_2d.length === 1) {
  1306. let params = queryURLParams(pen_2d[0].iframe.split('?')[1]);
  1307. meta2d.store.pens[
  1308. pen_2d[0].id
  1309. ].calculative.singleton.div.children[0].contentWindow.postMessage(
  1310. JSON.stringify({
  1311. name: 'downloadHtml',
  1312. id: params.id,
  1313. type: 1,
  1314. path: `2d`,
  1315. }),
  1316. '*'
  1317. );
  1318. pen_2d[0].iframe = '/view?data=2d';
  1319. } else {
  1320. pen_2d.forEach((pen) => {
  1321. //发送消息
  1322. let params = queryURLParams(pen.iframe.split('?')[1]);
  1323. (
  1324. meta2d.store.pens[pen.id].calculative.singleton.div
  1325. .children[0] as HTMLIFrameElement
  1326. ).contentWindow.postMessage(
  1327. JSON.stringify({
  1328. name: 'downloadHtml',
  1329. // id: params.id,
  1330. type: 1,
  1331. path: `2d-${params.id}`,
  1332. }),
  1333. '*'
  1334. );
  1335. pen.iframe = `/view?data=2d-${params.id}`;
  1336. });
  1337. }
  1338. iframeNum += pen_2d.length;
  1339. }
  1340. const pen_v = meta2dData.pens.filter(
  1341. (pen) =>
  1342. pen.name === 'iframe' &&
  1343. (pen.iframe.indexOf('v.le5le.com') !== -1 ||
  1344. pen.iframe.indexOf('/view/v') !== -1||pen.iframe.indexOf('data=v') !== -1)
  1345. );
  1346. if (pen_v && pen_v.length) {
  1347. //存在3d场景
  1348. pen_v.forEach((pen) => {
  1349. //发送消息
  1350. let params = queryURLParams(pen.iframe.split('?')[1]);
  1351. (
  1352. meta2d.store.pens[pen.id].calculative.singleton.div
  1353. .children[0] as HTMLIFrameElement
  1354. ).contentWindow.postMessage(
  1355. JSON.stringify({
  1356. name: 'downloadHtml',
  1357. // id: params.id,
  1358. type: 1,
  1359. path: `v-${params.id}`,
  1360. }),
  1361. '*'
  1362. );
  1363. pen.iframe = `/view?data=v-${params.id}`;
  1364. });
  1365. iframeNum += pen_v.length;
  1366. }
  1367. downloadList = getDownloadList(meta2dData);
  1368. if (iframeNum === 0) {
  1369. //如果没有嵌入场景
  1370. saveDownload();
  1371. } else {
  1372. setTimeout(() => {
  1373. if (compareNum < iframeNum) {
  1374. //message阻塞/报错的情况
  1375. saveDownload();
  1376. }
  1377. }, 10000);
  1378. }
  1379. };
  1380. const preFrameDownload = async () => {
  1381. iframeNum = 0;
  1382. compareNum = 0;
  1383. const meta2dData:any = meta2d.data();
  1384. meta2dData.userId = user.id;
  1385. const pen_3d = meta2dData.pens.filter(
  1386. (pen) =>
  1387. pen.name === 'iframe' &&
  1388. (pen.iframe.indexOf('3d.le5le.com') !== -1 ||
  1389. pen.iframe.indexOf('/3d') !== -1)
  1390. );
  1391. let name_3d = (downloadType===Frame.vue3?'toVue3':downloadType===Frame.vue2?'toVue2':'toReact');
  1392. let flag_3d = false; //标记是否存在3d场景
  1393. if (pen_3d && pen_3d.length) {
  1394. //存在3d场景
  1395. if (pen_3d.length === 1) {
  1396. let params = queryURLParams(pen_3d[0].iframe.split('?')[1]);
  1397. meta2d.store.pens[
  1398. pen_3d[0].id
  1399. ].calculative.singleton.div.children[0].contentWindow.postMessage(
  1400. JSON.stringify({
  1401. name: name_3d,
  1402. type: 1, //用于区分是系统消息
  1403. path: `3d`,
  1404. }),
  1405. '*'
  1406. );
  1407. pen_3d[0].iframe = '/3d?id=3d';
  1408. } else {
  1409. pen_3d.forEach((pen) => {
  1410. //发送消息
  1411. let params = queryURLParams(pen.iframe.split('?')[1]);
  1412. (
  1413. meta2d.store.pens[pen.id].calculative.singleton.div
  1414. .children[0] as HTMLIFrameElement
  1415. ).contentWindow.postMessage(
  1416. JSON.stringify({
  1417. name:name_3d,
  1418. // id: params.id,
  1419. type: 1,
  1420. path: `3d-${params.id}`,
  1421. }),
  1422. '*'
  1423. );
  1424. pen.iframe = `/3d?id=3d-${params.id}`;
  1425. });
  1426. }
  1427. iframeNum += pen_3d.length;
  1428. flag_3d = true;
  1429. }
  1430. const pen_2d = meta2dData.pens.filter(
  1431. (pen) =>
  1432. pen.name === 'iframe' &&
  1433. (pen.iframe.indexOf('2d.le5le.com') !== -1 ||
  1434. pen.iframe.indexOf('/2d') !== -1)
  1435. );
  1436. let name_2d = (downloadType===Frame.vue3?'downloadVue3':downloadType===Frame.vue2?'downloadVue2':'downloadReact');
  1437. if (pen_2d && pen_2d.length) {
  1438. //存在3d场景
  1439. if (pen_2d.length === 1) {
  1440. let params = queryURLParams(pen_2d[0].iframe.split('?')[1]);
  1441. meta2d.store.pens[
  1442. pen_2d[0].id
  1443. ].calculative.singleton.div.children[0].contentWindow.postMessage(
  1444. JSON.stringify({
  1445. name: name_2d,
  1446. id: params.id,
  1447. type: 1,
  1448. path: `2d`,
  1449. }),
  1450. '*'
  1451. );
  1452. pen_2d[0].iframe = '/2d?id=2d';
  1453. } else {
  1454. pen_2d.forEach((pen) => {
  1455. //发送消息
  1456. let params = queryURLParams(pen.iframe.split('?')[1]);
  1457. (
  1458. meta2d.store.pens[pen.id].calculative.singleton.div
  1459. .children[0] as HTMLIFrameElement
  1460. ).contentWindow.postMessage(
  1461. JSON.stringify({
  1462. name:name_2d,
  1463. // id: params.id,
  1464. type: 1,
  1465. path: `2d-${params.id}`,
  1466. }),
  1467. '*'
  1468. );
  1469. pen.iframe = `/2d?id=2d-${params.id}`;
  1470. });
  1471. }
  1472. iframeNum += pen_2d.length;
  1473. }
  1474. const pen_v = meta2dData.pens.filter(
  1475. (pen) =>
  1476. pen.name === 'iframe' &&
  1477. (pen.iframe.indexOf('v.le5le.com') !== -1 ||
  1478. pen.iframe.indexOf('/view/v') !== -1||pen.iframe.indexOf('data=v') !== -1||pen.iframe.indexOf('/preview') !== -1)
  1479. );
  1480. if (pen_v && pen_v.length) {
  1481. //存在大屏场景
  1482. pen_v.forEach((pen) => {
  1483. //发送消息
  1484. let params = queryURLParams(pen.iframe.split('?')[1]);
  1485. (
  1486. meta2d.store.pens[pen.id].calculative.singleton.div
  1487. .children[0] as HTMLIFrameElement
  1488. ).contentWindow.postMessage(
  1489. JSON.stringify({
  1490. name: name_2d,
  1491. // id: params.id,
  1492. type: 1,
  1493. path: `v-${params.id}`,
  1494. }),
  1495. '*'
  1496. );
  1497. pen.iframe = `/2d?id=v-${params.id}`;
  1498. });
  1499. iframeNum += pen_v.length;
  1500. }
  1501. downloadList = await getFrameDownloadList(meta2dData,undefined,downloadType,flag_3d);
  1502. if (iframeNum === 0) {
  1503. //如果没有嵌入场景
  1504. saveDownload();
  1505. } else {
  1506. setTimeout(() => {
  1507. if (compareNum < iframeNum) {
  1508. //message阻塞/报错的情况
  1509. saveDownload();
  1510. }
  1511. }, 10000);
  1512. }
  1513. }
  1514. const saveDownload = async () => {
  1515. const list = [...downloadList];
  1516. //控件
  1517. let jsPath= '';
  1518. switch (downloadType) {
  1519. case Frame.html:
  1520. jsPath = '/view/js/2d-components.js';
  1521. break;
  1522. case Frame.vue2:
  1523. jsPath = '/meta2d-vue2/public/js/2d-components.js';
  1524. break;
  1525. case Frame.vue3:
  1526. jsPath = '/meta2d-vue3/public/js/2d-components.js';
  1527. break;
  1528. case Frame.react:
  1529. jsPath = '/meta2d-react/public/js/2d-components.js';
  1530. break;
  1531. }
  1532. const js = await get2dComponentJs([...prePayList.iotPens]);
  1533. list.push({
  1534. data: js,
  1535. path:jsPath,
  1536. });
  1537. ///png图形库
  1538. const pngs = await getTemPngs([...prePayList.pngs]);
  1539. list.forEach((item) => {
  1540. if(item.url){
  1541. let url =item.url.replace(img_cdn, '').replace(img_upCdn, '')
  1542. if (pngs[url]) {
  1543. item.url = pngs[url];
  1544. }
  1545. }
  1546. });
  1547. //js线性图元 由对应页面处理
  1548. //SVG线性图元
  1549. if ([...prePayList.svgPens].length) {
  1550. let purchased = data.purchasedList?.filter(
  1551. (_item) => _item.type === 'SVG线性图元'
  1552. );
  1553. if (purchased.length === 1 && !purchased[0].name) {
  1554. //已经购买全部
  1555. list.forEach((item) => {
  1556. if (item.data && item.path.indexOf('/projects/v') !== 1) {
  1557. //清空所有svgpath
  1558. let meta2dData = JSON.parse(item.data);
  1559. for (let key of Object.keys(meta2dData.paths)) {
  1560. let path = meta2dData.paths[key];
  1561. if (
  1562. path.indexOf('-1.18Zm4-1') !== -1 ||
  1563. path.indexOf('-1.19Zm4-1') !== -1 ||
  1564. path.indexOf('2.85ZM') !== -1 ||
  1565. path.indexOf('-1-2.39.3') !== -1
  1566. ) {
  1567. meta2dData.paths[key] = '';
  1568. }
  1569. }
  1570. item.data = JSON.stringify(meta2dData);
  1571. }
  1572. });
  1573. } else {
  1574. let svgnames = purchased.map(i=>i.name);
  1575. list.forEach((item) => {
  1576. if (
  1577. item.data &&
  1578. (item.path.indexOf('/projects/v') !== -1 || item.path.indexOf('/public/json')!==-1) &&
  1579. item.path.indexOf('/projects/v/png/') === -1
  1580. ) {
  1581. //2d 图纸数据
  1582. let meta2dData = JSON.parse(item.data);
  1583. meta2dData.pens.forEach((pen) => {
  1584. if (pen.name === 'svgPath' && pen.svgUrl) {
  1585. if (svgnames.includes(pen.svgUrl.replace(img_cdn, ''))) {
  1586. pen.pathId = null;
  1587. }
  1588. }
  1589. });
  1590. item.data = JSON.stringify(meta2dData);
  1591. }
  1592. });
  1593. }
  1594. }
  1595. //开始下载list
  1596. const [{ default: JSZip }, { saveAs }] = await Promise.all([
  1597. import('jszip'),
  1598. import('file-saver'),
  1599. ]);
  1600. const zip = new JSZip();
  1601. await Promise.all(
  1602. list.map(async (item: any) => {
  1603. if (item.url) {
  1604. //接口请求
  1605. try{
  1606. const res: Blob = await axios.get(item.url.startsWith('/')?(cdn+item.url):item.url, {
  1607. responseType: 'blob',
  1608. });
  1609. zip.file(item.path, res, { createFolders: true });
  1610. }catch(e){
  1611. console.log(e);
  1612. }
  1613. } else if (item.data) {
  1614. //直接写数据
  1615. zip.file(item.path, item.data, { createFolders: true });
  1616. }
  1617. })
  1618. );
  1619. let _fileName =
  1620. (meta2d.store.data.name &&
  1621. meta2d.store.data.name.replace(/\//g, '_').replace(/:/g, '_')) ||
  1622. 'le5le.meta2d';
  1623. const blob = await zip.generateAsync({ type: 'blob' });
  1624. saveAs(blob, `${_fileName}.zip`);
  1625. };
  1626. // const _downloadHtml = async () => {
  1627. // if (!(user && user.id)) {
  1628. // MessagePlugin.warning(noLoginTip);
  1629. // return;
  1630. // }
  1631. // // if (!user.isVip) {
  1632. // // gotoAccount();
  1633. // // return;
  1634. // // }
  1635. // if (user.vipDesc !== '超级会员' && user.vipDesc !== '旗舰会员') {
  1636. // MessagePlugin.info('需要开通超级会员~');
  1637. // gotoAccount();
  1638. // return;
  1639. // }
  1640. // frameFlag = -1;
  1641. // MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
  1642. // const data: Meta2dBackData = meta2d.data();
  1643. // if (data._id) delete data._id;
  1644. // if (data.id) delete data.id;
  1645. // if (data.image) delete data.image;
  1646. // checkData(data);
  1647. // const [{ default: JSZip }, { saveAs }] = await Promise.all([
  1648. // import('jszip'),
  1649. // import('file-saver'),
  1650. // ]);
  1651. // const zip = new JSZip();
  1652. // let _fileName =
  1653. // (data.name && data.name.replace(/\//g, '_').replace(/:/g, '_')) ||
  1654. // 'le5le.meta2d';
  1655. // //处理cdn图片地址
  1656. // const _zip: any = zip.folder(`${_fileName}`);
  1657. // _zip.file(
  1658. // 'data.json',
  1659. // JSON.stringify(data).replaceAll(cdn, '').replaceAll(upCdn, '')
  1660. // );
  1661. // await Promise.all([
  1662. // zipBkImg(_zip),
  1663. // zipImages(_zip, meta2d.store.data.pens),
  1664. // zipFiles(_zip),
  1665. // ]);
  1666. // const blob = await zip.generateAsync({ type: 'blob' });
  1667. // saveAs(blob, `${_fileName}.zip`);
  1668. // };
  1669. // async function zipBkImg(zip: JSZip) {
  1670. // let img = meta2d.store.data.bkImage;
  1671. // if (img) {
  1672. // if (img.startsWith('/') || img.startsWith(cdn) || img.startsWith(upCdn)) {
  1673. // const pngs = await getTemPngs([img.replace(cdn, '').replace(upCdn, '')]);
  1674. // await zipImage(zip, img, pngs[img.replace(cdn, '').replace(upCdn, '')]);
  1675. // }
  1676. // }
  1677. // }
  1678. // enum Frame {
  1679. // vue2,
  1680. // vue3,
  1681. // react,
  1682. // html
  1683. // }
  1684. const downloadVue3 = async () => {
  1685. downloadAsFrame(Frame.vue3);
  1686. };
  1687. const downloadVue2 = async () => {
  1688. downloadAsFrame(Frame.vue2);
  1689. };
  1690. const downloadReact = async () => {
  1691. downloadAsFrame(Frame.react);
  1692. };
  1693. async function downloadAsFrame(type: Frame) {
  1694. if (!(user && user.id)) {
  1695. MessagePlugin.warning(noLoginTip);
  1696. return;
  1697. }
  1698. // if (user.vipDesc !== '旗舰会员') {
  1699. // MessagePlugin.info('需要开通旗舰会员~');
  1700. // gotoAccount();
  1701. // return;
  1702. // }
  1703. downloadType = type;
  1704. await preGetPayList();
  1705. }
  1706. // const preFrameDownload = async (type: Frame) => {
  1707. // frameFlag = type;
  1708. // MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
  1709. // zip3D(
  1710. // type === Frame.vue3 ? 'toVue3' : type === Frame.vue2 ? 'toVue2' : 'toReact'
  1711. // );
  1712. // zip2D(
  1713. // type === Frame.vue3 ? 'downloadVue3' : type === Frame.vue2 ? 'downloadVue2' : 'downloadReact'
  1714. // );
  1715. // const data: any = meta2d.data();
  1716. // if (data._id) delete data._id;
  1717. // if (data.id) delete data.id;
  1718. // if (data.image) delete data.image;
  1719. // data.userId = user.id;
  1720. // checkData(data);
  1721. // const [{ default: JSZip }, { saveAs }] = await Promise.all([
  1722. // import('jszip'),
  1723. // import('file-saver'),
  1724. // ]);
  1725. // const zip = new JSZip();
  1726. // let _fileName =
  1727. // (data.name && data.name.replace(/\//g, '_').replace(/:/g, '_')) ||
  1728. // 'le5le.meta2d';
  1729. // //处理付费svg
  1730. // if (Object.keys(data.paths).length >= 3) {
  1731. // //简单判断有无svg图元
  1732. // const res: any = await axios.post('/api/paid/2d/component', {
  1733. // type: 'SVG线性图元',
  1734. // });
  1735. // if (res.list.length === 1 && !res.list[0].name) {
  1736. // //已经购买全部
  1737. // for (let key of Object.keys(data.paths)) {
  1738. // let path = data.paths[key];
  1739. // if (
  1740. // path.indexOf('-1.18Zm4-1') !== -1 ||
  1741. // path.indexOf('-1.19Zm4-1') !== -1 ||
  1742. // path.indexOf('2.85ZM') !== -1 ||
  1743. // path.indexOf('-1-2.39.3') !== -1
  1744. // ) {
  1745. // data.paths[key] = '';
  1746. // }
  1747. // }
  1748. // } else {
  1749. // //购买部分
  1750. // let purchasedList = res.list.map((i) => i.name);
  1751. // data.pens.forEach((pen) => {
  1752. // if (pen.name === 'svgPath' && pen.svgUrl) {
  1753. // if (purchasedList.includes(pen.svgUrl)) {
  1754. // pen.pathId = null;
  1755. // }
  1756. // }
  1757. // });
  1758. // }
  1759. // }
  1760. // const _zip: any = zip.folder(`${_fileName}`);
  1761. // _zip.file(
  1762. // `${type === Frame.vue3
  1763. // ? 'meta2d-vue3'
  1764. // : type === Frame.vue2
  1765. // ? 'meta2d-vue2'
  1766. // : 'meta2d-react'
  1767. // }/public/json/data.json`,
  1768. // JSON.stringify(data).replaceAll(cdn, '').replaceAll(upCdn, '')
  1769. // );
  1770. // await Promise.all([
  1771. // zipJs(_zip),
  1772. // zipBkImg(_zip),
  1773. // zipImages(_zip, meta2d.store.data.pens),
  1774. // type === Frame.vue3
  1775. // ? zipVue3Files(_zip)
  1776. // : type === Frame.vue2
  1777. // ? zipVue2Files(_zip)
  1778. // : zipReactFiles(_zip),
  1779. // zipIotPens(_zip),
  1780. // ]);
  1781. // const blob = await zip.generateAsync({ type: 'blob' });
  1782. // saveAs(blob, `${_fileName}.zip`);
  1783. // frameFlag = -1;
  1784. // }
  1785. // async function zipIotPens(zip: JSZip) {
  1786. // //处理控件
  1787. // const js = await get2dComponentJs();
  1788. // zip.file(`${frameFlag === Frame.vue3
  1789. // ? 'meta2d-vue3'
  1790. // : frameFlag === Frame.vue2
  1791. // ? 'meta2d-vue2'
  1792. // : 'meta2d-react'
  1793. // }/public/js/2d-components.js`, js, { createFolders: true });
  1794. // const res: Blob = await axios.get('/view/js/r.js', {
  1795. // responseType: 'blob',
  1796. // });
  1797. // zip.file(`${frameFlag === Frame.vue3
  1798. // ? 'meta2d-vue3'
  1799. // : frameFlag === Frame.vue2
  1800. // ? 'meta2d-vue2'
  1801. // : 'meta2d-react'
  1802. // }/public/js/r.js`, res, { createFolders: true });
  1803. // }
  1804. // async function zipJs(zip: JSZip) {
  1805. // const files = ['/view/js/marked.min.js', '/view/js/lcjs.iife.js'];
  1806. // await Promise.all(
  1807. // files.map(async (filePath) => {
  1808. // const res: Blob = await axios.get(filePath, {
  1809. // responseType: 'blob',
  1810. // });
  1811. // zip.file(
  1812. // `${frameFlag === Frame.vue3
  1813. // ? 'meta2d-vue3'
  1814. // : frameFlag === Frame.vue2
  1815. // ? 'meta2d-vue2'
  1816. // : 'meta2d-react'
  1817. // }/public` + filePath.replace('/view', ''),
  1818. // res,
  1819. // { createFolders: true }
  1820. // );
  1821. // })
  1822. // );
  1823. // }
  1824. // async function _zipVue3Files(zip: JSZip) {
  1825. // const files = [
  1826. // '/view/js/marked.min.js',
  1827. // '/view/js/lcjs.iife.js',
  1828. // '/view/vue3/Meta2d.vue',
  1829. // '/view/index.html',
  1830. // '/view/js/meta2d.js',
  1831. // '/view/使用说明.md',
  1832. // ] as const;
  1833. // // 文件同时加载
  1834. // await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
  1835. // }
  1836. //新
  1837. // async function zipVue3Files(zip: JSZip) {
  1838. // const files = [
  1839. // '/view/meta2d-vue3/src/components/Meta2d.vue',
  1840. // '/view/meta2d-vue3/src/App.vue',
  1841. // '/view/meta2d-vue3/src/main.js',
  1842. // '/view/meta2d-vue3/src/style.css',
  1843. // '/view/meta2d-vue3/index.html',
  1844. // '/view/meta2d-vue3/package.json',
  1845. // '/view/meta2d-vue3/README.md',
  1846. // '/view/meta2d-vue3/vite.config.js',
  1847. // ] as const;
  1848. // // 文件同时加载
  1849. // await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
  1850. // }
  1851. // async function _zipVue2Files(zip: JSZip) {
  1852. // const files = [
  1853. // '/view/js/marked.min.js',
  1854. // '/view/js/lcjs.iife.js',
  1855. // '/view/vue2/Meta2d.vue',
  1856. // '/view/index.html',
  1857. // '/view/js/meta2d.js',
  1858. // '/view/使用说明.md',
  1859. // ] as const;
  1860. // // 文件同时加载
  1861. // await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
  1862. // }
  1863. // async function zipVue2Files(zip: JSZip) {
  1864. // const files = [
  1865. // '/view/meta2d-vue2/src/components/Meta2d.vue',
  1866. // '/view/meta2d-vue2/src/App.vue',
  1867. // '/view/meta2d-vue2/src/main.js',
  1868. // // '/view/meta2d-vue2/src/style.css',
  1869. // '/view/meta2d-vue2/public/index.html',
  1870. // '/view/meta2d-vue2/package.json',
  1871. // '/view/meta2d-vue2/README.md',
  1872. // // '/view/meta2d-vue3/vite.config.js',
  1873. // ] as const;
  1874. // // 文件同时加载
  1875. // await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
  1876. // }
  1877. // async function _zipReactFiles(zip: JSZip) {
  1878. // const files = [
  1879. // '/view/js/marked.min.js',
  1880. // '/view/js/lcjs.iife.js',
  1881. // '/view/react/Meta2d.jsx',
  1882. // '/view/react/Meta2d.css',
  1883. // '/view/index.html',
  1884. // '/view/js/meta2d.js',
  1885. // '/view/使用说明.md',
  1886. // ] as const;
  1887. // // 文件同时加载
  1888. // await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
  1889. // }
  1890. // async function zipReactFiles(zip: JSZip) {
  1891. // const files = [
  1892. // '/view/meta2d-react/src/index.css',
  1893. // '/view/meta2d-react/src/index.js',
  1894. // '/view/meta2d-react/src/Meta2d.css',
  1895. // '/view/meta2d-react/src/Meta2d.jsx',
  1896. // '/view/meta2d-react/package.json',
  1897. // '/view/meta2d-react/README.md',
  1898. // '/view/meta2d-react/public/index.html',
  1899. // ] as const;
  1900. // // 文件同时加载
  1901. // await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
  1902. // }
  1903. // async function zipFiles(zip: JSZip) {
  1904. // const files = [
  1905. // '/view/js/marked.min.js',
  1906. // '/view/js/lcjs.iife.js',
  1907. // '/view/js/index.js',
  1908. // '/view/js/meta2d.js',
  1909. // '/view/index.html',
  1910. // '/view/index.css',
  1911. // '/view/favicon.ico',
  1912. // '/view/使用说明.pdf',
  1913. // ] as const;
  1914. // // 文件同时加载
  1915. // await Promise.all(files.map((filePath) => zipFile(zip, filePath)));
  1916. // }
  1917. // async function zipFile(zip: JSZip, filePath: string) {
  1918. // const res: Blob = await axios.get(
  1919. // (cdn ? cdn + '/v' : import.meta.env.BASE_URL.slice(0, -1)) + filePath,
  1920. // {
  1921. // responseType: 'blob',
  1922. // }
  1923. // );
  1924. // zip.file(filePath.replace('/view', ''), res, { createFolders: true });
  1925. // }
  1926. // /**
  1927. // * 图片放到 zip 里
  1928. // * @param pens 可以是非具有 calculative 的 pen
  1929. // */
  1930. // async function zipImages(zip: JSZip, pens: Pen[]) {
  1931. // if (!pens) {
  1932. // return;
  1933. // }
  1934. // // 不止 image 上有图片, strokeImage ,backgroundImage 也有图片
  1935. // const imageKeys = [
  1936. // {
  1937. // string: 'image',
  1938. // },
  1939. // { string: 'strokeImage' },
  1940. // { string: 'backgroundImage' },
  1941. // ] as const;
  1942. // const images: string[] = [];
  1943. // for (const pen of pens) {
  1944. // for (const i of imageKeys) {
  1945. // const image = pen[i.string];
  1946. // if (image) {
  1947. // // HTMLImageElement 无法精确控制图片格式
  1948. // if (
  1949. // image.startsWith('/') ||
  1950. // image.startsWith(cdn) ||
  1951. // image.startsWith(upCdn)
  1952. // ) {
  1953. // // 只考虑相对路径下的 image ,绝对路径图片无需下载
  1954. // if (!images.includes(image)) {
  1955. // images.push(image);
  1956. // }
  1957. // }
  1958. // }
  1959. // }
  1960. // // 无需递归遍历子节点,现在所有的节点都在外层
  1961. // }
  1962. // //付费pngs
  1963. // const pngs = await getTemPngs(images.map(i => i.replace(cdn, '').replace(upCdn, '')));
  1964. // await Promise.all(images.map((image) => zipImage(zip, image, pngs[image.replace(cdn, '').replace(upCdn, '')])));
  1965. // }
  1966. // async function zipImage(zip: JSZip, image: string, temImage?: string) {
  1967. // const res: Blob = await axios.get(temImage || image, {
  1968. // responseType: 'blob',
  1969. // // params: {
  1970. // // isZip: true,
  1971. // // },
  1972. // });
  1973. // zip.file(
  1974. // (frameFlag === -1
  1975. // ? ''
  1976. // : `${frameFlag === Frame.vue3
  1977. // ? 'meta2d-vue3'
  1978. // : frameFlag === Frame.vue2
  1979. // ? 'meta2d-vue2'
  1980. // : 'meta2d-react'
  1981. // }/public`) + (cdn ? image.replace(cdn, '').replace(upCdn, '') : image),
  1982. // res,
  1983. // {
  1984. // createFolders: true,
  1985. // }
  1986. // );
  1987. // }
  1988. const downloadImageTips =
  1989. '无法下载,宽度不合法,画布可能没有画笔/画布大小超出浏览器最大限制';
  1990. const downloadPng = () => {
  1991. if (!meta2d.store.data.pens.length) {
  1992. MessagePlugin.warning(downloadImageTips);
  1993. return;
  1994. }
  1995. try {
  1996. meta2d.downloadPng();
  1997. } catch (e) {
  1998. MessagePlugin.warning(downloadImageTips);
  1999. }
  2000. };
  2001. async function getIconDefs(url: string) {
  2002. let res: any = await axios.get(url);
  2003. let str = res.match(/@font-face([\s\S]*?)\}/)[1];
  2004. str = `@font-face ${str} }`;
  2005. return str;
  2006. }
  2007. const downloadSvg = async () => {
  2008. // await import('@/assets/canvas2svg');
  2009. for (const pen of meta2d.store.data.pens) {
  2010. if (pen.calculative.img) {
  2011. //重新生成绘制图片
  2012. pen.onRenderPenRaw?.(pen);
  2013. }
  2014. }
  2015. if (!C2S) {
  2016. MessagePlugin.error('请先加载乐吾乐官网下的canvas2svg.js');
  2017. return;
  2018. }
  2019. const rect: any = meta2d.getRect();
  2020. if (!isFinite(rect.width)) {
  2021. MessagePlugin.error(downloadImageTips);
  2022. return;
  2023. }
  2024. rect.x -= 10;
  2025. rect.y -= 10;
  2026. const ctx = new C2S(rect.width + 20, rect.height + 20);
  2027. ctx.textBaseline = 'middle';
  2028. ctx.strokeStyle = getGlobalColor(meta2d.store);
  2029. for (const pen of meta2d.store.data.pens) {
  2030. // 不使用 calculative.inView 的原因是,如果 pen 在 view 之外,那么它的 calculative.inView 为 false,但是它的绘制还是需要的
  2031. if (!isShowChild(pen, meta2d.store) || pen.visible == false) {
  2032. continue;
  2033. }
  2034. meta2d.renderPenRaw(ctx, pen, rect);
  2035. }
  2036. let mySerializedSVG = ctx.getSerializedSvg();
  2037. let icon_pens = meta2d.store.data.pens.filter(
  2038. (item) => item.iconFamily && item.icon
  2039. );
  2040. if (icon_pens && icon_pens.length > 0) {
  2041. let iconList = [
  2042. '/icon/国家电网/iconfont.css',
  2043. '/icon/电气工程/iconfont.css',
  2044. '/icon/通用图标/iconfont.css',
  2045. ];
  2046. let defsList: any = await Promise.all(
  2047. iconList.map((item) => getIconDefs(item))
  2048. );
  2049. mySerializedSVG = mySerializedSVG.replace(
  2050. '<defs/>',
  2051. `<defs>
  2052. <style type="text/css">
  2053. ${defsList.join('\n')}
  2054. </style>
  2055. {{bk}}
  2056. </defs>
  2057. {{bkRect}}`
  2058. );
  2059. }
  2060. /* mySerializedSVG = mySerializedSVG.replace(
  2061. '<defs/>',
  2062. `<defs>
  2063. <style type="text/css">
  2064. @font-face {
  2065. font-family: 'ticon';
  2066. src: url('icon/通用图标/iconfont.ttf') format('truetype');
  2067. }
  2068. </style>
  2069. {{bk}}
  2070. </defs>
  2071. {{bkRect}}`
  2072. );
  2073. */
  2074. if (meta2d.store.data.background) {
  2075. mySerializedSVG = mySerializedSVG.replace('{{bk}}', '');
  2076. mySerializedSVG = mySerializedSVG.replace(
  2077. '{{bkRect}}',
  2078. `<rect x="0" y="0" width="100%" height="100%" fill="${meta2d.store.data.background}"></rect>`
  2079. );
  2080. } else {
  2081. mySerializedSVG = mySerializedSVG.replace('{{bk}}', '');
  2082. mySerializedSVG = mySerializedSVG.replace('{{bkRect}}', '');
  2083. }
  2084. mySerializedSVG = mySerializedSVG.replace(/--le5le--/g, '&#x');
  2085. const urlObject: any = (window as any).URL || window;
  2086. const export_blob = new Blob([mySerializedSVG]);
  2087. const url = urlObject.createObjectURL(export_blob);
  2088. const a = document.createElement('a');
  2089. a.setAttribute(
  2090. 'download',
  2091. `${(meta2d.store.data as Meta2dBackData).name || 'le5le.meta2d'}.svg`
  2092. );
  2093. a.setAttribute('href', url);
  2094. const evt = document.createEvent('MouseEvents');
  2095. evt.initEvent('click', true, true);
  2096. a.dispatchEvent(evt);
  2097. };
  2098. const onUndo = () => {
  2099. meta2d.undo();
  2100. };
  2101. const onRedo = () => {
  2102. meta2d.redo();
  2103. };
  2104. const onCut = () => {
  2105. meta2d.cut();
  2106. };
  2107. const onCopy = () => {
  2108. meta2d.copy();
  2109. };
  2110. const onPaste = () => {
  2111. meta2d.paste();
  2112. };
  2113. const onAll = () => {
  2114. meta2d.activeAll();
  2115. };
  2116. const onDelete = () => {
  2117. meta2d.delete();
  2118. };
  2119. const onToggleAnchor = () => {
  2120. //取消连线状态
  2121. // meta2d.store.options.disableAnchor = false;
  2122. if (!meta2d.store.options.disableAnchor) {
  2123. meta2d.canvas.drawingLineName && drawPen();
  2124. meta2d.toggleAnchorMode();
  2125. }
  2126. };
  2127. const onAddAnchorHand = () => {
  2128. meta2d.addAnchorHand();
  2129. };
  2130. const onRemoveAnchorHand = () => {
  2131. meta2d.removeAnchorHand();
  2132. };
  2133. const onToggleAnchorHand = () => {
  2134. meta2d.toggleAnchorHand();
  2135. };
  2136. const onScaleUp = () => {
  2137. const _scale = meta2d.store.data.scale + 0.1;
  2138. meta2d.scale(_scale);
  2139. };
  2140. const onScaleDown = () => {
  2141. const _scale = meta2d.store.data.scale - 0.1;
  2142. meta2d.scale(_scale);
  2143. };
  2144. const autoAnchor = ref(true);
  2145. const onAutoAnchor = () => {
  2146. meta2d.store.options.autoAnchor = !meta2d.store.options.autoAnchor;
  2147. autoAnchor.value = meta2d.store.options.autoAnchor;
  2148. };
  2149. const showAnchor = ref(false);
  2150. const onDisableAnchor = () => {
  2151. meta2d.store.options.disableAnchor = !meta2d.store.options.disableAnchor;
  2152. changeDisableAnchor();
  2153. };
  2154. const changeDisableAnchor = () => {
  2155. const { disableAnchor, autoAnchor } = meta2d.store.options;
  2156. showAnchor.value = !disableAnchor || false;
  2157. if (disableAnchor && autoAnchor) {
  2158. // 禁用瞄点开了,需要关闭自动瞄点
  2159. onAutoAnchor();
  2160. }
  2161. };
  2162. const payListDialog = reactive({
  2163. show: false,
  2164. title:'',
  2165. href:'',
  2166. downloadUrl:''
  2167. });
  2168. const downloadZipDialog = reactive({
  2169. show: false,
  2170. checked:true,
  2171. expend:false,
  2172. price:0,
  2173. list:[],
  2174. hasJs:false,
  2175. });
  2176. const prePay = async () => {
  2177. let list = [];
  2178. let names = data.purchasedList.map((item) => item.name);
  2179. if(data.payDiagram.checked){
  2180. prePayList.pngs.forEach((item) => {
  2181. if(!names.includes(item)){
  2182. list.push({
  2183. type: '图片图元',
  2184. name: item,
  2185. });
  2186. }
  2187. });
  2188. prePayList.jsPens.forEach((item) => {
  2189. if(!names.includes(item)){
  2190. list.push({
  2191. type: 'JS线性图元',
  2192. name: item,
  2193. });
  2194. }
  2195. });
  2196. prePayList.iotPens.forEach((item) => {
  2197. if(!names.includes(item)){
  2198. list.push({
  2199. type: '控件',
  2200. name: item,
  2201. });
  2202. }
  2203. });
  2204. if ([...prePayList.svgPens].includes('*')) {
  2205. list.push({
  2206. type: 'SVG线性图元',
  2207. });
  2208. } else {
  2209. prePayList.svgPens.forEach((item) => {
  2210. if(!names.includes(item)){
  2211. list.push({
  2212. type: 'SVG线性图元',
  2213. name: item,
  2214. });
  2215. }
  2216. });
  2217. }
  2218. }
  2219. const res: any = await axios.post('/api/order/deployment/submit', {
  2220. goods:data.payGoods,
  2221. '2ds':list,
  2222. });
  2223. wechatPayDialog.show = true;
  2224. data.order = res;
  2225. };
  2226. const downloadTrial = () => {
  2227. MessagePlugin.info('正在下载中,可能需要几分钟,请耐心等待...');
  2228. //下载试用版
  2229. window.open(payListDialog.downloadUrl, '_blank');
  2230. }
  2231. const skipPay = () => {
  2232. //跳过支付,直接下载
  2233. MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
  2234. if (downloadType === Frame.html) {
  2235. preDownload();
  2236. } else {
  2237. preFrameDownload();
  2238. }
  2239. };
  2240. const finishPay = async () => {
  2241. // let id = data.order.id;
  2242. // const result: { state: number } = await axios.post('/api/order/pay/state', {
  2243. // id,
  2244. // });
  2245. // if (result && result.state) {
  2246. MessagePlugin.success('支付成功');
  2247. wechatPayDialog.show = false;
  2248. if(wechatPayDialog.isZip){
  2249. // downloadZipDialog.show = false;
  2250. wechatPayDialog.isZip = false;
  2251. doDownloadZip();
  2252. }else{
  2253. payListDialog.show = false;
  2254. MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
  2255. if (downloadType === Frame.html) {
  2256. preDownload();
  2257. } else {
  2258. preFrameDownload();
  2259. }
  2260. }
  2261. // } else {
  2262. // MessagePlugin.error('支付失败');
  2263. // // wechatPayDialog.show = false;
  2264. // }
  2265. };
  2266. const finalPrice = computed(() => {
  2267. let total = 0;
  2268. let price = 0;
  2269. data.goods.forEach((item, index) => {
  2270. if (item.checked) {
  2271. total += item.unPurchased;
  2272. price += item.unPurchased * item.unitPrice;
  2273. }
  2274. });
  2275. return {
  2276. total,
  2277. price,
  2278. };
  2279. });
  2280. const wechatPayDialog = reactive({
  2281. show: false,
  2282. isZip:false
  2283. });
  2284. const emit = defineEmits(['success']);
  2285. const onSuccess = (success: boolean) => {
  2286. finishPay();
  2287. emit('success', success);
  2288. };
  2289. </script>
  2290. <style lang="postcss" scoped>
  2291. .app-header {
  2292. display: flex;
  2293. height: 40px;
  2294. background-color: var(--color-background);
  2295. position: relative;
  2296. z-index: 2;
  2297. .logo {
  2298. display: flex;
  2299. padding: 0 16px;
  2300. align-items: center;
  2301. font-size: 14px;
  2302. font-weight: 500;
  2303. img {
  2304. height: 20px;
  2305. margin-right: 6px;
  2306. }
  2307. }
  2308. a {
  2309. display: flex;
  2310. padding: 0 8px;
  2311. margin: 0 8px;
  2312. align-items: center;
  2313. color: var(--color);
  2314. text-decoration: none;
  2315. white-space: nowrap;
  2316. &:hover {
  2317. color: var(--color-primary);
  2318. }
  2319. svg {
  2320. font-size: 15px;
  2321. margin: 2px 4px 0 0;
  2322. }
  2323. &.active {
  2324. background-color: var(--color-primary);
  2325. color: #ffffff;
  2326. }
  2327. }
  2328. input {
  2329. font-size: var(--font-size);
  2330. flex-grow: 1;
  2331. background: none;
  2332. outline: none;
  2333. border: none;
  2334. text-align: center;
  2335. color: var(--color-title);
  2336. }
  2337. }
  2338. .pay-box{
  2339. background: rgba(175,202,255,0.04);
  2340. border-radius: 4px;
  2341. margin-bottom:24px;
  2342. padding:20px 24px;
  2343. position:relative;
  2344. display:flex;
  2345. .pay-up{
  2346. display:flex;
  2347. }
  2348. :deep(.t-checkbox__label){
  2349. font-size: 16px;
  2350. color: #6e7b91;
  2351. margin-left:16px;
  2352. }
  2353. .pay-title{
  2354. font-size: 16px;
  2355. color: #6e7b91;
  2356. .t-icon{
  2357. margin-top:-5px;
  2358. margin-left:12px;
  2359. }
  2360. :deep(.t-checkbox__input){
  2361. background:#fff0;
  2362. }
  2363. :deep(.t-is-checked){
  2364. .t-checkbox__input{
  2365. background:var(--color-primary);
  2366. }
  2367. }
  2368. }
  2369. .pay-price{
  2370. position:absolute;
  2371. right:24px;
  2372. color:#4480F9;
  2373. display:flex;
  2374. p:nth-child(2){
  2375. font-size: 20px;
  2376. }
  2377. }
  2378. .pay-down{
  2379. margin-top:16px;
  2380. display:flex;
  2381. flex-wrap:wrap;
  2382. /* justify-content:space-between; */
  2383. /* padding-top:24px; */
  2384. max-height: 200px;
  2385. overflow-y: scroll;
  2386. &>div{
  2387. width: 48px;
  2388. height: 48px;
  2389. background: #1c283b;
  2390. border-radius: 4px;
  2391. margin-right:2.5px;
  2392. margin-bottom:2.5px;
  2393. &:nth-child(12n){
  2394. margin-right: 0px;
  2395. }
  2396. img{
  2397. margin:4px;
  2398. width:40px;
  2399. height:40px;
  2400. }
  2401. .l-icon{
  2402. /* width: 80px; */
  2403. /* height: 80px; */
  2404. /* margin:8px; */
  2405. font-size:24px;
  2406. margin:12px;
  2407. }
  2408. &>div{
  2409. margin: 8px 12px;
  2410. }
  2411. }
  2412. }
  2413. }
  2414. .pay-footer{
  2415. display:flex;
  2416. margin-bottom: -48px;
  2417. margin-left:24px;
  2418. font-size: 14px;
  2419. &>div{
  2420. color:#4480F9;
  2421. display:flex;
  2422. p:nth-child(2){
  2423. font-size: 24px;
  2424. font-weight: 800;
  2425. margin-top:-3px;
  2426. }
  2427. p:nth-child(1){
  2428. margin:0px 4px;
  2429. }
  2430. }
  2431. }
  2432. .pay-diagram{
  2433. flex-direction:column;
  2434. }
  2435. /* .pay-dialog {
  2436. background-color: red;
  2437. } */
  2438. /* .pay-body {
  2439. height: 300px;
  2440. overflow-y: scroll;
  2441. margin-bottom: 30px;
  2442. .t-collapse {
  2443. border: 0px;
  2444. :deep(.t-collapse-panel__wrapper .t-collapse-panel__header) {
  2445. border-bottom: 0px;
  2446. }
  2447. :deep(.t-collapse-panel__wrapper .t-collapse-panel__body) {
  2448. background: #fff0;
  2449. border-bottom: 0px;
  2450. .t-collapse-panel__content {
  2451. padding: 0;
  2452. color: #c1c8d7;
  2453. }
  2454. }
  2455. }
  2456. } */
  2457. /* .pay-line {
  2458. display: flex;
  2459. height: 54px;
  2460. background-color: #afcaff0a;
  2461. margin-top: 1px;
  2462. div {
  2463. width: 30%;
  2464. text-align: center;
  2465. line-height: 54px;
  2466. :deep(.t-image) {
  2467. width: 40px;
  2468. height: 40px;
  2469. margin-top: 7px;
  2470. }
  2471. :deep(.pay-svg) {
  2472. .t-image {
  2473. background: #fff;
  2474. }
  2475. }
  2476. .l-icon {
  2477. width: 40px;
  2478. height: 40px;
  2479. margin-top: 7px;
  2480. width: 30%;
  2481. }
  2482. }
  2483. .pay-p{
  2484. overflow:hidden;
  2485. text-overflow:ellipsis;
  2486. white-space:nowrap;
  2487. }
  2488. & > div:first-child {
  2489. width: 40%;
  2490. display: flex;
  2491. }
  2492. } */
  2493. /* .pay-tip {
  2494. height: 54px;
  2495. width: 100%;
  2496. position: relative;
  2497. p {
  2498. position: absolute;
  2499. right: 16px;
  2500. color: var(--color-desc);
  2501. }
  2502. }
  2503. .pay-footer {
  2504. margin-bottom: -42px;
  2505. position: relative;
  2506. .pay-price {
  2507. position: absolute;
  2508. right: 215px;
  2509. margin-left: 50px;
  2510. align-items: flex-end;
  2511. line-height: 10px;
  2512. p{
  2513. vertical-align: bottom;
  2514. line-height: normal;
  2515. }
  2516. p:nth-child(2) {
  2517. font-size: 32px;
  2518. font-weight: Semibold;
  2519. color: #4480f9;
  2520. line-height: 20px;
  2521. }
  2522. p:nth-child(1) {
  2523. font-size: 14px;
  2524. color: #4480f9;
  2525. }
  2526. }
  2527. } */
  2528. /* .pay-title {
  2529. margin: 18px 0px 12px 18px;
  2530. } */
  2531. </style>