give-dialog.vue 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617
  1. <template>
  2. <div class="overlay" v-if="visible">
  3. <div class="content"
  4. :style="{
  5. height: showComType === 'preview' ? 'calc(100vh - 40px)' : dialogStyle.dialogHeight + 'px',
  6. width: dialogStyle.dialogContentWidth + 'px',
  7. }">
  8. <div class="pop-mask"
  9. v-show="showCurrencyPop || showCurrencySelect"
  10. @click.stop="showCurrencyPop = false; showCurrencySelect=false">
  11. </div>
  12. <!-- 头部 -->
  13. <div class="head">
  14. <div class="left">
  15. <!-- 关闭按钮 -->
  16. <div class="close-btn" @click="close">
  17. <img class="icon-close"
  18. :src="require('@/assets/svg/icon-close.svg')"
  19. v-if="showComType == 'default'"/>
  20. <img class="icon-close"
  21. :src="require('@/assets/svg/icon-back.svg')"
  22. v-else/>
  23. </div>
  24. <!-- 标题 -->
  25. <div class="title">
  26. {{ currentComData[showComType]["title"] }}
  27. </div>
  28. </div>
  29. <div class="right">
  30. <!-- 更多按钮 -->
  31. <img :src="require('@/assets/svg/icon-more-l.svg')"
  32. class="more"
  33. @click="showMoreOption = true">
  34. <div class="area-option"
  35. v-if="showMoreOption"
  36. @click="showMoreOption = false">
  37. <div class="option">
  38. <div class="item" @click="goTransactionsList()">
  39. <img :src="require('@/assets/svg/icon-menu.svg')">
  40. <span>Transaction History</span>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- 内容 -->
  47. <div class="body">
  48. <!-- 充值组件 -->
  49. <top-up
  50. v-if="showComType == 'topUp'"
  51. :asyncIng="asyncIng"
  52. :currentCurrencyInfo="tempCurrentCurrencyInfo"
  53. @topUpDone="topUpDone">
  54. </top-up>
  55. <!-- 自定义红包封面 -->
  56. <giveaway-poster
  57. v-else-if="showComType == 'poster'"
  58. :baseFormData="baseFormData"
  59. :currentCurrencyInfo="currentCurrencyInfo"
  60. :customPosterInfo="customPosterInfo"
  61. @selectImage="selectImage"
  62. @confirmData="confirmData">
  63. </giveaway-poster>
  64. <!-- 表单填写容器 -->
  65. <div class="body-content" v-else>
  66. <!-- 货币列表 -->
  67. <div class="currency-pop" v-show="showCurrencyPop">
  68. <currency-list
  69. ref="currencyListDom"
  70. @selectCurrency="selectCurrency"
  71. @setCurrencyList="setCurrentCurrencyInfo"></currency-list>
  72. </div>
  73. <div class="currency-pop-select" v-show="showCurrencySelect">
  74. <currency-select
  75. ref="currencySelectDom"
  76. :list="tempCurrentCurrencyList"
  77. @selectCurrency="selectCurrencyAfter"></currency-select>
  78. </div>
  79. <div class="left" v-if="showComType != 'preview'">
  80. <div class="gift-pack-wrapper">
  81. <img class="icon" :src="require('@/assets/svg/icon-gift-pack.svg')"/>
  82. </div>
  83. <div class="bottom">
  84. </div>
  85. </div>
  86. <div class="right"
  87. :class="{'fill-right': showComType == 'preview'}">
  88. <global-tip :type="'2'"></global-tip>
  89. <div class="form-wrapper" v-if="showComType == 'default'">
  90. <div class="form-cell-item base-form-wrapper">
  91. <div class="title">
  92. <img class="icon" :src="require('@/assets/svg/icon-reward-v2.svg')"/>
  93. Reward
  94. </div>
  95. <div class="form-cell-content">
  96. <div class="select-mode-ele">
  97. <img v-for="(item, index) in publishModeList"
  98. :key="index"
  99. :src="selectModeInfo.index == index ? item.imgActive : item.imgInActive"
  100. @click="selectPublishMode(item, index)">
  101. </div>
  102. <!-- 金额、数量 -->
  103. <div class="form-base">
  104. <div class="item currency-select-wrapper">
  105. <div>
  106. <div class="label currency-select"
  107. :class="{'selected': currentCurrencyInfo.currencyCode}"
  108. @click="selectCurrencyPopHandle">
  109. <img class="icon"
  110. v-if="currentCurrencyInfo.iconPath"
  111. :src="currentCurrencyInfo.iconPath"/>
  112. <div class="text">
  113. {{currentCurrencyInfo.currencyCode == 'USD' ? 'USD' : currentCurrencyInfo.tokenSymbol || 'Select a reward'}}
  114. </div>
  115. <img class="arrow"
  116. :src="currentCurrencyInfo.currencyCode ?
  117. require('@/assets/svg/icon-form-arrow-down.svg') : require('@/assets/svg/icon-form-white-arrow-down.svg')"/>
  118. </div>
  119. <!-- 刷新按钮、充值 -->
  120. <div class="currency-operation"
  121. v-if="currentCurrencyInfo.currencyCode">
  122. <div class="amount">
  123. Balance:
  124. <a-tooltip :title="currentCurrencyInfo.balance">
  125. {{ getBit(currentCurrencyInfo.balance) }}
  126. </a-tooltip>
  127. <img :class="{ 'icon-refresh-rotate': refreshRotate }"
  128. :src="require('@/assets/svg/icon-form-refresh.svg')"
  129. @click="updateCurrencyBanlce"/>
  130. </div>
  131. <div v-if="currentCurrencyInfo.currencyCode != 'USD'"
  132. class="top-up"
  133. @click="goTopUp">Deposit</div>
  134. </div>
  135. </div>
  136. <input v-model="baseFormData.amountValue"
  137. placeholder="0"
  138. autofocus
  139. @input="onAmountInput"
  140. @blur="onAmountBlur"/>
  141. </div>
  142. <div class="item winners-count-input">
  143. <div>
  144. <div class="label">
  145. <img class="icon"
  146. :src="require('@/assets/svg/icon-winner-v2.svg')"/>
  147. Winner Count
  148. </div>
  149. <div class="msg" v-show="selectModeInfo.type == 1">Recommend Winners 100~10000</div>
  150. </div>
  151. <input v-model="baseFormData.totalCount"
  152. placeholder="0"
  153. @input="onCountInput"
  154. @blur="onCountBlur"/>
  155. </div>
  156. <div class="item automatically-input" v-if="selectModeInfo.type == 2">
  157. <div class="label">
  158. <img class="icon"
  159. :src="require('@/assets/svg/icon-automatically.svg')"/>
  160. Automatically Draw in
  161. </div>
  162. <div class="input-wrapper">
  163. <input v-model="baseFormData.validityDuration"
  164. placeholder="0"
  165. @input="onValidityDurationInput"
  166. @blur="onValidityDurationBlur"/>
  167. <span class="unit">h</span>
  168. </div>
  169. </div>
  170. </div>
  171. <div class="giveaway-poster" @click="customCoverImg">
  172. <div class="show-img">
  173. <div
  174. :style="{
  175. 'zoom': 55 / 500,
  176. 'position': 'absolute',
  177. 'width': '345px',
  178. }">
  179. <custom-card-cover
  180. :data="{
  181. totalCount: baseFormData.totalCount,
  182. amountValue: baseFormData.amountValue,
  183. tokenSymbol: currentCurrencyInfo.tokenSymbol,
  184. currencyIconUrl: currentCurrencyInfo.iconPath,
  185. type: baseFormData.type,
  186. validityDuration: baseFormData.validityDuration,
  187. customPosterUrl: customPosterData && customPosterData.after && customPosterData.after.imagePath || '',
  188. }">
  189. </custom-card-cover>
  190. </div>
  191. </div>
  192. <div class="show-font">
  193. <span>Giveaway Poster</span>
  194. <img class="new" v-if="customShowNewImage" :src=" require('@/assets/svg/img-new.svg') " />
  195. </div>
  196. <div class="show-placeholder">Replace</div>
  197. <div class="arrow">
  198. <img :src=" require('@/assets/svg/icon-cell-arrow-right.svg') " />
  199. </div>
  200. </div>
  201. <!-- 提示 -->
  202. <ul class="tips-wrapper">
  203. <li class="row" style="white-space:nowrap;">
  204. Rewards can only be claimed after the target user completes all tasks you set.
  205. </li>
  206. <li class="row">
  207. Each user can only receive a reward once per task.
  208. </li>
  209. <li class="row" v-show="selectModeInfo.type == 1">
  210. The reward will expire in 7 days once issued. Please promote it as much as possible within this period. After the experiment, the remaining rewards will be returned to your DeNet Wallet.
  211. </li>
  212. </ul>
  213. </div>
  214. </div>
  215. <div class="form-cell-item task-wrapper">
  216. <div class="title">
  217. <img class="icon" :src="require('@/assets/svg/icon-tasks-v2.svg')"/>
  218. Tasks
  219. </div>
  220. <div class="form-cell-content form-require">
  221. <!-- 转推、like、关注 -->
  222. <div v-for="(item, index) in formList"
  223. :key="index">
  224. <div v-if="item.show" class="form-item"
  225. :class="{ 'border-hide': formList.length - 1 == index }">
  226. <div class="item-left">
  227. <div class="label">
  228. <img class="icon" :src="item.icon"/>
  229. {{ item.label }}
  230. </div>
  231. <div class="control"
  232. v-if="item.nodeType == 'textarea'">
  233. <follow-input
  234. :isAddSelf="!isBack"
  235. :atUserList="atUserList"
  236. @addUser="addFollowUser"
  237. @setUser="setFollowUser"
  238. @delUser="delFollowUser"></follow-input>
  239. </div>
  240. <div class="control"
  241. v-if="item.nodeType == 'input'">
  242. <div v-if="showDiscordInvitePop"
  243. class="discord-invite-info"
  244. @click="showDiscordInvitePop = false">
  245. <img class="icon" :src="discordInviteInfo.icon || require('@/assets/svg/icon-discord-mini.svg')" />
  246. <span class="name">{{discordInviteInfo.name}}</span>
  247. </div>
  248. <input v-model="item.text"
  249. placeholder="Enter discord invite link"
  250. class="discord-address"
  251. @input="onIptDiscordAddress($event, index)"
  252. @blur="onBlurDiscordAddress($event, index)" />
  253. </div>
  254. </div>
  255. <div>
  256. <a-switch
  257. v-if="item.type > 3"
  258. v-model:checked="item.checked"
  259. @change="formSwitchChange($event, item, index)"/>
  260. </div>
  261. </div>
  262. </div>
  263. </div>
  264. </div>
  265. <div class="submit-btn-wrapper">
  266. <div class="submit-btn"
  267. :class="{ 'disabled-submit': iptErrMsgTxt != ''}"
  268. @click="confirm">
  269. <img class="icon-loading"
  270. v-if="submitIng"
  271. :src="require('@/assets/svg/icon-btn-loading.svg')"
  272. />
  273. {{iptErrMsgTxt ? iptErrMsgTxt : 'NEXT'}}
  274. </div>
  275. </div>
  276. </div>
  277. <!-- 预览 -->
  278. <template v-else-if="showComType == 'preview'">
  279. <div class="preview">
  280. <div class="card"
  281. :class="{ center: Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance) }">
  282. <div class="card-title">
  283. <img class="img"
  284. v-if="Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)"
  285. :src=" require('@/assets/subject/top-01.svg') " />
  286. <div class="font">
  287. Preview: <span>{{installStatus ? 'After' : 'Before' }}</span> DeNet Installed
  288. </div>
  289. </div>
  290. <div class="flash">
  291. <preview-card
  292. :currentCurrencyInfo="currentCurrencyInfo"
  293. :postData="publishRes"
  294. :baseFormData="baseFormData"
  295. :amountFontSize="previewFontSize"
  296. :customPosterInfo="customPosterData"
  297. ></preview-card>
  298. </div>
  299. </div>
  300. <!-- 需充值 -->
  301. <div class="card-content" v-if="Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)">
  302. <template v-if="currentCurrencyInfo.currencyCode === 'USD'">
  303. <div class="card-title">
  304. <img class="img" :src=" require('@/assets/subject/top-02.svg') " />
  305. <div class="font">Deposit to Send Giveaway</div>
  306. </div>
  307. <div class="card-list">
  308. <div class="item">
  309. <div class="l">Giveaway Amount</div>
  310. <div class="r"></div>
  311. </div>
  312. <div class="item">
  313. <div class="l">Balance</div>
  314. <div class="r"></div>
  315. </div>
  316. <div class="item">
  317. <div class="l">Paypal charges fee ()</div>
  318. <div class="r"></div>
  319. </div>
  320. <div class="item">
  321. <div class="l">Deposit Amount</div>
  322. <div class="r"></div>
  323. </div>
  324. </div>
  325. </template>
  326. <template v-else>
  327. <div class="card-title">
  328. <img class="img" :src=" require('@/assets/subject/top-02.svg') " />
  329. <div class="font">Deposit to Send Giveaway</div>
  330. </div>
  331. <top-up2
  332. :asyncIng="asyncIng"
  333. :currentCurrencyInfo="tempCurrentCurrencyInfo"
  334. @topUpDone="topUpDone">
  335. </top-up2>
  336. <div class="card-title">
  337. <img class="img" :src=" require('@/assets/subject/top-03.svg') " />
  338. <div class="font">Wait for the amount to arrive</div>
  339. </div>
  340. <div class="card-amount">
  341. <img class="icon" src="@/assets/subject/icon-balance.png" />
  342. <div class="con">
  343. <div class="desc">Balance</div>
  344. <div class="price">{{currentCurrencyInfo.balance}} {{currentCurrencyInfo.tokenSymbol}}</div>
  345. </div>
  346. <img
  347. class="refresh"
  348. :class="{ 'icon-refresh-rotate': refreshRotate }"
  349. @click="updateCurrencyBanlce"
  350. :src=" require('@/assets/svg/icon-form-refresh-blue.svg') "
  351. />
  352. </div>
  353. </template>
  354. </div>
  355. </div>
  356. </template>
  357. <!-- paypal支付按钮 -->
  358. <div class="payment" v-show="showComType == 'preview'">
  359. <paypal-button
  360. :finalAmountData="finalAmountData"
  361. :payConfig="{
  362. paypalClientId,
  363. feeDesc: payConfig.feeDesc,
  364. paypalHtml,
  365. amount: baseFormData.amountValue,
  366. postId
  367. }"
  368. :currentCurrencyInfo="currentCurrencyInfo"
  369. @payPalFinsh="payPalFinsh">
  370. <template v-slot:balance>
  371. <div class="balance" v-if="Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance)">
  372. <img class="icon" src="@/assets/subject/icon-balance.png" />
  373. <div class="con">
  374. <div class="desc">Balance</div>
  375. <div class="price">{{currentCurrencyInfo.balance}} {{currentCurrencyInfo.tokenSymbol}}</div>
  376. </div>
  377. <img class="refresh"
  378. :class="{ 'icon-refresh-rotate': refreshRotate }"
  379. :src=" require('@/assets/svg/icon-form-refresh.svg')"
  380. @click="updateCurrencyBanlce"/>
  381. </div>
  382. </template>
  383. </paypal-button>
  384. </div>
  385. </div>
  386. </div>
  387. </div>
  388. </div>
  389. <!-- 提示 -->
  390. <message-box
  391. :dialogVisible="showMessageBox"
  392. :title="messageBoxData.title"
  393. :content="messageBoxData.content"
  394. @cancel="messageBoxCancel"
  395. @confirm="messageBoxConfirm"
  396. ></message-box>
  397. <!-- 裁剪 -->
  398. <div class="dialog" v-if="cropperDialog">
  399. <div class="corp-title">
  400. <img class="back" :src="require('@/assets/svg/icon-back.svg')" @click="hiddenDialog" />
  401. <span>Crop</span>
  402. </div>
  403. <div class="corp-content">
  404. <vue-cropper
  405. ref="refCropper"
  406. :img="cropperOption.img"
  407. :output-type="cropperOption.outputType"
  408. :infoTrue="cropperOption.infoTrue"
  409. :full="cropperOption.full"
  410. :fixed="cropperOption.fixed"
  411. :fixed-number="cropperOption.fixedNumber"
  412. :auto-crop="cropperOption.autoCrop"
  413. :auto-crop-width="cropperOption.autoCropWidth"
  414. :auto-crop-height="cropperOption.autoCropHeight"
  415. :center-box="cropperOption.centerBox"
  416. :high="cropperOption.high"
  417. :max-img-size="cropperOption.max">
  418. </vue-cropper>
  419. </div>
  420. <div class="corp-footer">
  421. <button v-if="cropperLoading" class="confirm disable">
  422. <img :src=" require('@/assets/svg/icon-btn-loading.svg') " />
  423. <span>Confirm</span>
  424. </button>
  425. <button v-else class="confirm" @click="confirmImage">Confirm</button>
  426. </div>
  427. </div>
  428. <div class="dialog-mask" v-if="cropperDialog"></div>
  429. </div>
  430. </template>
  431. <script setup>
  432. import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide, getCurrentInstance } from "vue";
  433. import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord, getCurrencyInfoByCode } from "@/http/publishApi";
  434. import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
  435. import { payCalcFee, getPayConfig } from "@/http/pay";
  436. import { getFrontConfig } from "@/http/account";
  437. import { uploadSignature, uploadFile } from '@/http/media';
  438. import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
  439. import { debounce, getBit } from "@/uilts/help"
  440. import Report from "@/log-center/log"
  441. import { ElMessage, ElLoading } from "element-plus";
  442. import "element-plus/es/components/message/style/css";
  443. import "element-plus/es/components/loading/style/css";
  444. import 'vue-cropper/dist/index.css'
  445. import { VueCropper } from "vue-cropper";
  446. import {create, all} from "mathjs";
  447. import messageBox from "@/view/components/message-box.vue";
  448. import currencyList from "@/view/components/currency-list.vue";
  449. import currencySelect from "@/view/components/currency-select.vue";
  450. import previewCard from "@/view/iframe/publish/components/preview-card";
  451. import followInput from "@/view/iframe/publish/components/follow-input";
  452. import paypalButton from "@/view/iframe/publish/components/paypal-button";
  453. import topUp from "@/view/iframe/publish/components/top-up.vue";
  454. import topUp2 from "@/view/iframe/publish/components/top-up2.vue";
  455. import giveawayPoster from '@/view/iframe/publish/components/giveaway-poster.vue';
  456. import GlobalTip from '@/view/components/global-tip.vue'
  457. import customCardCover from '@/view/components/custom-card-cover.vue'
  458. const currentInstance = getCurrentInstance();
  459. const config = {
  460. number: 'BigNumber',
  461. }
  462. const math = create(all, config);
  463. //临时货币信息
  464. let tempCurrentCurrencyInfo = ref({});
  465. let tempCurrentCurrencyList = ref([]);
  466. let paypalClientId = ref("");
  467. let payConfig = ref({});
  468. let paypalHtml = ref("");
  469. let installStatus = ref(false);
  470. let timer = ref(null);
  471. provide('installStatus', installStatus)
  472. // 发布后返回的结果
  473. let publishRes = reactive({});
  474. //弹窗是否展示
  475. let visible = ref(false);
  476. //弹窗高度
  477. let dialogStyle = reactive({
  478. dialogHeight: 670,
  479. dialogContentWidth: 1100
  480. })
  481. let cropperOption = ref({
  482. img: '',
  483. full: true,
  484. infoTrue: true,
  485. fixed: true,
  486. fixedNumber: [16, 8.396],
  487. outputType: 'png',
  488. autoCrop: true,
  489. autoCropWidth: 99999,
  490. autoCropHeight: 99999,
  491. centerBox: true,
  492. high: true,
  493. max: 99999,
  494. })
  495. let cropperDialog = ref(false)
  496. let cropperLoading = ref(false)
  497. let cropperType = ref('before')
  498. let customPosterInfo = ref({})
  499. let customPosterData = ref({})
  500. let customShowNewImage = ref(false)
  501. let refCropper = ref('')
  502. // 当前展示组件内容 default(表单) preview(预览) topUp(充值)
  503. let showComType = ref("default");
  504. let currentComData = {
  505. default: {
  506. title: "Giveaway",
  507. },
  508. preview: {
  509. title: "Giveaway",
  510. },
  511. topUp: {
  512. title: "Deposit",
  513. },
  514. poster: {
  515. title: "Giveaway Poster",
  516. }
  517. };
  518. // 机器人开关
  519. let openAntiBot = ref(false);
  520. // 是否正在提交
  521. let submitIng = ref(false);
  522. // 艾特关注人列表
  523. let atUserList = ref([]);
  524. // 表单错误提示
  525. let iptErrMsgTxt = ref("Select a reward");
  526. // 是否返回
  527. let isBack = ref(false);
  528. // 展示消息提示
  529. let showMessageBox = ref(false);
  530. // 展示货币列表pop
  531. let showCurrencyPop = ref(false);
  532. let showCurrencySelect = ref(false);
  533. // 展示更多按钮下的选项
  534. let showMoreOption = ref(false);
  535. // 货币列表的dom
  536. let currencyListDom = ref('');
  537. // 刷新按钮旋转
  538. let refreshRotate = ref(false);
  539. // 预览字体大小
  540. let previewFontSize = ref(56);
  541. let postId = ref('');
  542. let selectModeInfo = reactive({
  543. index: 0,
  544. type: 2 // 1: 红包 2: 抽奖
  545. })
  546. // 余额是否同步中
  547. let asyncIng = ref(false);
  548. let messageBoxData = ref({
  549. title: "",
  550. content: "",
  551. });
  552. // 真实支付金额数据
  553. let finalAmountData = ref({
  554. currencyCode: '',
  555. feeAmountValue: 0,
  556. finalAmountValue: 0,
  557. requestAmountValue: 0,
  558. });
  559. // 表单数据
  560. let baseFormData = reactive({
  561. amountCurrencyCode: "",
  562. amountValue: "",
  563. totalCount: "",
  564. validityDuration: "",
  565. type: selectModeInfo.type
  566. });
  567. // 当前选择的货币信息
  568. let currentCurrencyInfo = ref({
  569. currencyCode: "",
  570. currencyName: "",
  571. balance: "",
  572. currencyType: "",
  573. iconPath: "",
  574. minAmount: "",
  575. tokenChain: "",
  576. tokenSymbol: "",
  577. usdEstimateBalance: ""
  578. });
  579. const discordIptErrTxt = 'Discord invite link is wrong';
  580. const discordIptEmptyErrTxt = 'Enter discord invite link';
  581. const discordIptNerverExpiresErrTxt = 'Make sure the Discord link never expires'
  582. let iptErrType = ''; //discord
  583. let formList = reactive([
  584. {
  585. label: "Follow",
  586. icon: require("@/assets/svg/icon-task-twitter.svg"),
  587. nodeType: "textarea",
  588. type: 1,
  589. text: [],
  590. checked: true,
  591. show: true
  592. },
  593. {
  594. label: "Retweet & Like",
  595. icon: require("@/assets/svg/icon-task-twitter.svg"),
  596. nodeType: "div",
  597. type: 3,
  598. checked: true,
  599. show: true
  600. },
  601. {
  602. label: "Like Tweet",
  603. icon: require("@/assets/svg/icon-task-twitter.svg"),
  604. nodeType: "div",
  605. type: 2,
  606. checked: true,
  607. show: false
  608. },
  609. {
  610. label: "Comment and Tag 3 friends",
  611. icon: require("@/assets/svg/icon-task-twitter.svg"),
  612. nodeType: "div",
  613. type: 9,
  614. checked: true,
  615. show: true
  616. },
  617. {
  618. label: "Repost to Facebook",
  619. icon: require("@/assets/svg/icon-task-facebook.svg"),
  620. nodeType: "div",
  621. text: '',
  622. type: 8,
  623. checked: false,
  624. show: true
  625. },
  626. {
  627. label: "Join Discord",
  628. icon: require("@/assets/svg/icon-discord-mini.svg"),
  629. nodeType: "input",
  630. text: '',
  631. type: 7,
  632. checked: false,
  633. show: true
  634. },
  635. ]);
  636. let publishModeList = reactive([
  637. {
  638. imgActive: require("@/assets/svg/img-A1.svg"),
  639. imgInActive: require("@/assets/svg/img-A0.svg"),
  640. type: 2
  641. },
  642. {
  643. imgActive: require("@/assets/svg/img-B1.svg"),
  644. imgInActive: require("@/assets/svg/img-B0.svg"),
  645. type: 1
  646. }
  647. ])
  648. let discordInviteInfo = ref({});
  649. let showDiscordInvitePop = ref(false);
  650. let lotteryMaxHourDuration = 168;
  651. const props = defineProps({
  652. dialogVisible: {
  653. type: Boolean,
  654. default: false,
  655. },
  656. });
  657. watch(
  658. () => props.dialogVisible,
  659. (newVal) => {
  660. console.log("watch", newVal);
  661. visible.value = newVal;
  662. if (newVal) {
  663. Report.reportLog({
  664. pageSource: Report.pageSource.publisherDialog,
  665. businessType: Report.businessType.pageView,
  666. });
  667. getLocalCurrencyInfoByCode();
  668. setTimeout(() => {
  669. setDialogStyle();
  670. }, 300);
  671. // 更新余额
  672. clearInterval(timer.value);
  673. timer.value = setInterval(() => {
  674. getCurrencyInfo({loop: true});
  675. }, 10000)
  676. } else {
  677. clearInterval(timer.value);
  678. }
  679. }
  680. );
  681. const emits = defineEmits(["close", "confirm", "payPalFinsh"]);
  682. const close = () => {
  683. if (showComType.value != "default") {
  684. showComType.value = "default";
  685. isBack.value = true;
  686. } else {
  687. initParams();
  688. emits("close", false);
  689. }
  690. };
  691. /**
  692. * 设置弹窗高度
  693. */
  694. const setDialogStyle = (resize = false) => {
  695. nextTick(() => {
  696. let clientHeight = window.innerHeight;
  697. let clientWidth = window.innerWidth;
  698. let gapSafe = 40;
  699. if (dialogStyle.dialogHeight > clientHeight - gapSafe) {
  700. dialogStyle.dialogHeight = clientHeight - gapSafe;
  701. } else {
  702. if(resize) {
  703. dialogStyle.dialogHeight = 680;
  704. }
  705. }
  706. if(dialogStyle.dialogContentWidth > clientWidth - gapSafe) {
  707. dialogStyle.dialogContentWidth = clientWidth - gapSafe;
  708. } else {
  709. if(resize) {
  710. dialogStyle.dialogContentWidth = 1080;
  711. }
  712. }
  713. })
  714. };
  715. const selectCurrencyPopHandle = () => {
  716. Report.reportLog({
  717. pageSource: Report.pageSource.currencySelectorPage,
  718. businessType: Report.businessType.pageView,
  719. });
  720. showCurrencyPop.value = true;
  721. nextTick(() => {
  722. if(currencyListDom.value) {
  723. currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList();
  724. }
  725. })
  726. }
  727. /**
  728. * 获取实际支付金额
  729. */
  730. const getPayAmount = async (amountValue) => {
  731. let res = await payCalcFee({
  732. params: {
  733. amountValue,
  734. currencyCode: currentCurrencyInfo.value.currencyCode,
  735. payChannel: 'paypal',
  736. },
  737. });
  738. if (res.code == 0) {
  739. let { finalAmountValue, feeDesc } = res.data;
  740. payConfig.value.feeDesc = feeDesc;
  741. if (finalAmountValue > 0) {
  742. finalAmountData.value = res.data;
  743. }
  744. }
  745. return res.data;
  746. };
  747. const saveDiscordGuildInfo = () => {
  748. let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
  749. //保存服务器信息
  750. Report.reportLog({
  751. pageSource: Report.pageSource.publisherDialog,
  752. businessType: Report.businessType.buttonClick,
  753. objectType: Report.objectType.saveDiscordGuildData
  754. }, {
  755. reportData: discordInviteInfo.value
  756. });
  757. if(guildId && inviteCode && inviteUrl) {
  758. saveInviteGuildInfo({
  759. params: {
  760. guildId,
  761. inviteCode,
  762. inviteUrl
  763. }
  764. })
  765. }
  766. }
  767. const confirm = () => {
  768. if (submitIng.value || iptErrMsgTxt.value) {
  769. return;
  770. }
  771. let { totalCount = 0 } = baseFormData;
  772. if (!totalCount) {
  773. return;
  774. }
  775. saveDiscordGuildInfo();
  776. submitRequest();
  777. };
  778. /**
  779. * 货币列表-选中货币
  780. */
  781. const selectCurrency = (params) => {
  782. let { currencies } = params;
  783. tempCurrentCurrencyList.value = currencies;
  784. if (currencies.length > 1) {
  785. showCurrencyPop.value = false;
  786. showCurrencySelect.value = true;
  787. } else {
  788. selectCurrencyAfter(currencies[0])
  789. }
  790. };
  791. const selectCurrencyAfter = (params, openWindow = true) => {
  792. tempCurrentCurrencyInfo.value = params;
  793. showCurrencySelect.value = false;
  794. currentCurrencyInfo.value = params;
  795. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  796. if (openWindow === false) {
  797. return
  798. };
  799. if (params.currencyCode != "USD" && params.balance < params.minAmount) {
  800. let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
  801. messageBoxBlock({
  802. title: `Whether to deposit ${tokenSymbol}`,
  803. content: `Insufficient ${tokenSymbol} balance`,
  804. });
  805. } else {
  806. setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
  807. showCurrencyPop.value = false;
  808. finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
  809. resetFormIpt(false);
  810. onIptSetErrorTxt();
  811. }
  812. }
  813. const resetFormIpt = (clearMode = true) => {
  814. baseFormData.amountValue = "";
  815. baseFormData.totalCount = "";
  816. baseFormData.validityDuration = "";
  817. if(clearMode) {
  818. selectModeInfo.index = 0;
  819. selectModeInfo.type = publishModeList[selectModeInfo.index]['type'];
  820. baseFormData.type = selectModeInfo.type;
  821. }
  822. }
  823. const setLocalSelectCurrencyInfo = (params = {}) => {
  824. setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})
  825. }
  826. const setCurrentCurrencyListInfo = (params = {}) => {
  827. setChromeStorage({ selectCurrencyList : JSON.stringify(params)})
  828. }
  829. /**
  830. * 获取完货币列表
  831. */
  832. const setCurrentCurrencyInfo = (params) => {
  833. }
  834. const messageBoxBlock = ({ title = "", content = "" }) => {
  835. showMessageBox.value = true;
  836. messageBoxData.value.title = title;
  837. messageBoxData.value.content = content;
  838. };
  839. /**
  840. * 确定
  841. */
  842. const messageBoxConfirm = () => {
  843. showMessageBox.value = false;
  844. goTopUp();
  845. };
  846. /**
  847. * 取消
  848. */
  849. const messageBoxCancel = () => {
  850. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  851. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  852. setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
  853. showMessageBox.value = false;
  854. showCurrencyPop.value = false;
  855. showCurrencySelect.value = false;
  856. resetFormIpt(false);
  857. onIptSetErrorTxt();
  858. };
  859. /**
  860. * 去充值
  861. */
  862. const goTopUp = () => {
  863. Report.reportLog({
  864. pageSource: Report.pageSource.rechargePage,
  865. businessType: Report.businessType.pageView,
  866. });
  867. showComType.value = 'topUp';
  868. }
  869. /*
  870. * 自定义封面
  871. */
  872. const customCoverImg = () => {
  873. customPosterInfo.value = {}
  874. if (Object.keys(customPosterData.value).length > 0) {
  875. customPosterInfo.value = customPosterData.value;
  876. }
  877. showComType.value = 'poster';
  878. customShowNewImage.value = false;
  879. setChromeStorage({ custom_poster_guide: Date.now() });
  880. }
  881. /**
  882. * 充值done事件
  883. */
  884. const topUpDone = () => {
  885. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  886. asyncIng.value = true;
  887. asyncIng.value = false;
  888. showCurrencyPop.value = false;
  889. showCurrencySelect.value = false;
  890. showComType.value = 'default';
  891. onIptSetErrorTxt()
  892. asyncTokenRechRecord((res) => {
  893. if(res.code == 0 && res.data && res.data.length) {
  894. let currencyInfo = res.data[0];
  895. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  896. currentCurrencyInfo.value.balance = currencyInfo.balance;
  897. onIptSetErrorTxt()
  898. }
  899. }
  900. })
  901. }
  902. /**
  903. * 更新货币余额
  904. */
  905. const updateCurrencyBanlce = () => {
  906. if(!refreshRotate.value) {
  907. refreshRotate.value = true;
  908. setTimeout(() => {
  909. refreshRotate.value = false;
  910. }, 1000)
  911. }
  912. asyncTokenRechRecord((res) => {
  913. if(res.code == 0 && res.data && res.data.length) {
  914. let currencyInfo = res.data[0];
  915. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  916. currentCurrencyInfo.value.balance = currencyInfo.balance;
  917. }
  918. }
  919. })
  920. }
  921. /**
  922. * 同步链上交易
  923. */
  924. const asyncTokenRechRecord = (cb) => {
  925. syncChainTokenRechargeRecord({
  926. params: {
  927. currencyCode: currentCurrencyInfo.value.currencyCode
  928. }
  929. }).then(res => {
  930. cb && cb(res)
  931. })
  932. }
  933. /**
  934. * 提交表单请求
  935. */
  936. const submitRequest = async () => {
  937. let { amountValue = 0, totalCount = 0 } = baseFormData;
  938. baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
  939. // 组装提交参数
  940. let finishConditions = [];
  941. for (let i = 0; i < formList.length; i++) {
  942. let item = {};
  943. item.type = formList[i]["type"];
  944. if (item.type == 1 && atUserList.value.length) {
  945. // follow 参数
  946. let relatedUsers = atUserList.value.filter(item => item.name);
  947. item.relatedUsers = relatedUsers;
  948. finishConditions.push(item);
  949. } else if (formList[i]["type"] == 7) {
  950. // join discord
  951. if(formList[i]["checked"] && formList[i]["text"]) {
  952. item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
  953. finishConditions.push(item);
  954. }
  955. } else if (formList[i]["checked"]) {
  956. // 其余任务
  957. finishConditions.push(item);
  958. }
  959. }
  960. let receiveConditions = openAntiBot.value ? "" : [];
  961. let validityDuration = '';
  962. if(baseFormData.type == 2) {
  963. //小时转毫秒
  964. let unit = process.env.NODE_ENV != 'production' ? 60 * 1000 : 60 * 60 * 1000;
  965. // let unit = 60 * 60 * 1000
  966. validityDuration = baseFormData.validityDuration * unit;
  967. } else {
  968. validityDuration = '';
  969. }
  970. // 提交参数
  971. let formData = {
  972. amountCurrencyCode: baseFormData.amountCurrencyCode,
  973. amountValue,
  974. totalCount,
  975. finishConditions,
  976. receiveConditions,
  977. payAmountValue: amountValue,
  978. type: baseFormData.type,
  979. posterType: 1,
  980. validityDuration
  981. };
  982. submitIng.value = true;
  983. // 自定义封面
  984. if (Object.keys(customPosterData.value).length > 0) {
  985. formData['posterType'] = 2;
  986. if (customPosterData.value && customPosterData.value.after) {
  987. formData['customPosterInstalled'] = customPosterData.value.after.objectKey || ''
  988. }
  989. if (customPosterData.value && customPosterData.value.before) {
  990. formData['customPosterUninstalled'] = customPosterData.value.before.objectKey || ''
  991. }
  992. }
  993. // 法币支付需要计算费率
  994. if(formData.amountCurrencyCode == "USD") {
  995. let payAmountRes = await getPayAmount(amountValue);
  996. formData["payAmountValue"] = payAmountRes.finalAmountValue;
  997. }
  998. let data = {
  999. params: {
  1000. postBizData: JSON.stringify(formData),
  1001. postSrc: 1, //1 twitter
  1002. postType: 1, //1 红包
  1003. },
  1004. };
  1005. postPublish(data).then((res) => {
  1006. submitIng.value = false;
  1007. if (res.code == 0) {
  1008. publishRes = res.data;
  1009. postId.value = res.data.postId;
  1010. Report.reportLog({
  1011. pageSource: Report.pageSource.previewPage,
  1012. businessType: Report.businessType.pageView,
  1013. });
  1014. showComType.value = "preview";
  1015. previewFontSize.value = calcFontSize(baseFormData.amountValue, 238, 56);
  1016. isBack.value = false;
  1017. } else {
  1018. console.log(res);
  1019. }
  1020. })
  1021. .catch((err) => {
  1022. console.log(err);
  1023. });
  1024. };
  1025. const calcFontSize = (str, domWidth, maxSize) => {
  1026. let lenstr = str.length;
  1027. let num = parseInt(domWidth / lenstr);
  1028. let fontSize = num < maxSize ? num : maxSize
  1029. return fontSize;
  1030. }
  1031. /**
  1032. * 初始化提交参数
  1033. */
  1034. const initParams = () => {
  1035. resetFormIpt();
  1036. // clear follow value
  1037. atUserList.value = [];
  1038. submitIng.value = false;
  1039. isBack.value = false;
  1040. showCurrencyPop.value = false;
  1041. showCurrencySelect.value = false;
  1042. openAntiBot.value = false;
  1043. tempCurrentCurrencyInfo.value = {};
  1044. currentCurrencyInfo.value = {};
  1045. // clear discord value
  1046. setDiscordIptTxt({text: ''});
  1047. discordInviteInfo.value = {};
  1048. customPosterInfo.value = {};
  1049. customPosterData.value = {};
  1050. };
  1051. const setDiscordIptTxt = ({text}) => {
  1052. const index = formList.findIndex(item => item.type == 7);
  1053. formList[index]['text'] = text;
  1054. }
  1055. /**
  1056. * 支付完成回调
  1057. */
  1058. const payPalFinsh = (params) => {
  1059. let {payNetwork, payStatus} = params;
  1060. // token 支付
  1061. if(payNetwork == 'bsc') {
  1062. payStatusHandle(payStatus);
  1063. } else {
  1064. // 法币支付
  1065. let transaction = params.transaction;
  1066. let loadingInstance = ElLoading.service({
  1067. background: "rgba(0,0,0,.3)",
  1068. });
  1069. verifyPaypalResult({
  1070. params: {
  1071. paypalTransactionId: transaction.id,
  1072. postId: publishRes.postId,
  1073. paypalClientId: paypalClientId.value,
  1074. },
  1075. }).then((res) => {
  1076. loadingInstance.close();
  1077. if (res.code == 0) {
  1078. if (res.data) {
  1079. payStatusHandle(res.data.payStatus)
  1080. }
  1081. }
  1082. })
  1083. .catch(() => {
  1084. loadingInstance.close();
  1085. });
  1086. }
  1087. };
  1088. const payStatusHandle = (payStatus) => {
  1089. //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
  1090. switch (payStatus) {
  1091. case 1:
  1092. emits("payPalFinsh", { publishRes });
  1093. showComType.value = "default";
  1094. initParams();
  1095. break;
  1096. case 2:
  1097. // ElMessage({
  1098. // message: "Pay Fail",
  1099. // type: "warning",
  1100. // });
  1101. break;
  1102. case 3:
  1103. // ElMessage({
  1104. // message: "Pay Exceptions",
  1105. // type: "warning",
  1106. // });
  1107. break;
  1108. case 4:
  1109. // ElMessage({
  1110. // message: "Pay Exceptions",
  1111. // type: "warning",
  1112. // });
  1113. break;
  1114. }
  1115. }
  1116. /**
  1117. * follow组件触发新增关注人
  1118. */
  1119. const addFollowUser = (params) => {
  1120. atUserList.value.push(params);
  1121. };
  1122. const setFollowUser = (params) => {
  1123. atUserList.value[params.index]["name"] = params.name;
  1124. };
  1125. const delFollowUser = (params) => {
  1126. atUserList.value.splice(params.index, 1);
  1127. };
  1128. const onAmountInput = () => {
  1129. let val = baseFormData.amountValue;
  1130. // val = val.replace(/[^\d^\.]+/g, "");
  1131. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  1132. if(val == '00') {
  1133. val = '0'
  1134. }
  1135. if(val.indexOf('.') > -1){ //校验 例:00.12 => 0.12
  1136. let arr = val.split('.');
  1137. if(arr[0].startsWith('0')) {
  1138. let num = +arr[0];
  1139. val = num + '.' + arr[1];
  1140. }
  1141. }
  1142. baseFormData.amountValue = val;
  1143. setInputErrorMsg({from: 'amount', type:'input'});
  1144. return val;
  1145. };
  1146. const onCountInput = () => {
  1147. let val = baseFormData.totalCount;
  1148. const maxCount = 100000000;
  1149. if (val == 0) {
  1150. val = "";
  1151. }
  1152. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  1153. if(val > maxCount) {
  1154. val = maxCount
  1155. }
  1156. baseFormData.totalCount = val;
  1157. setInputErrorMsg({from: 'count', type:'input'});
  1158. return val;
  1159. };
  1160. const onValidityDurationInput = () => {
  1161. let val = baseFormData.validityDuration;
  1162. if (val == 0) {
  1163. val = "";
  1164. } else if(val > lotteryMaxHourDuration) {
  1165. val = lotteryMaxHourDuration+'';
  1166. }
  1167. val = val.replace(/[^\d]/g, "");
  1168. baseFormData.validityDuration = val;
  1169. setInputErrorMsg();
  1170. return val;
  1171. }
  1172. const onValidityDurationBlur = () => {
  1173. let val = baseFormData.validityDuration;
  1174. if (val == 0) {
  1175. val = "";
  1176. } else if(val > lotteryMaxHourDuration) {
  1177. val = lotteryMaxHourDuration+'';
  1178. }
  1179. val = val.replace(/[^\d]/g, "");
  1180. baseFormData.validityDuration = val;
  1181. setInputErrorMsg();
  1182. return val;
  1183. }
  1184. /**
  1185. * 金额输入失焦
  1186. */
  1187. const onAmountBlur = () => {
  1188. setInputErrorMsg({from: 'amount', type:'blur'});
  1189. };
  1190. /**
  1191. * count失焦,校验输入结果
  1192. */
  1193. const onCountBlur = () => {
  1194. setInputErrorMsg({from: 'count', type:'blur'});
  1195. };
  1196. /**
  1197. * 输入结果金额和数量 (金额/数量)是否小于最小货币单位
  1198. */
  1199. const calcIptValue = (cb) => {
  1200. let amountValue = baseFormData.amountValue;
  1201. let totalCount = baseFormData.totalCount;
  1202. let flag = true;
  1203. if (!amountValue || !totalCount) {
  1204. return {
  1205. flag
  1206. };
  1207. }
  1208. if (math.format(math.evaluate(`${baseFormData.amountValue} / ${baseFormData.totalCount}`)) < +currentCurrencyInfo.value.minAmount) {
  1209. flag = false;
  1210. }
  1211. return {
  1212. flag,
  1213. count: Math.floor(math.format(math.evaluate(`${baseFormData.amountValue} / ${currentCurrencyInfo.value.minAmount}`)))
  1214. }
  1215. };
  1216. /**
  1217. * 设置输入提示语
  1218. */
  1219. const setInputErrorMsg = () => {
  1220. onIptSetErrorTxt();
  1221. };
  1222. /**
  1223. * 输入时 检测设置错误信息
  1224. */
  1225. const onIptSetErrorTxt = (params = {}) => {
  1226. if(!currentCurrencyInfo.value.currencyCode) {
  1227. iptErrMsgTxt.value = "Select a reward"
  1228. } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
  1229. iptErrMsgTxt.value = "Enter an amount";
  1230. } else if (!baseFormData.totalCount || baseFormData.totalCount == '0') {
  1231. iptErrMsgTxt.value = "Enter the number of winners";
  1232. } else if(+baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
  1233. // 输入金额 小于 余额
  1234. let res = calcIptValue();
  1235. if (!res.flag) {
  1236. iptErrMsgTxt.value = `${baseFormData.amountValue} ${currentCurrencyInfo.value.tokenSymbol} Can send up to ${res.count} winners`;
  1237. } else {
  1238. if(baseFormData.type == 2 && !baseFormData.validityDuration) {
  1239. iptErrMsgTxt.value = "Enter Automatically Draw";
  1240. } else {
  1241. //清空错误提示
  1242. iptErrMsgTxt.value = "";
  1243. if(params.actionType != 'discord_blur') {
  1244. setDiscordErrTxt({getDuildId: true});
  1245. }
  1246. }
  1247. }
  1248. } else if(baseFormData.type == 2 && !baseFormData.validityDuration) {
  1249. // 抽奖模式 没有输入时长
  1250. iptErrMsgTxt.value = "Enter Automatically Draw";
  1251. } else {
  1252. setDiscordErrTxt({getDuildId: true}, () => {
  1253. iptErrMsgTxt.value = '';
  1254. });
  1255. }
  1256. }
  1257. /**
  1258. * 监听开关触发事件
  1259. */
  1260. const formSwitchChange = (val, params, index) => {
  1261. closeDiscordTask(val, params, index);
  1262. }
  1263. const hideTask = (params, index) => {
  1264. formList[index]['checked'] = false;
  1265. formList[index]['show'] = false;
  1266. closeDiscordTask(false, {type: 7}, index)
  1267. }
  1268. const clickDropdown = (params, index) => {
  1269. formList[index]['show'] = true;
  1270. formList[index]['checked'] = true;
  1271. }
  1272. const closeDiscordTask = (val, params, index) => {
  1273. if(params.type == 7) {
  1274. if(!val) {
  1275. //错误类型 discord 清空discord错误校验
  1276. if(iptErrType == 'discord') {
  1277. iptErrMsgTxt.value = '';
  1278. formList[index]['text'] = '';
  1279. onIptSetErrorTxt();
  1280. }
  1281. } else {
  1282. onIptSetErrorTxt();
  1283. }
  1284. }
  1285. }
  1286. /** 监听 discord 输入 */
  1287. const onIptDiscordAddress = (e, index) => {
  1288. let val = formList[index].text;
  1289. let checked = formList[index].checked;
  1290. if(val && !checked) {
  1291. checked = true;
  1292. formList[index].checked = checked;
  1293. formList[index].text = formList[index].text.replace(/\s/g,'');
  1294. } else if(!val){
  1295. discordInviteInfo.value = {};
  1296. }
  1297. onIptDiscordDebounce()
  1298. }
  1299. const onBlurDiscordAddress = (e, index) => {
  1300. setDiscordErrTxt({fromType: 'discord', showPop: false, actionType: 'discord_blur'});
  1301. }
  1302. const getDiscordIptData = () => {
  1303. let discordItem = formList.find(item => item.type == 7);
  1304. return discordItem;
  1305. }
  1306. /**
  1307. * 设置输入discord错误提示信息
  1308. */
  1309. const setDiscordErrTxt = (params = {showPop: false}, cb) => {
  1310. let discordData = getDiscordIptData() || {};
  1311. if(discordData.checked) {
  1312. if(discordData.text) {
  1313. let validata = checkInviteUrl(discordData.text);
  1314. if(validata) {
  1315. getDiscordInviteInfo({inviteUrl: discordData.text, getDuildId: params.getDuildId}, (res) => {
  1316. console.log('discordData',res)
  1317. // 未知的邀请链接
  1318. if(res.inviteCode != res.data.code || !res.data.guildId) {
  1319. iptErrMsgTxt.value = discordIptErrTxt;
  1320. iptErrType = 'discord';
  1321. } else {
  1322. if(res.data.expires !== null) {
  1323. // 不是永久邀请链接
  1324. iptErrMsgTxt.value = discordIptNerverExpiresErrTxt;
  1325. iptErrType = '';
  1326. } else {
  1327. if(iptErrMsgTxt.value) {
  1328. iptErrMsgTxt.value = '';
  1329. iptErrType = '';
  1330. }
  1331. if(params.showPop && res.data) {
  1332. showDiscordInvitePop.value = true;
  1333. setTimeout(() => {
  1334. showDiscordInvitePop.value = false;
  1335. }, 2000)
  1336. }
  1337. if(params.fromType == 'discord') {
  1338. onIptSetErrorTxt();
  1339. }
  1340. }
  1341. }
  1342. cb && cb(res)
  1343. })
  1344. } else {
  1345. iptErrMsgTxt.value = discordIptErrTxt;
  1346. iptErrType = 'discord';
  1347. }
  1348. } else {
  1349. if(params.actionType == 'discord_blur') {
  1350. onIptSetErrorTxt({acitonType: 'discord_blur'});
  1351. } else {
  1352. // 设置空提示
  1353. iptErrMsgTxt.value = discordIptEmptyErrTxt;
  1354. iptErrType = 'discord';
  1355. }
  1356. }
  1357. } else {
  1358. cb && cb();
  1359. }
  1360. }
  1361. const onIptDiscordDebounce = debounce(function() {
  1362. setDiscordErrTxt({fromType: 'discord', showPop: true});
  1363. }, 800)
  1364. /**
  1365. * 校验 discord邀请url
  1366. */
  1367. const checkInviteUrl = (inviteUrl) => {
  1368. let flag = false;
  1369. const INVITE_URL_PREFIX_1 = 'https://discord.gg/';
  1370. const INVITE_URL_PREFIX_2 = 'https://discord.com/invite/';
  1371. const INVITE_URL_PREFIX_3 = 'http://discord.gg/';
  1372. const INVITE_URL_PREFIX_4 = 'http://discord.com/invite/';
  1373. const INVITE_URL_PREFIX_5 = 'discord.gg/';
  1374. const INVITE_URL_PREFIX_6 = 'discord.com/invite/';
  1375. const arr = [INVITE_URL_PREFIX_1, INVITE_URL_PREFIX_2, INVITE_URL_PREFIX_3, INVITE_URL_PREFIX_4, INVITE_URL_PREFIX_5, INVITE_URL_PREFIX_6]
  1376. if(inviteUrl) {
  1377. if(arr.indexOf(inviteUrl) > -1) {
  1378. flag = false;
  1379. } else {
  1380. let isPass = false;
  1381. for(let i = 0; i < arr.length; i++) {
  1382. let item = arr[i];
  1383. if(inviteUrl.startsWith(item)) {
  1384. isPass = true;
  1385. break;
  1386. }
  1387. }
  1388. flag = isPass;
  1389. }
  1390. }
  1391. return flag;
  1392. }
  1393. /**获取discord 邀请信息 */
  1394. const getDiscordInviteInfo = ({inviteUrl, getDuildId}, cb) => {
  1395. if(!inviteUrl) return;
  1396. let inviteCode = '';
  1397. let arr = inviteUrl.split('/');
  1398. if(arr.length > 0) {
  1399. inviteCode = arr[arr.length - 1];
  1400. }
  1401. if(!getDuildId && discordInviteInfo.value.guildId && discordInviteInfo.value.inviteCode == inviteCode) {
  1402. return;
  1403. }
  1404. getInviteGuildInfo({
  1405. inviteCode
  1406. }).then(res => {
  1407. let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
  1408. if(resData.data.guildId) {
  1409. cb && cb(resData);
  1410. } else {
  1411. //DISCORD 接口未获取到服务器信息 resdata
  1412. Report.reportLog({
  1413. pageSource: Report.pageSource.publisherDialog,
  1414. businessType: Report.businessType.buttonClick,
  1415. objectType: Report.objectType.getDiscordGuildNoData
  1416. }, {
  1417. resData: resData
  1418. });
  1419. getGuildInfoByOpenApi({inviteCode}, cb);
  1420. }
  1421. }).catch((err) => {
  1422. //DISCORD 接口 catch
  1423. Report.reportLog({
  1424. pageSource: Report.pageSource.publisherDialog,
  1425. businessType: Report.businessType.buttonClick,
  1426. objectType: Report.objectType.getDiscordGuildCatch
  1427. }, {
  1428. err: err
  1429. });
  1430. let errMsg = err;
  1431. if(typeof errMsg == 'object') {
  1432. errMsg = JSON.stringify(err);
  1433. }
  1434. if(errMsg.indexOf('code 404') > -1) {
  1435. discordInviteInfo.value = {};
  1436. iptErrMsgTxt.value = discordIptErrTxt;
  1437. } else {
  1438. getGuildInfoByOpenApi({inviteCode}, cb);
  1439. }
  1440. });
  1441. }
  1442. const getGuildInfoByOpenApi = (params, cb) => {
  1443. let { inviteCode } = params;
  1444. getInviteGuildInfoByOpenApi({
  1445. inviteCode
  1446. }).then(res => {
  1447. let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
  1448. if(resData.data.guildId) {
  1449. cb && cb(resData);
  1450. } else {
  1451. //OPENAPI 接口未获取到服务器信息 resdata
  1452. Report.reportLog({
  1453. pageSource: Report.pageSource.publisherDialog,
  1454. businessType: Report.businessType.buttonClick,
  1455. objectType: Report.objectType.getDiscordGuildOpenApiNoData
  1456. }, {
  1457. resData: resData
  1458. });
  1459. }
  1460. }).catch((err) => {
  1461. // OPENAPI 接口 catch 限频
  1462. Report.reportLog({
  1463. pageSource: Report.pageSource.publisherDialog,
  1464. businessType: Report.businessType.buttonClick,
  1465. objectType: Report.objectType.getDiscordGuildOpenApiCatch
  1466. }, {
  1467. err: err
  1468. });
  1469. if(iptErrMsgTxt.value && iptErrType == 'discord') {
  1470. iptErrMsgTxt.value = '';
  1471. iptErrType = '';
  1472. }
  1473. });
  1474. }
  1475. const inviteGuildResHandler = (res, params) => {
  1476. let {inviteCode, inviteUrl} = params;
  1477. if(!res) {
  1478. res = {};
  1479. }
  1480. let {name, icon, id} = res.guild || {};
  1481. icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
  1482. let resData = {
  1483. inviteCode,
  1484. data: {
  1485. code: res.code,
  1486. guildId: id,
  1487. inviteUrl,
  1488. inviteCode,
  1489. expires: res.expires_at,
  1490. name,
  1491. icon,
  1492. }
  1493. }
  1494. if(res.code == inviteCode) {
  1495. discordInviteInfo.value = resData.data;
  1496. } else {
  1497. discordInviteInfo.value = {};
  1498. iptErrMsgTxt.value = discordIptErrTxt;
  1499. }
  1500. return resData;
  1501. };
  1502. /**
  1503. * 获取支付配置(paypalClientId)
  1504. */
  1505. const setPayConfig = () => {
  1506. getPayConfig({
  1507. params: {},
  1508. }).then((res) => {
  1509. if (res.code == 0) {
  1510. payConfig.value = res.data;
  1511. paypalClientId.value = res.data.paypalClientId;
  1512. }
  1513. });
  1514. };
  1515. /**
  1516. * 获取配置
  1517. */
  1518. const setFrontConfig = () => {
  1519. getFrontConfig({
  1520. params: {},
  1521. }).then((res) => {
  1522. if (res.code == 0) {
  1523. paypalHtml.value = res.data.paypalHtml;
  1524. lotteryMaxHourDuration = res.data.lotteryMaxHourDuration;
  1525. }
  1526. });
  1527. };
  1528. const goTransactionsList = () => {
  1529. window.open(`${chrome.runtime.getURL('/iframe/home.html#/transactions')}`)
  1530. }
  1531. /**
  1532. * 默认获取上次选中的货币信息
  1533. */
  1534. const getLocalCurrencyInfoByCode = () => {
  1535. if(!currentCurrencyInfo.value.currencyCode) {
  1536. getCurrencyInfo();
  1537. }
  1538. }
  1539. const getCurrencyInfo = async (_params) => {
  1540. let { loop = false} = _params || {};
  1541. let {accessToken = ''} = await getChromeStorage('userInfo') || {};
  1542. if (accessToken) {
  1543. getChromeStorage('selectCurrencyInfo', (res) => {
  1544. if(res && res.currencyCode) {
  1545. getCurrencyInfoByCode({
  1546. params: {
  1547. currencyCode: res.currencyCode
  1548. }
  1549. }).then(res => {
  1550. if(res.code == 0 && res.data) {
  1551. currentCurrencyInfo.value = res.data;
  1552. tempCurrentCurrencyInfo.value = res.data;
  1553. if(!loop) {
  1554. onIptSetErrorTxt();
  1555. }
  1556. }
  1557. });
  1558. }
  1559. })
  1560. getChromeStorage('selectCurrencyList', (res) => {
  1561. if (showCurrencySelect.value === false) {
  1562. tempCurrentCurrencyList.value = res;
  1563. }
  1564. })
  1565. }
  1566. }
  1567. const selectPublishMode = (params, index) => {
  1568. selectModeInfo.index = index;
  1569. selectModeInfo.type = params.type;
  1570. baseFormData.type = params.type;
  1571. setInputErrorMsg();
  1572. }
  1573. // 截图相关
  1574. const showDialog = () => {
  1575. cropperDialog.value = true;
  1576. }
  1577. const hiddenDialog = () => {
  1578. cropperDialog.value = false;
  1579. cropperLoading.value = false;
  1580. }
  1581. const selectImage = (option) => {
  1582. // 设置图片
  1583. cropperOption.value.img = option.file
  1584. // 选取比例
  1585. if (option && option.type && option.type == 2) {
  1586. cropperType.value = 'after';
  1587. cropperOption.value.fixedNumber = [1, 1];
  1588. } else {
  1589. cropperType.value = 'before';
  1590. cropperOption.value.fixedNumber = [16, 8.396];
  1591. }
  1592. nextTick(() => {
  1593. showDialog()
  1594. })
  1595. }
  1596. const confirmImage = () => {
  1597. let contentType = 'image/png';
  1598. cropperLoading.value = true;
  1599. if (refCropper.value) {
  1600. refCropper.value.getCropBlob(imgData => {
  1601. uploadSignature({
  1602. params: {
  1603. bizType: 1,
  1604. fileType: 1,
  1605. contentType: contentType,
  1606. fileSuffix: 'png',
  1607. }
  1608. }).then(res => {
  1609. let { code, data } = res;
  1610. if (code === 0) {
  1611. let reader = new FileReader()
  1612. reader.readAsArrayBuffer(imgData)
  1613. reader.onload = function(e) {
  1614. let execFile = e.target.result;
  1615. uploadFile({
  1616. url: data.url,
  1617. data: new Blob([execFile]),
  1618. headers: {
  1619. 'Authorization': data.authorization,
  1620. 'x-amz-date': data.date,
  1621. 'Content-Type': contentType
  1622. }
  1623. }).then(res => {
  1624. let { status } = res
  1625. if (status == 200) {
  1626. successImage(data)
  1627. }
  1628. }).finally(() => {
  1629. cropperLoading.value = false;
  1630. })
  1631. }
  1632. }
  1633. })
  1634. })
  1635. }
  1636. }
  1637. const successImage = (data) => {
  1638. hiddenDialog()
  1639. // setPosterInfo
  1640. customPosterInfo.value[cropperType.value] = data;
  1641. }
  1642. const confirmData = (data) => {
  1643. close()
  1644. customPosterData.value = customPosterInfo.value;
  1645. }
  1646. onMounted(() => {
  1647. setFrontConfig();
  1648. setPayConfig();
  1649. getLocalCurrencyInfoByCode();
  1650. window.addEventListener('resize', function () {
  1651. setDialogStyle(true);
  1652. })
  1653. // showNewImage
  1654. getChromeStorage('custom_poster_guide', (info) => {
  1655. if (!info) {
  1656. customShowNewImage.value = true
  1657. }
  1658. })
  1659. });
  1660. </script>
  1661. <style lang="scss" scoped>
  1662. :deep() .ant-switch {
  1663. background-color: #E9ECEE;
  1664. height: 14px;
  1665. line-height: 16px;
  1666. min-width: 36px;
  1667. }
  1668. :deep() .ant-switch-checked {
  1669. background-color: #AED8F5 !important;
  1670. }
  1671. :deep() .ant-switch::after {
  1672. width: 20px;
  1673. height: 20px;
  1674. top: -4px;
  1675. left: -1px;
  1676. }
  1677. :deep() .ant-switch-checked::after {
  1678. background-color: #1D9BF0 !important;
  1679. margin-left: 3px;
  1680. left: 100% !important;
  1681. }
  1682. .overlay {
  1683. position: fixed;
  1684. top: 0;
  1685. right: 0;
  1686. bottom: 0;
  1687. left: 0;
  1688. z-index: 1000;
  1689. width: 100%;
  1690. height: 100%;
  1691. background-color: rgba(0, 0, 0, 0.5);
  1692. overflow: auto;
  1693. .content {
  1694. height: 620px;
  1695. background: #ffffff;
  1696. border-radius: 20px;
  1697. position: absolute;
  1698. left: 50%;
  1699. top: 50%;
  1700. transform: translate(-50%, -50%);
  1701. box-sizing: border-box;
  1702. z-index: 2000;
  1703. max-height: 825px;
  1704. .pop-mask {
  1705. width: 100%;
  1706. height:100%;
  1707. position: absolute;
  1708. z-index:900;
  1709. }
  1710. .head {
  1711. border-bottom: 1px solid #ececec;
  1712. height: 48px;
  1713. box-sizing: border-box;
  1714. display: flex;
  1715. align-items: center;
  1716. justify-content: space-between;
  1717. padding: 0 14px;
  1718. .left {
  1719. display: flex;
  1720. align-items: center;
  1721. .title {
  1722. font-size: 16px;
  1723. font-weight: 500;
  1724. }
  1725. .close-btn {
  1726. display: flex;
  1727. align-items: center;
  1728. width: max-content;
  1729. margin-right: 12px;
  1730. cursor: pointer;
  1731. }
  1732. }
  1733. .right {
  1734. .more {
  1735. cursor: pointer;
  1736. }
  1737. .area-option {
  1738. width: 100%;
  1739. height: 100%;
  1740. position: absolute;
  1741. top: 0;
  1742. left: 0;
  1743. z-index: 111;
  1744. .option {
  1745. position: absolute;
  1746. top: 43px;
  1747. right: 15px;
  1748. background: #fff;
  1749. filter: drop-shadow(0px 3px 20px rgba(0, 0, 0, 0.2));
  1750. width: 240px;
  1751. border-radius: 15px;
  1752. overflow: hidden;
  1753. .item {
  1754. width: 100%;
  1755. height: 50px;
  1756. display: flex;
  1757. align-items: center;
  1758. cursor: pointer;
  1759. border-top: 1px solid #E9E9E9;
  1760. img {
  1761. margin-left: 15px;
  1762. width: 30px;
  1763. height: 30px;
  1764. margin-right: 6px;
  1765. }
  1766. span {
  1767. font-weight: 500;
  1768. font-size: 14px;
  1769. }
  1770. }
  1771. .item:first-child {
  1772. border-top: 0;
  1773. }
  1774. .item:hover {
  1775. background: #F5F5F5;
  1776. }
  1777. }
  1778. }
  1779. }
  1780. }
  1781. .body {
  1782. box-sizing: border-box;
  1783. height: calc(100% - 48px);
  1784. display: flex;
  1785. position: relative;
  1786. .body-content {
  1787. display:flex;
  1788. width:100%;
  1789. }
  1790. .currency-pop {
  1791. position: absolute;
  1792. width: 375px;
  1793. height: 480px;
  1794. top: 85px;
  1795. left: 88px;
  1796. z-index: 1000;
  1797. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1798. background-color: #fff;
  1799. border-radius: 20px;
  1800. overflow-y: auto;
  1801. }
  1802. .currency-pop-select {
  1803. position: absolute;
  1804. width: 375px;
  1805. max-height: 480px;
  1806. top: 85px;
  1807. left: 88px;
  1808. z-index: 1000;
  1809. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1810. background-color: #fff;
  1811. border-radius: 20px;
  1812. overflow-y: scroll;
  1813. }
  1814. .left,
  1815. .right {
  1816. height: 100%;
  1817. }
  1818. .left {
  1819. width: 50px;
  1820. display: flex;
  1821. flex-direction: column;
  1822. justify-content: space-between;
  1823. align-items: center;
  1824. .gift-pack-wrapper {
  1825. width: 100%;
  1826. height: 55px;
  1827. background: #f5f5f5;
  1828. display: flex;
  1829. align-items: center;
  1830. justify-content: center;
  1831. }
  1832. .bottom {
  1833. .icon {
  1834. display: block;
  1835. margin-bottom: 26px;
  1836. }
  1837. }
  1838. }
  1839. .right {
  1840. width: calc(100% - 50px);
  1841. box-sizing: border-box;
  1842. position: relative;
  1843. border-left: 1px solid #ececec;
  1844. .form-wrapper {
  1845. padding: 18px 18px 18px 18px;
  1846. height: calc(100% - 80px);
  1847. overflow: auto;
  1848. box-sizing: border-box;
  1849. display: flex;
  1850. .task-wrapper {
  1851. width: 480px;
  1852. }
  1853. .form-cell-item {
  1854. height: 100%;
  1855. .title {
  1856. display: flex;
  1857. align-items: center;
  1858. font-weight: 500;
  1859. font-size: 15px;
  1860. .icon {
  1861. width: 20px;
  1862. height: 20px;
  1863. margin-right: 5px;
  1864. }
  1865. }
  1866. .form-cell-content {
  1867. margin-top: 12px;
  1868. box-sizing: border-box;
  1869. }
  1870. }
  1871. .base-form-wrapper {
  1872. width: 450px;
  1873. margin-right: 30px;
  1874. .form-cell-content {
  1875. .select-mode-ele {
  1876. display: flex;
  1877. cursor: pointer;
  1878. img:first-child {
  1879. margin-right: 10px;
  1880. }
  1881. img {
  1882. -webkit-user-drag: none;
  1883. width: 220px;
  1884. height: 90px;
  1885. }
  1886. }
  1887. .form-base {
  1888. margin-top: 20px;
  1889. border: 1px solid #D1D9DD;
  1890. border-radius: 14px;
  1891. box-sizing: border-box;
  1892. padding-left: 14px;
  1893. .item {
  1894. box-sizing: border-box;
  1895. padding: 7px 0;
  1896. min-height: 76px;
  1897. display: flex;
  1898. align-items: center;
  1899. justify-content: space-between;
  1900. input {
  1901. width: 178px;
  1902. text-align: right;
  1903. font-weight: 700;
  1904. font-size: 26px;
  1905. border: none;
  1906. outline: none;
  1907. box-sizing: border-box;
  1908. }
  1909. input::placeholder {
  1910. color: #c5c5c5;
  1911. }
  1912. input {
  1913. padding-right: 16px;
  1914. }
  1915. .label {
  1916. font-weight: 500;
  1917. font-size: 15px;
  1918. display: flex;
  1919. align-items: center;
  1920. .icon {
  1921. width: 20px;
  1922. height: 20px;
  1923. margin-right: 8px;
  1924. }
  1925. }
  1926. }
  1927. .currency-select-wrapper {
  1928. overflow: hidden;
  1929. .currency-select {
  1930. cursor: pointer;
  1931. background: #1D9BF0;
  1932. padding: 6px 10px;
  1933. border-radius: 12px;
  1934. color: #fff;
  1935. width: max-content;
  1936. max-width: 234px;
  1937. .text {
  1938. word-break: break-all;
  1939. }
  1940. .arrow {
  1941. margin-left: 5px;
  1942. }
  1943. }
  1944. .selected {
  1945. background: #F4F4F4 !important;
  1946. color: #000 !important;
  1947. }
  1948. }
  1949. .winners-count-input {
  1950. border-top: 1px solid #D1D9DD;
  1951. .msg {
  1952. font-weight: 400;
  1953. font-size: 12px;
  1954. color: #A39F9F;
  1955. margin-top: 8px
  1956. }
  1957. }
  1958. .automatically-input {
  1959. border-top: 1px solid #D1D9DD;
  1960. .input-wrapper {
  1961. margin-right: 16px;
  1962. box-sizing: border-box;
  1963. input {
  1964. padding-right: 4px !important;
  1965. }
  1966. .unit {
  1967. font-weight: 700;
  1968. font-size: 26px;
  1969. opacity: 0.5;
  1970. }
  1971. }
  1972. }
  1973. }
  1974. }
  1975. }
  1976. .currency-operation {
  1977. position: relative;
  1978. box-sizing: border-box;
  1979. display: flex;
  1980. align-items: center;
  1981. margin-top: 8px;
  1982. .balance,
  1983. .amount {
  1984. display: flex;
  1985. align-items: center;
  1986. }
  1987. .amount {
  1988. font-weight: 400;
  1989. font-size: 12px;
  1990. color: #A39F9F;
  1991. img {
  1992. margin-left: 6px;
  1993. cursor: pointer;
  1994. }
  1995. }
  1996. .top-up {
  1997. font-weight: 500;
  1998. font-size: 12px;
  1999. color: #1D9BF0;
  2000. cursor: pointer;
  2001. margin-left: 4px;
  2002. }
  2003. }
  2004. .form-label {
  2005. margin-top: 14px;
  2006. margin-bottom: 10px;
  2007. font-weight: 500;
  2008. font-size: 14px;
  2009. display: flex;
  2010. align-items: center;
  2011. justify-content: space-between;
  2012. .icon-add-task {
  2013. cursor: pointer;
  2014. }
  2015. }
  2016. .form-require {
  2017. box-sizing: border-box;
  2018. border-radius: 15px;
  2019. border: 1px solid #D1D9DD;
  2020. .form-item {
  2021. min-height: 54px;
  2022. display: flex;
  2023. align-items: center;
  2024. justify-content: space-between;
  2025. margin: 0 16px;
  2026. border-bottom: 1px solid #ececec;
  2027. padding: 8px 0;
  2028. box-sizing: border-box;
  2029. .item-left {
  2030. display: flex;
  2031. }
  2032. .label {
  2033. min-width: 76px;
  2034. display: flex;
  2035. align-items: center;
  2036. font-size: 15px;
  2037. font-weight: 500;
  2038. .icon {
  2039. margin-right: 10px;
  2040. }
  2041. }
  2042. .control {
  2043. min-width: 258px;
  2044. margin-left: 6px;
  2045. box-sizing: border-box;
  2046. position: relative;
  2047. .discord-address {
  2048. border: none;
  2049. outline: none;
  2050. color: #1D9BF0;
  2051. font-weight: 500;
  2052. font-size: 14px;
  2053. width: 100%;
  2054. height: 34px;
  2055. padding-left: 15px;
  2056. }
  2057. .discord-address::placeholder {
  2058. color: #c5c5c5;
  2059. }
  2060. .discord-invite-info {
  2061. position: absolute;
  2062. top: 40px;
  2063. left: 0;
  2064. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  2065. background: #fff;
  2066. border-radius: 16px;
  2067. padding: 16px;
  2068. box-sizing: border-box;
  2069. display: flex;
  2070. align-items: center;
  2071. cursor: pointer;
  2072. .icon {
  2073. width: 40px;
  2074. height: 40px;
  2075. margin-right: 10px;
  2076. border-radius: 50%;
  2077. }
  2078. .name {
  2079. font-weight: 600;
  2080. font-size: 16px;
  2081. color: #101419;
  2082. width: 193px;
  2083. height: 20px;
  2084. overflow: hidden;
  2085. white-space: nowrap;
  2086. text-overflow: ellipsis;
  2087. display: inline-block;
  2088. }
  2089. }
  2090. }
  2091. .icon-task-close {
  2092. margin-left: 6px;
  2093. cursor: pointer;
  2094. }
  2095. }
  2096. .border-hide {
  2097. border-bottom: none !important;
  2098. }
  2099. }
  2100. }
  2101. .giveaway-poster {
  2102. display: flex;
  2103. align-items: center;
  2104. flex-direction: row;
  2105. cursor: pointer;
  2106. height: 84px;
  2107. margin-top: 20px;
  2108. border-radius: 14px;
  2109. border: 1px solid #D1D9DD;
  2110. .show-img {
  2111. display: flex;
  2112. align-items: center;
  2113. justify-content: center;
  2114. width: 45px;
  2115. height: 60px;
  2116. margin-left: 14px;
  2117. margin-right: 14px;
  2118. }
  2119. .show-font {
  2120. position: relative;
  2121. font-size: 15px;
  2122. font-weight: 500;
  2123. .new {
  2124. width: 40px;
  2125. height: 18px;
  2126. margin-left: 10px;
  2127. }
  2128. }
  2129. .show-placeholder {
  2130. flex: 1;
  2131. color: #1D9BF0;
  2132. font-size: 15px;
  2133. font-weight: 500;
  2134. text-align: right;
  2135. }
  2136. .arrow {
  2137. width: 18px;
  2138. height: 24px;
  2139. margin-left: 2px;
  2140. margin-right: 12px;
  2141. }
  2142. }
  2143. .tips-wrapper {
  2144. margin: 16px 0 0 12px !important;
  2145. padding: 0px !important;
  2146. .title,
  2147. .row {
  2148. font-weight: 400;
  2149. font-size: 12px;
  2150. color: #A39F9F;
  2151. }
  2152. .row {
  2153. box-sizing: border-box;
  2154. line-height: 16px;
  2155. }
  2156. }
  2157. .submit-btn-wrapper {
  2158. width: 100%;
  2159. background: #fff;
  2160. position: absolute;
  2161. bottom: 18px;
  2162. left: 0;
  2163. box-sizing: border-box;
  2164. padding: 16px 18px 0 18px;
  2165. .submit-btn {
  2166. width: 100%;
  2167. height: 46px;
  2168. text-align: center;
  2169. background: #4a99e9;
  2170. border-radius: 100px;
  2171. color: #fff;
  2172. display: flex;
  2173. align-items: center;
  2174. justify-content: center;
  2175. font-size: 16px;
  2176. font-weight: 500;
  2177. cursor: pointer;
  2178. .icon-loading {
  2179. width: 20px;
  2180. height: 20px;
  2181. margin-right: 3px;
  2182. }
  2183. }
  2184. .disabled-submit {
  2185. background-color: #D9D9D9;
  2186. }
  2187. }
  2188. }
  2189. .fill-right {
  2190. width: 100% !important;
  2191. border-bottom-left-radius: 16px;
  2192. }
  2193. }
  2194. }
  2195. }
  2196. .preview {
  2197. padding: 30px 40px;
  2198. height: calc(100% - 80px);
  2199. overflow-y: auto;
  2200. .card {
  2201. float: left;
  2202. width: 480px;
  2203. position: relative;
  2204. .flash {
  2205. overflow: hidden;
  2206. height: 600px;
  2207. border-radius: 26px;
  2208. border: solid 1px #ECECEC;
  2209. }
  2210. &.center {
  2211. margin-left: 50%;
  2212. transform: translateX(-50%);
  2213. }
  2214. }
  2215. .card-title {
  2216. height: 32px;
  2217. .img {
  2218. float: left;
  2219. width: 20px;
  2220. height: 20px;
  2221. margin-right: 8px;
  2222. }
  2223. .font {
  2224. float: left;
  2225. font-size: 17px;
  2226. font-weight: 500;
  2227. span {
  2228. color: #0091e9;
  2229. }
  2230. }
  2231. }
  2232. .card-content {
  2233. float: right;
  2234. width: 500px;
  2235. }
  2236. .card-amount {
  2237. overflow: hidden;
  2238. display: flex;
  2239. height: 80px;
  2240. align-items: center;
  2241. padding: 20px;
  2242. border-radius: 20px;
  2243. border: 1px solid #E6E6E6;
  2244. .icon {
  2245. width: 40px;
  2246. height: 40px;
  2247. }
  2248. .con {
  2249. flex: 1;
  2250. padding: 0 10px;
  2251. .desc {
  2252. color: rgba($color: #000000, $alpha: 0.5);
  2253. font-size: 12px;
  2254. margin-bottom: 4px;
  2255. }
  2256. .price {
  2257. font-size: 16px;
  2258. font-weight: bold;
  2259. word-break: break-all;
  2260. }
  2261. }
  2262. .refresh {
  2263. cursor: pointer;
  2264. width: 30px;
  2265. height: 30px;
  2266. margin-top: -5px;
  2267. }
  2268. }
  2269. .card-list {
  2270. padding: 20px;
  2271. border-radius: 20px;
  2272. border: 1px solid #E6E6E6;
  2273. .item {
  2274. display: flex;
  2275. justify-content: space-between;
  2276. align-items: center;
  2277. height: 47px;
  2278. font-size: 14px;
  2279. font-weight: 500;
  2280. box-shadow: inset 0px -1px 0px #EAEAEA;
  2281. }
  2282. }
  2283. }
  2284. .icon-refresh-rotate {
  2285. transform: rotate(360deg);
  2286. transition-duration: 1s;
  2287. }
  2288. .payment {
  2289. .balance {
  2290. display: flex;
  2291. margin-right: 20px;
  2292. .icon {
  2293. width: 40px;
  2294. height: 40px;
  2295. }
  2296. .con {
  2297. padding: 0 5px;
  2298. .desc {
  2299. color: rgba($color: #000000, $alpha: 0.5);
  2300. font-size: 12px;
  2301. margin-bottom: 4px;
  2302. }
  2303. .price {
  2304. font-size: 14px;
  2305. font-weight: bold;
  2306. word-break: break-all;
  2307. }
  2308. }
  2309. .refresh {
  2310. width: 40px;
  2311. cursor: pointer;
  2312. margin-left: -5px;
  2313. }
  2314. }
  2315. }
  2316. .dialog {
  2317. position: absolute;
  2318. z-index: 2002;
  2319. top: 50%;
  2320. left: 50%;
  2321. transform: translate(-50%, -50%);
  2322. width: 800px;
  2323. height: calc(100% - 100px);
  2324. border-radius: 20px;
  2325. background-color: #ffffff;
  2326. .corp-title {
  2327. display: flex;
  2328. height: 48px;
  2329. align-items: center;
  2330. .back {
  2331. cursor: pointer;
  2332. width: 24px;
  2333. height: 24px;
  2334. margin: 0 12px;
  2335. }
  2336. span {
  2337. font-size: 16px;
  2338. font-weight: 500;
  2339. }
  2340. }
  2341. .corp-content {
  2342. width: 472px;
  2343. margin: auto;
  2344. height: calc(100% - 130px);
  2345. }
  2346. .corp-footer {
  2347. display: flex;
  2348. align-items: center;
  2349. justify-content: right;
  2350. height: 80px;
  2351. text-align: right;
  2352. padding-right: 30px;
  2353. .confirm {
  2354. cursor: pointer;
  2355. border: 0;
  2356. width: 200px;
  2357. height: 50px;
  2358. color: #ffffff;
  2359. font-size: 18px;
  2360. font-weight: 700;
  2361. border-radius: 25px;
  2362. background: #1D9BF0;
  2363. &.disable {
  2364. background: #D9D9D9;
  2365. img {
  2366. width: 20px;
  2367. margin-right: 10px;
  2368. }
  2369. }
  2370. }
  2371. }
  2372. }
  2373. .dialog-mask {
  2374. position: absolute;
  2375. z-index: 2001;
  2376. top: 0;
  2377. left: 0;
  2378. width: 100%;
  2379. height: 100%;
  2380. background-color: rgba(0, 0, 0, 0.5);
  2381. }
  2382. :deep() .vue-cropper {
  2383. background-image: none;
  2384. }
  2385. :deep() .cropper-modal {
  2386. background: rgba(0, 0, 0, .05);
  2387. }
  2388. </style>