give-dialog.vue 107 KB

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