
import Vue from 'vue'
import api from '@/api/api.js'
import fetch from '@/api/fetch.js'
import utils from './utils/utils.js'

import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI);

// 当前环境
const type = 'prod'


// 环境配置
const config = {
	local : {
		baseUrl : 'http://127.0.0.1:8002/novel-admin',
	},
	dev : {
		baseUrl : 'http://h5.xzaiyp.top/novel-admin',
	},
	prod : {
		baseUrl : 'https://prod-api.budingxiaoshuo.com/novel-admin',
	}
}
// oss:
//     accessKey: LTAI5tG9VnnPpjvcrQ3dtaYG
//     secretKey: h0nzWxMbH9RIeVVcFbtjTpocCj9GHc
//     endpoint:  oss-cn-shenzhen.aliyuncs.com    
//     bucketName: buding-oss
//     staticDomain: https://oss.budingxiaoshuo.com/


// 默认配置
const defaultConfig = {
	mapKey : 'XMBBZ-BCPCV-SXPPQ-5Y7MY-PHZXK-YFFVU',
	aliOss: {
		url: 'https://oss.budingxiaoshuo.com/',
		config: {
			//桶的地址
			region: 'oss-cn-shenzhen',
			//id
			accessKeyId: 'LTAI5tG9VnnPpjvcrQ3dtaYG',
			//密钥
			accessKeySecret: 'h0nzWxMbH9RIeVVcFbtjTpocCj9GHc',
			//桶的名字
			bucket: 'buding-oss',
			endpoint: 'oss-cn-shenzhen.aliyuncs.com',
		}
	},
}


uni.$uv.setConfig({
	// 修改$uv.config对象的属性
	config: {
		// 修改默认单位为rpx，相当于执行 uni.$uv.config.unit = 'rpx'
		unit: 'rpx'
	},
})

Vue.prototype.$config = utils.deepMergeObject(defaultConfig, config[type])

Vue.prototype.$api = api
Vue.prototype.$fetch = fetch

export default Vue.prototype.$config