profile.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. <template>
  2. <view class="rf-category">
  3. <!--顶部导航栏-->
  4. <view class="dcp-profile">
  5. <text style="margin-left: 50upx;line-height: 100upx;font-size: 38upx;">{{i18n.Account}}</text>
  6. </view>
  7. <!-- 头像区域 -->
  8. <view class="dcp-profile-nav">
  9. <!-- 登录状态 -->
  10. <view v-if="AuthToken" style="width: 100%;height: 100%;">
  11. <!-- 上传图片 -->
  12. <view class="introduceItemImg" @click="uploadImg">
  13. <image v-show="form.userPic" style="width: 100%;height: 100%; border-radius: 50%;"
  14. :src="imgURL + form.userPic"></image>
  15. <image v-show="!form.userPic" style="width: 100%;height: 100%; border-radius: 50%;"
  16. src="/static/missing-face.png"></image>
  17. </view>
  18. <view class="dcp-profile-right">
  19. <view class="dcp-profile-name">
  20. <text class="dcp-profile-name1">
  21. {{Storage_data.username}}
  22. </text>
  23. </view>
  24. <view>
  25. <text v-if="loginAccount">
  26. {{salfInfo}}
  27. </text>
  28. <!-- <text v-else>
  29. {{salfEmail}}
  30. </text> -->
  31. </view>
  32. </view>
  33. <!-- <i class="fa fa-angle-right dcp-profile-icon" aria-hidden="true"></i> -->
  34. </view>
  35. <!-- 未登录状态 -->
  36. <view class="" v-else>
  37. <view class="introduceItemImg" style="backgroundImage: url(../../static/missing-face.png);
  38. backgroundSize:130upx 130upx;background-repeat: no-repeat; border-radius: 50%;">
  39. </view>
  40. <view class="dcp-profile-right" @click="toNav">
  41. <view class="dcp-profile-nameNot">
  42. <text class="dcp-profile-nameNot1">
  43. {{$i18n.locale=='zh'?'请登录':'Please login'}}
  44. </text>
  45. </view>
  46. </view>
  47. <!-- <i class="fa fa-angle-right dcp-profile-icon" aria-hidden="true" @click="toNav"></i> -->
  48. </view>
  49. </view>
  50. <!-- 实名认证 -->
  51. <!-- <view style="background-color: #fff;">
  52. <view class="Certification">
  53. <view>{{i18n.RealAuthentication}}</view>
  54. <view>
  55. <text class="text_vip">vip</text>
  56. </view>
  57. <view class="right yellow_border">
  58. <i class="fa fa-angle-right" aria-hidden="true"></i>
  59. </view>
  60. </view>
  61. </view> -->
  62. <u-button v-show="userTypeId" class="get-integrate" type="custom" shape="circle" text="按钮形状"
  63. @tap="toGetIntegrate">
  64. <text class="get-text">{{$i18n.locale=='zh'?'签到':'Sign In'}}</text>
  65. </u-button>
  66. <view class="new-integrate" v-show="userTypeId">
  67. <view class="new-integrate-grade new-content" @tap="toGrade()">
  68. <view class="user-num"> {{userInfos.level==null?'0':userInfos.level}}</view>
  69. {{$i18n.locale=='zh'?'等级':'Grade'}}
  70. </view>
  71. <view class="new-integrate-account new-content" @tap="toIntegrate()">
  72. <view class="user-num">{{userInfos.point==null?'0':userInfos.point}}</view>
  73. {{$i18n.locale=='zh'?'积分':'Integrate'}}
  74. </view>
  75. <view class="new-integrate-grow new-content" @tap="toGrowList">
  76. <view class="user-num">{{userInfos.growthValue==null?'0':userInfos.growthValue}}</view>
  77. {{$i18n.locale=='zh'?'成长值':'Growth Value'}}
  78. </view>
  79. </view>
  80. <view class="history-section icon">
  81. <!-- 个人信息 -->
  82. <list-cell imagesrcnew="/static/zhanghu/user-info.png" :title="i18n.PersonalInformation"
  83. @eventClick="toPersonalInfo">
  84. </list-cell>
  85. <!-- 积分账户 -->
  86. <list-cell v-show="userTypeId" imagesrcnew="/static/zhanghu/user-inte.png" :title="i18n.IntegrateInfo"
  87. @eventClick="toIntegrate">
  88. </list-cell>
  89. <!-- 积分兑换 -->
  90. <list-cell v-show="userTypeId" imagesrcnew="/static/zhanghu/user-mine.png" :title="i18n.ConversionDetail"
  91. @eventClick="toConversion">
  92. </list-cell>
  93. <!-- 权益等级 -->
  94. <list-cell v-show="userTypeId" imagesrcnew="/static/zhanghu/user-grade.png" :title="i18n.PersonGrade"
  95. @eventClick="toGrade">
  96. </list-cell>
  97. <!-- 地址管理 -->
  98. <list-cell v-show="userTypeId" imagesrcnew="/static/zhanghu/user-address.png" :title="i18n.UserAddress"
  99. @eventClick="toAddress">
  100. </list-cell>
  101. <!-- 语言 -->
  102. <list-cell imagesrcnew="/static/zhanghu/user-lan.png" :title="i18n.language"
  103. :tips="$i18n.locale=='zh'?i18n.Chinese:i18n.English" @eventClick="languageChange">
  104. </list-cell>
  105. <!-- 设置 -->
  106. <list-cell imagesrcnew="/static/zhanghu/user-do.png" :title="i18n.setUp" @eventClick="setting()">
  107. </list-cell>
  108. <!-- 检查更新 -->
  109. <!-- <list-cell icon="fa fa-user-o" iconColor="#333" :title="$i18n.locale=='zh'?'检查更新':'check update'" :tips="i18n.currentVersion + '-v1.0.0'"></list-cell> -->
  110. <!-- 清除缓存 -->
  111. <list-cell imagesrcnew="/static/zhanghu/user-cls.png" :title="$i18n.locale=='zh'?'清除缓存':'Clear cache'"
  112. :tips="fileSizeString" @eventClick="ClearCache"></list-cell>
  113. <!-- 关于我们 -->
  114. <list-cell imagesrcnew="/static/zhanghu/user-us.png" :title="$i18n.locale=='zh'?'关于我们':'About us'"
  115. @eventClick="AboutUs()"></list-cell>
  116. <!-- <view class="border"></view>
  117. <view> -->
  118. <!-- <button type="fff" style="">切换账户</button> -->
  119. <!-- <view class="border"></view> -->
  120. <!-- <button type="fff" v-if="AuthToken" @click="backLogin">退出登录</button>
  121. </view> -->
  122. </view>
  123. <u-modal v-model="show" :title="i18n.Tips" :confirm-text="i18n.submit" :cancel-text='i18n.cancel'
  124. @confirm="settingConfirm" :content="$i18n.locale == 'zh' ? '是否登录?' : 'Log in?'" :show-cancel-button="true">
  125. </u-modal>
  126. <uni-popup ref="popup" type="center" @change="popupChange">
  127. <uni-popup-dialog type="input" :content="contentText" :duration="2000" :before-close="true" @close="close"
  128. @confirm="confirm">
  129. </uni-popup-dialog>
  130. </uni-popup>
  131. <u-toast ref="uToast" />
  132. </view>
  133. </template>
  134. <script>
  135. import {
  136. getDict,
  137. getProject
  138. } from '@/api/product';
  139. import listCell from '@/components/JumpBox';
  140. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  141. import {
  142. getToken,
  143. resetToken,
  144. getNewToken
  145. } from "@/utils/auth";
  146. import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
  147. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
  148. import {
  149. addIntegral,
  150. addGrowth
  151. } from '@/components/addPointDetailByTaskDict.js'
  152. export default {
  153. components: {
  154. listCell,
  155. uniPopup,
  156. uniPopupMessage,
  157. uniPopupDialog,
  158. addIntegral,
  159. addGrowth
  160. },
  161. data() {
  162. return {
  163. userTypeId: false,
  164. userInfoDets: {},
  165. Storage_data: null,
  166. AuthToken: null,
  167. loginAccount: null,
  168. show: false,
  169. contentText: null,
  170. // salfPhone: '',
  171. // salfEmail: '',
  172. salfInfo: '',
  173. fileSizeString: '0B',
  174. imgURL: 'https://m.geidcp.com/api/file/pub/', // 本地图片地址
  175. // imgURL: 'https://192.168.1.190/api/fileextend/pub/', // 生产图片地址
  176. // action: 'http://192.168.1.190/api/file/upload/img?module=personnel', // 本地上传地址
  177. action: 'https://m.geidcp.com/api/file/pub/', // 生产上传地址
  178. form: {},
  179. myHeaders: {
  180. Authorization: ''
  181. // Authorization: ('Bearer ' + AuthToken)
  182. },
  183. userDetails: {},
  184. userInfos: {},
  185. };
  186. },
  187. onLoad() {
  188. this.userInfoDets = JSON.parse(uni.getStorageSync('user'))
  189. let userType = this.userInfoDets.umsUser.userUsertypeDict
  190. if (userType !== '2') {
  191. this.userTypeId = true
  192. console.log('你好111');
  193. } else {
  194. this.userTypeId = false
  195. console.log('你好啊111');
  196. }
  197. },
  198. async onShow() {
  199. this.getToken()
  200. this.getClearCacle();
  201. let token = uni.getStorageSync('Auth-Token')
  202. if (token) {
  203. await this.findBasicInfo()
  204. this.getUserDetails()
  205. }
  206. this.userInfoDets = JSON.parse(uni.getStorageSync('user'))
  207. let userType = this.userInfoDets.umsUser.userUsertypeDict
  208. if (userType !== '2') {
  209. this.userTypeId = true
  210. console.log('你好222');
  211. } else {
  212. this.userTypeId = false
  213. console.log('你好啊2222');
  214. }
  215. },
  216. computed: {
  217. i18n() {
  218. return this.$t('common');
  219. }
  220. },
  221. watch: {
  222. AuthToken() {}
  223. },
  224. methods: {
  225. getToken() {
  226. this.AuthToken = uni.getStorageSync('Auth-Token');
  227. this.Storage_data = JSON.parse(uni.getStorageSync('user'));
  228. // console.log(this.Storage_data, '==================');
  229. this.loginAccount = uni.getStorageSync('loginAccount');
  230. this.myHeaders.Authorization = 'Bearer ' + this.AuthToken;
  231. if (this.AuthToken) {
  232. this.findBasicInfo();
  233. this.hideInfo(this.loginAccount);
  234. }
  235. console.log(this.$i18n.locale, ' this is locale 这是中英文版本')
  236. this.getConText();
  237. this.getTabBar();
  238. },
  239. hideInfo(logAccount) {
  240. // if (this.Storage_data.umsUser.userMobileStatus == '0') {
  241. if (logAccount.indexOf('@') == -1) {
  242. // let moblieNum = this.Storage_data.umsUser.userPreferredMobile;
  243. if (logAccount.length < 12) {
  244. this.salfInfo = logAccount.substr(0, 3) + '****' + logAccount.substr(7, 4);
  245. } else {
  246. this.salfInfo = logAccount.substr(4, 3) + '****' + logAccount.substr(11, 4);
  247. }
  248. console.log(this.salfInfo)
  249. // this.salfPhone = moblieNum.substr(4, 3) + '****' + moblieNum.substr(11, 4);
  250. } else {
  251. // let emailNum = this.Storage_data.umsUser.userEmail;
  252. this.salfInfo = this.AccountHide(logAccount);
  253. console.log(this.salfInfo)
  254. }
  255. },
  256. //上传图片
  257. uploadImg() {
  258. const that = this;
  259. uni.chooseImage({
  260. count: 1, //默认9
  261. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  262. sourceType: ['album'], //从相册选择
  263. success: function(chooseImageRes) {
  264. const tempFilePaths = chooseImageRes.tempFilePaths;
  265. console.log('chooseImageRes', tempFilePaths);
  266. console.log(tempFilePaths);
  267. that.beforeAvatarUpload(chooseImageRes);
  268. console.log(tempFilePaths[0]);
  269. console.log(typeof tempFilePaths[0]);
  270. uni.uploadFile({
  271. url: that.action, //上传地址
  272. filePath: tempFilePaths[0],
  273. name: 'file',
  274. header: that.myHeaders,
  275. success: (uploadFileRes) => {
  276. //图片上传成功
  277. console.log('uploadFileRes', uploadFileRes);
  278. that.form.userPic = JSON.parse(uploadFileRes.data).data;
  279. /* that.handleAvatarSuccess(that.form.userPic);
  280. //获取头像
  281. that.findBasicInfo(); */
  282. that.hand(that.form.userPic)
  283. addIntegral("point_task_upload_head_portrait", "20");
  284. addGrowth("point_task_upload_head_portrait")
  285. }
  286. });
  287. }
  288. });
  289. },
  290. async hand(data) {
  291. await this.handleAvatarSuccess(data);
  292. //获取头像
  293. await this.findBasicInfo();
  294. },
  295. //上传图片之前
  296. beforeAvatarUpload(data) {
  297. const that = this;
  298. const img = data.tempFiles[0];
  299. // const isJPG = img.type === 'image/jpeg';
  300. const isLt2M = img.size / 1024 / 1024 < 2;
  301. /* if (!isJPG) {
  302. this.$message.error('上传头像图片只能是 JPG 格式!');
  303. return;
  304. }*/
  305. if (!isLt2M) {
  306. that.$refs.uToast.show({
  307. title: that.i18n.uploadInfo,
  308. type: 'error',
  309. });
  310. return;
  311. }
  312. },
  313. //保存图像
  314. async handleAvatarSuccess(params) {
  315. let that = this;
  316. const result = await this.$myRequest({
  317. url: '/uc/userCenter/saveUserPic',
  318. data: {
  319. userPic: params
  320. },
  321. });
  322. if (result.status == '200') {
  323. console.log('上传提示');
  324. if (this.$i18n.locale == 'zh') {
  325. this.$refs.uToast.show({
  326. // title: that.i18n.uploadSuccess,
  327. title: '上传成功!',
  328. type: 'success',
  329. });
  330. } else {
  331. this.$refs.uToast.show({
  332. // title: that.i18n.uploadSuccess,
  333. title: 'Upload successful!',
  334. type: 'success',
  335. });
  336. }
  337. } else {
  338. if (this.$i18n.locale == 'zh') {
  339. this.$refs.uToast.show({
  340. // title: result.msg,
  341. title: '上传失败!',
  342. type: 'error',
  343. });
  344. } else {
  345. this.$refs.uToast.show({
  346. // title: result.msg,
  347. title: 'Fail to upload!',
  348. type: 'error',
  349. });
  350. }
  351. }
  352. },
  353. //获取已上传的图片
  354. async findBasicInfo() {
  355. const result = await this.$myRequest({
  356. url: '/uc/userCenter/findBasicInfo',
  357. data: {},
  358. });
  359. if (!result.data.userPic) {
  360. this.form.userPic = "/static/missing-face.png";
  361. }
  362. this.form = result.data;
  363. // console.log(this.form, '====================');
  364. // this.form.userPic = 'meeting/2020/12/18/4b8e1c488766439e921fb603d99e3078.png?custom=600_390'
  365. // this.form.userPic = 'https://www.geidcp.com/api/fileextend/pub/meeting/2020/12/18/4b8e1c488766439e921fb603d99e3078.png?custom=600_390'
  366. },
  367. // 获取登录用户的信息
  368. async getUserDetails() {
  369. const res = await this.$myRequest({
  370. url: '/uc/umsUserPoints/getUserPoint',
  371. data: {
  372. // "userUid": this.form.id
  373. }
  374. });
  375. // console.log(res, '---1--->');
  376. this.userInfos = res.data.umsUserPoints[0]
  377. },
  378. getClearCacle() {
  379. let that = this;
  380. // #ifdef APP-PLUS
  381. plus.cache.calculate(function(size) {
  382. let sizeCache = parseInt(size);
  383. if (sizeCache == 0) {
  384. that.fileSizeString = "0B";
  385. } else if (sizeCache < 1024) {
  386. that.fileSizeString = sizeCache + "B";
  387. } else if (sizeCache < 1048576) {
  388. that.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
  389. } else if (sizeCache < 1073741824) {
  390. that.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
  391. } else {
  392. that.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
  393. }
  394. });
  395. // #endif
  396. },
  397. AccountHide(email) {
  398. let altIndex = email.indexOf('@');
  399. let spotIndex = email.lastIndexOf('.');
  400. let star = '*';
  401. let starNum1 = 4;
  402. let starNum2 = 3;
  403. let emailHide = '';
  404. let emailHide1 = '';
  405. let emailHide2 = '';
  406. if (altIndex > starNum1) {
  407. emailHide1 = email.slice(0, altIndex - starNum1) + star.repeat(starNum1);
  408. if (spotIndex - altIndex - 0 > starNum2) {
  409. emailHide2 = email.slice(altIndex, altIndex + 1) + star.repeat(starNum2) + email.slice(altIndex +
  410. starNum1);
  411. } else {
  412. emailHide2 = email.slice(altIndex, altIndex + 1) + star.repeat(spotIndex - altIndex - 1) + email
  413. .slice(
  414. spotIndex);
  415. }
  416. } else {
  417. emailHide1 = email.slice(0, 1) + star.repeat(altIndex - 1);
  418. if (spotIndex - altIndex - 0 > starNum2) {
  419. emailHide2 = email.slice(altIndex, altIndex + 1) + star.repeat(starNum2) + email.slice(altIndex +
  420. starNum1);
  421. } else {
  422. emailHide2 = email.slice(altIndex, altIndex + 1) + star.repeat(spotIndex - altIndex - 1) + email
  423. .slice(
  424. spotIndex);
  425. }
  426. }
  427. return emailHide = emailHide1 + emailHide2
  428. },
  429. ClearCache() {
  430. let that = this;
  431. // #ifdef APP-PLUS
  432. let os = plus.os.name;
  433. if (os == 'Android') {
  434. let main = plus.android.runtimeMainActivity();
  435. let sdRoot = main.getCacheDir();
  436. let files = plus.android.invoke(sdRoot, "listFiles");
  437. let len = files.length;
  438. for (let i = 0; i < len; i++) {
  439. let filePath = '' + files[i]; // 没有找到合适的方法获取路径,这样写可以转成文件路径
  440. plus.io.resolveLocalFileSystemURL(filePath, function(entry) {
  441. if (entry.isDirectory) {
  442. entry.removeRecursively(function(entry) { //递归删除其下的所有文件及子目录
  443. uni.showToast({
  444. title: '缓存清理完成',
  445. duration: 2000
  446. });
  447. that.getClearCacle(); // 重新计算缓存
  448. }, function(e) {
  449. console.log(e.message)
  450. });
  451. } else {
  452. entry.remove();
  453. }
  454. }, function(e) {
  455. console.log('文件路径读取失败')
  456. });
  457. }
  458. } else { // ios
  459. plus.cache.clear(function() {
  460. uni.showToast({
  461. title: '缓存清理完成',
  462. duration: 2000
  463. });
  464. that.getClearCacle();
  465. });
  466. }
  467. // #endif
  468. },
  469. setting() {
  470. if (this.AuthToken) {
  471. this.navTo('/pages/profile/profileSetUp/setUp')
  472. } else {
  473. this.show = true;
  474. }
  475. },
  476. AboutUs() {
  477. this.navTo('/pages/profile/profileSetUp/aboutUs')
  478. },
  479. toPersonalInfo() {
  480. if (this.AuthToken) {
  481. this.navTo('/pages/profile/profileSetUp/personalInformation')
  482. } else {
  483. this.show = true;
  484. }
  485. },
  486. // 签到
  487. toGetIntegrate() {
  488. if (this.AuthToken) {
  489. this.navTo('/pages/profile/personIntegrate/getIntegrate')
  490. } else {
  491. this.show = true;
  492. }
  493. },
  494. // 积分账户
  495. toIntegrate() {
  496. if (this.AuthToken) {
  497. this.navTo('/pages/profile/personIntegrate/integrateAccount')
  498. } else {
  499. this.show = true;
  500. }
  501. },
  502. // 积分兑换
  503. toConversion() {
  504. if (this.AuthToken) {
  505. this.navTo('/pages/profile/personIntegrate/integrateConversion')
  506. } else {
  507. this.show = true;
  508. }
  509. },
  510. // 权益等级
  511. toGrade() {
  512. if (this.AuthToken) {
  513. this.navTo('/pages/profile/personIntegrate/equityGrade')
  514. } else {
  515. this.show = true;
  516. }
  517. },
  518. //地址管理
  519. toAddress() {
  520. if (this.AuthToken) {
  521. this.navTo('/pages/profile/personIntegrate/userAddress')
  522. } else {
  523. this.show = true;
  524. }
  525. },
  526. // 成长值
  527. toGrowList() {
  528. if (this.AuthToken) {
  529. this.navTo('/pages/profile/personIntegrate/growList')
  530. } else {
  531. this.show = true;
  532. }
  533. },
  534. settingConfirm() {
  535. setTimeout(() => {
  536. // 3秒后自动关闭
  537. this.show = false;
  538. this.navTo('/pages/public/login')
  539. // 如果不想关闭,而单是清除loading状态,需要通过ref手动调用方法
  540. // this.$refs.uModal.clearLoading();
  541. }, 500)
  542. },
  543. /* backLogin() {
  544. try {
  545. uni.removeStorageSync('Auth-Token');
  546. uni.removeStorageSync('user');
  547. // uni.redirectTo({
  548. // url: '/pages/profile/profile'
  549. // });
  550. this.Storage_data = null;
  551. this.AuthToken = null;
  552. console.log(this.AuthToken, '========', uni.getStorageSync('Auth-Token'))
  553. // uni.switchTab({
  554. // url: '/pages/profile/profile'
  555. // });
  556. } catch (e) {
  557. };
  558. }, */
  559. getTabBar() {
  560. uni.setTabBarItem({
  561. index: 0,
  562. text: this.$t('common.Home')
  563. });
  564. uni.setTabBarItem({
  565. index: 1,
  566. text: this.$t('common.News')
  567. });
  568. uni.setTabBarItem({
  569. index: 2,
  570. text: this.$t('common.Find')
  571. });
  572. uni.setTabBarItem({
  573. index: 3,
  574. text: this.$t('common.Service')
  575. });
  576. uni.setTabBarItem({
  577. index: 4,
  578. text: this.$t('common.Account')
  579. });
  580. },
  581. // 点击头像判断是否登录
  582. toNav() {
  583. if (this.Storage_data) {
  584. this.navTo('/pages/public/login')
  585. } else {
  586. this.navTo('/pages/public/login')
  587. }
  588. },
  589. popupChange() {
  590. this.getConText();
  591. },
  592. getConText() {
  593. if (this.AuthToken && this.$i18n.locale == 'zh') {
  594. this.contentText = '检测到您已登录,修改语言设置会同步到账户默认语言中,是否修改?'
  595. } else if (this.AuthToken && this.$i18n.locale !== 'zh') {
  596. this.contentText =
  597. 'It is detected that you have logged in. Modifying the language settings will be synchronized to the default language of the account. Do you want to modify it?'
  598. } else if (!this.AuthToken && this.$i18n.locale !== 'zh') {
  599. this.contentText = 'Confirm to switch to Chinese?'
  600. } else {
  601. this.contentText = '确认切换为英文?'
  602. };
  603. },
  604. async confirm(done) {
  605. if (this.AuthToken) {
  606. let res = await this.$myRequest({
  607. url: '/uc/userCenter/settingLanguage',
  608. data: {
  609. language: this.$i18n.locale == 'zh' ? 'en' : 'zh'
  610. },
  611. })
  612. if (res.status == 200) {
  613. if (this.$i18n.locale == 'zh') {
  614. uni.setStorageSync("language", 'en')
  615. this.$i18n.locale = 'en';
  616. } else {
  617. uni.setStorageSync("language", 'zh')
  618. this.$i18n.locale = 'zh';
  619. }
  620. this.$refs.uToast.show({
  621. title: this.$i18n.locale == 'zh' ? '设置成功' : 'set language success',
  622. type: 'success',
  623. icon: false
  624. })
  625. } else {
  626. this.$refs.uToast.show({
  627. title: this.$i18n.locale == 'zh' ? '设置失败' : 'set language fail',
  628. type: 'error',
  629. icon: false
  630. })
  631. }
  632. } else {
  633. if (this.$i18n.locale == 'zh') {
  634. uni.setStorageSync("language", 'en')
  635. this.$i18n.locale = 'en';
  636. } else {
  637. uni.setStorageSync("language", 'zh')
  638. this.$i18n.locale = 'zh';
  639. }
  640. }
  641. this.getTabBar();
  642. done();
  643. },
  644. close(done) {
  645. done();
  646. },
  647. languageChange() {
  648. this.$refs.popup.open();
  649. },
  650. navTo(route) {
  651. this.$mRouter.push({
  652. route
  653. });
  654. },
  655. }
  656. };
  657. </script>
  658. <style lang="scss" scoped>
  659. .rf-category {
  660. background-color: $color-white;
  661. /* #ifdef APP-PLUS */
  662. margin-top: calc(20upx + var(--status-bar-height));
  663. /* #endif */
  664. .dcp-profile {
  665. background-color: #1777ff;
  666. height: 100upx;
  667. color: $color-white;
  668. }
  669. .uni-button[type=fff] {
  670. color: #323232;
  671. background-color: #fff;
  672. }
  673. .border {
  674. background-color: #f3f4f6;
  675. height: 20upx;
  676. width: 100%;
  677. }
  678. .dcp-profile-nav {
  679. height: 200upx;
  680. margin: 0 20upx;
  681. position: relative;
  682. background-image: url('/static/bgc-user.png');
  683. background-size: 100%;
  684. .introduceItemImg {
  685. width: 130upx;
  686. height: 130upx;
  687. position: absolute;
  688. left: 30upx;
  689. top: 36upx;
  690. }
  691. .dcp-profile-right {
  692. width: 500upx;
  693. height: 100%;
  694. float: right;
  695. .dcp-profile-nameNot {
  696. line-height: 100upx;
  697. margin-top: 48upx;
  698. .dcp-profile-nameNot1 {
  699. font-weight: 700;
  700. color: #515056;
  701. font-size: 35upx;
  702. }
  703. }
  704. .dcp-profile-name {
  705. line-height: 80upx;
  706. margin-top: 36upx;
  707. .dcp-profile-name1 {
  708. font-weight: 700;
  709. color: #515056;
  710. font-size: 35upx;
  711. }
  712. .dcp-profile-name2 {
  713. color: #f5888d;
  714. font-size: 26upx;
  715. padding: 5upx 10upx;
  716. border: 1px solid #f5888d;
  717. margin-left: 24upx;
  718. border-radius: 20upx;
  719. }
  720. }
  721. }
  722. .dcp-profile-icon {
  723. position: absolute;
  724. right: 20upx;
  725. top: 50upx;
  726. font-size: 75upx;
  727. color: #999999;
  728. font-weight: 400;
  729. }
  730. }
  731. .Certification {
  732. position: relative;
  733. /* font-size: 22upx; */
  734. color: #fff;
  735. line-height: 45upx;
  736. height: 160upx;
  737. border-radius: 15upx;
  738. margin: 0upx 20upx 0 20upx;
  739. background-color: #1b76ff;
  740. }
  741. .Certification uni-view:nth-of-type(1) {
  742. font-size: 38upx;
  743. line-height: 4;
  744. margin-left: 35upx;
  745. }
  746. .Certification uni-view:nth-of-type(2) {
  747. font-size: 22upx;
  748. position: relative;
  749. margin-left: 35upx;
  750. }
  751. .Certification uni-view:nth-of-type(2) .text_vip {
  752. font-size: 92upx;
  753. color: #6dbaff;
  754. position: absolute;
  755. top: -150upx;
  756. right: 140upx;
  757. }
  758. .get-integrate {
  759. width: 16%;
  760. height: 50upx;
  761. line-height: 50upx;
  762. text-align: center;
  763. background-color: lightskyblue;
  764. border: 1upx solid skyblue;
  765. transform: translateX(230%) translateY(-140%);
  766. .get-text {
  767. color: blue;
  768. }
  769. }
  770. .new-integrate {
  771. position: relative;
  772. color: #fff;
  773. line-height: 45upx;
  774. height: 160upx;
  775. border-radius: 15upx;
  776. margin: 0upx 20upx 0 20upx;
  777. background-color: #1b76ff;
  778. display: flex;
  779. justify-content: space-around;
  780. .new-integrate-grade {
  781. display: block;
  782. text-align: center;
  783. width: 30%;
  784. }
  785. .new-content {
  786. display: block;
  787. text-align: center;
  788. width: 30%;
  789. margin-top: 3%;
  790. .user-num {
  791. font-size: 45rpx;
  792. }
  793. }
  794. }
  795. .yellow_border {
  796. width: 100upx;
  797. height: 100upx;
  798. background-color: #fbe104;
  799. border-radius: 50%;
  800. overflow: hidden;
  801. text-align: center;
  802. line-height: 100upx;
  803. }
  804. .right {
  805. position: absolute;
  806. right: 24upx;
  807. bottom: 45%;
  808. font-size: 71upx;
  809. transform: translateY(42%);
  810. }
  811. .history-section {
  812. padding: 10upx 0 0;
  813. margin-top: 15upx;
  814. background: #fff;
  815. border-radius: 10upx;
  816. .sec-header {
  817. display: flex;
  818. align-items: center;
  819. font-size: $font-base;
  820. color: $font-color-dark;
  821. line-height: 40upx;
  822. margin-left: 30upx;
  823. .yticon {
  824. font-size: 44upx;
  825. color: #5eba8f;
  826. margin-right: 16upx;
  827. line-height: 40upx;
  828. }
  829. }
  830. .h-list {
  831. white-space: nowrap;
  832. padding: 30upx 30upx 0;
  833. image {
  834. display: inline-block;
  835. width: 160upx;
  836. height: 160upx;
  837. margin-right: 20upx;
  838. border-radius: 10upx;
  839. }
  840. }
  841. }
  842. }
  843. </style>