import {ref} from "vue"
import {getIsLogin, getToken} from "./auth";
import tab from "../plugins/tab";
import modal from "../plugins/modal";

export const useMixin = () => {
    const data = ref([1, 2, 3, 4])
    const obj = ref({name: 1})
    const questions = ref([
        {
            name: "大型犬无论是白天晚上，在外遛狗都是定要拴绳的，小型犬晚上在人很少的地方遛狗时视情况可以不拴绳",
            option: [
                {
                    name: "A.对",
                    value: "A"
                },
                {
                    name: "B.错",
                    value: "B"
                }
            ]
        },
        {
            name: "以下哪个选项是正确的遛狗打开方式",
            option: [
                {
                    name: "A.人为遛狗，按照狗狗的节奏走走停停，享受遛狗的过程，让狗狗充分嗅闻探索;",
                    value: "A"
                },
                {
                    name: "B.人为遛狗，遛狗过程可以一直跑步自己锻炼的同时也让狗狗充分运动;",
                    value: "B"
                },
                {
                    name: "C.让狗狗追逐交通工具，释放精力;",
                    value: "C"
                }
            ]
        },
        {
            name: "猫咪如果做错事，以下哪种教育方式更妥当",
            option: [
                {
                    name: "A.得看具体情况，严重得话打一顿，不严重得话就不管了;",
                    value: "A"
                },
                {
                    name: "B.立即大声呵止或适当冷落猫咪，让猫咪意识到不对;",
                    value: "B"
                },
                {
                    name: "C.给猫咪进行绝食，让猫咪意识到严重性;",
                    value: "C"
                }
            ]
        }
    ])
    return {
        data, obj,
        questions
    }
}
/*
* 判断是否登录
* */
export const getLoginStatus = () => {
    if (getIsLogin() && getToken()) {
        return true
    } else {
        uni.navigateTo({
        	url: '/pages/login/index'
        })
        return false
    }
}