@@ -0,0 +1,27 @@
+import { computed } from 'vue'
+import { useStore } from 'vuex'
+
+export default () => {
+ return cb => {
+ const store = useStore()
+ const token = computed(() => store.state.token)
+ if (token.value) {
+ cb && cb()
+ } else{
+ uni.showModal({
+ content: '你还未登录,请先登录',
+ confirmText: '去登录',
+ confirmColor: '#0063F5',
+ success: function (res) {
+ if (res.confirm) {
+ uni.navigateTo({
+ url: '/modules/common/login/login'
+ })
+ }
+}
@@ -32,7 +32,7 @@ const request = (method, url, data, opt) => {
if (data.code === 200 || data.success) {
resolve(data)
- } else{
+ } else {
uni.showToast({
title: data.msg,
icon: 'none'