mine.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view class="mine">
  3. <view class="top">
  4. <view class="topBox">
  5. <image src="/static/img/pic_def_ava@2x.png" mode="" class="touxiang"></image>
  6. <view class="name">{{ currentUser.supplierName }}</view>
  7. </view>
  8. <!-- <image :src="currentUser.avatar"></image> -->
  9. </view>
  10. <view class="cont" style="margin-top: -50rpx;">
  11. <view class="contBox">
  12. <!-- <view class="line" >
  13. <view class="lineName">
  14. <image src="/static/img/my_icon_history@2x.png" mode="" class="lineIcon"></image>
  15. 语音播报提醒
  16. </view>
  17. <image src="/static/img/icon_arrow.png" mode="" class="jtImg"></image>
  18. </view> -->
  19. <view class="line" @click="goUp">
  20. <view class="lineName">
  21. <image src="/static/img/my_icon_psw@2x.png" mode="" class="lineIcon"></image>
  22. 修改密码
  23. </view>
  24. <image src="/static/img/icon_arrow.png" mode="" class="jtImg"></image>
  25. </view>
  26. <view class="line" @click="goBrand">
  27. <view class="lineName">
  28. <image src="/static/img/my_icon_jiuc@2x.png" mode="" class="lineIcon"></image>
  29. 经营品牌</view>
  30. <image src="/static/img/icon_arrow.png" mode="" class="jtImg"></image>
  31. </view>
  32. </view>
  33. <!-- <view class="contBox" style="margin-top: 20rpx;">
  34. <view class="line">
  35. <view class="lineName">当前版本</view>
  36. <view class="version">version1.0.0</view>
  37. </view>
  38. <view class="line" @click="claerHc">
  39. <view class="lineName">清除缓存</view>
  40. <image src="/static/img/icon_arrow.png" mode="" class="jtImg"></image>
  41. </view>
  42. </view> -->
  43. </view>
  44. <view class="bottom">
  45. <view class="logout" @click="logout">退出</view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. const GoEasy = uni.$GoEasy;
  51. export default {
  52. data() {
  53. return {
  54. currentUser: null,
  55. token:'',
  56. }
  57. },
  58. onShow() {
  59. this.currentUser = uni.getStorageSync("loginInfo")
  60. var token= uni.getStorageSync("accessToken")
  61. this.token=token
  62. if(token){
  63. this.imLoginUrl()
  64. }else{
  65. uni.navigateTo({
  66. url: './login'
  67. })
  68. }
  69. },
  70. methods: {
  71. imLoginUrl(){
  72. this.$http2('imSys/imLoginUrl', {
  73. token:this.token,
  74. type:1
  75. },'POST').then(res => {
  76. console.log(res)
  77. if(res.code!=0){
  78. // uni.clearStorageSync();
  79. this.logout()
  80. }
  81. })
  82. },
  83. claerHc(){
  84. uni.showToast({
  85. icon: 'none',
  86. title: '清除成功',
  87. duration: 3000
  88. });
  89. },
  90. goUp(){
  91. uni.navigateTo({
  92. url:'editPass'
  93. })
  94. },
  95. goBrand(){
  96. uni.navigateTo({
  97. url:'brand'
  98. })
  99. },
  100. logout() {
  101. // uni.clearStorageSync();
  102. GoEasy.disconnect({
  103. onSuccess: function(){
  104. console.log("GoEasy disconnect successfully.")
  105. uni.removeStorageSync('accessToken');
  106. uni.removeStorageSync('loginInfo')
  107. uni.navigateTo({
  108. url: './login'
  109. })
  110. },
  111. onFailed: function(error){
  112. uni.removeStorageSync('accessToken');
  113. uni.removeStorageSync('loginInfo')
  114. uni.navigateTo({
  115. url: './login'
  116. })
  117. console.log("Failed to disconnect GoEasy, code:"+error.code+ ",error:"+error.content);
  118. }
  119. });
  120. /* if(GoEasy.getConnectionStatus() === 'disconnected') {
  121. return
  122. }
  123. uni.showLoading({
  124. title: '注销中',
  125. mask: true,
  126. });
  127. GoEasy.disconnect({
  128. onSuccess: function () {
  129. uni.hideLoading();
  130. console.log('注销成功')
  131. uni.$currentUser = null;
  132. },
  133. onFailed: function (error) {
  134. uni.hideLoading();
  135. uni.showToast({
  136. icon: 'none',
  137. title: '注销超时,请检查网络!(务必确保注销成功才允许客户退出应用,否则有可能会收到上个用户的消息。)',
  138. duration: 6000
  139. });
  140. console.log('注销失败', error);
  141. }
  142. }); */
  143. }
  144. }
  145. }
  146. </script>
  147. <style scoped>
  148. .topBox{
  149. display: flex;
  150. color: #FFFFFF;
  151. font-weight: 500;
  152. font-size: 34rpx;
  153. color: #FFFFFF;
  154. padding-left: 25rpx;
  155. padding-top: 70rpx;
  156. }
  157. .cont{
  158. padding: 0 24rpx;
  159. }
  160. .lineIcon{
  161. width: 40rpx;height: 40rpx;margin-right: 10rpx;
  162. }
  163. .lineName{
  164. display: flex;line-height: 42rpx;
  165. }
  166. .contBox{
  167. background: #FFFFFF;
  168. border-radius: 10rpx;
  169. }
  170. .mine {
  171. width: 100%;
  172. height: 100%;
  173. display: flex;
  174. flex-direction: column;
  175. background: #F7F7F7;
  176. }
  177. .top {
  178. height: 240rpx;
  179. background: #46B1F8;
  180. /* display: flex;
  181. flex-direction: column;
  182. justify-content: center;
  183. align-items: center; */
  184. }
  185. .top .touxiang {
  186. width: 82rpx;
  187. height: 82rpx;
  188. /* border-radius: 156rpx; */
  189. }
  190. .top .name {
  191. line-height: 82rpx;
  192. padding-left: 16rpx;
  193. }
  194. .bottom {
  195. text-align: center;
  196. line-height: 200rpx;
  197. margin-top: 100rpx;
  198. }
  199. .logout {
  200. width: 702rpx;
  201. height: 88rpx;
  202. background: #FFFFFF;
  203. border-radius: 10rpx;
  204. margin: 0 auto;
  205. text-align: center;
  206. line-height: 88rpx;
  207. font-size: 28rpx;
  208. color: #F03B3B;
  209. }
  210. .line{
  211. display: flex;justify-content: space-between;
  212. padding: 30rpx 20rpx;
  213. border-bottom: 1px solid #eee;
  214. color: #333333;
  215. }
  216. .jtImg{
  217. width: 20rpx;height: 20rpx;margin-top: 6rpx;
  218. }
  219. </style>