give-dialog.vue 92 KB

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