Usermanager.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <view>
  3. <customNav :shownav="true" :title="$t('user.gerenxinxi')" tinColor="#40AE36" jiantou="0"></customNav>
  4. <view class="contentColumnC" style="margin-top: 30rpx;">
  5. <yhdslCropper ref="yhdslCropper" :quality="1" mode="scale" @uploadImg="uploadImg" :scale="scale"></yhdslCropper>
  6. <myImage class="iconImg" :isIcon="true" :mysrc="userInfo.avatar" mymode="scaleToFill" v-on:Emyimageclick="userIconkl"></myImage>
  7. </view>
  8. <view style="width: 92%;margin-left: 4%;margin-top: 20rpx;">
  9. <view class="contentInRowS Itemcontent" @click="userNamekl">
  10. <text class="titleText">{{$t('user.nicheng')}}</text>
  11. <view class="contentInRowC titleText">
  12. <text class="">{{userInfo.nickName}}</text>
  13. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  14. </view>
  15. </view>
  16. <view class="contentInRowS Itemcontent" @click="shimingrenzh">
  17. <text class="titleText">{{$t('user.shimingwsmrz')}}</text>
  18. <view class="contentInRowC">
  19. <text class="titleText">{{audTitle}}</text>
  20. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  21. </view>
  22. </view>
  23. <view class="contentInRowS Itemcontent" @click="shezhixiugai(0)">
  24. <text class="titleText">{{$t('user.bangdingsj')}}</text>
  25. <view class="contentInRowC titleText">
  26. <text v-if="telPhone" class="">{{telPhone}}</text>
  27. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  28. </view>
  29. </view>
  30. <view class="contentInRowS Itemcontent" @click="cheshourenzheng">
  31. <text class="titleText">{{$t('user.cheshourenzh')}}</text>
  32. <view class="contentInRowC">
  33. <!-- <text class="detealText">{{userInfo.licensePlate}}</text> -->
  34. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  35. </view>
  36. </view>
  37. <view class="contentInRowS Itemcontent" @click="shezhixiugai(4)">
  38. <text class="titleText">{{$t('index.zhoubianfw')}}</text>
  39. <view class="contentInRowC">
  40. <text class="detealText">{{juli}}Km</text>
  41. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  42. </view>
  43. </view>
  44. <view class="contentInRowS Itemcontent" @click="shezhixiugai(5)">
  45. <text class="titleText">{{$t('user.navType')}}</text>
  46. <view class="contentInRowC">
  47. <text class="detealText">{{navType}}</text>
  48. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  49. </view>
  50. </view>
  51. <view class="contentInRowS Itemcontent" @click="shezhixiugai(1)">
  52. <text class="titleText">{{$t('user.denglumima')}}</text>
  53. <view class="contentInRowC">
  54. <text class="detealText">{{$t('user.xiugai')}}</text>
  55. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  56. </view>
  57. </view>
  58. <!-- <view class="contentInRowS Itemcontent" @click="shezhixiugai(2)">
  59. <text class="titleText">{{$t('user.zhifumima')}}</text>
  60. <view class="contentInRowC">
  61. <text class="detealText">{{$t('user.weishezhi')}}</text>
  62. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  63. </view>
  64. </view> -->
  65. <view class="contentInRowS Itemcontent" @click="zhuxiaozh">
  66. <text class="titleText">{{$t('user.zhuxiaozh')}}</text>
  67. <view class="contentInRowR">
  68. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  69. </view>
  70. </view>
  71. <view class="contentInRowS Itemcontent" @click="tuichudengl">
  72. <text class="titleText">{{$t('user.tuichudengl')}}</text>
  73. <view class="contentInRowR">
  74. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  75. </view>
  76. </view>
  77. <view class="contentInRowS Itemcontent" @click="yueduyszc">
  78. <text class="titleText">{{$t('index.yinsizc')}}</text>
  79. <view class="contentInRowR">
  80. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  81. </view>
  82. </view>
  83. <!-- <view class="contentInRowS Itemcontent" @click="openwebV(1)">
  84. <text class="titleText">{{$t('user.baomizc')}}</text>
  85. <view class="contentInRowR">
  86. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  87. </view>
  88. </view> -->
  89. <view class="contentInRowS Itemcontent" @click="openwebV(2)">
  90. <text class="titleText">{{$t('user.fuwutiaok')}}</text>
  91. <view class="contentInRowR">
  92. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  93. </view>
  94. </view>
  95. <view class="contentInRowS Itemcontent" @click="openwebV(3)">
  96. <text class="titleText">{{$t('user.caozuogz')}}</text>
  97. <view class="contentInRowR">
  98. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  99. </view>
  100. </view>
  101. <view class="contentInRowS Itemcontent" @click="openwebV(4)">
  102. <text class="titleText">{{$t('user.zengyihts')}}</text>
  103. <view class="contentInRowR">
  104. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  105. </view>
  106. </view>
  107. <view class="contentInRowS Itemcontent" @click="openwebV(5)">
  108. <text class="titleText">{{$t('user.guanyuwm')}}</text>
  109. <view class="contentInRowR">
  110. <image class="jiantouImg" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  111. </view>
  112. </view>
  113. </view>
  114. <view style="height: 140rpx;"></view>
  115. <view class="versionV">
  116. <view class="versionitem">
  117. <!-- <text class="appname"></text> -->
  118. <text class="dangqbb">{{$t('user.dangqianbb')}}: v({{appVersionCode}})</text>
  119. </view>
  120. <view style="height: 50rpx;"></view>
  121. </view>
  122. <popViewGG :tips="$t('order.qingxuanz')" :show="showpop" :acttips="$t('index.queren')" :maskClosable="true" :isCancel="true" @chooseCancel="chooseCancel">
  123. <picker-view :indicator-style="indicatorStyle" :value="pvalue" @change="bindChange" class="picker-view">
  124. <picker-view-column>
  125. <view class="item" v-for="(item,index) in range" :key="index">{{item}}</view>
  126. </picker-view-column>
  127. </picker-view>
  128. </popViewGG>
  129. <!-- 提示窗示例 -->
  130. <uni-popup ref="TCalertDialog" type="dialog">
  131. <uni-popup-dialog type="NOMLE" :cancelText="$t('index.quxiao')" :confirmText="$t('index.queren')" :title="titleT" :content="noteT" @confirm="TCdialogConfirm"
  132. @close="TCdialogClose"></uni-popup-dialog>
  133. </uni-popup>
  134. <uni-popup ref="alertDialog" type="dialog">
  135. <uni-popup-dialog ref="inputClose" mode="input" :title="inputTitle" value="" :placeholder="inputNote" :confirmText="$t('index.queren')" :cancelText="$t('index.quxiao')" @confirm="dialogConfirm"></uni-popup-dialog>
  136. </uni-popup>
  137. </view>
  138. </template>
  139. <script>
  140. import {
  141. getUserMsg,
  142. updataUserMsg,
  143. deleuser
  144. } from '@/pages/api/login';
  145. import {
  146. UploadImage
  147. } from '@/pages/api/basic.js';
  148. import yhdslCropper from '@/components/yhdsl-cropper/yhdsl-cropper.vue';
  149. export default {
  150. components: {
  151. yhdslCropper
  152. },
  153. data() {
  154. return {
  155. range: ["3Km","5Km","10Km","15Km","20Km","25Km","30Km"],
  156. rangeMark:1,
  157. showpop:false,
  158. indicatorStyle: 'height: 50px;',
  159. pvalue: [0],
  160. juli:10,
  161. userInfo:'',
  162. userIcon:'',
  163. scale:1,
  164. avatar:'',
  165. telPhone:'',
  166. nikename:'',
  167. auditStatus:0,
  168. audTitle:this.$t('user.weirenzheng'),
  169. versionMSG:[],
  170. appversionN:'',
  171. appVersionCode:0,
  172. isnewV:true,
  173. doSate:0,
  174. titleT:'',
  175. noteT:'',
  176. navType:'',
  177. inputTitle:'',
  178. inputNote:'',
  179. inputState:0
  180. }
  181. },
  182. onLoad() {
  183. this.userInfo = uni.getStorageSync('userInfo');
  184. this.avatar = this.userInfo.avatar;
  185. this.telPhone = this.userInfo.telPhone;
  186. this.nikename = this.userInfo.nikename;
  187. this.auditStatus = this.userInfo.auditStatus;
  188. var tempaut = uni.getStorageSync('auditStatus');
  189. if(this.auditStatus==0){
  190. this.audTitle=this.$t('user.weirenzheng')
  191. if(tempaut==9){
  192. this.audTitle=this.$t('user.shenhezhong')
  193. }
  194. }
  195. else if(this.auditStatus==1){
  196. this.audTitle=this.$t('user.yirenzheng')
  197. }
  198. },
  199. onShow() {
  200. this.getUserMsg();
  201. var tempjuli=uni.getStorageSync('FuWujuli');
  202. if(''==tempjuli||null==tempjuli||undefined==tempjuli){
  203. this.juli=10;
  204. }
  205. else{
  206. this.juli=tempjuli;
  207. }
  208. this.navType=uni.getStorageSync('navType');
  209. if(''==this.navType||null==this.navType||undefined==this.navType){
  210. this.navType=this.$t('user.navTypeby');
  211. uni.setStorageSync('navType','cycling');
  212. }
  213. else{
  214. if(this.navType=='cycling'){
  215. this.navType=this.$t('user.navTypeby');
  216. }
  217. else{
  218. this.navType=this.$t('user.navTypedr');
  219. }
  220. }
  221. var info = uni.getSystemInfoSync();
  222. //console.log(info);
  223. this.appVersionCode=info.appVersionCode;
  224. this.appversionN=info.appVersion;
  225. },
  226. methods: {
  227. userIconkl(){
  228. console.log('userIconkl');
  229. this.$refs.yhdslCropper.chooseImage();
  230. },
  231. userNamekl(){
  232. this.inputTitle=this.$t('user.shezhinc');
  233. this.inputNote=this.$t('user.qingshurnc');
  234. this.inputState=1;
  235. this.$refs.alertDialog.open('center');
  236. },
  237. cheshourenzheng(){
  238. uni.navigateTo({
  239. url:'/pages/user/Cheshourenzheng'
  240. })
  241. },
  242. chepaihao(){
  243. this.inputTitle=this.$t('user.chepaihao');
  244. this.inputNote=this.$t('user.qsrchepaihao');
  245. this.inputState=2;
  246. this.$refs.alertDialog.open('center');
  247. },
  248. shimingrenzh(){
  249. uni.navigateTo({
  250. url:'/pages/user/zhanghu/Shimingrenzheng'
  251. })
  252. return;
  253. if(this.auditStatus!=0){
  254. uni.navigateTo({
  255. url:'/pages/user/zhanghu/Shimingrenzheng'
  256. })
  257. }
  258. },
  259. dialogConfirm(name) {
  260. console.log('点击确认')
  261. if(this.inputState==1){
  262. var usdata = {
  263. "nickName": name};
  264. this.updataUserMsg(usdata);
  265. }
  266. else if(this.inputState==2){
  267. var usdata = {
  268. "licensePlate": name};
  269. this.updataUserMsg(usdata);
  270. }
  271. },
  272. dialogClose() {
  273. console.log('点击关闭')
  274. },
  275. shezhixiugai(index){
  276. if(index==4){
  277. this.range=["3Km","5Km","10Km","15Km","20Km","25Km","30Km"];
  278. this.rangeMark=1;
  279. this.showpop = true;
  280. return;
  281. }
  282. if(index==5){
  283. this.range=[this.$t('user.navTypedr'),this.$t('user.navTypeby')];
  284. this.rangeMark=2;
  285. this.showpop = true;
  286. return;
  287. }
  288. uni.navigateTo({
  289. url:'/pages/user/Shezhixiugai?state='+index
  290. })
  291. },
  292. zhuxiaozh(){
  293. this.titleT=this.$t('user.zhuxiaozh');
  294. this.noteT=this.$t('user.zhuxiaodqzh');
  295. this.doSate=2;
  296. this.$refs.TCalertDialog.open('center');
  297. },
  298. tuichudengl(){
  299. this.titleT=this.$t('user.tuichudengl');
  300. this.noteT=this.$t('user.querentcdq');
  301. this.doSate=1;
  302. this.$refs.TCalertDialog.open('center');
  303. },
  304. TCdialogConfirm(name) {
  305. console.log('点击确认')
  306. if(this.doSate==1){
  307. uni.setStorageSync('userInfo','');
  308. uni.setStorageSync('token','');
  309. getApp().globalData.token='';
  310. this.goeasydisconnect();
  311. setTimeout(function() {
  312. uni.reLaunch({
  313. url:'/pages/index/index'
  314. })
  315. }, 1000);
  316. }
  317. else if(this.doSate==2){//注销账号
  318. this.updatazuxiao();
  319. }
  320. },
  321. updatazuxiao(){
  322. this.$http.get(`${deleuser}`,{},true)
  323. .then(r => {
  324. console.log('deleuser',r)
  325. getApp().globalData.token='';
  326. uni.setStorageSync('userInfo','');
  327. uni.setStorageSync('token','');
  328. this.goeasydisconnect();
  329. setTimeout(function() {
  330. uni.reLaunch({
  331. url:'/pages/index/index'
  332. })
  333. }, 1000);
  334. })
  335. .catch(err => {
  336. console.log(err)
  337. })
  338. },
  339. TCdialogClose() {
  340. console.log('点击关闭')
  341. },
  342. uploadImg(e) {
  343. //console.log('------------uploadImg:',e)
  344. this.spImage = e;
  345. var that = this;
  346. uni.uploadFile({
  347. url: this.$baseurl+UploadImage, //上传图片api
  348. filePath: e,
  349. name: 'file',
  350. header:{
  351. //"Authorization": userinfo.token
  352. },
  353. success: (res) => {
  354. let group = JSON.parse(res.data);
  355. that.userIcon=group.data;
  356. var usdata = {
  357. "avatar": that.userIcon};
  358. that.updataUserMsg(usdata);
  359. }
  360. });
  361. },
  362. async updataUserMsg(data){
  363. var that = this;
  364. await this.$http.post(`${updataUserMsg}`,data,true)
  365. .then(async r => {
  366. console.log('updataUserMsg',r)
  367. that.getUserMsg();
  368. })
  369. .catch(err => {
  370. console.log(err)
  371. })
  372. },
  373. async getUserMsg(){
  374. console.log('getUserMsg')
  375. await this.$http.get(`${getUserMsg}`, {
  376. },true)
  377. .then(async r => {
  378. console.log(r.data)
  379. this.userInfo=r.data.data;
  380. this.telPhone=r.data.data.telPhone;
  381. this.nickName=r.data.data.nickName;
  382. this.avatar=r.data.data.avatar;
  383. //console.log('this.avatar',this.avatar)
  384. uni.setStorageSync('userInfo',r.data.data);
  385. if(r.data.data.userType==1){
  386. this.isShangjia=true;
  387. }
  388. })
  389. .catch(err => {
  390. console.log(err)
  391. })
  392. },
  393. bindChange (e) {
  394. if(this.rangeMark==1){
  395. var val = e.detail.value[0];
  396. console.log(val)
  397. if(val==0){
  398. this.juli=3;
  399. }
  400. else{
  401. this.juli=5*val;
  402. }
  403. uni.setStorageSync('FuWujuli',this.juli);
  404. }
  405. else if(this.rangeMark==2){
  406. var val = e.detail.value[0];
  407. console.log(val)
  408. if(val==0){
  409. uni.setStorageSync('navType','driving-traffic');
  410. this.navType=this.$t('user.navTypedr');
  411. }
  412. else if(val==1){
  413. uni.setStorageSync('navType','cycling');
  414. this.navType=this.$t('user.navTypeby');
  415. }
  416. }
  417. },
  418. chooseCancel(){
  419. this.showpop=false;
  420. console.log(this.juli);
  421. },
  422. checkgengxin(){
  423. },
  424. yueduyszc(){
  425. uni.navigateTo({
  426. url:'/pages/index/yinszhengc'
  427. })
  428. },
  429. openwebV(index){
  430. var url=''
  431. if(index==1){
  432. url='https://fooder.tw/bao-mat-thong-tin'
  433. }
  434. if(index==2){
  435. url='https://fooder.tw/dieu-khoan-su-dung'
  436. }
  437. if(index==3){
  438. url='https://fooder.tw/quy-che-hoat-dong'
  439. }
  440. if(index==4){
  441. url='https://fooder.tw/quy-trinh-giai-quyet-tranh-chap-khieu-nai'
  442. }
  443. if(index==5){
  444. url='https://fooder.tw/dia-chi-cong-ty'
  445. }
  446. uni.navigateTo({
  447. url:'/pages/index/Openwebview?url='+url
  448. })
  449. },
  450. //断开连接
  451. goeasydisconnect(){
  452. this.goEasy.disconnect({
  453. onSuccess: function(){
  454. console.log("GoEasy disconnect successfully.")
  455. getApp().globalData.goEasycnt=false;
  456. },
  457. onFailed: function(error){
  458. console.log("Failed to disconnect GoEasy, code:"+error.code+ ",error:"+error.content);
  459. }
  460. });
  461. },
  462. },
  463. }
  464. </script>
  465. <style lang="scss">
  466. @import '@/common/common.scss';
  467. page{
  468. background-color: whitesmoke;
  469. }
  470. .iconImg{
  471. margin-top: 20rpx;
  472. margin-bottom: 20rpx;
  473. width: 110rpx;
  474. height: 110rpx;
  475. border-radius: 55rpx;
  476. background-color: #1A1A1A;
  477. }
  478. .jiantouImg{
  479. width: 32rpx;
  480. height: 32rpx;
  481. }
  482. .nameText{
  483. padding-left: 20rpx;
  484. font-size: 32rpx;
  485. color: white;
  486. }
  487. .titleText{
  488. font-size: 30rpx;
  489. color: #1A1A1A;
  490. }
  491. .detealText{
  492. font-size: 28rpx;
  493. color:darkgray;
  494. }
  495. .Itemcontent{
  496. padding-top: 30rpx;
  497. padding-bottom: 30rpx;
  498. border: solid lavender;
  499. border-width: 0px 0px 1rpx 0px;
  500. }
  501. .picker-view {
  502. width: 750rpx;
  503. height: 300rpx;
  504. margin-top: 10rpx;
  505. }
  506. .item {
  507. line-height: 100rpx;
  508. text-align: center;
  509. }
  510. .versionV{
  511. position:fixed;
  512. bottom: 0rpx;
  513. width: 100%;
  514. background-color: whitesmoke;
  515. }
  516. .versionitem{
  517. display:flex;
  518. flex-direction: column;
  519. justify-content: center;
  520. align-items: center;
  521. width: 90%;
  522. }
  523. .appname{
  524. font-size: 30rpx;
  525. }
  526. .zuixinbb{
  527. padding-top: 10rpx;
  528. font-size: 28rpx;
  529. }
  530. .dangqbb{
  531. padding-top: 10rpx;
  532. font-size: 28rpx;
  533. }
  534. .huoqubb{
  535. padding-top: 10rpx;
  536. font-size: 28rpx;
  537. color: blue;
  538. text-decoration:underline;
  539. }
  540. </style>