export default {
	methods: {
		navigateBack(num = 1) {
			uni.navigateBack({
				delta: num
			});
		},
		sendCode(phone) {
			// this.$http
			// .get('', {
			// phone: phone
			// })
			// .then(() => {
			this.checkTime();
			// })
			// .catch(e => {
			//     this.$message.error(e.error);
			// });
		},
		navigateTo(url) {
			uni.navigateTo({
				url: url
			});
		},
		toast(title, icon = 'none', duration = 1500) {
			uni.showToast({
				icon: icon,
				title: title,
				mask: true,
				duration: duration
			});
		},
		preview(img, urls = []) {
			if (!img) {
				return;
			}
			if (urls.length === 0) {
				urls = [img];
			}

			uni.previewImage({
				current: img, // 当前显示图片的http链接
				urls: urls // 需要预览的图片http链接列表
			});
		},
		checkTime() {
			this.time = 60;
			let i = setInterval(() => {
				this.time--;
				if (this.time === 0) {
					clearInterval(i);
				}
			}, 1000);
		},
	}
}
