give-dialog.vue 89 KB

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