api.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. /**
  2. * ## 1. 代码结构混乱,组织无序
  3. - 导入语句不规范 :使用花括号导入 baseUrl 和 baseApiUrl ,但文件开头没有明确的导出语句,依赖关系不清晰。
  4. - 变量命名随意 : methodsToken 命名晦涩,既不是驼峰也不是语义化命名,难以理解其用途。
  5. - 代码组织混乱 :工具函数、API 定义和常量混合在一起,缺乏模块化设计,可读性极差。
  6. ## 2. 语法错误和代码质量低下
  7. - 语法错误 :第11行存在多余逗号 'editMainBodyUser', , 'contribute', ,属于低级语法错误。
  8. - 重复定义 :第14行重复定义 'scanApplyVolunteer' ,表明代码编写时缺乏严谨性。
  9. - 硬编码严重 :多处使用硬编码 URL(如第438行 'https://huli-app.wenlvti.net/addons/cms/api' ),维护成本极高。
  10. - 变量作用域问题 :第154行在 if 块内重新定义 realurl 变量,但未使用,属于无效代码。
  11. ## 3. 安全性问题突出
  12. - Token 处理不当 :在请求头中同时传递 'token' 和 '__token__' (第64-65行),重复且可能暴露敏感信息。
  13. - 缺乏参数验证 :所有 API 调用均未对输入参数进行验证和过滤,容易受到注入攻击。
  14. - HTTPS 支持不足 :未强制使用 HTTPS,可能导致数据传输不安全。
  15. - 错误处理不完善 :第91-93行错误处理逻辑不完整,仅检查 error.response 但未处理其他错误情况。
  16. ## 4. 性能优化缺失
  17. - 无缓存机制 :所有请求均直接发送,未实现本地缓存,增加服务器负担。
  18. - 无请求管理 :缺乏请求防抖、节流和队列管理,可能导致重复请求和性能浪费。
  19. - 无超时处理 :所有请求均未设置超时时间,网络异常时可能导致请求无限等待。
  20. - Promise 实现简陋 : syncget 和 syncpost 函数的 Promise 实现过于简单,未处理异常情况。
  21. ## 5. 可维护性极差
  22. - 函数参数过多 : post 函数有5个参数,调用复杂度高,难以理解和维护。
  23. - 注释缺失 :除少量中文注释外,大部分代码无注释,特别是 API 调用的用途和参数说明。
  24. - 导出方式不一致 :有的使用 export const ,有的使用直接导出,风格不统一。
  25. - 错误处理分散 :不同函数的错误处理逻辑不一致,增加维护难度。
  26. ## 6. 功能实现不完整
  27. - 请求头设置混乱 : post 函数使用 'application/x-www-form-urlencoded' ,而 uploadImage 函数使用 'multipart/form-data' ,但其他函数可能需要不同的 Content-Type。
  28. - 响应处理简单 :仅在 post 函数中处理了登录失效的情况,其他错误情况处理不完善。
  29. - API 定义重复 :第404-405行注释掉的 getContentDetail 定义与第349-350行重复,表明代码管理混乱。
  30. ## 7. 代码风格不统一
  31. - 缩进不一致 :有的地方使用4空格缩进,有的地方使用2空格缩进。
  32. - 空行使用不规范 :函数之间和代码块之间的空行使用不一致。
  33. - 注释风格混乱 :有的使用单行注释,有的使用多行注释,且注释内容多为中文,不利于国际化协作。
  34. - 变量命名风格不一致 :有的使用驼峰命名,有的使用下划线命名,缺乏统一规范。
  35. ## 总结
  36. api.js 文件是一个典型的"代码垃圾场",集语法错误、安全隐患、性能问题和可维护性差于一身。它不仅难以理解和维护,还可能成为整个项目的性能瓶颈和安全漏洞来源。这样的代码质量,完全不符合现代前端开发的标准和最佳实践,亟需全面重构。## 1. 代码结构混乱,组织无序
  37. - 导入语句不规范 :使用花括号导入 baseUrl 和 baseApiUrl ,但文件开头没有明确的导出语句,依赖关系不清晰。
  38. - 变量命名随意 : methodsToken 命名晦涩,既不是驼峰也不是语义化命名,难以理解其用途。
  39. - 代码组织混乱 :工具函数、API 定义和常量混合在一起,缺乏模块化设计,可读性极差。
  40. ## 2. 语法错误和代码质量低下
  41. - 语法错误 :第11行存在多余逗号 'editMainBodyUser', , 'contribute', ,属于低级语法错误。
  42. - 重复定义 :第14行重复定义 'scanApplyVolunteer' ,表明代码编写时缺乏严谨性。
  43. - 硬编码严重 :多处使用硬编码 URL(如第438行 'https://huli-app.wenlvti.net/addons/cms/api' ),维护成本极高。
  44. - 变量作用域问题 :第154行在 if 块内重新定义 realurl 变量,但未使用,属于无效代码。
  45. ## 3. 安全性问题突出
  46. - Token 处理不当 :在请求头中同时传递 'token' 和 '__token__' (第64-65行),重复且可能暴露敏感信息。
  47. - 缺乏参数验证 :所有 API 调用均未对输入参数进行验证和过滤,容易受到注入攻击。
  48. - HTTPS 支持不足 :未强制使用 HTTPS,可能导致数据传输不安全。
  49. - 错误处理不完善 :第91-93行错误处理逻辑不完整,仅检查 error.response 但未处理其他错误情况。
  50. ## 4. 性能优化缺失
  51. - 无缓存机制 :所有请求均直接发送,未实现本地缓存,增加服务器负担。
  52. - 无请求管理 :缺乏请求防抖、节流和队列管理,可能导致重复请求和性能浪费。
  53. - 无超时处理 :所有请求均未设置超时时间,网络异常时可能导致请求无限等待。
  54. - Promise 实现简陋 : syncget 和 syncpost 函数的 Promise 实现过于简单,未处理异常情况。
  55. ## 5. 可维护性极差
  56. - 函数参数过多 : post 函数有5个参数,调用复杂度高,难以理解和维护。
  57. - 注释缺失 :除少量中文注释外,大部分代码无注释,特别是 API 调用的用途和参数说明。
  58. - 导出方式不一致 :有的使用 export const ,有的使用直接导出,风格不统一。
  59. - 错误处理分散 :不同函数的错误处理逻辑不一致,增加维护难度。
  60. ## 6. 功能实现不完整
  61. - 请求头设置混乱 : post 函数使用 'application/x-www-form-urlencoded' ,而 uploadImage 函数使用 'multipart/form-data' ,但其他函数可能需要不同的 Content-Type。
  62. - 响应处理简单 :仅在 post 函数中处理了登录失效的情况,其他错误情况处理不完善。
  63. - API 定义重复 :第404-405行注释掉的 getContentDetail 定义与第349-350行重复,表明代码管理混乱。
  64. ## 7. 代码风格不统一
  65. - 缩进不一致 :有的地方使用4空格缩进,有的地方使用2空格缩进。
  66. - 空行使用不规范 :函数之间和代码块之间的空行使用不一致。
  67. - 注释风格混乱 :有的使用单行注释,有的使用多行注释,且注释内容多为中文,不利于国际化协作。
  68. - 变量命名风格不一致 :有的使用驼峰命名,有的使用下划线命名,缺乏统一规范。
  69. ## 总结
  70. api.js 文件是一个典型的"代码垃圾场",集语法错误、安全隐患、性能问题和可维护性差于一身。它不仅难以理解和维护,还可能成为整个项目的性能瓶颈和安全漏洞来源。这样的代码质量,完全不符合现代前端开发的标准和最佳实践,亟需全面重构。
  71. */
  72. import {
  73. baseUrl,
  74. baseApiUrl
  75. } from './config.js';
  76. import * as common from './common.js' //引入common
  77. import * as db from './db.js' //引入common
  78. // 需要登陆的,都写到这里,否则就是不需要登陆的接口
  79. let methodsToken = ['profile', 'refreshUser', 'wxLogin', 'changeMobile', 'addCart',
  80. 'previewOrder', 'getWuyuanUser', 'archives_post', 'get_channel_fields', 'get_channel', 'lists', 'details', 'daishenhe',
  81. 'logOffVolunteer', 'getCrProperty', 'joinTeam', 'getTeamMember', 'getPatrolTask', 'claimCr',
  82. 'getPatrolLog', 'claimCrList', 'claimCrDetails', 'editMainBodyUser', , 'contribute',
  83. 'getPatrolTaskDetails', 'getContentDetail', 'examineVolunteer', 'userManageRegionCrAuth', 'applyVolunteer',
  84. 'getPhoneNumber', 'editApplyVolunteer', 'mobileBindVolunteer', 'getTeamDetails', 'examineTask', 'removeMemberm',
  85. 'getScoreLog', 'rankingList', 'getMainBodyColumnContentList', 'regionData', 'cityData', 'checkIn', 'scanApplyVolunteer', 'scanApplyVolunteer',
  86. 'getMainBodyUser', 'getUserContribute', 'getUserHonor', 'submitTask', 'exportPatrolRecord', 'userManageCrAuth',
  87. 'getDevices', 'submitIdentityInfo', 'submitActivitySignupInfo','getUserSignupActivity', 'getUserSignupActivityDetails'
  88. ];
  89. const post = (method, data, callback, type, orgurl) => {
  90. //填入默认主体id为1
  91. data.main_body_id = 1;
  92. let userToken = '';
  93. let auth = '';
  94. // 判断token是否存在
  95. console.log("method: ", method);
  96. if (methodsToken.indexOf(method) >= 0) {
  97. // 获取用户token
  98. let auth = db.get("auth");
  99. // console.log(auth);
  100. let nowdate = (new Date()) / 1000; //当前时间戳
  101. //新增用户判断是否登录逻辑begin
  102. common.isLogin();
  103. //新增用户判断是否登录逻辑end
  104. if (!auth || auth.createtime + auth.expires_in < nowdate) {
  105. //FUCK: common.toLogin();
  106. return false;
  107. } else {
  108. userToken = auth.token;
  109. }
  110. }
  111. if (type) {
  112. method = type + '/' + method
  113. } else {
  114. method = '/' + method
  115. }
  116. let realurl = baseApiUrl + method;
  117. if (orgurl) {
  118. realurl = baseUrl + orgurl;
  119. }
  120. uni.showLoading({
  121. title: '',
  122. icon: 'loading'
  123. });
  124. uni.request({
  125. url: realurl,
  126. data: data,
  127. header: {
  128. 'Accept': 'application/json',
  129. 'Content-Type': 'application/x-www-form-urlencoded',
  130. 'token': userToken,
  131. '__token__': userToken
  132. },
  133. method: 'POST',
  134. success: (response) => {
  135. uni.hideLoading();
  136. const result = response.data
  137. if (result.msg == 'Please login' || result.msg == '请登陆') {
  138. db.del("user");
  139. db.del("auth");
  140. console.log('未登陆')
  141. uni.showToast({
  142. title: result.msg,
  143. icon: 'none',
  144. duration: 2000,
  145. complete: function() {
  146. uni.reLaunch({
  147. url: '/pages/index/index',
  148. })
  149. }
  150. });
  151. }
  152. callback(result);
  153. },
  154. fail: (error) => {
  155. uni.hideLoading();
  156. if (error && error.response) {
  157. showError(error.response);
  158. }
  159. },
  160. });
  161. }
  162. // 上传图片
  163. export const uploadImage = (method, data = {}, callback, num = 9, type) => {
  164. if (type) {
  165. method = type + '/' + method
  166. } else {
  167. method = method
  168. }
  169. let userToken = '';
  170. let auth = db.get("auth");
  171. userToken = auth.token;
  172. uni.chooseImage({
  173. count: num,
  174. success: (res) => {
  175. uni.showLoading({
  176. title: '上传中...'
  177. });
  178. let tempFilePaths = res.tempFilePaths
  179. for (var i = 0; i < tempFilePaths.length; i++) {
  180. data.file = tempFilePaths[i]
  181. uni.uploadFile({
  182. url: baseApiUrl + method,
  183. filePath: tempFilePaths[i],
  184. fileType: 'image',
  185. name: 'file',
  186. headers: {
  187. 'Accept': 'application/json',
  188. 'Content-Type': 'multipart/form-data',
  189. 'token': userToken
  190. },
  191. formData: data,
  192. success: (uploadFileRes) => {
  193. callback(JSON.parse(uploadFileRes.data))
  194. },
  195. fail: (error) => {
  196. if (error && error.response) {
  197. common.showError(error.response);
  198. }
  199. },
  200. complete: () => {
  201. setTimeout(function() {
  202. uni.hideLoading();
  203. }, 250);
  204. },
  205. });
  206. }
  207. }
  208. });
  209. }
  210. const get = (url, callback) => {
  211. uni.showLoading({
  212. title: '加载中'
  213. });
  214. let realurl = baseUrl + url;
  215. if (url.indexOf('http:') >= 0 || url.indexOf('https:') >= 0) {
  216. let realurl = url;
  217. }
  218. uni.request({
  219. url: realurl,
  220. header: {
  221. 'Accept': 'application/json',
  222. 'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
  223. },
  224. method: 'GET',
  225. success: (response) => {
  226. callback(response.data);
  227. },
  228. fail: (error) => {
  229. if (error && error.response) {
  230. showError(error.response);
  231. }
  232. },
  233. complete: () => {
  234. setTimeout(function() {
  235. uni.hideLoading();
  236. }, 250);
  237. }
  238. });
  239. }
  240. const showError = error => {
  241. let errorMsg = ''
  242. switch (error.status) {
  243. case 400:
  244. errorMsg = '请求参数错误'
  245. break
  246. case 401:
  247. errorMsg = '未授权,请登录'
  248. break
  249. case 403:
  250. errorMsg = '跨域拒绝访问'
  251. break
  252. case 404:
  253. errorMsg = `请求地址出错: ${error.config.url}`
  254. break
  255. case 408:
  256. errorMsg = '请求超时'
  257. break
  258. case 500:
  259. errorMsg = '服务器内部错误'
  260. break
  261. case 501:
  262. errorMsg = '服务未实现'
  263. break
  264. case 502:
  265. errorMsg = '网关错误'
  266. break
  267. case 503:
  268. errorMsg = '服务不可用'
  269. break
  270. case 504:
  271. errorMsg = '网关超时'
  272. break
  273. case 505:
  274. errorMsg = 'HTTP版本不受支持'
  275. break
  276. default:
  277. errorMsg = error.msg
  278. break
  279. }
  280. uni.showToast({
  281. title: errorMsg,
  282. icon: 'none',
  283. duration: 2000
  284. });
  285. }
  286. const syncget = (url, data) => {
  287. return new Promise(function(resolve, reject) {
  288. get(url + queryParams(data, true), (result) => {
  289. try {
  290. resolve(result);
  291. } catch (e) {
  292. reject(e);
  293. }
  294. })
  295. })
  296. }
  297. const syncpost = (f, m, d) => {
  298. return new Promise(function(resolve, reject) {
  299. post(f, d, (result) => {
  300. try {
  301. resolve(result);
  302. } catch (e) {
  303. reject(e);
  304. }
  305. }, m, m);
  306. })
  307. }
  308. // 登录
  309. export const third = (data, callback) => post('third', data, callback, 'content/main_body_user');
  310. // 用户绑定手机
  311. export const bindphone = (data, callback) => post('bind', data, callback, 'discover/User');
  312. // 修改用户信息
  313. export const profile = (data, callback) => post('profile', data, callback, 'discover/User');
  314. // 发送验证码
  315. export const sendSmsVerify = (data, callback) => post('sendSmsVerify', data, callback, 'discover/User');
  316. // 刷新用户
  317. export const refreshUser = (data, callback) => post('refreshUser', data, callback, 'content/main_body_user');
  318. // 注册
  319. export const register = (data, callback) => post('register', data, callback, 'discover/User');
  320. // 登录
  321. export const login = (data, callback) => post('login', data, callback, 'discover/User');
  322. // 退出登录
  323. export const logout = (data, callback) => post('logout', data, callback, 'discover/User');
  324. // 上传头像
  325. export const upload = (data, callback) => post('upload', data, callback, 'discover/Ajax');
  326. // 绑定手机
  327. export const changeMobile = (data, callback) => post('changeMobile', data, callback, 'discover/User');
  328. //获取手机号前先登录
  329. export const wxLogin = (data, callback) => post('wxLogin', data, callback, 'user');
  330. //获取手机号
  331. // export const getMobile = (data, callback) => post('getPhoneNumber', data, callback, 'user');
  332. //取CMS配置
  333. export const getConfig = async (params = {}) => await syncget('addons/cms/api.common/init', params);
  334. function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
  335. //填入默认主体id为1
  336. data.main_body_id = 1;
  337. let prefix = isPrefix ? '?' : ''
  338. let _result = []
  339. if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';
  340. for (let key in data) {
  341. let value = data[key]
  342. // 去掉为空的参数
  343. if (['', undefined, null].indexOf(value) >= 0) {
  344. continue;
  345. }
  346. if (value.length > 0) {
  347. value = value.replace(/%/g, "%25");
  348. value = value.replace(/\&/g, "%26");
  349. value = value.replace(/\+/g, "%2B");
  350. }
  351. // 如果值为数组,另行处理
  352. if (value.constructor === Array) {
  353. // e.g. {ids: [1, 2, 3]}
  354. switch (arrayFormat) {
  355. case 'indices':
  356. // 结果: ids[0]=1&ids[1]=2&ids[2]=3
  357. for (let i = 0; i < value.length; i++) {
  358. _result.push(key + '[' + i + ']=' + value[i])
  359. }
  360. break;
  361. case 'brackets':
  362. // 结果: ids[]=1&ids[]=2&ids[]=3
  363. value.forEach(_value => {
  364. _result.push(key + '[]=' + _value)
  365. })
  366. break;
  367. case 'repeat':
  368. // 结果: ids=1&ids=2&ids=3
  369. value.forEach(_value => {
  370. _result.push(key + '=' + _value)
  371. })
  372. break;
  373. case 'comma':
  374. // 结果: ids=1,2,3
  375. let commaStr = "";
  376. value.forEach(_value => {
  377. commaStr += (commaStr ? "," : "") + _value;
  378. })
  379. _result.push(key + '=' + commaStr)
  380. break;
  381. default:
  382. value.forEach(_value => {
  383. _result.push(key + '[]=' + _value)
  384. })
  385. }
  386. } else {
  387. _result.push(key + '=' + value)
  388. }
  389. }
  390. return _result.length ? prefix + _result.join('&') : ''
  391. }
  392. // 模型的主体栏目列表
  393. export const getColumnList = (data, callback) => post('getColumnList', data, callback,
  394. 'content/main_body_column');
  395. // 内容详情
  396. export const getContentDetail = (data, callback) => post('getContentDetail', data, callback,
  397. 'content/content');
  398. // 模型内容列表
  399. export const getContentList = (data, callback) => post('getContentList', data, callback,
  400. 'content/content');
  401. // 模型主体栏目的内容列表
  402. export const getMainBodyColumnContentList = (data, callback) => post('getMainBodyColumnContentList', data, callback,
  403. 'content/content');
  404. // 培训分类列表
  405. export const getCategoryList = (data, callback) => post('getCategoryList', data, callback, '',
  406. 'addons/yuneducation/course/getCategoryList');
  407. // 学院底部课程
  408. export const getHomeData = (data, callback) => post('getHomeData', data, callback, '',
  409. 'addons/yuneducation/page/getHomeData');
  410. // 课程界面数据
  411. export const getCourseList = (data, callback) => post('getCourseList', data, callback, '',
  412. 'addons/yuneducation/course/getCourseList');
  413. // 课程详情
  414. export const getCourseDetail = (data, callback) => post('getCourseDetail', data, callback, '',
  415. 'addons/yuneducation/course/getCourseDetail');
  416. // 获取课程考核
  417. export const getCourseExamine = (data, callback) => post('getCourseExamine', data, callback, '',
  418. 'addons/yuneducation/course/getCourseExamine');
  419. // 课程开始学习
  420. export const startLearn = (data, callback) => post('startLearn', data, callback, '',
  421. 'addons/yuneducation/course/startLearn');
  422. // 加入购物车
  423. export const addCart = (data, callback) => post('addCart', data, callback, '',
  424. 'addons/yuneducation/order/addCart');
  425. // 预览订单
  426. export const previewOrder = (data, callback) => post('previewOrder', data, callback, '',
  427. 'addons/yuneducation/order/previewOrder');
  428. // 提交订单
  429. export const submitOrder = (data, callback) => post('submitOrder', data, callback, '',
  430. 'addons/yuneducation/order/submitOrder');
  431. // 移除购物车
  432. export const removeCart = (data, callback) => post('removeCart', data, callback, '',
  433. 'addons/yuneducation/order/removeCart');
  434. // 讲师详情
  435. export const getTeacherDetail = (data, callback) => post('getTeacherDetail', data, callback, '',
  436. 'addons/yuneducation/teacher/getTeacherDetail');
  437. // 获取培训列表
  438. export const getScheduleList = (data, callback) => post('getScheduleList', data, callback, '',
  439. 'addons/yuneducation/schedule/getScheduleList');
  440. // 获取培训详情
  441. export const getScheduleDetail = (data, callback) => post('getScheduleDetail', data, callback, '',
  442. 'addons/yuneducation/schedule/getScheduleDetail');
  443. // 培训开始学习
  444. export const scheduleStartLearn = (data, callback) => post('startLearn', data, callback, '',
  445. 'addons/yuneducation/schedule/startLearn');
  446. // 获取我的课程列表
  447. export const getMineCourseList = (data, callback) => post('getMineCourseList', data, callback, '',
  448. 'addons/yuneducation/course/getMineCourseList');
  449. // 试播
  450. // export const getContentDetail = (data, callback) => post('getContentDetail', data, callback, '',
  451. // 'addons/yuneducation/course/getContentDetail');
  452. //获取栏目
  453. export const getChannel = async (params = {}) => await syncpost('get_channel', '/addons/cms/api.archives/get_channel',
  454. params);
  455. //我发的文章
  456. export const myArchives = async (params = {}) => await syncpost('my', '/addons/cms/api.archives/my', params);
  457. // 文物管理相关
  458. //场馆详情页获取管理员权限
  459. export const userManageCrAuth = (data, callback) => post('userManageCrAuth', data, callback, 'auth/user_manage_cr');
  460. export const getDevices = (data, callback) => post('getDevices', data, callback, 'zhoujie/device');
  461. //取文巡查记录
  462. export const getPatrolLog = (data, callback) => post('getPatrolLog', data, callback, 'wuyuan/volunteer');
  463. //取文物详情
  464. export const getCulturalDetails = (data, callback) => get('api/wuyuan/cultural_relic/details' + queryParams(data, true),
  465. callback);
  466. // 文物管理相关end
  467. //取轮播图
  468. export const getBannerList = (data, callback) => get('/api/wuyuan/swiper_icon/lists' + queryParams(data, true),
  469. callback);
  470. // //人物列表 传 type参数类型:inheritor=非遗传承人,history=历史人物,folklore=民俗学者,specialist=文史专家
  471. // export const getPeopleList = (data, callback) => get('api/wuyuan/biographies/lists' + queryParams(data, true), callback);
  472. // //人物详情
  473. // export const getPeopleDetails = (data, callback) => get('api/wuyuan/biographies/details' + queryParams(data, true), callback);
  474. // 获取用户信息
  475. export const getMainBodyUser = (data, callback) => post('getMainBodyUser', data, callback,
  476. 'content/main_body_user/getMainBodyUser');
  477. //修改头像
  478. export const editMainBodyUser = (data, callback) => post('editMainBodyUser', data, callback,
  479. 'content/main_body_user');
  480. //取任务列表
  481. export const getTaskList = (data, callback) => post('lists', data, callback, 'wuyuan/task');
  482. //取法律文章列表
  483. export const getArchives = async (params = {}) => await syncget('https://huli-app.wenlvti.net/addons/cms/api', params);
  484. // 积分信息
  485. export const getWuyuanUser = (data, callback) => post('getWuyuanUser', data, callback, 'wuyuan/user');
  486. //取文物分类 参数传type类型
  487. export const getCulturalRelicCategory = (data, callback) => get('api/content/category/getCategoryList' + queryParams(
  488. data,
  489. true), callback);
  490. //取级联分类
  491. export const getCategoryCascadeList = (data, callback) => get('api/content/category/getCategoryCascadeList' +
  492. queryParams(
  493. data, true), callback);
  494. // 投稿
  495. export const contribute = (data, callback) => post('contribute', data, callback, '',
  496. 'api/content/style/contribute');
  497. //取文物场景列表
  498. export const getCulturalRelic = (data, callback) => get('api/content/cultural_relic/lists' + queryParams(data, true),
  499. callback);
  500. // 志愿报名
  501. export const applyVolunteer = (data, callback) => post('applyVolunteer', data, callback, '',
  502. 'api/volunteer/volunteer/applyVolunteer');
  503. // 志愿者列表
  504. export const lists = (data, callback) => post('lists', data, callback, '', 'api/volunteer/volunteer/lists');
  505. // 志愿者详情
  506. export const details = (data, callback) => post('details', data, callback, '', 'api/volunteer/volunteer/details');
  507. //待审核志愿者数量
  508. export const daishenhe = (data, callback) => post('daishenhe', data, callback, 'volunteer/volunteer');
  509. // 注销志愿者
  510. export const logOffVolunteer = (data, callback) => post('logOffVolunteer', data, callback, '',
  511. 'api/volunteer/volunteer/logOffVolunteer');
  512. // 志愿者巡查文物资产列表
  513. export const getCrProperty = (data, callback) => post('getCrProperty', data, callback, '',
  514. 'api/volunteer/patrol_property/getCrProperty');
  515. // 加入志愿者团队
  516. export const joinTeam = (data, callback) => post('joinTeam', data, callback, '',
  517. 'api/volunteer/team_member/joinTeam');
  518. // 获取团队成员列表
  519. export const getTeamMember = (data, callback) => post('getTeamMember', data, callback, '',
  520. 'api/volunteer/team/getTeamMember');
  521. // 移除成员
  522. export const removeMemberm = (data, callback) => post('removeMemberm', data, callback, '',
  523. 'api/volunteer/team_member/removeMember');
  524. // 获取志愿者任务列表
  525. export const getPatrolTask = (data, callback) => post('getPatrolTask', data, callback, '',
  526. 'api/volunteer/patrol_task/getPatrolTask');
  527. // 获取任务列详情
  528. export const getPatrolTaskDetails = (data, callback) => post('getPatrolTaskDetails', data, callback, '',
  529. 'api/volunteer/patrol_task/getPatrolTaskDetails');
  530. // 提交巡查任务
  531. export const submitTask = (data, callback) => post('submitTask', data, callback, '',
  532. 'api/volunteer/patrol_task/submitTask');
  533. // 计算志愿者与文物点的距离
  534. export const distanceCheck = (data, callback) => post('distanceCheck', data, callback, '',
  535. 'api/volunteer/patrol_task/distanceCheck');
  536. // 认领文物
  537. export const claimCr = (data, callback) => post('claimCr', data, callback, '',
  538. 'api/volunteer/claim_cr/claimCr');
  539. // 认领文物列表
  540. export const claimCrList = (data, callback) => post('claimCrList', data, callback, '',
  541. 'api/volunteer/claim_cr/claimCrList');
  542. // 认领文物详情暂未调用
  543. export const claimCrDetails = (data, callback) => post('claimCrDetails', data, callback, '',
  544. 'api/volunteer/claim_cr/claimCrDetails');
  545. // 最新公告
  546. export const getNotice = (data, callback) => post('getNotice', data, callback, '',
  547. 'api/system/notice/getNotice');
  548. // 区域
  549. export const getCategoryOnlyChildList = (data, callback) => post('getCategoryOnlyChildList', data, callback, '',
  550. 'api/content/category/getCategoryOnlyChildList');
  551. // 志愿者审核
  552. export const examineVolunteer = (data, callback) => post('examineVolunteer', data, callback, '',
  553. 'api/volunteer/volunteer/examineVolunteer');
  554. // 用户区域管理文物权限
  555. export const userManageRegionCrAuth = (data, callback) => post('userManageRegionCrAuth', data, callback, '',
  556. 'api/auth/user_manage_cr/userManageRegionCrAuth');
  557. // 修改驳回志愿者信息
  558. export const editApplyVolunteer = (data, callback) => post('editApplyVolunteer', data, callback, '',
  559. 'api/volunteer/volunteer/editApplyVolunteer');
  560. // 老志愿者手机号绑定志愿者
  561. export const getPhoneNumber = (data, callback) => post('getPhoneNumber', data, callback, '',
  562. 'api/volunteer/volunteer/getPhoneNumber');
  563. // 手动绑定志愿者手机号
  564. export const mobileBindVolunteer = (data, callback) => post('mobileBindVolunteer', data, callback, '',
  565. 'api/volunteer/volunteer/mobileBindVolunteer');
  566. // 提交任务审核
  567. export const examineTask = (data, callback) => post('examineTask', data, callback, '',
  568. 'api/volunteer/patrol_task/examineTask');
  569. // 获取用户积分列表
  570. export const getScoreLog = (data, callback) => post('getScoreLog', data, callback, '',
  571. 'api/content/main_body_user/getScoreLog');
  572. // 志愿者排行
  573. export const rankingList = (data, callback) => post('rankingList', data, callback, '',
  574. 'api/volunteer/volunteer/rankingList');
  575. export const getVolunteerNotify = (data, callback) => post('getVolunteerNotify', data, callback, '',
  576. 'api/volunteer/volunteer/getVolunteerNotify');
  577. export const scanApplyVolunteer = (data, callback) => post('scanApplyVolunteer', data, callback, '',
  578. 'api/volunteer/volunteer/scanApplyVolunteer');
  579. //活动相关
  580. //活动主题详情
  581. export const activityThemeDetails = (data, callback) => get('api/activity/theme/details' + queryParams(data, true), callback);
  582. // 活动列表
  583. export const activityLists = (data, callback) => get('api/activity/activity/lists' + queryParams(data, true),
  584. callback);
  585. // 活动详情
  586. export const activityDetails = (data, callback) => get('api/activity/activity/details' + queryParams(data, true),
  587. callback);
  588. // 活动日程列表
  589. export const activityScheduleList = (data, callback) => get('api/activity/schedule/lists' + queryParams(data, true),
  590. callback);
  591. // 活动报名参数
  592. export const activitySignupParams = (data, callback) => get('api/activity/signup_params/lists' + queryParams(data, true),
  593. callback);
  594. // 主体用户身份信息列表
  595. export const getMemberList = (data, callback) => post('lists', data, callback, 'content/main_body_user_identity');
  596. // 主体用户身份信息提交
  597. export const submitIdentityInfo = (data, callback) => post('submitIdentityInfo', data, callback, 'content/main_body_user_identity');
  598. // 主体用户身份信息提交
  599. export const submitActivitySignupInfo = (data, callback) => post('submitActivitySignupInfo', data, callback, 'activity/signup');
  600. // 获取志愿者宣讲员
  601. export const getXuanjiangList = (data, callback) => get('api/volunteer/volunteer/getXuanjiangList' + queryParams(data, true), callback);
  602. // 获取志愿者宣讲员详情
  603. export const getXuanjiangDetails = (data, callback) => get('api/volunteer/volunteer/getXuanjiangDetails' + queryParams(data, true), callback);
  604. // 获取用户报名活动列表
  605. export const getUserSignupActivity = (data, callback) => post('getUserSignupActivity', data, callback, 'content/main_body_user');
  606. // 获取用户报名活动详情
  607. export const getUserSignupActivityDetails = (data, callback) => post('getUserSignupActivityDetails', data, callback, 'content/main_body_user');
  608. // 志愿者排行详情
  609. export const rankingDetails = (data, callback) => get('api/volunteer/volunteer/rankingDetails' + queryParams(data,
  610. true),
  611. callback);
  612. // 区域数据统计
  613. export const regionData = (data, callback) => post('regionData', data, callback, '',
  614. 'api/volunteer/statistics/regionData');
  615. // 市级数据统计
  616. export const cityData = (data, callback) => post('cityData', data, callback, '',
  617. 'api/volunteer/statistics/cityData');
  618. // 新闻公告
  619. export const getNewsNotice = (data, callback) => post('getNewsNotice', data, callback, '',
  620. 'api/system/notice/getNewsNotice');
  621. // 打卡
  622. export const checkIn = (data, callback) => post('checkIn', data, callback, '',
  623. 'api/content/main_body_user/checkIn');
  624. // 活动报名
  625. export const activitySignup = (data, callback) => post('activitySignup', data, callback, '',
  626. 'api/activity/activity/activitySignup');
  627. // 我的投稿
  628. export const getUserContribute = (data, callback) => post('getUserContribute', data, callback, '',
  629. 'api/content/main_body_user/getUserContribute');
  630. // 我的荣誉
  631. export const getUserHonor = (data, callback) => post('getUserHonor', data, callback, '',
  632. 'api/content/main_body_user/getUserHonor');
  633. // 轮播
  634. export const getIndexBanner = (data, callback) => post('getIndexBanner', data, callback, '',
  635. 'api/content/banner_function/getIndexBanner');
  636. // 导出
  637. export const exportPatrolRecord = (data, callback) => post('exportPatrolRecord', data, callback, '',
  638. 'api/volunteer/patrol_task/exportPatrolRecord');