import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import ElementUI from 'element-ui';
import http from './plugins/http';
import VueSticky from 'vue-sticky';
import 'normalize.css/normalize.css';
import '../theme/index.css';
import RichText from '@/components/RichText';
import MultiUpload from '@/components/MultiUpload';
import SingleUpload from '@/components/SingleUpload';
import FileUpload from '@/components/FileUpload';
import { mapState } from 'vuex';
import Formatters from '@/mixins/formatters';
import AutoInput from '@/components/AutoInput';
Vue.config.productionTip = false;

Vue.use(ElementUI, { size: 'small' });
Vue.use(http);
Vue.use(VueSticky);
Vue.directive('sticky', VueSticky);
Vue.component('multi-upload', MultiUpload);
Vue.component('single-upload', SingleUpload);
Vue.component('rich-text', RichText);
Vue.component('file-upload', FileUpload);
Vue.component('auto-input', AutoInput);
Vue.mixin(Formatters);

Vue.mixin({
    computed: {
        ...mapState(['userInfo'])
    }
});
Vue.filter('text', function(value) {
    var span = document.createElement('span');
    span.innerHTML = value;
    return (span.textContent || span.innerText).trim();
});
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app');

http.axios
    .get('/user/my')
    .then(res => {
        store.commit('updateUserInfo', res.data);
    })
    .catch(e => {});

/* http.axios
    .get('/artNeed/all')
    .then(res => {
        // console.log(res);
    })
    .catch(e => {});
http.axios
    .get('/financingNeeds/all')
    .then(res => {
        // console.log(res);
    })
    .catch(e => {});
http.axios
    .get('/product/all')
    .then(res => {
        // console.log(res);
    })
    .catch(e => {});
http.axios
    .get('/artProduct/all')
    .then(res => {
        // console.log(res);
    })
    .catch(e => {});
http.axios
    .get('/tresource/all')
    .then(res => {
        // console.log(res);
    })
    .catch(e => {});
http.axios
    .get('/productNeed/all')
    .then(res => {})
    .catch(e => {});
// 政民互动 官方问答
http.axios
    .get('/question/all')
    .then(res => {})
    .catch(e => {});
http.axios
    .get('/topic/all')
    .then(res => {
        // console.log(res);
    })
    .catch(e => {}); */
