auth.js 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const TokenKey = 'App-Token'
  2. const AdminTypeKey = 'App-AdminType'
  3. const ServerUrlKey = 'ServerUrl'
  4. const UserGuidKey = 'UserGuid'
  5. export function getToken() {
  6. return uni.getStorageSync(TokenKey)
  7. }
  8. export function setToken(token) {
  9. return uni.setStorageSync(TokenKey, token)
  10. }
  11. export function removeToken() {
  12. return uni.removeStorageSync(TokenKey)
  13. }
  14. export function setServerUrl(ServerUrl) {
  15. return uni.setStorageSync(ServerUrlKey, ServerUrl)
  16. }
  17. export function getServerUrl() {
  18. return uni.getStorageSync(ServerUrlKey)
  19. }
  20. export function setUserGuid(UserGuid) {
  21. return uni.setStorageSync(UserGuidKey, UserGuid)
  22. }
  23. export function getUserGuid() {
  24. return uni.getStorageSync(UserGuidKey)
  25. }
  26. export function getAdminType() {
  27. return uni.getStorageSync(AdminTypeKey)
  28. }
  29. export function setAdminType(adminType) {
  30. console.log(adminType)
  31. return uni.setStorageSync(AdminTypeKey, adminType)
  32. }
  33. export function removeAdminType() {
  34. return uni.removeStorageSync(AdminTypeKey)
  35. }