mine.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. saveWebState(){
  101. var standalone = window.navigator.standalone
  102. var userAgent = window.navigator.userAgent.toLowerCase()
  103. var safari = /safari/.test(userAgent)
  104. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  105. var android = /android/.test(userAgent)
  106. if (ios) {
  107. if ( true) {//!standalone&& !safari
  108. window.webkit.messageHandlers.saveWebState.postMessage(2)
  109. }
  110. } else if (android) {
  111. window.android.saveWebState(2)
  112. }
  113. },
  114. logout() {
  115. // uni.clearStorageSync();
  116. GoEasy.disconnect({
  117. onSuccess: function(){
  118. console.log("GoEasy disconnect successfully.")
  119. uni.removeStorageSync('accessToken');
  120. uni.removeStorageSync('loginInfo')
  121. uni.navigateTo({
  122. url: './login'
  123. })
  124. },
  125. onFailed: function(error){
  126. uni.removeStorageSync('accessToken');
  127. uni.removeStorageSync('loginInfo')
  128. uni.navigateTo({
  129. url: './login'
  130. })
  131. console.log("Failed to disconnect GoEasy, code:"+error.code+ ",error:"+error.content);
  132. }
  133. });
  134. this.saveWebState()
  135. /* if(GoEasy.getConnectionStatus() === 'disconnected') {
  136. return
  137. }
  138. uni.showLoading({
  139. title: '注销中',
  140. mask: true,
  141. });
  142. GoEasy.disconnect({
  143. onSuccess: function () {
  144. uni.hideLoading();
  145. console.log('注销成功')
  146. uni.$currentUser = null;
  147. },
  148. onFailed: function (error) {
  149. uni.hideLoading();
  150. uni.showToast({
  151. icon: 'none',
  152. title: '注销超时,请检查网络!(务必确保注销成功才允许客户退出应用,否则有可能会收到上个用户的消息。)',
  153. duration: 6000
  154. });
  155. console.log('注销失败', error);
  156. }
  157. }); */
  158. }
  159. }
  160. }
  161. </script>
  162. <style scoped>
  163. .topBox{
  164. display: flex;
  165. color: #FFFFFF;
  166. font-weight: 500;
  167. font-size: 34rpx;
  168. color: #FFFFFF;
  169. padding-left: 25rpx;
  170. padding-top: 70rpx;
  171. }
  172. .cont{
  173. padding: 0 24rpx;
  174. }
  175. .lineIcon{
  176. width: 40rpx;height: 40rpx;margin-right: 10rpx;
  177. }
  178. .lineName{
  179. display: flex;line-height: 42rpx;
  180. }
  181. .contBox{
  182. background: #FFFFFF;
  183. border-radius: 10rpx;
  184. }
  185. .mine {
  186. width: 100%;
  187. height: 100%;
  188. display: flex;
  189. flex-direction: column;
  190. background: #F7F7F7;
  191. }
  192. .top {
  193. height: 240rpx;
  194. background: #46B1F8;
  195. /* display: flex;
  196. flex-direction: column;
  197. justify-content: center;
  198. align-items: center; */
  199. }
  200. .top .touxiang {
  201. width: 82rpx;
  202. height: 82rpx;
  203. /* border-radius: 156rpx; */
  204. }
  205. .top .name {
  206. line-height: 82rpx;
  207. padding-left: 16rpx;
  208. }
  209. .bottom {
  210. text-align: center;
  211. line-height: 200rpx;
  212. margin-top: 100rpx;
  213. }
  214. .logout {
  215. width: 702rpx;
  216. height: 88rpx;
  217. background: #FFFFFF;
  218. border-radius: 10rpx;
  219. margin: 0 auto;
  220. text-align: center;
  221. line-height: 88rpx;
  222. font-size: 28rpx;
  223. color: #F03B3B;
  224. }
  225. .line{
  226. display: flex;justify-content: space-between;
  227. padding: 30rpx 20rpx;
  228. border-bottom: 1px solid #eee;
  229. color: #333333;
  230. }
  231. .jtImg{
  232. width: 20rpx;height: 20rpx;margin-top: 6rpx;
  233. }
  234. </style>