give-dialog.vue 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862
  1. <template>
  2. <div class="overlay" v-if="visible">
  3. <div class="content"
  4. :style="{
  5. height: dialogHeight + 'px',
  6. width: showComType != 'preview' ? '600px' : 'auto'}">
  7. <div class="pop-mask"
  8. v-show="showCurrencyPop"
  9. @click.stop="showCurrencyPop = false"></div>
  10. <!-- 头部 -->
  11. <div class="head">
  12. <div class="left">
  13. <!-- 关闭按钮 -->
  14. <div class="close-btn" @click="close">
  15. <img class="icon-close"
  16. :src="require('@/assets/svg/icon-close.svg')"
  17. v-if="showComType == 'default'"/>
  18. <img class="icon-close"
  19. :src="require('@/assets/svg/icon-back.svg')"
  20. v-else/>
  21. </div>
  22. <!-- 标题 -->
  23. <div class="title">
  24. {{ currentComData[showComType]["title"] }}
  25. </div>
  26. </div>
  27. <div class="right">
  28. <!-- 更多按钮 -->
  29. <img :src="require('@/assets/svg/icon-more-l.svg')"
  30. class="more"
  31. @click="showMoreOption = true">
  32. <div class="area-option"
  33. v-if="showMoreOption"
  34. @click="showMoreOption = false">
  35. <div class="option">
  36. <div class="item" @click="goTransactionsList()">
  37. <img :src="require('@/assets/svg/icon-menu.svg')">
  38. <span>Transaction History</span>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- 内容 -->
  45. <div class="body">
  46. <img src="@/assets/gif/icon-guide-select.gif"
  47. class="icon-guide-select"
  48. v-if="!currentCurrencyInfo.currencyCode && showComType == 'default'">
  49. <!-- 充值组件 -->
  50. <top-up v-if="showComType == 'topUp'"
  51. :asyncIng="asyncIng"
  52. :currentCurrencyInfo="tempCurrentCurrencyInfo"
  53. @topUpDone="topUpDone"></top-up>
  54. <!-- 表单填写容器 -->
  55. <div class="body-content" v-if="showComType != 'topUp'">
  56. <!-- 货币列表 -->
  57. <div class="currency-pop" v-show="showCurrencyPop">
  58. <currency-list
  59. ref="currencyListDom"
  60. @selectCurrency="selectCurrency"
  61. @setCurrencyList="setCurrentCurrencyInfo"></currency-list>
  62. </div>
  63. <div class="left" v-if="showComType != 'preview'">
  64. <div class="gift-pack-wrapper">
  65. <img class="icon"
  66. :src="require('@/assets/svg/icon-gift-pack.svg')"/>
  67. </div>
  68. <div class="bottom">
  69. </div>
  70. </div>
  71. <div class="right"
  72. :class="{'fill-right': showComType == 'preview'}">
  73. <div class="form-wrapper" v-if="showComType == 'default'">
  74. <img
  75. class="img-mode"
  76. :src="require('@/assets/svg/img-mode.svg')"
  77. />
  78. <!-- 金额、数量 -->
  79. <div class="form-base">
  80. <div class="item currency-select-wrapper">
  81. <div
  82. class="label currency-select"
  83. :class="{'selected': currentCurrencyInfo.currencyCode}"
  84. @click="selectCurrencyPopHandle"
  85. >
  86. <img v-if="currentCurrencyInfo.iconPath"
  87. class="icon"
  88. :src="currentCurrencyInfo.iconPath"
  89. />
  90. <div class="text">
  91. {{currentCurrencyInfo.currencyCode == 'USD' ? 'USD' : currentCurrencyInfo.tokenSymbol || 'Select a reward'}}
  92. </div>
  93. <img
  94. class="arrow"
  95. :src="currentCurrencyInfo.currencyCode ?
  96. require('@/assets/svg/icon-form-arrow-down.svg') : require('@/assets/svg/icon-form-white-arrow-down.svg')
  97. "
  98. />
  99. </div>
  100. <input
  101. v-model="baseFormData.amountValue"
  102. placeholder="0"
  103. autofocus
  104. @input="onAmountInput"
  105. @blur="onAmountBlur"
  106. />
  107. </div>
  108. <div class="item">
  109. <div class="label">
  110. <img
  111. class="icon"
  112. :src="
  113. require('@/assets/svg/icon-winners.svg')
  114. "
  115. />
  116. Winners
  117. </div>
  118. <input
  119. v-model="baseFormData.totalCount"
  120. placeholder="0"
  121. @input="onCountInput"
  122. @blur="onCountBlur"
  123. />
  124. </div>
  125. </div>
  126. <!-- 刷新按钮、充值 -->
  127. <div class="form-base-help" v-show="currentCurrencyInfo.currencyCode">
  128. <div class="currency-operation">
  129. <div class="balance">
  130. <img
  131. :src="
  132. require('@/assets/svg/icon-balance.svg')
  133. "
  134. />
  135. Balance
  136. </div>
  137. <div class="amount">
  138. {{currentCurrencyInfo.balance}}
  139. <img
  140. :class="{ 'icon-refresh-rotate': refreshRotate }"
  141. @click="updateCurrencyBanlce"
  142. :src="
  143. require('@/assets/svg/icon-form-refresh.svg')
  144. "
  145. />
  146. </div>
  147. <div v-if="currentCurrencyInfo.currencyCode != 'USD'" class="top-up" @click="goTopUp">Deposit</div>
  148. </div>
  149. <div class="msg">
  150. Recommend winners 100~10000
  151. </div>
  152. </div>
  153. <div class="form-label">Tasks</div>
  154. <!-- 转推、like、关注 -->
  155. <div class="form-require">
  156. <div
  157. class="form-item"
  158. v-for="(item, index) in formList"
  159. :key="index"
  160. >
  161. <div class="item-left">
  162. <div class="label">
  163. <img
  164. class="icon"
  165. :src="item.icon"
  166. />
  167. {{ item.label }}
  168. </div>
  169. <div
  170. class="control"
  171. v-if="item.nodeType == 'textarea'"
  172. >
  173. <follow-input
  174. :isAddSelf="!isBack"
  175. :atUserList="atUserList"
  176. @addUser="addFollowUser"
  177. @setUser="setFollowUser"
  178. @delUser="delFollowUser"
  179. ></follow-input>
  180. </div>
  181. <!-- join discord -->
  182. <div
  183. class="control"
  184. v-if="item.nodeType == 'input'"
  185. >
  186. <div v-if="showDiscordInvitePop"
  187. class="discord-invite-info"
  188. @click="showDiscordInvitePop = false">
  189. <img class="icon" :src="discordInviteInfo.icon || require('@/assets/svg/icon-discord-mini.svg')" />
  190. <span class="name">{{discordInviteInfo.name}}</span>
  191. </div>
  192. <input v-model="item.text"
  193. placeholder="Enter discord invite link"
  194. class="discord-address"
  195. @input="onIptDiscordAddress($event, index)"
  196. @blur="onBlurDiscordAddress($event, index)" />
  197. </div>
  198. </div>
  199. <el-switch
  200. v-if="item.type == 2 || item.type == 7 || item.type == 8"
  201. v-model="item.checked"
  202. @change="formSwitchChange($event, item, index)"
  203. />
  204. <img
  205. v-if="item.type == 3"
  206. :src="
  207. require('@/assets/svg/icon-option-checked.svg')
  208. "
  209. />
  210. </div>
  211. </div>
  212. <!-- 机器人 -->
  213. <!-- <div class="anti-bot-wrapper">
  214. <div class="label">
  215. <img
  216. :src="
  217. require('@/assets/svg/icon-anti-bot.svg')
  218. "
  219. class="icon-bot"
  220. />
  221. Anti Bot
  222. <img
  223. :src="
  224. require('@/assets/svg/icon-beta.svg')
  225. "
  226. class="icon-beta"
  227. />
  228. <img
  229. :src="
  230. require('@/assets/svg/icon-question.svg')
  231. "
  232. class="icon-question"
  233. />
  234. </div>
  235. <el-switch v-model="openAntiBot" />
  236. </div> -->
  237. <!-- 提示 -->
  238. <ul class="tips-wrapper">
  239. <li class="row">
  240. Rewards can only be claimed after the target user completes all tasks you set.
  241. </li>
  242. <li class="row">
  243. Each user can only receive a reward once per task.
  244. </li>
  245. <li class="row">
  246. 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.
  247. </li>
  248. </ul>
  249. <div class="submit-btn-wrapper">
  250. <div class="submit-btn"
  251. :class="{ 'disabled-submit': iptErrMsgTxt != '' && !depositGuide }"
  252. @click="confirm">
  253. <img class="icon-loading"
  254. v-if="submitIng"
  255. :src="require('@/assets/svg/icon-btn-loading.svg')"
  256. />
  257. {{iptErrMsgTxt ? iptErrMsgTxt : 'NEXT'}}
  258. </div>
  259. </div>
  260. </div>
  261. <!-- 预览 -->
  262. <template v-else-if="showComType == 'preview'">
  263. <preview-card
  264. :currentCurrencyInfo="currentCurrencyInfo"
  265. :postData="publishRes"
  266. :baseFormData="baseFormData"
  267. :amountFontSize="previewFontSize"
  268. ></preview-card>
  269. </template>
  270. <!-- paypal支付按钮 -->
  271. <div v-show="showComType == 'preview'">
  272. <paypal-button
  273. :finalAmountData="finalAmountData"
  274. :payConfig="{
  275. paypalClientId,
  276. feeDesc: payConfig.feeDesc,
  277. paypalHtml,
  278. amount: baseFormData.amountValue,
  279. postId
  280. }"
  281. :currentCurrencyInfo="currentCurrencyInfo"
  282. @payPalFinsh="payPalFinsh"
  283. ></paypal-button>
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. </div>
  289. <!-- 提示 -->
  290. <message-box
  291. :dialogVisible="showMessageBox"
  292. :title="messageBoxData.title"
  293. :content="messageBoxData.content"
  294. @cancel="messageBoxCancel"
  295. @confirm="messageBoxConfirm"
  296. ></message-box>
  297. </div>
  298. </template>
  299. <script setup>
  300. import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick } from "vue";
  301. import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord, getCurrencyInfoByCode } from "@/http/publishApi";
  302. import { getInviteGuildInfo, saveInviteGuildInfo } from "@/http/discordApi";
  303. import { payCalcFee, getPayConfig } from "@/http/pay";
  304. import { getFrontConfig } from "@/http/account";
  305. import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
  306. import { debounce } from "@/uilts/help"
  307. import Report from "@/log-center/log"
  308. import { ElMessage, ElLoading } from "element-plus";
  309. import "element-plus/es/components/message/style/css";
  310. import {create, all} from "mathjs";
  311. import messageBox from "@/view/components/message-box.vue";
  312. import currencyList from "@/view/components/currency-list.vue";
  313. import previewCard from "@/view/iframe/publish/components/preview-card";
  314. import followInput from "@/view/iframe/publish/components/follow-input";
  315. import paypalButton from "@/view/iframe/publish/components/paypal-button";
  316. import topUp from "@/view/iframe/publish/components/top-up.vue";
  317. const config = {
  318. number: 'BigNumber',
  319. }
  320. const math = create(all, config);
  321. //临时货币信息
  322. let tempCurrentCurrencyInfo = ref({});
  323. let paypalClientId = ref("");
  324. let payConfig = ref({});
  325. let paypalHtml = ref("");
  326. // 发布后返回的结果
  327. let publishRes = reactive({});
  328. //弹窗是否展示
  329. let visible = ref(false);
  330. //弹窗高度
  331. let dialogHeight = ref(680);
  332. // 当前展示组件内容 default(表单) preview(预览) topUp(充值)
  333. let showComType = ref("default");
  334. let currentComData = {
  335. default: {
  336. title: "Giveaway",
  337. },
  338. preview: {
  339. title: "Preview",
  340. },
  341. topUp: {
  342. title: "Deposit",
  343. },
  344. };
  345. // 机器人开关
  346. let openAntiBot = ref(false);
  347. // 是否正在提交
  348. let submitIng = ref(false);
  349. // 艾特关注人列表
  350. let atUserList = ref([]);
  351. // 表单错误提示
  352. let iptErrMsgTxt = ref("Select a reward");
  353. // 是否返回
  354. let isBack = ref(false);
  355. // 展示消息提示
  356. let showMessageBox = ref(false);
  357. // 展示货币列表pop
  358. let showCurrencyPop = ref(false);
  359. // 展示更多按钮下的选项
  360. let showMoreOption = ref(false);
  361. // 货币列表的dom
  362. let currencyListDom = ref('');
  363. // 刷新按钮旋转
  364. let refreshRotate = ref(false);
  365. // 预览字体大小
  366. let previewFontSize = ref(56);
  367. let postId = ref('');
  368. // 余额是否同步中
  369. let asyncIng = ref(false);
  370. // 提交按钮-充值引导提示
  371. let depositGuide = ref(false);
  372. let messageBoxData = ref({
  373. title: "",
  374. content: "",
  375. });
  376. // 真实支付金额数据
  377. let finalAmountData = ref({
  378. currencyCode: '',
  379. feeAmountValue: 0,
  380. finalAmountValue: 0,
  381. requestAmountValue: 0,
  382. });
  383. // 表单数据
  384. let baseFormData = reactive({
  385. amountCurrencyCode: '',
  386. amountValue: "",
  387. totalCount: "",
  388. });
  389. // 当前选择的货币信息
  390. let currentCurrencyInfo = ref({
  391. currencyCode: "",
  392. currencyName: "",
  393. balance: "",
  394. currencyType: "",
  395. iconPath: "",
  396. minAmount: "",
  397. tokenChain: "",
  398. tokenSymbol: "",
  399. usdEstimateBalance: ""
  400. });
  401. const discordIptErrTxt = 'Discord invite link is wrong';
  402. const discordIptEmptyErrTxt = 'Enter discord invite link';
  403. const discordIptNerverExpiresErrTxt = 'Make sure the Discord link never expires'
  404. let iptErrType = ''; //discord
  405. let formList = reactive([
  406. {
  407. label: "Follow",
  408. icon: require("@/assets/svg/icon-task-twitter.svg"),
  409. nodeType: "textarea",
  410. type: 1,
  411. text: [],
  412. checked: true,
  413. },
  414. {
  415. label: "Retweet",
  416. icon: require("@/assets/svg/icon-task-twitter.svg"),
  417. nodeType: "div",
  418. type: 3,
  419. checked: true,
  420. },
  421. {
  422. label: "Like Tweet",
  423. icon: require("@/assets/svg/icon-task-twitter.svg"),
  424. nodeType: "div",
  425. type: 2,
  426. checked: true,
  427. },
  428. {
  429. label: "Repost to Facebook",
  430. icon: require("@/assets/svg/icon-task-facebook.svg"),
  431. nodeType: "div",
  432. text: '',
  433. type: 8,
  434. checked: true,
  435. },
  436. {
  437. label: "Join Discord",
  438. icon: require("@/assets/svg/icon-discord-mini.svg"),
  439. nodeType: "input",
  440. text: '',
  441. type: 7,
  442. checked: true,
  443. },
  444. ]);
  445. const discordInviteInfo = ref({});
  446. let showDiscordInvitePop = ref(false);
  447. const props = defineProps({
  448. dialogVisible: {
  449. type: Boolean,
  450. default: false,
  451. },
  452. });
  453. watch(
  454. () => props.dialogVisible,
  455. (newVal) => {
  456. console.log("watch", newVal);
  457. visible.value = newVal;
  458. if (newVal) {
  459. Report.reportLog({
  460. pageSource: Report.pageSource.publisherDialog,
  461. businessType: Report.businessType.pageView,
  462. });
  463. getLocalCurrencyInfoByCode();
  464. setTimeout(() => {
  465. setDialogHeight();
  466. }, 300);
  467. }
  468. }
  469. );
  470. const emits = defineEmits(["close", "confirm", "payPalFinsh"]);
  471. const close = () => {
  472. if (showComType.value != "default") {
  473. showComType.value = "default";
  474. calcDomZoom();
  475. isBack.value = true;
  476. } else {
  477. initParams();
  478. emits("close", false);
  479. }
  480. };
  481. /**
  482. * 设置弹窗高度
  483. */
  484. const setDialogHeight = (resize = false) => {
  485. nextTick(() => {
  486. let clientHeight = window.innerHeight;
  487. let gapSafe = 40;
  488. console.log('resize',resize)
  489. if (dialogHeight.value > clientHeight - gapSafe) {
  490. dialogHeight.value = clientHeight - gapSafe;
  491. } else {
  492. if(resize) {
  493. dialogHeight.value = 680;
  494. }
  495. }
  496. })
  497. };
  498. const selectCurrencyPopHandle = () => {
  499. Report.reportLog({
  500. pageSource: Report.pageSource.currencySelectorPage,
  501. businessType: Report.businessType.pageView,
  502. });
  503. showCurrencyPop.value = true;
  504. nextTick(() => {
  505. if(currencyListDom.value) {
  506. currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList();
  507. }
  508. })
  509. }
  510. /**
  511. * 获取实际支付金额
  512. */
  513. const getPayAmount = async (amountValue) => {
  514. let res = await payCalcFee({
  515. params: {
  516. amountValue,
  517. currencyCode: currentCurrencyInfo.value.currencyCode,
  518. payChannel: 'paypal',
  519. },
  520. });
  521. if (res.code == 0) {
  522. let { finalAmountValue, feeDesc } = res.data;
  523. payConfig.value.feeDesc = feeDesc;
  524. if (finalAmountValue > 0) {
  525. finalAmountData.value = res.data;
  526. }
  527. }
  528. return res.data;
  529. };
  530. const saveDiscordGuildInfo = () => {
  531. let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
  532. if(guildId && inviteCode && inviteUrl) {
  533. saveInviteGuildInfo({
  534. params: {
  535. guildId,
  536. inviteCode,
  537. inviteUrl
  538. }
  539. })
  540. }
  541. }
  542. const confirm = () => {
  543. if(depositGuide.value) { //余额不够去充值
  544. goTopUp();
  545. return;
  546. }
  547. if (submitIng.value || iptErrMsgTxt.value) {
  548. return;
  549. }
  550. let { totalCount = 0 } = baseFormData;
  551. if (!totalCount) {
  552. return;
  553. }
  554. saveDiscordGuildInfo();
  555. submitRequest();
  556. };
  557. /**
  558. * 货币列表-选中货币
  559. */
  560. const selectCurrency = (params) => {
  561. tempCurrentCurrencyInfo.value = params;
  562. depositGuide.value = false;
  563. if(params.currencyCode != "USD" && params.balance < params.minAmount) {
  564. let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
  565. messageBoxBlock({
  566. title: `Whether to deposit ${tokenSymbol}`,
  567. content: `Insufficient ${tokenSymbol} balance`,
  568. });
  569. } else {
  570. currentCurrencyInfo.value = params;
  571. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  572. showCurrencyPop.value = false;
  573. finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
  574. calcDomZoom();
  575. resetFormIpt();
  576. onIptSetErrorTxt();
  577. }
  578. };
  579. const calcDomZoom = () => {
  580. nextTick(() => {
  581. let maxWidth = 68;
  582. var textWidth = document.querySelector('.text').offsetWidth;
  583. if(textWidth > 68) {
  584. var scale = maxWidth / textWidth;
  585. document.querySelector('.text').style.zoom = scale;
  586. }
  587. })
  588. }
  589. const resetFormIpt = () => {
  590. baseFormData.amountValue = "";
  591. baseFormData.totalCount = "";
  592. }
  593. const setLocalSelectCurrencyInfo = (params = {}) => {
  594. setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})
  595. }
  596. /**
  597. * 获取完货币列表
  598. */
  599. const setCurrentCurrencyInfo = (params) => {
  600. }
  601. const messageBoxBlock = ({ title = "", content = "" }) => {
  602. showMessageBox.value = true;
  603. messageBoxData.value.title = title;
  604. messageBoxData.value.content = content;
  605. };
  606. /**
  607. * 确定
  608. */
  609. const messageBoxConfirm = () => {
  610. showMessageBox.value = false;
  611. goTopUp();
  612. };
  613. /**
  614. * 取消
  615. */
  616. const messageBoxCancel = () => {
  617. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  618. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  619. showMessageBox.value = false;
  620. showCurrencyPop.value = false;
  621. calcDomZoom();
  622. resetFormIpt();
  623. onIptSetErrorTxt();
  624. };
  625. /**
  626. * 去充值
  627. */
  628. const goTopUp = () => {
  629. Report.reportLog({
  630. pageSource: Report.pageSource.rechargePage,
  631. businessType: Report.businessType.pageView,
  632. });
  633. showComType.value = 'topUp';
  634. }
  635. /**
  636. * 充值done事件
  637. */
  638. const topUpDone = () => {
  639. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  640. asyncIng.value = true;
  641. depositGuide.value = false;
  642. asyncIng.value = false;
  643. showCurrencyPop.value = false;
  644. showComType.value = 'default';
  645. calcDomZoom();
  646. onIptSetErrorTxt()
  647. asyncTokenRechRecord((res) => {
  648. if(res.code == 0 && res.data && res.data.length) {
  649. let currencyInfo = res.data[0];
  650. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  651. currentCurrencyInfo.value.balance = currencyInfo.balance;
  652. onIptSetErrorTxt()
  653. }
  654. }
  655. })
  656. }
  657. /**
  658. * 更新货币余额
  659. */
  660. const updateCurrencyBanlce = () => {
  661. if(!refreshRotate.value) {
  662. refreshRotate.value = true;
  663. setTimeout(() => {
  664. refreshRotate.value = false;
  665. }, 1000)
  666. }
  667. asyncTokenRechRecord((res) => {
  668. if(res.code == 0 && res.data && res.data.length) {
  669. let currencyInfo = res.data[0];
  670. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  671. currentCurrencyInfo.value.balance = currencyInfo.balance;
  672. }
  673. }
  674. })
  675. }
  676. /**
  677. * 同步链上交易
  678. */
  679. const asyncTokenRechRecord = (cb) => {
  680. syncChainTokenRechargeRecord({
  681. params: {
  682. currencyCode: currentCurrencyInfo.value.currencyCode
  683. }
  684. }).then(res => {
  685. cb && cb(res)
  686. })
  687. }
  688. /**
  689. * 提交表单请求
  690. */
  691. const submitRequest = async () => {
  692. let { amountValue = 0, totalCount = 0 } = baseFormData;
  693. baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
  694. // 组装提交参数
  695. let finishConditions = [];
  696. for (let i = 0; i < formList.length; i++) {
  697. let item = {};
  698. item.type = formList[i]["type"];
  699. if (item.type == 1 && atUserList.value.length) {
  700. // follow 参数
  701. let relatedUsers = atUserList.value;
  702. item.relatedUsers = relatedUsers;
  703. finishConditions.push(item);
  704. } else if (formList[i]["type"] == 7) {
  705. // join discord
  706. if(formList[i]["checked"] && formList[i]["text"]) {
  707. item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
  708. finishConditions.push(item);
  709. }
  710. } else if (formList[i]["checked"]) {
  711. // 其余任务
  712. finishConditions.push(item);
  713. }
  714. }
  715. let receiveConditions = openAntiBot.value ? "" : [];
  716. // 提交参数
  717. let formData = {
  718. amountCurrencyCode: baseFormData.amountCurrencyCode,
  719. amountValue,
  720. totalCount,
  721. finishConditions,
  722. receiveConditions,
  723. payAmountValue: amountValue
  724. };
  725. submitIng.value = true;
  726. // 法币支付需要计算费率
  727. if(formData.amountCurrencyCode == "USD") {
  728. let payAmountRes = await getPayAmount(amountValue);
  729. formData["payAmountValue"] = payAmountRes.finalAmountValue;
  730. }
  731. let data = {
  732. params: {
  733. postBizData: JSON.stringify(formData),
  734. postSrc: 1, //1 twitter
  735. postType: 1, //1 红包
  736. },
  737. };
  738. postPublish(data).then((res) => {
  739. submitIng.value = false;
  740. if (res.code == 0) {
  741. publishRes = res.data;
  742. postId.value = res.data.postId;
  743. Report.reportLog({
  744. pageSource: Report.pageSource.previewPage,
  745. businessType: Report.businessType.pageView,
  746. });
  747. showComType.value = "preview";
  748. previewFontSize.value = calcFontSize(baseFormData.amountValue, 238, 56);
  749. isBack.value = false;
  750. } else {
  751. console.log(res);
  752. }
  753. })
  754. .catch((err) => {
  755. console.log(err);
  756. });
  757. };
  758. const calcFontSize = (str, domWidth, maxSize) => {
  759. let lenstr = str.length;
  760. let num = parseInt(domWidth / lenstr);
  761. let fontSize = num < maxSize ? num : maxSize
  762. return fontSize;
  763. }
  764. /**
  765. * 初始化提交参数
  766. */
  767. const initParams = () => {
  768. resetFormIpt();
  769. // clear follow value
  770. atUserList.value = [];
  771. submitIng.value = false;
  772. isBack.value = false;
  773. showCurrencyPop.value = false;
  774. openAntiBot.value = false;
  775. tempCurrentCurrencyInfo.value = {};
  776. currentCurrencyInfo.value = {};
  777. // clear discord value
  778. setDiscordIptTxt({text: ''});
  779. discordInviteInfo.value = {};
  780. };
  781. const setDiscordIptTxt = ({text}) => {
  782. const index = formList.findIndex(item => item.type == 7);
  783. formList[index]['text'] = text;
  784. }
  785. /**
  786. * 支付完成回调
  787. */
  788. const payPalFinsh = (params) => {
  789. let {payNetwork, payStatus} = params;
  790. // token 支付
  791. if(payNetwork == 'bsc') {
  792. payStatusHandle(payStatus);
  793. } else {
  794. // 法币支付
  795. let transaction = params.transaction;
  796. let loadingInstance = ElLoading.service({
  797. background: "rgba(0,0,0,.3)",
  798. });
  799. verifyPaypalResult({
  800. params: {
  801. paypalTransactionId: transaction.id,
  802. postId: publishRes.postId,
  803. paypalClientId: paypalClientId.value,
  804. },
  805. }).then((res) => {
  806. loadingInstance.close();
  807. if (res.code == 0) {
  808. if (res.data) {
  809. payStatusHandle(res.data.payStatus)
  810. }
  811. }
  812. })
  813. .catch(() => {
  814. loadingInstance.close();
  815. });
  816. }
  817. };
  818. const payStatusHandle = (payStatus) => {
  819. //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
  820. switch (payStatus) {
  821. case 1:
  822. emits("payPalFinsh", { publishRes });
  823. showComType.value = "default";
  824. initParams();
  825. break;
  826. case 2:
  827. // ElMessage({
  828. // message: "Pay Fail",
  829. // type: "warning",
  830. // });
  831. break;
  832. case 3:
  833. // ElMessage({
  834. // message: "Pay Exceptions",
  835. // type: "warning",
  836. // });
  837. break;
  838. case 4:
  839. // ElMessage({
  840. // message: "Pay Exceptions",
  841. // type: "warning",
  842. // });
  843. break;
  844. }
  845. }
  846. /**
  847. * follow组件触发新增关注人
  848. */
  849. const addFollowUser = (params) => {
  850. atUserList.value.push(params);
  851. };
  852. const setFollowUser = (params) => {
  853. atUserList.value[params.index]["name"] = params.name;
  854. };
  855. const delFollowUser = (params) => {
  856. atUserList.value.splice(params.index, 1);
  857. };
  858. const onAmountInput = () => {
  859. let val = baseFormData.amountValue;
  860. // val = val.replace(/[^\d^\.]+/g, "");
  861. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  862. if(val == '00') {
  863. val = '0'
  864. }
  865. if(val.indexOf('.') > -1){ //校验 例:00.12 => 0.12
  866. let arr = val.split('.');
  867. if(arr[0].startsWith('0')) {
  868. let num = +arr[0];
  869. val = num + '.' + arr[1];
  870. }
  871. }
  872. baseFormData.amountValue = val;
  873. setInputErrorMsg({from: 'amount', type:'input'});
  874. return val;
  875. };
  876. const onCountInput = () => {
  877. let val = baseFormData.totalCount;
  878. if (val == 0) {
  879. val = "";
  880. }
  881. // val = val.replace(/[^\d]/g, "");
  882. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  883. baseFormData.totalCount = val;
  884. setInputErrorMsg({from: 'count', type:'input'});
  885. return val;
  886. };
  887. /**
  888. * 金额输入失焦
  889. */
  890. const onAmountBlur = () => {
  891. setInputErrorMsg({from: 'amount', type:'blur'});
  892. };
  893. /**
  894. * count失焦,校验输入结果
  895. */
  896. const onCountBlur = () => {
  897. setInputErrorMsg({from: 'count', type:'blur'});
  898. };
  899. /**
  900. * 输入结果金额和数量 (金额/数量)是否小于最小货币单位
  901. */
  902. const calcIptValue = (cb) => {
  903. let amountValue = baseFormData.amountValue;
  904. let totalCount = baseFormData.totalCount;
  905. let flag = true;
  906. if (!amountValue || !totalCount) {
  907. return {
  908. flag
  909. };
  910. }
  911. if (math.format(math.evaluate(`${baseFormData.amountValue} / ${baseFormData.totalCount}`)) < +currentCurrencyInfo.value.minAmount) {
  912. flag = false;
  913. }
  914. return {
  915. flag,
  916. count: Math.floor(math.format(math.evaluate(`${baseFormData.amountValue} / ${currentCurrencyInfo.value.minAmount}`)))
  917. }
  918. };
  919. /**
  920. * 设置输入提示语
  921. */
  922. const setInputErrorMsg = () => {
  923. onIptSetErrorTxt();
  924. };
  925. /**
  926. * 输入时 检测设置错误信息
  927. */
  928. const onIptSetErrorTxt = (params = {}) => {
  929. depositGuide.value = false;
  930. if(!currentCurrencyInfo.value.currencyCode) {
  931. iptErrMsgTxt.value = "Select a reward"
  932. } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
  933. iptErrMsgTxt.value = "Enter an amount";
  934. } else if (!baseFormData.totalCount || baseFormData.totalCount == '0') {
  935. iptErrMsgTxt.value = "Enter the number of winners";
  936. } else if(+baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
  937. let res = calcIptValue();
  938. if (!res.flag) {
  939. iptErrMsgTxt.value = `${baseFormData.amountValue} ${currentCurrencyInfo.value.tokenSymbol} Can send up to ${res.count} winners`;
  940. } else {
  941. iptErrMsgTxt.value = "";
  942. if(params.actionType != 'discord_blur') {
  943. setDiscordErrTxt({getDuildId: true});
  944. }
  945. }
  946. } else if(currentCurrencyInfo.value.currencyCode != 'USD') {
  947. depositGuide.value = true;
  948. iptErrMsgTxt.value = `Insufficient ${currentCurrencyInfo.value.tokenSymbol} balance, please deposit`;
  949. }
  950. }
  951. /**
  952. * 监听开关触发事件
  953. */
  954. const formSwitchChange = (val, params, index) => {
  955. console.log('formSwitchChange')
  956. if(params.type == 7) {
  957. if(!val) {
  958. //错误类型 discord 清空discord错误校验
  959. if(iptErrType == 'discord') {
  960. iptErrMsgTxt.value = '';
  961. formList[index]['text'] = '';
  962. onIptSetErrorTxt();
  963. }
  964. } else {
  965. onIptSetErrorTxt();
  966. }
  967. }
  968. }
  969. /** 监听 discord 输入 */
  970. const onIptDiscordAddress = (e, index) => {
  971. let val = formList[index].text;
  972. let checked = formList[index].checked;
  973. if(val && !checked) {
  974. checked = true;
  975. formList[index].checked = checked;
  976. formList[index].text = formList[index].text.replace(/\s/g,'');
  977. } else if(!val){
  978. discordInviteInfo.value = {};
  979. }
  980. onIptDiscordDebounce()
  981. }
  982. const onBlurDiscordAddress = (e, index) => {
  983. setDiscordErrTxt({fromType: 'discord', showPop: false, actionType: 'discord_blur'});
  984. }
  985. const getDiscordIptData = () => {
  986. let discordItem = formList.find(item => item.type == 7);
  987. return discordItem;
  988. }
  989. /**
  990. * 设置输入discord错误提示信息
  991. */
  992. const setDiscordErrTxt = (params = {showPop: false}) => {
  993. let discordData = getDiscordIptData() || {};
  994. if(discordData.checked) {
  995. if(discordData.text) {
  996. let validata = checkInviteUrl(discordData.text);
  997. if(validata) {
  998. getDiscordInviteInfo({inviteUrl: discordData.text, getDuildId: params.getDuildId}, (res) => {
  999. console.log('discordData',res)
  1000. // 未知的邀请链接
  1001. if(res.inviteCode != res.data.code || !res.data.guildId) {
  1002. iptErrMsgTxt.value = discordIptErrTxt;
  1003. iptErrType = 'discord';
  1004. } else {
  1005. if(res.data.expires !== null) {
  1006. // 不是永久邀请链接
  1007. iptErrMsgTxt.value = discordIptNerverExpiresErrTxt;
  1008. iptErrType = '';
  1009. } else {
  1010. if(iptErrMsgTxt.value) {
  1011. iptErrMsgTxt.value = '';
  1012. iptErrType = '';
  1013. }
  1014. if(params.showPop && res.data) {
  1015. showDiscordInvitePop.value = true;
  1016. setTimeout(() => {
  1017. showDiscordInvitePop.value = false;
  1018. }, 2000)
  1019. }
  1020. if(params.fromType == 'discord') {
  1021. onIptSetErrorTxt();
  1022. }
  1023. }
  1024. }
  1025. })
  1026. } else {
  1027. iptErrMsgTxt.value = discordIptErrTxt;
  1028. iptErrType = 'discord';
  1029. }
  1030. } else {
  1031. if(params.actionType == 'discord_blur') {
  1032. onIptSetErrorTxt({acitonType: 'discord_blur'});
  1033. } else {
  1034. // 设置空提示
  1035. iptErrMsgTxt.value = discordIptEmptyErrTxt;
  1036. iptErrType = 'discord';
  1037. }
  1038. }
  1039. }
  1040. }
  1041. const onIptDiscordDebounce = debounce(function() {
  1042. setDiscordErrTxt({fromType: 'discord', showPop: true});
  1043. }, 800)
  1044. /**
  1045. * 校验 discord邀请url
  1046. */
  1047. const checkInviteUrl = (inviteUrl) => {
  1048. let flag = false;
  1049. const INVITE_URL_PREFIX_1 = 'https://discord.gg/';
  1050. const INVITE_URL_PREFIX_2 = 'https://discord.com/invite/';
  1051. const INVITE_URL_PREFIX_3 = 'http://discord.gg/';
  1052. const INVITE_URL_PREFIX_4 = 'http://discord.com/invite/';
  1053. const INVITE_URL_PREFIX_5 = 'discord.gg/';
  1054. const INVITE_URL_PREFIX_6 = 'discord.com/invite/';
  1055. 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]
  1056. if(inviteUrl) {
  1057. if(arr.indexOf(inviteUrl) > -1) {
  1058. flag = false;
  1059. } else {
  1060. let isPass = false;
  1061. for(let i = 0; i < arr.length; i++) {
  1062. let item = arr[i];
  1063. if(inviteUrl.startsWith(item)) {
  1064. isPass = true;
  1065. break;
  1066. }
  1067. }
  1068. flag = isPass;
  1069. }
  1070. }
  1071. return flag;
  1072. }
  1073. /**获取discord 邀请信息 */
  1074. const getDiscordInviteInfo = ({inviteUrl, getDuildId}, cb) => {
  1075. if(!inviteUrl) return;
  1076. let inviteCode = '';
  1077. let arr = inviteUrl.split('/');
  1078. if(arr.length > 0) {
  1079. inviteCode = arr[arr.length - 1];
  1080. }
  1081. if(!getDuildId && discordInviteInfo.value.guildId && discordInviteInfo.value.inviteCode == inviteCode) {
  1082. return;
  1083. }
  1084. getInviteGuildInfo({
  1085. inviteCode
  1086. }).then(res => {
  1087. if(!res) {
  1088. res = {};
  1089. }
  1090. let {name, icon, id} = res.guild || {};
  1091. icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
  1092. let resData = {
  1093. inviteCode,
  1094. data: {
  1095. code: res.code,
  1096. guildId: id,
  1097. inviteUrl,
  1098. inviteCode,
  1099. expires: res.expires_at,
  1100. name,
  1101. icon,
  1102. }
  1103. }
  1104. discordInviteInfo.value = resData.data;
  1105. cb && cb(resData);
  1106. }).catch((err) => {
  1107. if(iptErrMsgTxt.value && iptErrType == 'discord') {
  1108. iptErrMsgTxt.value = '';
  1109. iptErrType = '';
  1110. }
  1111. });
  1112. }
  1113. /**
  1114. * 获取支付配置(paypalClientId)
  1115. */
  1116. const setPayConfig = () => {
  1117. getPayConfig({
  1118. params: {},
  1119. }).then((res) => {
  1120. if (res.code == 0) {
  1121. payConfig.value = res.data;
  1122. paypalClientId.value = res.data.paypalClientId;
  1123. }
  1124. });
  1125. };
  1126. /**
  1127. * 获取配置
  1128. */
  1129. const setFrontConfig = () => {
  1130. getFrontConfig({
  1131. params: {},
  1132. }).then((res) => {
  1133. if (res.code == 0) {
  1134. paypalHtml.value = res.data.paypalHtml;
  1135. }
  1136. });
  1137. };
  1138. const goTransactionsList = () => {
  1139. window.open(`${chrome.runtime.getURL('/iframe/home.html#/transactions')}`)
  1140. }
  1141. /**
  1142. * 默认获取上次选中的货币信息
  1143. */
  1144. const getLocalCurrencyInfoByCode = () => {
  1145. if(!currentCurrencyInfo.value.currencyCode) {
  1146. getChromeStorage('selectCurrencyInfo', (res) => {
  1147. if(res && res.currencyCode) {
  1148. getCurrencyInfoByCode({
  1149. params: {
  1150. currencyCode: res.currencyCode
  1151. }
  1152. }).then(res => {
  1153. if(res.code == 0 && res.data) {
  1154. currentCurrencyInfo.value = res.data;
  1155. tempCurrentCurrencyInfo.value = res.data;
  1156. onIptSetErrorTxt();
  1157. }
  1158. });
  1159. }
  1160. })
  1161. }
  1162. }
  1163. onMounted(() => {
  1164. setFrontConfig();
  1165. setPayConfig();
  1166. getLocalCurrencyInfoByCode();
  1167. document.onkeydown = function (e) {
  1168. var keyNum = window.event ? e.keyCode : e.which;
  1169. let escKey = 27;
  1170. if (keyNum == escKey) {
  1171. if (visible.value) {
  1172. // close();
  1173. }
  1174. }
  1175. };
  1176. window.addEventListener('resize', function () {
  1177. setDialogHeight(true);
  1178. })
  1179. });
  1180. </script>
  1181. <style lang="scss" scoped>
  1182. .overlay {
  1183. position: fixed;
  1184. top: 0;
  1185. right: 0;
  1186. bottom: 0;
  1187. left: 0;
  1188. z-index: 2000;
  1189. height: 100%;
  1190. background-color: rgba(0, 0, 0, 0.5);
  1191. overflow: auto;
  1192. .content {
  1193. height: 620px;
  1194. background: #ffffff;
  1195. border-radius: 20px;
  1196. position: absolute;
  1197. left: 50%;
  1198. top: 50%;
  1199. transform: translate(-50%, -50%);
  1200. box-sizing: border-box;
  1201. z-index: 2000;
  1202. .pop-mask {
  1203. width: 100%;
  1204. height:100%;
  1205. position: absolute;
  1206. z-index:900;
  1207. }
  1208. .head {
  1209. border-bottom: 1px solid #ececec;
  1210. height: 48px;
  1211. box-sizing: border-box;
  1212. display: flex;
  1213. align-items: center;
  1214. justify-content: space-between;
  1215. padding: 0 14px;
  1216. .left {
  1217. display: flex;
  1218. align-items: center;
  1219. .title {
  1220. font-size: 16px;
  1221. font-weight: 500;
  1222. }
  1223. .close-btn {
  1224. display: flex;
  1225. align-items: center;
  1226. width: max-content;
  1227. margin-right: 12px;
  1228. cursor: pointer;
  1229. }
  1230. }
  1231. .right {
  1232. .more {
  1233. cursor: pointer;
  1234. }
  1235. .area-option {
  1236. width: 100%;
  1237. height: 100%;
  1238. position: absolute;
  1239. top: 0;
  1240. left: 0;
  1241. z-index: 111;
  1242. .option {
  1243. position: absolute;
  1244. top: 43px;
  1245. right: 15px;
  1246. background: #fff;
  1247. filter: drop-shadow(0px 3px 20px rgba(0, 0, 0, 0.2));
  1248. width: 240px;
  1249. border-radius: 15px;
  1250. overflow: hidden;
  1251. .item {
  1252. width: 100%;
  1253. height: 50px;
  1254. display: flex;
  1255. align-items: center;
  1256. cursor: pointer;
  1257. border-top: 1px solid #E9E9E9;
  1258. img {
  1259. margin-left: 15px;
  1260. width: 30px;
  1261. height: 30px;
  1262. margin-right: 6px;
  1263. }
  1264. span {
  1265. font-weight: 500;
  1266. font-size: 14px;
  1267. }
  1268. }
  1269. .item:first-child {
  1270. border-top: 0;
  1271. }
  1272. .item:hover {
  1273. background: #F5F5F5;
  1274. }
  1275. }
  1276. }
  1277. }
  1278. }
  1279. .body {
  1280. box-sizing: border-box;
  1281. height: calc(100% - 48px);
  1282. display: flex;
  1283. position: relative;
  1284. .icon-guide-select {
  1285. width: 40px;
  1286. position: absolute;
  1287. top: 78px;
  1288. left: 25px;
  1289. z-index: 1000;
  1290. }
  1291. .body-content {
  1292. display:flex;
  1293. width:100%;
  1294. }
  1295. .currency-pop {
  1296. position: absolute;
  1297. width: 375px;
  1298. height: 480px;
  1299. top: 85px;
  1300. left: 88px;
  1301. z-index: 1000;
  1302. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1303. background-color: #fff;
  1304. border-radius: 20px;
  1305. overflow-y: scroll;
  1306. }
  1307. .left,
  1308. .right {
  1309. height: 100%;
  1310. }
  1311. .left {
  1312. width: 50px;
  1313. display: flex;
  1314. flex-direction: column;
  1315. justify-content: space-between;
  1316. align-items: center;
  1317. .gift-pack-wrapper {
  1318. width: 100%;
  1319. height: 55px;
  1320. background: #f5f5f5;
  1321. display: flex;
  1322. align-items: center;
  1323. justify-content: center;
  1324. }
  1325. .bottom {
  1326. .icon {
  1327. display: block;
  1328. margin-bottom: 26px;
  1329. }
  1330. }
  1331. }
  1332. .right {
  1333. width: calc(100% - 50px);
  1334. box-sizing: border-box;
  1335. position: relative;
  1336. border-left: 1px solid #ececec;
  1337. .form-wrapper {
  1338. padding: 0px 18px 18px 18px;
  1339. height: calc(100% - 80px);
  1340. overflow-y: scroll;
  1341. overflow-x: hidden;
  1342. box-sizing: border-box;
  1343. .img-mode {
  1344. margin-left: -18px;
  1345. }
  1346. .form-base-help {
  1347. display: flex;
  1348. justify-content: space-between;
  1349. margin-top: 10px;
  1350. .currency-operation:before{
  1351. box-sizing: content-box;
  1352. width: 0px;
  1353. height: 0px;
  1354. position: absolute;
  1355. top: -16px;;
  1356. left:46px;
  1357. padding:0;
  1358. border-bottom:8px solid #FFFFFF;
  1359. border-top:8px solid transparent;
  1360. border-left:8px solid transparent;
  1361. border-right:8px solid transparent;
  1362. display: block;
  1363. content:'';
  1364. z-index: 12;
  1365. }
  1366. .currency-operation:after{
  1367. box-sizing: content-box;
  1368. width: 0px;
  1369. height: 0px;
  1370. position: absolute;
  1371. top: -18px;;
  1372. left:45px;
  1373. padding:0;
  1374. border-bottom:9px solid #EAEAEA;
  1375. border-top:9px solid transparent;
  1376. border-left:9px solid transparent;
  1377. border-right:9px solid transparent;
  1378. display: block;
  1379. content:'';
  1380. z-index:10
  1381. }
  1382. .currency-operation {
  1383. position: relative;
  1384. height: 36px;
  1385. border: 1px solid #EAEAEA;
  1386. box-sizing: border-box;
  1387. padding: 10px;
  1388. display: flex;
  1389. align-items: center;
  1390. border-radius: 100px;
  1391. .balance,
  1392. .amount {
  1393. display: flex;
  1394. align-items: center;
  1395. }
  1396. .balance {
  1397. font-weight: 400;
  1398. font-size: 13px;
  1399. img {
  1400. width: 16px;
  1401. height: 16px;
  1402. margin-right: 3px;
  1403. }
  1404. }
  1405. .amount {
  1406. font-weight: 500;
  1407. font-size: 13px;
  1408. color: #4e4e4e;
  1409. margin-left: 5px;
  1410. img {
  1411. margin-left: 5px;
  1412. cursor: pointer;
  1413. }
  1414. }
  1415. .top-up {
  1416. font-weight: 500;
  1417. font-size: 12px;
  1418. color: #ff9839;
  1419. cursor: pointer;
  1420. margin-left: 8px;
  1421. }
  1422. .icon-refresh-rotate {
  1423. transform: rotate(360deg);
  1424. transition-duration: 1s;
  1425. }
  1426. }
  1427. .msg {
  1428. font-weight: 400;
  1429. font-size: 12px;
  1430. color: #acacac;
  1431. }
  1432. }
  1433. .form-base {
  1434. display: flex;
  1435. justify-content: space-between;
  1436. align-items: center;
  1437. margin-top: 14px;
  1438. .item {
  1439. width: 250px;
  1440. height: 50px;
  1441. box-sizing: border-box;
  1442. border-radius: 14px;
  1443. border: 1px solid #D1D9DD;
  1444. display: flex;
  1445. align-items: center;
  1446. justify-content: space-between;
  1447. padding: 16px 14px;
  1448. input {
  1449. width: 102px;
  1450. text-align: right;
  1451. font-weight: 500;
  1452. font-size: 18px;
  1453. border: none;
  1454. outline: none;
  1455. box-sizing: border-box;
  1456. }
  1457. input::placeholder {
  1458. color: #c5c5c5;
  1459. }
  1460. .label {
  1461. font-weight: 500;
  1462. font-size: 15px;
  1463. display: flex;
  1464. align-items: center;
  1465. .icon {
  1466. width: 20px;
  1467. height: 20px;
  1468. margin-right: 8px;
  1469. }
  1470. }
  1471. }
  1472. .item:first-child {
  1473. margin-right: 14px
  1474. }
  1475. .currency-select-wrapper {
  1476. padding: 0 !important;
  1477. input {
  1478. padding-right: 14px;
  1479. }
  1480. .currency-select {
  1481. max-width: 136px;
  1482. cursor: pointer;
  1483. background: #1D9BF0;
  1484. margin-left: 6px;
  1485. padding: 6px 10px;
  1486. border-radius: 12px;
  1487. color: #fff;
  1488. .text {
  1489. white-space: nowrap;
  1490. zoom: 0.85;
  1491. }
  1492. .arrow {
  1493. margin-left: 5px;
  1494. }
  1495. }
  1496. .selected {
  1497. background: #F4F4F4 !important;
  1498. color: #000 !important;
  1499. }
  1500. }
  1501. }
  1502. .form-label {
  1503. margin-top: 14px;
  1504. margin-bottom: 10px;
  1505. font-weight: 500;
  1506. font-size: 14px;
  1507. }
  1508. .form-require {
  1509. box-sizing: border-box;
  1510. border-radius: 15px;
  1511. margin-top: 12px;
  1512. border: 1px solid #D1D9DD;
  1513. .form-item {
  1514. min-height: 50px;
  1515. display: flex;
  1516. align-items: center;
  1517. justify-content: space-between;
  1518. margin: 0 16px;
  1519. border-bottom: 1px solid #ececec;
  1520. padding: 8px 0;
  1521. box-sizing: border-box;
  1522. .item-left {
  1523. display: flex;
  1524. }
  1525. .label {
  1526. min-width: 76px;
  1527. display: flex;
  1528. align-items: center;
  1529. font-size: 15px;
  1530. font-weight: 500;
  1531. .icon {
  1532. margin-right: 10px;
  1533. }
  1534. }
  1535. .control {
  1536. min-width: 280px;
  1537. margin-left: 18px;
  1538. box-sizing: border-box;
  1539. border-left: 1px solid #ECECEC;
  1540. position: relative;
  1541. .discord-address {
  1542. border: none;
  1543. outline: none;
  1544. color: #1D9BF0;
  1545. font-weight: 500;
  1546. font-size: 14px;
  1547. width: 100%;
  1548. height: 34px;
  1549. padding-left: 15px;
  1550. }
  1551. .discord-address::placeholder {
  1552. color: #c5c5c5;
  1553. }
  1554. .discord-invite-info {
  1555. position: absolute;
  1556. top: 40px;
  1557. left: 0;
  1558. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1559. background: #fff;
  1560. border-radius: 16px;
  1561. padding: 16px;
  1562. box-sizing: border-box;
  1563. display: flex;
  1564. align-items: center;
  1565. cursor: pointer;
  1566. .icon {
  1567. width: 40px;
  1568. height: 40px;
  1569. margin-right: 10px;
  1570. border-radius: 50%;
  1571. }
  1572. .name {
  1573. font-weight: 600;
  1574. font-size: 16px;
  1575. color: #101419;
  1576. width: 193px;
  1577. height: 20px;
  1578. overflow: hidden;
  1579. white-space: nowrap;
  1580. text-overflow: ellipsis;
  1581. display: inline-block;
  1582. }
  1583. }
  1584. }
  1585. }
  1586. .form-item:last-child {
  1587. border-bottom: none !important;
  1588. }
  1589. }
  1590. }
  1591. .anti-bot-wrapper {
  1592. width: 100%;
  1593. height: 50px;
  1594. display: flex;
  1595. align-items: center;
  1596. justify-content: space-between;
  1597. box-sizing: border-box;
  1598. border-radius: 15px;
  1599. padding: 0 18px;
  1600. margin-top: 14px;
  1601. border: 1px solid #D1D9DD;
  1602. .label {
  1603. display: flex;
  1604. align-items: center;
  1605. font-size: 15px;
  1606. font-weight: 500;
  1607. .icon-bot {
  1608. margin-right: 8px;
  1609. }
  1610. .icon-beta {
  1611. margin-left: 5px;
  1612. margin-right: 8px;
  1613. }
  1614. .icon-question {
  1615. cursor: pointer;
  1616. }
  1617. }
  1618. }
  1619. .tips-wrapper {
  1620. margin: 16px 0 0 12px !important;
  1621. padding: 0px !important;
  1622. .title,
  1623. .row {
  1624. font-weight: 400;
  1625. font-size: 12px;
  1626. color: #A39F9F;
  1627. }
  1628. .row {
  1629. box-sizing: border-box;
  1630. line-height: 16px;
  1631. }
  1632. .more {
  1633. color: #1D9BF0;
  1634. font-size: 13px;
  1635. padding-left: 4px;
  1636. cursor: pointer;
  1637. }
  1638. }
  1639. .submit-btn-wrapper {
  1640. width: 100%;
  1641. background: #fff;
  1642. position: absolute;
  1643. bottom: 18px;
  1644. left: 0;
  1645. box-sizing: border-box;
  1646. padding: 16px 18px 0 18px;
  1647. .submit-btn {
  1648. width: 100%;
  1649. height: 46px;
  1650. text-align: center;
  1651. background: #4a99e9;
  1652. border-radius: 100px;
  1653. color: #fff;
  1654. display: flex;
  1655. align-items: center;
  1656. justify-content: center;
  1657. font-size: 16px;
  1658. font-weight: 500;
  1659. cursor: pointer;
  1660. .icon-loading {
  1661. width: 20px;
  1662. height: 20px;
  1663. margin-right: 3px;
  1664. }
  1665. }
  1666. .disabled-submit {
  1667. background-color: #D9D9D9;
  1668. }
  1669. }
  1670. }
  1671. .fill-right {
  1672. width: 100% !important;
  1673. border-bottom-left-radius: 16px;
  1674. }
  1675. }
  1676. }
  1677. }
  1678. </style>