import unit from '@/utils/tool/unit';
import config from "../../../config/config";
import orderData from '../data/order';
import controlData from '../data/control';
import notice from "@/utils/notice/index";
export default {

    data(){
        return {
            height: unit(340),
            paddingTop: config.headerHeight,
            orderData,
            controlData,
            codeModal:false
        }
    },

    methods:{

        openCodeModal(item){
          if (this.user[item.key]) return;
          if (!this.codeModal) {
              this.codeModal = true;
          }
        },

        routerTarget(name){
            this.routerLogin(()=>{
                return this.$router.navigateTo({
                    name
                })
            })
        }
    },
    onShow(){
        if (this.useNoticeItem && this.useNoticeItem.update) {
            this.useNoticeItem = undefined;
            this.$store.dispatch('updateUserInfoPromise',true);
        }
    },

    created(){
        this.$store.dispatch('updateUserInfoPromise',true);
        notice.on('user',(item)=>{
            this.useNoticeItem = item;
        },'user');

    }

}