give-dialog.vue 61 KB

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