basicInformation.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view style="background-color: $color-white !important;">
  3. <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
  4. :background="background" title-width="300" :title="i18n('BasicInformation')"></u-navbar>
  5. <!-- 单元格列表 -->
  6. <u-cell-group>
  7. <!-- 头像 -->
  8. <!-- <u-cell-item :title="$i18n.locale=='zh'?'头像':'Avatar'" :index="0" @click="Avatar" hover-class="none"> -->
  9. <!-- 上传 -->
  10. <!-- <u-upload :custom-btn="true">
  11. <view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
  12. <u-icon size="60" :color="$u.color['lightColor']"></u-icon>
  13. </view>
  14. </u-upload>
  15. </u-cell-item> -->
  16. <!-- 手机号 -->
  17. <u-cell-item :title="$i18n.locale=='zh'?'手机':'Phone'" :value="form.userPreferredMobile" :arrow="false"
  18. hover-class="none"></u-cell-item>
  19. <!-- 邮箱 -->
  20. <u-cell-item :title="$i18n.locale=='zh'?'邮箱':'Email'" :value="form.userEmail" :arrow="false"
  21. hover-class="none"></u-cell-item>
  22. <!-- 注册日期 -->
  23. <u-cell-item :title="$i18n.locale=='zh'?'注册日期':'Registration'" :value="form.userAccountRegistertime"
  24. :arrow="false" hover-class="none"></u-cell-item>
  25. <!-- 用户类型 -->
  26. <u-cell-item :title="$i18n.locale=='zh'?'用户类型':'Type'" :value="region" :arrow="false" hover-class="none">
  27. </u-cell-item>
  28. <!-- 最后登录 -->
  29. <u-cell-item :title="$i18n.locale=='zh'?'最后登录':'Log Last'" :value="form.lastLoginTime" :arrow="false"
  30. hover-class="none"></u-cell-item>
  31. <!-- 昵称 -->
  32. <!-- <u-cell-item :title="$i18n.locale=='zh'?'昵称':'Nickname'" value="开心每一天" :arrow="false"></u-cell-item> -->
  33. <!-- 性别 -->
  34. <!-- <u-cell-item :title="$i18n.locale=='zh'?'性别':'Gender'"></u-cell-item> -->
  35. <!-- 生日 -->
  36. <!-- <u-cell-item :title="$i18n.locale=='zh'?'生日':'Birthday'"></u-cell-item> -->
  37. <!-- 所在地区 -->
  38. <!-- <u-cell-item :title="$i18n.locale=='zh'?'所在地区':'Address'" :required="true"></u-cell-item> -->
  39. <!-- 标签 -->
  40. <!-- <u-cell-item :title="$i18n.locale=='zh'?'标签':'Label'"></u-cell-item> -->
  41. <!-- 兴趣方向 -->
  42. <!-- <u-cell-item :title="$i18n.locale=='zh'?'兴趣方向':'InterestDirection'"></u-cell-item> -->
  43. <!-- 邮箱 -->
  44. <!-- <u-cell-item :title="$i18n.locale=='zh'?'邮箱':'Email'" value="" :arrow="false"></u-cell-item> -->
  45. <!-- 介绍 -->
  46. <!-- <u-cell-item :title="$i18n.locale=='zh'?'介绍':'Introduce'"></u-cell-item> -->
  47. </u-cell-group>
  48. <!-- <view class="SocialInfor">社交信息</view> -->
  49. <!-- <u-cell-group> -->
  50. <!-- 微信号 -->
  51. <!-- <u-cell-item :title="$i18n.locale=='zh'?'微信号':'WeChat'"></u-cell-item> -->
  52. <!-- QQ号 -->
  53. <!-- <u-cell-item :title="$i18n.locale=='zh'?'QQ号':'QQ'"></u-cell-item> -->
  54. <!-- 微博 -->
  55. <!-- <u-cell-item :title="$i18n.locale=='zh'?'微博':'MicroBlog'"></u-cell-item> -->
  56. <!-- </u-cell-group> -->
  57. </view>
  58. </template>
  59. <script>
  60. import listCell from '@/components/JumpBox';
  61. import {
  62. addIntegral,
  63. addGrowth
  64. } from '@/components/addPointDetailByTaskDict.js'
  65. export default {
  66. components: {
  67. listCell,
  68. addIntegral,
  69. addGrowth
  70. },
  71. data() {
  72. return {
  73. background: {
  74. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  75. },
  76. backStyle: {
  77. color: '#FFFFFF',
  78. },
  79. Storage_data: '',
  80. AuthToken: '',
  81. form: {},
  82. userUsertypeDicts: [],
  83. region: '',
  84. };
  85. },
  86. onShow() {
  87. try {
  88. this.Storage_data = JSON.parse(uni.getStorageSync('user'));
  89. this.AuthToken = uni.getStorageSync('Auth-Token');
  90. } catch (e) {
  91. };
  92. this.showInfo();
  93. this.userBasicInfo();
  94. // addIntegral('point_task_complete_info', '20')
  95. // addGrowth('point_task_complete_info')
  96. },
  97. methods: {
  98. async showInfo() {
  99. const result = await this.$myRequest({
  100. url: '/uc/userCenter/findBasicInfo',
  101. data: {},
  102. });
  103. // this.form = this.Storage_data.umsUser;
  104. this.form = result.data;
  105. if (this.form.userEmail) {
  106. this.form.userEmail = this.AccountHide(this.form.userEmail);
  107. // this.form.userEmail = this.form.userEmail.substr(0,3) + '****' + this.form.userEmail.substr(-4);
  108. } else {
  109. this.form.userEmail = ""
  110. }
  111. // this.form.userEmail = this.form.userEmail || "";
  112. if (this.form.userPreferredMobile) {
  113. if (this.form.userPreferredMobile.length < 12) {
  114. this.form.userPreferredMobile = this.form.userPreferredMobile.substr(0, 3) + '****' + this.form
  115. .userPreferredMobile.substr(-4);
  116. } else {
  117. this.form.userPreferredMobile = this.form.userPreferredMobile.substr(4, 3) + '****' + this.form
  118. .userPreferredMobile.substr(-4);
  119. }
  120. // this.form.userPreferredMobile = this.form.userPreferredMobile.substr(4);
  121. } else {
  122. this.form.userPreferredMobile = "";
  123. }
  124. this.form.userAccountRegistertime = this.formatDate(this.form.userAccountRegistertime,
  125. "YYYY-MM-DD hh:mm:ss") ||
  126. "";
  127. this.form.lastLoginTime = this.formatDate(this.form.lastLoginTime, "YYYY-MM-DD hh:mm:ss") || "";
  128. console.log(this.form.userAccountRegistertime, this.form.lastLoginTime)
  129. },
  130. AccountHide(email) {
  131. let altIndex = email.indexOf('@');
  132. let spotIndex = email.lastIndexOf('.');
  133. let star = '*';
  134. let starNum1 = 4;
  135. let starNum2 = 3;
  136. let emailHide = '';
  137. let emailHide1 = '';
  138. let emailHide2 = '';
  139. if (altIndex > starNum1) {
  140. emailHide1 = email.slice(0, altIndex - starNum1) + star.repeat(starNum1);
  141. if (spotIndex - altIndex - 0 > starNum2) {
  142. emailHide2 = email.slice(altIndex, altIndex + 1) + star.repeat(starNum2) + email.slice(altIndex +
  143. starNum1);
  144. } else {
  145. emailHide2 = email.slice(altIndex, altIndex + 1) + star.repeat(spotIndex - altIndex - 1) + email
  146. .slice(
  147. spotIndex);
  148. }
  149. } else {
  150. emailHide1 = email.slice(0, 1) + star.repeat(altIndex - 1);
  151. if (spotIndex - altIndex - 0 > starNum2) {
  152. emailHide2 = email.slice(altIndex, altIndex + 1) + star.repeat(starNum2) + email.slice(altIndex +
  153. starNum1);
  154. } else {
  155. emailHide2 = email.slice(altIndex, altIndex + 1) + star.repeat(spotIndex - altIndex - 1) + email
  156. .slice(
  157. spotIndex);
  158. }
  159. }
  160. return emailHide = emailHide1 + emailHide2
  161. },
  162. async userBasicInfo() {
  163. if (this.$i18n.locale.toUpperCase() == "EN") {
  164. const result = await this.$myRequest({
  165. url: '/sys/sysDicts',
  166. data: {
  167. type: 'USERTYPE_DICT_EN'
  168. }
  169. });
  170. if (result.data) {
  171. this.userUsertypeDicts = result.data['0'] || [];
  172. }
  173. } else {
  174. const result = await this.$myRequest({
  175. url: '/sys/sysDicts',
  176. data: {
  177. type: 'USERTYPE_DICT'
  178. }
  179. });
  180. if (result.data) {
  181. this.userUsertypeDicts = result.data['0'] || [];
  182. }
  183. }
  184. const that = this;
  185. this.userUsertypeDicts.forEach((value, index) => {
  186. let type = this.form.userUsertypeDict;
  187. if (value.value == type) {
  188. that.region = value.label;
  189. }
  190. });
  191. },
  192. Avatar(index) {
  193. console.log(index)
  194. console.log(11111)
  195. },
  196. navTo(route) {
  197. this.$mRouter.push({
  198. route
  199. });
  200. },
  201. i18n(data) {
  202. return this.$t('common.' + data);
  203. },
  204. }
  205. }
  206. </script>
  207. <style lang="scss" scoped>
  208. page,
  209. body.pages-profile-profileSetUp-setUp uni-page-body {
  210. background-color: #fff !important;
  211. height: 110vh;
  212. .SocialInfor {
  213. background-color: #f8f8f8;
  214. width: 100%;
  215. height: 80upx;
  216. font-size: 28upx;
  217. line-height: 80upx;
  218. padding: 0upx 32upx;
  219. }
  220. .slot-btn {
  221. width: 720rpx;
  222. height: 32rpx;
  223. display: flex;
  224. justify-content: center;
  225. align-items: center;
  226. background: rgba(0, 0, 0, 0);
  227. border-radius: 10rpx;
  228. }
  229. .slot-btn__hover {
  230. background-color: rgb(235, 236, 238);
  231. }
  232. }
  233. </style>