methodTool.js 534 B

12345678910111213141516171819202122232425262728
  1. const BASE_IMG_URL = 'https://file-dev.xyyxt.net/'
  2. import store from '@/store/index.js'
  3. export default {
  4. isLogin() {
  5. if(uni.getStorageSync('union_id')){
  6. return true;
  7. }else{
  8. return false
  9. }
  10. },
  11. splitImgHost(url) {
  12. if(!url){
  13. return ''
  14. }
  15. if(url.indexOf("http") != -1||url.indexOf("https") != -1){
  16. return url;
  17. }
  18. return BASE_IMG_URL+url
  19. },
  20. exit() {
  21. uni.removeStorageSync('union_id')
  22. uni.removeStorageSync('token')
  23. store.state.userInfo = null
  24. uni.reLaunch({
  25. url: '/pages/index/index'
  26. });
  27. },
  28. }