setUserinfo.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. <template>
  2. <div class="user">
  3. <div class="user-wrap">
  4. <div class="u-item flex">
  5. <div class="base">用户名</div>
  6. <div class="base">{{userInfo.username}}</div>
  7. <el-button type="text" @click="dlVisible= true">修改密码</el-button>
  8. </div>
  9. <div class="u-item flex">
  10. <div class="base">用户ID</div>
  11. <div class="base">{{userInfo.id}}</div>
  12. </div>
  13. <div class="u-item flex">
  14. <div class="base">用户编号</div>
  15. <div class="base">{{userInfo.user_code}}</div>
  16. </div>
  17. <!-- <div class="u-item flex">
  18. <div class="base">地址</div>
  19. <div>
  20. <span style="display: inline-block;margin-right: 20px;">{{userInfo.address}}</span>
  21. <el-button type="text" @click="adVisible = true">设置地址</el-button>
  22. </div>
  23. </div> -->
  24. <div class="u-item flex">
  25. <div class="base">余额</div>
  26. <div>
  27. <span style="display: inline-block;margin-right: 20px;">{{userInfo.money}}</span>
  28. <el-button type="text" @click="czVisible = true">充值</el-button>
  29. <el-button type="text" @click="txVisible = true">提现</el-button>
  30. <el-button type="text" @click="zzVisible = true">转账</el-button>
  31. </div>
  32. </div>
  33. <div class="u-item flex">
  34. <div class="base">交易密码</div>
  35. <div @click="jyVisible = true">
  36. <el-button type="text" v-if="!userInfo.transaction">设置交易密码</el-button>
  37. <el-button type="text" v-else>修改交易密码</el-button>
  38. </div>
  39. </div>
  40. <div class="u-item flex">
  41. <div>
  42. <div class="base">开通二次验证</div>
  43. <el-tag type="danger">开通二次验证可以保障你的资金安全 否则被盗号所产生的一切问题,自行负责</el-tag>
  44. </div>
  45. <div>
  46. <el-button type="text" v-if="userInfo.is_binding == 1">已开通</el-button>
  47. <el-button type="text" v-else @click="getga">立即开通</el-button>
  48. </div>
  49. </div>
  50. <div class="u-item flex" v-if="userInfo.agent_id != 1">
  51. <div class="base">自动下单</div>
  52. <div>
  53. <el-button type="text" v-if="!userInfo.auto_order == 1" @click="xdVisible = true">立即开通</el-button>
  54. <el-button type="text" v-else>已开通</el-button>
  55. </div>
  56. </div>
  57. <div class="u-item flex" v-if="userInfo.agent_id != 1">
  58. <div class="base">账号有效时间</div>
  59. <div style="display: flex;flex-direction: column;align-items: flex-end;">
  60. <el-button type="text" @click="xfVisible = true">点击续费</el-button>
  61. <div>到期时间:{{showTime(userInfo.order_create_endtime) }}</div>
  62. </div>
  63. </div>
  64. </div>
  65. <!-- <el-card>
  66. <div class="wrap">
  67. <el-form :model="form" style="width: 500px;">
  68. <el-form-item label="头像" :label-width="formLabelWidth">
  69. <el-upload
  70. class="avatar-uploader"
  71. action="http://www.pingguozhushou.shop/api/common/upload"
  72. :show-file-list="false"
  73. :headers="token"
  74. :on-success="handleAvatarSuccess"
  75. :before-upload="beforeAvatarUpload">
  76. <img v-if="form.avatar" :src="form.avatar" class="avatar">
  77. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  78. </el-upload>
  79. </el-form-item>
  80. <el-form-item label="ID" :label-width="formLabelWidth">
  81. <el-input v-model="form.id" type="text" disabled
  82. width="300px"></el-input>
  83. </el-form-item>
  84. <el-form-item label="账号" :label-width="formLabelWidth">
  85. <el-input v-model="form.username" type="text" disabled
  86. width="300px"></el-input>
  87. </el-form-item>
  88. <el-form-item label="昵称" :label-width="formLabelWidth">
  89. <el-input v-model="form.nickname" type="text"
  90. placeholder="请输入昵称" width="300px"></el-input>
  91. </el-form-item>
  92. </el-form>
  93. <div class="dialog-footer">
  94. <el-button type="primary" @click="setInfo">确 定</el-button>
  95. </div>
  96. </div>
  97. </el-card> -->
  98. <!-- 账号续费 -->
  99. <el-dialog title="提示" :visible.sync="xfVisible" width="350px">
  100. <span style="display: block; padding: 0 0 20px 20px;">账号续费需支付{{baseInfo.code_price}}元</span>
  101. <el-form v-if="userInfo.is_binding == 1">
  102. <el-form-item label="动态口令">
  103. <el-input v-model="dtkl" type="number"></el-input>
  104. </el-form-item>
  105. </el-form>
  106. <span slot="footer" class="dialog-footer" style="width: 300px;">
  107. <el-button @click="xfVisible = false">取 消</el-button>
  108. <el-button type="primary" @click="xfzh">确 定</el-button>
  109. </span>
  110. </el-dialog>
  111. <!-- 添加地址 -->
  112. <el-dialog title="设置地址" :visible.sync="adVisible" @close="closeAd" width="600px">
  113. <el-form :model="adForm" style="width: 500px;">
  114. <el-form-item label="地址" :label-width="formLabelWidth">
  115. <el-input v-model="adForm.address" type="text" placeholder="请输入地址"></el-input>
  116. </el-form-item>
  117. <el-form-item label="动态口令" :label-width="formLabelWidth" v-if="userInfo.is_binding == 1">
  118. <el-input v-model="adForm.code" type="text" placeholder="请输入动态口令" width="300px"></el-input>
  119. </el-form-item>
  120. </el-form>
  121. <div class="dialog-footer">
  122. <el-button @click="closeAd">取 消</el-button>
  123. <el-button type="primary" @click="goAd">确 定</el-button>
  124. </div>
  125. </el-dialog>
  126. <!-- 登录密码 -->
  127. <el-dialog title="登录密码" :visible.sync="dlVisible" @close="closeDl" width="600px">
  128. <el-form :model="dlForm" style="width: 500px;">
  129. <el-form-item label="旧登录密码" :label-width="formLabelWidth">
  130. <el-input v-model="dlForm.oldpassword" type="password" placeholder="请输入旧登录密码"></el-input>
  131. </el-form-item>
  132. <el-form-item label="新登录密码" :label-width="formLabelWidth">
  133. <el-input v-model="dlForm.newpassword" type="password" placeholder="请输入新登录密码"
  134. width="300px"></el-input>
  135. </el-form-item>
  136. </el-form>
  137. <div class="dialog-footer">
  138. <el-button @click="closeDl">取 消</el-button>
  139. <el-button type="primary" @click="goDl">确 定</el-button>
  140. </div>
  141. </el-dialog>
  142. <!-- 自动下单 -->
  143. <el-dialog title="提示" :visible.sync="xdVisible" width="350px">
  144. <span style="display: block; padding: 0 0 20px 20px;">开通自动下单需支付{{baseInfo.auto_order}}元</span>
  145. <el-form v-if="userInfo.is_binding == 1">
  146. <el-form-item label="动态口令">
  147. <el-input v-model="dtkl" type="number"></el-input>
  148. </el-form-item>
  149. </el-form>
  150. <span slot="footer" class="dialog-footer" style="width: 300px;">
  151. <el-button @click="xdVisible = false">取 消</el-button>
  152. <el-button type="primary" @click="ktAuto">确 定</el-button>
  153. </span>
  154. </el-dialog>
  155. <!-- 谷歌校验 -->
  156. <el-dialog title="动态口令" :visible.sync="dtVisible" @close="closeDt" width="600px">
  157. <el-form :model="dtForm" style="width: 500px;">
  158. <el-form-item label="绑定二维码" :label-width="formLabelWidth">
  159. <img :src="images" alt="">
  160. </el-form-item>
  161. <el-form-item label="密钥" :label-width="formLabelWidth">
  162. <el-input v-model="dtForm.secret" type="text" placeholder="" width="300px"></el-input>
  163. </el-form-item>
  164. <el-form-item label="绑定口令" :label-width="formLabelWidth">
  165. <el-input v-model="dtForm.code" type="text" placeholder="请输入绑定口令" width="300px"></el-input>
  166. </el-form-item>
  167. </el-form>
  168. <div class="dialog-footer">
  169. <el-button type="primary" @click="goDt">确 定</el-button>
  170. </div>
  171. </el-dialog>
  172. <!-- 设置交易密码 -->
  173. <el-dialog title="交易密码" :visible.sync="jyVisible" @close="closeJy" width="600px">
  174. <el-form :model="jyForm" style="width: 500px;">
  175. <el-form-item label="新交易密码" :label-width="formLabelWidth">
  176. <el-input v-model="jyForm.newpassword" type="password" maxlength="30" minlength="6"
  177. placeholder="请输入新交易密码(6~30位任意字符)" width="300px"></el-input>
  178. </el-form-item>
  179. <el-form-item label="旧交易密码" :label-width="formLabelWidth" v-if="userInfo.transaction">
  180. <el-input v-model="jyForm.oldpassword" type="password" maxlength="30" minlength="6"
  181. placeholder="请输入旧交易密码"></el-input>
  182. </el-form-item>
  183. </el-form>
  184. <div class="dialog-footer">
  185. <el-button @click="closeJy">取 消</el-button>
  186. <el-button type="primary" @click="goJy">确 定</el-button>
  187. </div>
  188. </el-dialog>
  189. <!-- 转账 -->
  190. <el-dialog title="转账" :visible.sync="zzVisible" @close="closeZz" width="600px">
  191. <el-form :model="zzForm">
  192. <el-form-item label="收款用户ID" :label-width="formLabelWidth">
  193. <el-input v-model="zzForm.to_user_id" type="number"></el-input>
  194. </el-form-item>
  195. <el-form-item label="转账金额" :label-width="formLabelWidth">
  196. <el-input v-model="zzForm.transfer_num" type="number"></el-input>
  197. </el-form-item>
  198. <el-form-item label="动态口令" :label-width="formLabelWidth" v-if="userInfo.is_binding == 1">
  199. <el-input v-model="zzForm.code" type="number"></el-input>
  200. </el-form-item>
  201. </el-form>
  202. <div class="t-r">
  203. 当前余额: {{userInfo.money*1}}元
  204. </div>
  205. <div slot="footer" class="dialog-footer">
  206. <el-button @click="closeZz">取 消</el-button>
  207. <el-button type="primary" @click="goZz">确 定</el-button>
  208. </div>
  209. </el-dialog>
  210. <!-- 提现 -->
  211. <el-dialog title="提现" :visible.sync="txVisible" @close="closeTx" width="600px">
  212. <el-form :model="txForm">
  213. <el-form-item label="提现地址" :label-width="formLabelWidth">
  214. <el-input v-model="txForm.address" type="text"></el-input>
  215. </el-form-item>
  216. <el-form-item label="提现金额" :label-width="formLabelWidth">
  217. <el-input v-model="txForm.withdraw_num" type="number"></el-input>
  218. </el-form-item>
  219. <el-form-item label="动态口令" :label-width="formLabelWidth" v-if="userInfo.is_binding == 1">
  220. <el-input v-model="txForm.code" type="number"></el-input>
  221. </el-form-item>
  222. </el-form>
  223. <div class="t-r">
  224. 到账: {{((txForm.withdraw_num*1 || 0)/(baseInfo.to_rmb*1)).toFixed(2)}}U
  225. </div>
  226. <div class="t-r">
  227. 当前余额: {{userInfo.money*1}}元
  228. </div>
  229. <div slot="footer" class="dialog-footer">
  230. <el-button @click="closeTx">取 消</el-button>
  231. <el-button type="primary" @click="goTx">确 定</el-button>
  232. </div>
  233. </el-dialog>
  234. <!-- 充值 -->
  235. <el-dialog title="充值" :visible.sync="czVisible" @close="closeCz" width="600px">
  236. <el-form :model="czForm">
  237. <!-- payimg -->
  238. <el-form-item label="充值二维码" :label-width="formLabelWidth">
  239. <vueQrCode :size=qrCodeSize :text="qrCodeText"> </vueQrCode>
  240. </el-form-item>
  241. <el-form-item label="TRC20地址" :label-width="formLabelWidth">
  242. <div class="flex">
  243. <el-input v-model="qrCodeText" type="text" disabled></el-input>
  244. <el-button @click="onCopy(qrCodeText)" style="margin-left: 20px;">复制地址</el-button>
  245. </div>
  246. </el-form-item>
  247. <!-- <el-form-item label="充值凭证" :label-width="formLabelWidth">
  248. <el-upload class="avatar-uploader" action="http://www.pingguozhushou.shop/api/common/upload"
  249. :show-file-list="false" :headers="headers" :on-success="handleCzSuccess"
  250. :before-upload="beforeAvatarUpload">
  251. <img v-if="czForm.image" :src="czForm.image" class="czimg">
  252. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  253. </el-upload>
  254. </el-form-item> -->
  255. </el-form>
  256. <!-- <div class="t-r">
  257. 到账: {{((form.recharge_num*1 || 0)*(baseInfo.to_rmb*1)).toFixed(2)}}元
  258. </div>
  259. <div class="t-r">
  260. 当前余额: {{userInfo.money*1}}元
  261. </div>
  262. <div slot="footer" class="dialog-footer">
  263. <el-button @click="closeCz">取 消</el-button>
  264. <el-button type="primary" @click="goCz">确 定</el-button>
  265. </div> -->
  266. </el-dialog>
  267. </div>
  268. </template>
  269. <script>
  270. import vueQrCode from "@/components/vueQrCode.vue";
  271. import {
  272. mapState,
  273. mapMutations
  274. } from 'vuex';
  275. import {
  276. setTransaction,
  277. getIndex
  278. } from '@/request/agent.js'
  279. import {
  280. setUserInfo,
  281. getUserInfo,
  282. rechange,
  283. withdrawal,
  284. transfer,
  285. getga,
  286. checkCode,
  287. payAuto,
  288. repwd,
  289. address,
  290. xfZh
  291. } from '@/request/user.js'
  292. import { showTime } from '@/assets/js/tools.js'
  293. export default {
  294. name: 'Order',
  295. components: {
  296. vueQrCode,
  297. },
  298. data() {
  299. return {
  300. xfVisible: false,
  301. dtkl: '',
  302. xdVisible: false,
  303. images: '',
  304. qrCodeSize: 150,
  305. qrCodeText: '',
  306. headers: {},
  307. dtVisible: false,
  308. dtForm: {
  309. code: '',
  310. secret: ''
  311. },
  312. czVisible: false,
  313. czForm: {
  314. recharge_num: '',
  315. image: ''
  316. },
  317. txVisible: false,
  318. txForm: {
  319. withdraw_num: '',
  320. address: '',
  321. code: ''
  322. },
  323. zzVisible: false,
  324. zzForm: {
  325. to_user_id: '',
  326. transfer_num: '',
  327. code: ''
  328. },
  329. jyVisible: false,
  330. jyForm: {
  331. newpassword: '',
  332. oldpassword: ''
  333. },
  334. dlVisible: false,
  335. dlForm: {
  336. newpassword: '',
  337. oldpassword: ''
  338. },
  339. adVisible: false,
  340. adForm: {
  341. address: '',
  342. code: ''
  343. },
  344. token: {},
  345. formLabelWidth: '120px',
  346. form: {
  347. avatar: '',
  348. id: '',
  349. nickname: '',
  350. username: ''
  351. },
  352. dialogTableVisible: false,
  353. queryInfo: {
  354. keyword: '',
  355. page: 1,
  356. limit: 10
  357. },
  358. list: [],
  359. total: 0,
  360. loading: false,
  361. czloading: false,
  362. txloading: false,
  363. zzloading: false,
  364. jyloading: false,
  365. dtloading: false,
  366. dlloading: false,
  367. adloading: false
  368. }
  369. },
  370. computed: {
  371. ...mapState(['userInfo', 'baseInfo'])
  372. },
  373. created() {
  374. console.log(this.userInfo);
  375. if (this.userInfo.address) {
  376. this.txForm.address = this.userInfo.address
  377. }
  378. this.headers['token'] = window.localStorage.getItem('token')
  379. this.form = {
  380. avatar: this.userInfo.avatar,
  381. id: this.userInfo.id,
  382. nickname: this.userInfo.nickname,
  383. username: this.userInfo.username
  384. }
  385. this.getIndex()
  386. this.getUserInfo()
  387. // this.getga()
  388. },
  389. methods: {
  390. showTime,
  391. ...mapMutations(['setUserInfo', 'setBaseInfo']),
  392. xfzh() {
  393. let that = this
  394. if(that.baseInfo.code_price*1 > that.userInfo.money*1) {
  395. return that.$msg.error('您的账号余额不足,请充值后操作')
  396. }
  397. xfZh().then(res => {
  398. that.$msg.success('续费成功')
  399. that.getUserInfo()
  400. that.xfVisible = false
  401. })
  402. },
  403. closeAd() {
  404. this.adVisible = false
  405. this.adForm.address = ''
  406. this.adForm.code = ''
  407. this.adloding = false
  408. },
  409. goAd() {
  410. let that = this
  411. if (!that.adForm.address) {
  412. return that.$msg.error('请输入地址')
  413. }
  414. address(that.adForm).then(res => {
  415. that.$msg.success('设置成功')
  416. that.closeAd()
  417. that.getUserInfo()
  418. that.adloding = false
  419. }).catch(err => {
  420. that.adloding = false
  421. })
  422. },
  423. ktAuto() {
  424. let that = this
  425. if (that.userInfo.money * 1 < that.baseInfo.auto_order * 1) {
  426. return that.$msg.error('您当前余额不足')
  427. }
  428. payAuto({
  429. code: that.dtkl
  430. }).then(res => {
  431. that.getUserInfo()
  432. that.xdVisible = false
  433. //自动下单启动
  434. })
  435. },
  436. getga() {
  437. getga().then(res => {
  438. console.log(res);
  439. this.dtForm.secret = res.data.secret
  440. this.images = res.data.qrCodeUrl
  441. this.dtVisible = true
  442. })
  443. },
  444. closeDt() {
  445. this.dtVisible = false
  446. this.dtForm.code = ''
  447. },
  448. goDt() {
  449. if (this.dtloading) {
  450. return
  451. }
  452. this.dtloading = true
  453. checkCode({
  454. code: this.dtForm.code
  455. }).then(res => {
  456. this.$msg.success('绑定成功')
  457. this.closeDt()
  458. this.dtloading = false
  459. }).then(err => {
  460. this.dtloading = false
  461. })
  462. },
  463. getIndex() {
  464. getIndex().then(res => {
  465. this.setBaseInfo(res.data)
  466. // this.qrCodeText = res.data.trc20
  467. })
  468. },
  469. //关闭设置交易密码
  470. closeJy() {
  471. this.jyVisible = false
  472. this.jyForm = {
  473. newpassword: '',
  474. oldpassword: ''
  475. }
  476. },
  477. goJy() {
  478. let that = this
  479. if (that.jyloading) {
  480. return
  481. }
  482. if (!that.jyForm.newpassword) {
  483. return that.$msg.error('请输入新交易密码')
  484. }
  485. setTransaction(that.jyForm).then(res => {
  486. that.$msg.success('交易密码设置成功')
  487. that.closeJy()
  488. that.jyloading = false
  489. }).catch(err => {
  490. that.jyloading = false
  491. })
  492. },
  493. //
  494. closeDl() {
  495. this.dlVisible = false
  496. this.dlForm = {
  497. newpassword: '',
  498. oldpassword: ''
  499. }
  500. },
  501. goDl() {
  502. let that = this
  503. if (that.dlloading) {
  504. return
  505. }
  506. if (!that.dlForm.newpassword) {
  507. return that.$msg.error('请输入旧登录密码')
  508. }
  509. if (!that.dlForm.newpassword) {
  510. return that.$msg.error('请输入新登录密码')
  511. }
  512. repwd(that.dlForm).then(res => {
  513. that.$msg.success('登录密码设置成功')
  514. that.closeDl()
  515. that.dlloading = false
  516. }).catch(err => {
  517. that.dlloading = false
  518. })
  519. },
  520. //关闭转账
  521. closeZz() {
  522. this.zzVisible = false
  523. this.zzForm = {
  524. to_user_id: '',
  525. transfer_num: '',
  526. code: ''
  527. }
  528. },
  529. goZz() {
  530. let that = this
  531. if (that.zzloading) {
  532. return
  533. }
  534. if (!that.zzForm.to_user_id) {
  535. return that.$msg.error('请输入收款人ID')
  536. }
  537. if (!that.zzForm.transfer_num) {
  538. return that.$msg.error('请输入转账金额')
  539. }
  540. if (that.userInfo.money < that.zzForm.transfer_num * 1) {
  541. return that.$msg.error('您的余额不足本次转账')
  542. }
  543. that.zzloading = true
  544. transfer(that.zzForm).then(res => {
  545. console.log(res);
  546. that.$msg.success('转账成功')
  547. that.zzloading = false
  548. that.closeZz()
  549. that.getUserInfo()
  550. }).catch(err => {
  551. that.zzloading = false
  552. })
  553. },
  554. //关闭提现
  555. closeTx() {
  556. this.txVisible = false
  557. this.txForm = {
  558. withdraw_num: '',
  559. address: '',
  560. code: ''
  561. }
  562. },
  563. goTx() {
  564. let that = this
  565. if (that.txloading) {
  566. return
  567. }
  568. if (!that.txForm.withdraw_num) {
  569. return that.$msg.error('请输入提现金额')
  570. }
  571. if (that.txForm.address == '') {
  572. return that.$msg.error('请输入提现地址')
  573. }
  574. if (that.userInfo.money * 1 < that.txForm.withdraw_num * 1) {
  575. return that.$msg.error('您当前账号的余额不足')
  576. }
  577. that.txloading = true
  578. withdrawal(that.txForm).then(res => {
  579. that.$msg.success('提交成功,请等待审核')
  580. that.txloading = false
  581. that.closeTx()
  582. that.getUserInfo()
  583. }).catch(err => {
  584. that.txloading = false
  585. })
  586. },
  587. //关闭充值
  588. closeCz() {
  589. this.czVisible = false
  590. this.czForm = {
  591. recharge_num: '',
  592. image: ''
  593. }
  594. },
  595. // 充值提交
  596. goCz() {
  597. let that = this
  598. if (that.czloading) {
  599. return
  600. }
  601. if (!that.czForm.recharge_num) {
  602. return that.$msg.error('请输入充值金额')
  603. }
  604. if (!that.czForm.image) {
  605. return that.$msg.error('请上传充值凭证')
  606. }
  607. that.czloading = true
  608. rechange(that.czForm).then(res => {
  609. that.$msg.success('提交成功,请等待审核')
  610. that.czVisible = false
  611. that.czloading = false
  612. that.closeCz()
  613. }).catch(err => {
  614. that.czloading = false
  615. })
  616. },
  617. handleAvatarSuccess(res, file) {
  618. this.form.avatar = res.data.fullurl;
  619. },
  620. handleCzSuccess(res, file) {
  621. this.czForm.image = res.data.fullurl;
  622. },
  623. beforeAvatarUpload(file) {
  624. // const isJPG = file.type === 'image/jpeg/png';
  625. // const isLt2M = file.size / 1024 / 1024 < 2;
  626. // if (!isJPG) {
  627. // this.$message.error('上传头像图片只能是 JPG 格式!');
  628. // }
  629. // if (!isLt2M) {
  630. // this.$message.error('上传头像图片大小不能超过 2MB!');
  631. // }
  632. // return isJPG && isLt2M;
  633. return true
  634. },
  635. handleAvatarError() {
  636. },
  637. openBuy() {
  638. this.dialogTableVisible = true
  639. },
  640. getUserInfo() {
  641. getUserInfo().then(res => {
  642. this.setUserInfo(res.data)
  643. this.qrCodeText = res.data.withdraw_trc_address
  644. })
  645. },
  646. setInfo() {
  647. let that = this
  648. if (that.form.avatar == '') {
  649. return that.$msg.error('请选择头像')
  650. }
  651. if (that.form.nickname == '') {
  652. return that.$msg.error('请选择输入昵称')
  653. }
  654. setUserInfo({
  655. avatar: that.form.avatar,
  656. nickname: that.form.nickname
  657. }).then(res => {
  658. that.$msg.success('修改成功')
  659. that.getUserInfo()
  660. })
  661. },
  662. handleSizeChange(newPageSize) {
  663. this.queryInfo.limit = newPageSize
  664. this.getList()
  665. },
  666. handleCurrentChange(newPageNum) {
  667. this.queryInfo.page = newPageNum
  668. this.getList()
  669. },
  670. onCopy(text) {
  671. this.$copyText(text).then(
  672. e => {
  673. console.log('复制成功:', e);
  674. },
  675. e => {
  676. console.log('复制失败:', e);
  677. }
  678. )
  679. }
  680. },
  681. }
  682. </script>
  683. <style scoped lang="scss">
  684. /*
  685. /deep/ .el-card__body {
  686. display: flex;
  687. justify-content: center;
  688. align-items: center;
  689. }
  690. .avatar-uploader .el-upload {
  691. border: 1px dashed #d9d9d9;
  692. border-radius: 6px;
  693. cursor: pointer;
  694. position: relative;
  695. overflow: hidden;
  696. }
  697. .avatar-uploader .el-upload:hover {
  698. border-color: #409EFF;
  699. }
  700. .avatar {
  701. width: 178px;
  702. height: 178px;
  703. display: block;
  704. } */
  705. .dialog-footer {
  706. display: flex;
  707. justify-content: flex-end;
  708. width: 500px;
  709. }
  710. .avatar-uploader-icon {
  711. font-size: 28px;
  712. color: #8c939d;
  713. width: 178px;
  714. height: 178px;
  715. line-height: 178px;
  716. text-align: center;
  717. border: 1px dashed #d9d9d9;
  718. border-radius: 10px;
  719. }
  720. .user-wrap {
  721. width: 700px;
  722. background-color: #fff;
  723. margin: auto;
  724. .u-item {
  725. padding: 10px 15px;
  726. justify-content: space-between;
  727. align-items: flex-start;
  728. border-bottom: 1px solid #f0f0f0;
  729. .base {
  730. padding: 12px 0;
  731. }
  732. }
  733. }
  734. .t-r {
  735. text-align: right;
  736. padding-top: 10px;
  737. }
  738. .czimg {
  739. width: 178px;
  740. height: 178px;
  741. }
  742. </style>