index.js 510 B

123456789101112131415161718192021222324252627
  1. import { computed } from 'vue'
  2. import { useStore } from 'vuex'
  3. export default () => {
  4. return cb => {
  5. const store = useStore()
  6. const token = computed(() => store.state.token)
  7. if (token.value) {
  8. cb && cb()
  9. } else{
  10. uni.showModal({
  11. content: '你还未登录,请先登录',
  12. confirmText: '去登录',
  13. confirmColor: '#0063F5',
  14. success: function (res) {
  15. if (res.confirm) {
  16. uni.navigateTo({
  17. url: '/modules/common/login/login'
  18. })
  19. }
  20. }
  21. })
  22. }
  23. }
  24. }