give-dialog.vue 110 KB

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