give-dialog.vue 77 KB

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