import App from './App'
import store from './store'
import uView from "@/node_modules/uview-ui";
import {formatSalesNum} from "@/utils/tools.js"
import {getDict,isEmpty,parseIDCardInfo,parseText,urlToObj,clearHisSearch,getHisSearch,addHisSearch,logout,getDictLabelName,getProvider,parsePhone,isLogin,getAge,parseIdCard,isLoginCourse,reLoginCheck} from './utils/common.js'
// #ifndef VUE3
import Vue from 'vue'
// Vuex 插件注册
import Vuex from 'vuex'
Vue.config.productionTip = false
App.mpType = 'app'

Vue.use(Vuex)
Vue.use(uView);
Vue.prototype.$formatSalesNum= formatSalesNum;
Vue.prototype.$getProvider = getProvider;
Vue.prototype.$parsePhone = parsePhone;
Vue.prototype.$isLogin = isLogin;
Vue.prototype.$isEmpty = isEmpty;
Vue.prototype.$getAge = getAge;
Vue.prototype.$parseIdCard = parseIdCard;
Vue.prototype.$getDictLabelName = getDictLabelName;
Vue.prototype.$parseText = parseText;
Vue.prototype.$logout = logout;
Vue.prototype.$clearHisSearch = clearHisSearch
Vue.prototype.$getHisSearch = getHisSearch
Vue.prototype.$addHisSearch = addHisSearch
Vue.prototype.$urlToObj = urlToObj
Vue.prototype.$parseText = parseText
Vue.prototype.$parseIDCardInfo = parseIDCardInfo
Vue.prototype.$isLoginCourse = isLoginCourse
Vue.prototype.$reLoginCheck = reLoginCheck
Vue.prototype.$getDict = getDict
// Vue.prototype.$formatHour = formatHour;
// Vue.prototype.$updateMsgDot = updateMsgDot;
const app = new Vue({
	store,	
    ...App
})

// 引入请求封装
require("./pages_im/util/request/index")(app);

app.$mount()
// #endif

// #ifdef VUE3

import { createSSRApp } from 'vue'
import uviewPlus from '@/uni_modules/uview-plus'
export function createApp() {
  const app = createSSRApp(App)
  app.config.globalProperties.$getProvider = getProvider
  app.config.globalProperties.$parsePhone = parsePhone
  app.config.globalProperties.$isLogin = isLogin
  app.config.globalProperties.$isEmpty = isEmpty
  app.config.globalProperties.$getAge = getAge
  app.config.globalProperties.$parseIdCard = parseIdCard
  app.config.globalProperties.$getDictLabelName = getDictLabelName
  app.config.globalProperties.$logout = logout
  app.config.globalProperties.$clearHisSearch = clearHisSearch
  app.config.globalProperties.$getHisSearch = getHisSearch
  app.config.globalProperties.$addHisSearch = addHisSearch
  app.config.globalProperties.$urlToObj = urlToObj
  app.config.globalProperties.$parseText = parseText
  app.config.globalProperties.$parseIDCardInfo = parseIDCardInfo
  app.config.globalProperties.$isLoginCourse = isLoginCourse
  app.config.globalProperties.$formatSalesNum = formatSalesNum
  app.config.globalProperties.$getDict = getDict
  
  app.use(uviewPlus)
  return {
    app
  }
}
// #endif