• uniapp 学习笔记十二 自动转存商品数据逻辑


    collect-data.vue

    1. <script>
    2. export default {
    3. data() {
    4. return {
    5. };
    6. },
    7. methods: {
    8. haddleCfy() {
    9. uni.request({
    10. url: "https://h******om/api/5e90690f0e270d04?cityId=110",
    11. method: "GET",
    12. header: {
    13. "access-token": "b1965ae1dfb72c63fb84a47e079f84fa",
    14. "version": "v1.0"
    15. },
    16. success: (res) => {
    17. // console.log(res);
    18. let {
    19. data
    20. } = res.data
    21. let batchObj = {
    22. "requests": []
    23. }
    24. data.forEach(item => {
    25. batchObj.requests.push({
    26. "method": "POST",
    27. "path": "/1.1/classes/classify",
    28. "body": item
    29. })
    30. })
    31. console.log(batchObj);
    32. // this.$post('/1.1/batch',batchObj) //批量录入分类
    33. }
    34. })
    35. },
    36. haddleGoods() {
    37. uni.request({
    38. url: "https://h*****om/api/0434b49d1ac28f9d?cityId=110&page=1&bid=6",
    39. method: "GET",
    40. header: {
    41. "access-token": "b1965ae1dfb72c63fb84a47e079f84fa",
    42. "version": "v1.0"
    43. },
    44. success: (res) => {
    45. console.log(res);
    46. let {
    47. list
    48. } = res.data.data
    49. let batchObj = {
    50. "requests": []
    51. }
    52. list.forEach(item => {
    53. batchObj.requests.push({
    54. "method": "POST",
    55. "path": "/1.1/classes/goods",
    56. "body": item
    57. })
    58. })
    59. // console.log(batchObj);
    60. this.$post('/1.1/batch',batchObj) //批量录入分类
    61. }
    62. })
    63. }
    64. }
    65. }
    66. script>
    67. <style lang="scss">
    68. style>

     

  • 相关阅读:
    deque的插入和删除
    linux应用基础
    zookeeper实现程序高可用
    MinIO FTP 断点续传
    CAP理论和BASE思想
    17 | 用户和用户组管理
    el-table中加图标文字提示
    寒假训练——第三周(状压DP)
    MySQL查询某字段的多条结果展示成按逗号隔开
    安全性算法
  • 原文地址:https://blog.csdn.net/gixome/article/details/126573574