let dialog = {};

/**
 * 封装模态框
 */
dialog.showModal=(content,showCancel=true,confirmColor)=>{
    return new Promise((resolve,reject)=>{
        uni.showModal({
			title:'提示',
			content,
			showCancel,
			confirmColor:confirmColor?confirmColor:'#2979ff',
			success: (res)=>{
				if (res.confirm) {
					resolve(res)
				} 
			}
		});
	})
}

dialog.showModalAndBack=(content,confirmColor)=>{
    uni.showModal({
    	title: "提示",
    	content: content,
    	showCancel:false,
		confirmColor:confirmColor?confirmColor:'#2979ff',
    	success: (res)=>{
    		if (res.confirm) {
    			uni.navigateBack({
    				delta:1
    			})
    		} 
    	}
    });
}

dialog.showLoading=(title='加载中...')=>{
	uni.showLoading({
		title
	})
}


export default dialog
