toCompleteTask.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import {getToken} from "@/api/token";
  2. import {
  3. addPointDetailByTaskDict,
  4. completeGrowthValue,
  5. } from "@/api/user";
  6. import {downloadDeductingIntegral} from "../api/user";
  7. // 加积分
  8. export function addIntegral(taskDict, point) {
  9. // let userid = JSON.parse(window.localStorage.getItem("user"));
  10. // console.log(userid.userId)
  11. getToken().then((res) => {
  12. addPointDetailByTaskDict(
  13. {
  14. taskDict: taskDict,
  15. // userId: userid.userId,
  16. point: point,
  17. },
  18. res.data
  19. )
  20. .then((res) => {
  21. })
  22. .catch((error) => {
  23. });
  24. });
  25. }
  26. // 加成长值
  27. export function addGrowth(taskDict, isUserID) {
  28. // let userid = JSON.parse(window.localStorage.getItem("user"));
  29. getToken().then((res) => {
  30. completeGrowthValue(
  31. {
  32. taskDict: taskDict,
  33. // userId: isUserID ? isUserID : userid.userId,
  34. },
  35. res.data
  36. )
  37. .then((res) => {
  38. })
  39. .catch((error) => {
  40. });
  41. });
  42. }
  43. // 减积分
  44. export function reductionIntegral(taskDict) {
  45. getToken().then((res) => {
  46. let params = taskDict
  47. downloadDeductingIntegral(params, res.data).then((res) => {
  48. })
  49. });
  50. }