| 
						 | 
						- import http from './http.js'
 - 
 - 
 - let limit = {}
 - let debounce = {}
 - 
 - const config = {
 - 	// 示例
 - 	// wxLogin : {url : '/api/wxLogin', method : 'POST', 
 - 	// auth : false, showLoading : true, loadingTitle : '加载中...',
 - 	// limit : 1000
 - 	// },
 - 
 - 	getConfig: {
 - 		url: '/info/queryConfigList',
 - 		method: 'GET',
 - 		limit: 500
 - 	},
 - 
 - 
 - 	// 微信登录接口
 - 	wxLogin: {
 - 		url: '/login/login',
 - 		method: 'GET',
 - 		limit: 500,
 - 		showLoading: true,
 - 	},
 - 
 - 	// 修改个人信息接口
 - 	updateInfo: {
 - 		url: '/user/updateHanHaiMemberById',
 - 		method: 'POST',
 - 		auth: true,
 - 		limit: 500,
 - 		showLoading: true,
 - 	},
 - 
 - 	// 获取个人信息接口
 - 	getInfo: {
 - 		url: '/user/queryHanHaiMemberById',
 - 		method: 'GET',
 - 		auth: true,
 - 		showLoading: true,
 - 	},
 - 
 - 	//隐私政策
 - 	getPrivacyPolicy: {
 - 		url: '/login/getPrivacyPolicy',
 - 		method: 'GET',
 - 	},
 - 	//用户协议
 - 	getUserAgreement: {
 - 		url: '/login/getUserAgreement',
 - 		method: 'GET',
 - 	},
 - 
 - 	/**
 - 	 * 首页相关接口
 - 	 */
 - 
 - 	// 添加建议
 - 	addAdvice: {
 - 		url: '/info/addAdvice',
 - 		method: 'POST',
 - 		limit: 500,
 - 		showLoading: true,
 - 	},
 - 	// 添加志愿者
 - 	addVolunteer: {
 - 		url: '/user/addVolunteer',
 - 		method: 'POST',
 - 		limit: 500,
 - 		showLoading: true,
 - 	},
 - 	// 获取景区列表
 - 	queryAreaList: {
 - 		url: '/info/queryAreaList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 根据id获取景区详情
 - 	queryAreaListById: {
 - 		url: '/info/queryAreaListById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 根据id获取文章详情
 - 	queryArticleById: {
 - 		url: '/info/queryArticleById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 获取文章列表
 - 	queryArticleList: {
 - 		url: '/info/queryArticleList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 根据分类获取文章列表
 - 	queryArticleListByType: {
 - 		url: '/info/queryArticleListByType',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 获取banner图列表
 - 	queryBannerList: {
 - 		url: '/info/queryBannerList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 获取景点列表
 - 	// areaId: 0-瓷都镇区 1-湖田片区 2-高岭片区 3-瑶里片区 4-蛟潭片区; categoryTyep: 0-景点 1-美食店铺 2-民宿 3-厕所
 - 	querySpotList: {
 - 		url: '/info/querySpotList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 获取地点详情
 - 	querySpotById: {
 - 		url: '/info/querySpotById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 获取视频列表
 - 	queryVedioById: {
 - 		url: '/info/queryVedioById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	
 - 	
 - 	
 - 	
 - 	// amusement 游玩项目相关接口
 - 	
 - 	
 - 	// 获取非遗体验列表
 - 	queryExperienceList: {
 - 		url: '/info/queryExperienceList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 获取非遗体验详情
 - 	queryExperienceById: {
 - 		url: '/info/queryExperienceById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 获取路径定制、我要研学列表
 - 	queryAmusementList: {
 - 		url: '/info/queryAmusementList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 获取路径定制、我要研学详情
 - 	queryAmusementById: {
 - 		url: '/info/queryAmusementById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	
 - 	
 - 	
 - 	
 - 	// 修改地址
 - 	updateAddress: {
 - 		url: '/user/updateAddress',
 - 		method: 'POST',
 - 		showLoading: true,
 - 	},
 - 	// 修改默认地址
 - 	updateDefaultAddress: {
 - 		url: '/user/updateDefaultAddress',
 - 		method: 'POST',
 - 		showLoading: true,
 - 	},
 - 	// 查询地址
 - 	queryAddress: {
 - 		url: '/user/queryAddress',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 删除地址
 - 	deleteAddress: {
 - 		url: '/user/deleteAddress',
 - 		method: 'DELETE',
 - 		showLoading: true,
 - 	},
 - 	// 添加地址
 - 	addAddress: {
 - 		url: '/user/addAddress',
 - 		method: 'POST',
 - 		showLoading: true,
 - 	},
 - 	// 根据角色Id获取角色信息详情
 - 	queryRoleInfoById: {
 - 		url: '/info/queryRoleInfoById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 根据角色类型获取角色信息列表-讲解员-达人-摄影师
 - 	queryRoleInfoList: {
 - 		url: '/info/queryRoleInfoList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 添加收藏
 - 	addCollection: {
 - 		url: '/user/addCollection',
 - 		method: 'POST',
 - 		showLoading: true,
 - 	},
 - 	// 取消收藏
 - 	deleteCollection: {
 - 		url: '/user/deleteCollection',
 - 		method: 'POST',
 - 		showLoading: true,
 - 	},
 - 	// 获取收藏列表
 - 	queryCollectionList: {
 - 		url: '/user/queryCollectionList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	
 - 	
 - 	
 - 	
 - 	// 查询预约时间段
 - 	queryOrderTime: {
 - 		url: '/user/queryOrderTime',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 查询订单列表
 - 	queryOrderList: {
 - 		url: '/user/queryOrderList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	
 - 	
 - 	
 - 	//文创好物-获取商品详情
 - 	queryWaresById: {
 - 		url: '/info/queryWaresById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	//文创好物-获取商品列表
 - 	queryWaresList: {
 - 		url: '/info/queryWaresList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	// 添加购物车
 - 	addShopcar: {
 - 		url: '/user/addShopcar',
 - 		method: 'POST',
 - 		showLoading: true,
 - 		auth: true,
 - 	},
 - 	// 获取购物车列表
 - 	queryShopcarList: {
 - 		url: '/user/queryShopcarList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 		auth: true,
 - 	},
 - 	// 取消购物车
 - 	deleteShopcar: {
 - 		url: '/user/deleteShopcar',
 - 		method: 'DELETE',
 - 		showLoading: true,
 - 		auth: true,
 - 	},
 - 	// 修改购物车信息
 - 	updateShopcar: {
 - 		url: '/user/updateShopcar',
 - 		method: 'POST',
 - 		debounce : 500,
 - 		auth: true,
 - 	},
 - 	
 - 	
 - 	
 - 	/**
 - 	 * 10月7日新接口
 - 	 */
 - 	
 - 	// 语音播放
 - 	textToAudio: {
 - 		url: '/info/textToAudio',
 - 		method: 'GET',
 - 	},
 - 	// 根据id给视频点赞
 - 	addThumpup: {
 - 		url: '/info/addThumpup',
 - 		method: 'POST',
 - 		showLoading: true,
 - 		limit : 500,
 - 	},
 - 	// 我的预约-创建预约订单
 - 	createOrder: {
 - 		url: '/user/addOrder',
 - 		method: 'POST',
 - 		showLoading: true,
 - 		limit : 500,
 - 	},
 - 	// 创建文创好物订单
 - 	addWaresOrder: {
 - 		url: '/info/addWaresOrder',
 - 		method: 'POST',
 - 		showLoading: true,
 - 		limit : 500,
 - 	},
 - 	// 查询文创好物订单列表
 - 	queryWaresOrderList: {
 - 		url: '/info/queryWaresOrderList',
 - 		method: 'GET',
 - 		showLoading: true,
 - 		limit : 500,
 - 	},
 - 	// 查询文创好物订单详情
 - 	queryWaresOrderById: {
 - 		url: '/info/queryWaresOrderById',
 - 		method: 'GET',
 - 		showLoading: true,
 - 		limit : 500,
 - 	},
 - 	// 搜索文章
 - 	queryArticleListByTitle: {
 - 		url: '/info/queryArticleListByTitle',
 - 		method: 'GET',
 - 		showLoading: true,
 - 	},
 - 	
 - 	
 - 	
 - 	// 2025-2-18
 - 	
 - 	// 申遗新闻-获取新闻分类列表
 - 	queryNewsTypeList: {
 - 		url: '/info/queryNewsTypeList',
 - 		method: 'GET',
 - 	},
 - 	// 申遗新闻-根据分类获取新闻列表
 - 	queryNewsByType: {
 - 		url: '/info/queryNewsByType',
 - 		method: 'GET',
 - 	},
 - 	// 根据id获取新闻详情
 - 	queryNewsById: {
 - 		url: '/info/queryNewsById',
 - 		method: 'GET',
 - 	},
 - }
 - 
 - 
 - 
 - export function api(key, data, callback, loadingTitle) {
 - 	let req = config[key]
 - 
 - 	if (!req) {
 - 		console.error('无效key' + key);
 - 		return
 - 	}
 - 
 - 	if (typeof callback == 'string') {
 - 		loadingTitle = callback
 - 	}
 - 
 - 	if (typeof data == 'function') {
 - 		callback = data
 - 		data = {}
 - 	}
 - 
 - 	// 接口限流
 - 	if (req.limit) {
 - 		let storageKey = req.url
 - 		let storage = limit[storageKey]
 - 		if (storage && new Date().getTime() - storage < req.limit) {
 - 			return
 - 		}
 - 		limit[storageKey] = new Date().getTime()
 - 	}
 - 
 - 	//必须登录
 - 	if (req.auth) {
 - 		if (!uni.getStorageSync('token')) {
 - 			uni.navigateTo({
 - 				url: '/pages_order/auth/wxLogin'
 - 			})
 - 			console.error('需要登录')
 - 			return
 - 		}
 - 	}
 - 	
 - 	// 接口防抖
 - 	if(req.debounce){
 - 		
 - 		let storageKey = req.url
 - 		let storage = debounce[storageKey]
 - 		
 - 		if (storage) {
 - 			clearTimeout(storage)
 - 		}
 - 		
 - 		debounce[storageKey] = setTimeout(() => {
 - 			
 - 			clearTimeout(storage)
 - 			
 - 			delete debounce[storageKey]
 - 			
 - 			http.http(req.url, data, callback, req.method,
 - 				loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
 - 		}, req.debounce)
 - 		
 - 		return
 - 	}
 - 
 - 	http.http(req.url, data, callback, req.method,
 - 		loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
 - }
 - 
 - export default api
 
 
  |