set.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="content">
  3. <view class='avatar' @click="switchPicture">
  4. <image :src="headUrl" class="picture"></image>
  5. <view class='setavatar'>
  6. <image style='width:39px;height:39px;' src="../../static/mine/set/setavatar.png"></image>
  7. </view>
  8. <view style='font-size:12px;color:#999;margin-bottom:20px;' class="" v-if="!headUrl">
  9. 未上传头像
  10. </view>
  11. </view>
  12. <view class='wrap'>
  13. <view class='flex flex-space-between wrap-item' @click="nickname(username)">
  14. <view>
  15. <text>姓名</text>
  16. </view>
  17. <view @click='editname' style='align-items: center;' class="flex">
  18. <view class="username">
  19. {{name}}
  20. </view>
  21. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  22. </view>
  23. </view>
  24. <!-- <view class='flex flex-space-between wrap-item' @click='UpdataPassword'>
  25. <view>
  26. <text>修改账号</text>
  27. </view>
  28. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  29. </view> -->
  30. </view>
  31. <view class='wrap'>
  32. <view class='flex flex-space-between wrap-item' @click='UpdataPassword'>
  33. <view>
  34. <text>修改密码</text>
  35. </view>
  36. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  37. </view>
  38. </view>
  39. <view class='wrap'>
  40. <view class='flex flex-space-between wrap-item' @click='fankui'>
  41. <view>
  42. <text>意见反馈</text>
  43. </view>
  44. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  45. </view>
  46. <u-line color="#EEEEEE" class="line"></u-line>
  47. <view class='flex flex-space-between wrap-item' @click='clearStorage'>
  48. <view>
  49. <text>注销账号</text>
  50. </view>
  51. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  52. </view>
  53. </view>
  54. <view class='exitloginwrap'>
  55. <button @click='logoutAlert()' class='exitlogin'>退出登录</button>
  56. </view>
  57. <u-modal :show="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  58. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#2772FB' confirm-text='确定' :title='title'
  59. :showCancelButton='true' :content="content" @confirm="logout" @cancel="cancelClick"></u-modal>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. mapState
  65. } from 'vuex';
  66. export default {
  67. data() {
  68. return {
  69. isShowAlert: false,
  70. content: '您确定要退出吗?',
  71. show:false,
  72. title:'温馨提示',
  73. // content:'uView的目标是成为uni-app生态最优秀的UI框架',
  74. headUrl: "@/static/mine/avatar1.png",
  75. username: "",
  76. name:'',
  77. gridList: [{
  78. num: 0,
  79. name: '退出登录',
  80. // icon:'cuIcon-exit',
  81. src: '../../static/images/sign/return@3x.png',
  82. tips: 0,
  83. url: '',
  84. show: true
  85. }, ],
  86. }
  87. },
  88. computed: {
  89. ...mapState(['hasLogin', 'userInfo'])
  90. },
  91. onShow() {
  92. this.getList()
  93. },
  94. onLoad() {
  95. uni.showLoading({
  96. title: '加载中',
  97. mask: true
  98. })
  99. this.$request.baseRequest('get', '/cargoOwnerInfo/selectCargoOwner', {
  100. commonId: this.userInfo.id
  101. }).then(res => {
  102. uni.hideLoading()
  103. if (res.data) {
  104. this.name=res.data.call+'**'
  105. }
  106. })
  107. .catch(res => {
  108. uni.hideLoading()
  109. uni.showToast({
  110. title: res.message,
  111. icon: 'none',
  112. duration: 2000
  113. })
  114. });
  115. },
  116. methods: {
  117. editname(){
  118. uni.$u.toast('可在 货主认证-身份信息 中修改')
  119. },
  120. UpdataPassword() {
  121. console.log(1111)
  122. uni.navigateTo({
  123. url: `/pages/mine/settings/editPassword?phone=${this.userInfo.phone}`
  124. })
  125. },
  126. clearStorage() {
  127. let that = this
  128. uni.clearStorage({
  129. success: function(res) {
  130. console.log('success');
  131. that.logout()
  132. }
  133. })
  134. },
  135. cancelClick() {
  136. this.isShowAlert = false
  137. },
  138. logout() {
  139. uni.hideTabBarRedDot({
  140. index: 3
  141. })
  142. uni.clearStorageSync();
  143. var that = this
  144. this.$request.baseRequest('post', '/auth/api/logout').then(res => {
  145. })
  146. this.$store.commit('logout')
  147. this.$helper.logout()
  148. uni.navigateTo({
  149. url: `/pages/public/login`
  150. })
  151. },
  152. getList() {
  153. this.userInfo = uni.getStorageSync('userInfo')
  154. this.headUrl = this.userInfo.avatarUrl
  155. if (this.headUrl == null || this.headUrl == "") {
  156. this.headUrl = "../../static/mine/avatar1.png"
  157. }
  158. this.username = this.userInfo.userName
  159. },
  160. switchPicture() {
  161. uni.navigateTo({
  162. url: `/pages/mine/settings/editAvatar`
  163. })
  164. },
  165. nickname(username) {
  166. uni.navigateTo({
  167. url: `/pages/user/set_nickname?nickname=${username}`
  168. })
  169. },
  170. exitlogin() {
  171. },
  172. fankui() {
  173. uni.navigateTo({
  174. url: `/pages/mine/settings/fankui`
  175. })
  176. },
  177. logoutAlert() {
  178. this.show=true
  179. // const that = this
  180. this.isShowAlert = true
  181. // uni.showModal({
  182. // title: '询问',
  183. // content: '您确定要退出吗?',
  184. // cancelText: '取消',
  185. // confirmText: '确定',
  186. // success: (e) => {
  187. // if (e.confirm) {
  188. // uni.hideTabBarRedDot({
  189. // index: 3
  190. // })
  191. // uni.clearStorageSync();
  192. // that.$store.commit('logout')
  193. // that.$api.logout()
  194. // uni.navigateTo({
  195. // url: `/pages/public/login`
  196. // })
  197. // }
  198. // }
  199. // })
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. page {
  206. background-color: #F5F6FA;
  207. }
  208. .wrap{
  209. background:#fff;
  210. padding:10px 15px;
  211. border-radius:5px;
  212. margin:10px 0;
  213. font-size:14px;
  214. .wrap-item{
  215. padding:10px 0;
  216. }
  217. }
  218. .avatar{
  219. text-align:center;
  220. }
  221. .container {
  222. padding: 10px 0 0px;
  223. }
  224. .content{
  225. padding:0 20px;
  226. height: calc(100vh - 7vh);
  227. }
  228. .pictures {
  229. justify-content: flex-end;
  230. width: 35px;
  231. height: 35px;
  232. background-color: #E0FAF6;
  233. border-radius: 18px;
  234. }
  235. .picture {
  236. width: 60px;
  237. height: 60px;
  238. border-radius: 30px;
  239. }
  240. .arrow {
  241. margin-left: 15px;
  242. width: 8px;
  243. height: 12px;
  244. // justify-content: flex-end
  245. }
  246. .exitloginwrap {
  247. width: 100%;
  248. padding-bottom: 20px;
  249. }
  250. .exitlogin {
  251. background: #fff;
  252. border-radius: 10px;
  253. color: #2772FB;
  254. font-size: 17px;
  255. }
  256. .exitlogin:after {
  257. border: none;
  258. }
  259. .setavatar{
  260. position:relative;
  261. margin:0 auto;
  262. width:58px;
  263. height:10px;
  264. image{
  265. position:absolute;
  266. bottom:1px;
  267. left:50%;
  268. transform: translateX(-50%);
  269. }
  270. }
  271. </style>