authrz.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="content">
  3. <view class="">
  4. <view class="" style="padding: 50rpx 30rpx;font-size: 50rpx;">{{ $t('smrz.smrz') }}</view>
  5. <view class="" style="width: 720rpx;height: 80rpx;background-color: #fff;margin: auto;line-height: 80rpx;padding:0 10rpx;border-radius: 20rpx;font-size: 26rpx;">
  6. {{ $t('smrz.wcsmrz') }}
  7. </view>
  8. <view class="" style="width: 720rpx;height: 80rpx;background-color: #fff;margin: auto;line-height: 80rpx;padding:0 10rpx;border-radius: 20rpx;font-size: 26rpx;">
  9. {{ $t('smrz.gjsm') }}
  10. </view>
  11. </view>
  12. <view class="up-wrap">
  13. <view class="up-tit">{{ $t('smrz.xm') }}</view>
  14. <input type="text" v-model="nickname" :placeholder="$t('smrz.qsrxm')" class="cardinp" />
  15. <view class="up-tit">{{ $t('smrz.sfzhm') }}</view>
  16. <input type="text" v-model="card" :placeholder="$t('smrz.sfzhm')" class="cardinp" />
  17. <view class="up-tit">{{ $t('smrz.scsfzzm') }}</view>
  18. <view class="up-img" @click="upcardzm()">
  19. <image :src="cardzmt" mode="heightFix" v-if="cardzmt"></image>
  20. <image src="../../static/img/flower.png" mode="heightFix" v-else></image>
  21. </view>
  22. <view class="up-tit">{{ $t('smrz.scsfzfm') }}</view>
  23. <view class="up-img" @click="upcardfm()">
  24. <image :src="cardfmt" mode="heightFix" v-if="cardfmt"></image>
  25. <image src="../../static/img/flower.png" mode="heightFix" v-else></image>
  26. </view>
  27. </view>
  28. <view class="up-btn" @click="upauthrz()">{{ $t('smrz.gjtj') }}</view>
  29. </view>
  30. </template>
  31. <script>
  32. import { mapState, mapMutations } from 'vuex';
  33. import { upauthrz, upimg, getUser } from '@/api/login.js';
  34. import { upload } from '@/api/wallet.js';
  35. export default {
  36. data() {
  37. return {
  38. nickname: '',
  39. card: '',
  40. cardzm: '',
  41. cardzmt: '',
  42. cardfm: '',
  43. cardfmt: ''
  44. };
  45. },
  46. onLoad() {
  47. this.getUser();
  48. },
  49. onShow() {},
  50. onReachBottom() {},
  51. onReady() {},
  52. methods: {
  53. ...mapMutations('user', ['setUserInfo']),
  54. getUser() {
  55. let obj = this;
  56. getUser().then(res => {
  57. console.log(res);
  58. let data = res.data;
  59. this.setUserInfo(res.data);
  60. if (res.data.name) {
  61. obj.nickname = data.name;
  62. obj.cardzm = data.cardzm;
  63. obj.cardzmt = data.http + data.cardzm;
  64. obj.cardfm = data.cardfm;
  65. obj.cardfmt = data.http + data.cardfm;
  66. obj.card = data.zhengjian;
  67. }
  68. });
  69. },
  70. upcardzm() {
  71. upload({
  72. filename: ''
  73. }).then(data => {
  74. console.log('data', data);
  75. this.cardzm = data[0].img;
  76. this.cardzmt = data[0].src;
  77. });
  78. },
  79. upcardfm() {
  80. upload({
  81. filename: ''
  82. }).then(data => {
  83. console.log('data', data);
  84. this.cardfm = data[0].img;
  85. this.cardfmt = data[0].src;
  86. });
  87. },
  88. upauthrz() {
  89. let obj = this;
  90. if (obj.nickname == '') {
  91. return obj.$api.msg(this.$t('smrz.qsrxm'));
  92. }
  93. if (obj.card == '') {
  94. return obj.$api.msg(this.$t('smrz.qsrsfz'));
  95. }
  96. if (obj.cardzm == '') {
  97. return obj.$api.msg(this.$t('smrz.qscsfzzm'));
  98. }
  99. if (obj.cardfm == '') {
  100. return obj.$api.msg(this.$t('smrz.qscsfzfm'));
  101. }
  102. upauthrz({
  103. cardzm: obj.cardzm,
  104. cardfm: obj.cardfm,
  105. nickname: obj.nickname,
  106. card: obj.card
  107. }).then(res => {
  108. uni.showToast({
  109. title: this.$t('smrz.tjcg'),
  110. duration: 2000,
  111. position: 'top'
  112. });
  113. });
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss">
  119. .up-wrap {
  120. width: 720rpx;
  121. // height: 860rpx;
  122. border-radius: 20rpx;
  123. background-color: #fff;
  124. margin: 30rpx auto;
  125. padding: 20rpx;
  126. font-size: 32rpx;
  127. .up-tit {
  128. height: 80rpx;
  129. line-height: 80rpx;
  130. }
  131. .up-img {
  132. height: 240rpx;
  133. margin-top: 20rpx;
  134. image {
  135. height: 200rpx;
  136. display: block;
  137. margin: auto;
  138. }
  139. }
  140. }
  141. .cardinp {
  142. display: inline-block;
  143. width: 100%;
  144. height: 80rpx;
  145. line-height: 80rpx;
  146. background-color: #f5f5f5;
  147. border-radius: 20rpx;
  148. padding-left: 20rpx;
  149. }
  150. .up-btn {
  151. margin: 20rpx auto 0;
  152. width: 680rpx;
  153. height: 80rpx;
  154. line-height: 80rpx;
  155. text-align: center;
  156. color: #000;
  157. font-size: 28rpx;
  158. background: linear-gradient(to left, #eeb80d, #ffe35b);
  159. border-radius: 20rpx;
  160. }
  161. </style>