import Vue from "vue";
import $ajax from '../../../../util/request'
import store from '../../../../store/store'
import {
	Notify,
	Toast
} from "vant";
Vue.use(Toast, Notify);
const BASE_URL = process.env.API_HOST //'https://lzdz3-isv.isvjcloud.com/api';

export default {
    async activity(activityId,channel,callback) {
        let param = {
            activityId:activityId,
            channel:channel,
            shareUuid:store.state.shareUserId
        }

		var url = BASE_URL + '/dz/blindBox/activity'
		let {
			data
		} = await $ajax.post(url,param)
		callback && callback(data)
		
	},
	//主接口助力
	async activityShare (activityId,type,callback){
		let param = {
            activityId:activityId,
            type:type,
            shareUuid:store.state.shareUserId
        }
		var url = BASE_URL + '/dz/blindBox/activity'
		let {
			data
		} = await $ajax.post(url,param)
		callback && callback(data)
	},
	//抽奖
	async draw (callback){
		var url = BASE_URL + '/dz/blindBox/draw'
		let {
			data
		} = await $ajax.post(url)
		callback && callback(data)
	},
	//抽奖记录
	async myPrizeRecord (callback){
		var url = BASE_URL + '/dz/blindBox/myPrizeRecord'
		let {
			data
		} = await $ajax.post(url)
		callback && callback(data)
	},
	//任务明细
	async taskRecord (callback){
		var url = BASE_URL + '/dz/task/taskRecord'
		let {
			data
		} = await $ajax.post(url,{})
		callback && callback(data)
	},
	//任务列表
	async getTaskList (activityId,callback){

		var url = BASE_URL + '/dz/task/taskList'
		let {
			data
		} = await $ajax.post(url,{activityId:activityId})
		callback && callback(data)
	},
	// 做任务
	async task (param,callback){
		var url = BASE_URL + '/dz/blindBox/doTask'
		let {
			data
		} = await $ajax.post(url,param)
		callback && callback(data)
	},
	// 任务记录
	async record (param,callback){
		var url = BASE_URL + '/dz/task/taskRecord'
		let {
			data
		} = await $ajax.post(url,param)
		callback && callback(data)
	},
    // 保存日志
    async saveLog (param,callback){
	var url = BASE_URL + '/dz/eventLog/saveLog'
	let {
		data
	} = await $ajax.post(url,param)
	callback && callback(data)
    },
	// 我的奖品
    async getMyPrize (callback){
		var url = BASE_URL + '/dz/prize/myPrize'
		let {
			data
		} = await $ajax.get(url)
		callback && callback(data)
	},
	// 奖品地址
    async getAddress (parameter,callback){
		var url = BASE_URL + '/dz/prize/getAddress'
		let {
			data
		} = await $ajax.post(url,parameter)
		callback && callback(data)
	},
	// 保存地址
    async saveAddress (parameter,callback){
		var url = BASE_URL + '/dz/prize/saveAddress'
		let {
			data
		} = await $ajax.post(url,parameter)
		callback && callback(data)
	},
	// 加购商品
    async productList (parameter,callback){
		var url = BASE_URL + '/dz/product/productList'
		let {
			data
		} = await $ajax.post(url,parameter)
		callback && callback(data)
	},
	// 敏感内容
    async check (parameter,callback){
		var url = BASE_URL + '/dz/sensitive/check'
		let {
			data
		} = await $ajax.post(url,parameter)
		callback && callback(data)
	},
	//上传图片
	async uploadImage (file,callback){
		var url = BASE_URL + '/dz/upload/common/media/uploadImage'
		let {
			data
		} = await $ajax.uploadFile(url,file)
		callback && callback(data)
	},

	
}