set.vue 6.1 KB

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