import Vue from 'vue'
import App from './App'
import store from "./store/index.js"
import check from './check/index.js'

// 引入全局uView
import uView from 'uview-ui';
Vue.use(uView);

// import myImage from './components/myImage.vue'
// #ifdef H5
import wechat from './wechat'
Vue.prototype.$wechat =wechat;
// #endif
// #ifdef H5
// 提交前需要注释  本地调试使用
	// const vconsole = require('vconsole')
	// Vue.prototype.$vconsole = new vconsole() // 使用vconsole
// #endif

Vue.config.productionTip = false
Vue.prototype.$imgUrl="http://api.intewl.cn/uploads/"
Vue.prototype.apiUrl="https://car.goorcar.com"
Vue.prototype.appid="wxa9f996fcd50636d4"
Vue.prototype.appsecert="be55bfa1f04c59374620036ccbbbec2a"
// Vue.prototype.$imgUrl="http://www.mall.com/uploads/"
// Vue.prototype.apiUrl="http://www.mall.com/api"
Vue.prototype.check=check;

// Vue.component('my-image',myImage)

Vue.prototype.$request=function(url,data='',type=1){
	// var that=this
	return new Promise((reslove,reject)=>{
		if(type == 1){
			uni.showLoading({
				title:'加载中'
			})
		}
		if(type == 2){
			uni.showLoading({
				title:'提交中'
			})
		}
		uni.request({
			url:url,
			method:"get",
			header: {
				'token': uni.getStorageSync('token')
			},
			data:data,
			success:(res)=>{
				reslove(res.data)
				uni.hideLoading()
			}
		})
	})
	
	
		
	
}
Vue.prototype.$href=function(data,type=1){
	// if(uni.getStorageSync("token")){
		if(type==1){
			uni.navigateTo({
				url:data
			})
		}
		if(type==2){
			uni.switchTab({
				url:data
			})
		}
		
	/* }else{
		uni.navigateTo({
			url:"/pages/login/login?backurl="+data
		})
	} */
}
Vue.prototype.$back=function(data,type=1){
	if(uni.getStorageSync("token")){
		if(type==1){
			uni.navigateTo({
				url:data
			})
		}else{
			uni.switchTab({
				url:data
			})
		}
			

	}else{
		uni.navigateTo({
			url:"/pages/login/login?backurl=1"
		})
	}
}

// Vue.prototype.apiUrl="http://192.168.1.101/mall/public/api"
App.mpType = 'app'

const app = new Vue({
	store,
    ...App
})

app.$mount()