weixin_41584177
2019-08-29 11:14
采纳率: 83.3%
浏览 1.6k

微信小程序中关于返回数据的操作

请问如何在服务器返回的数据中提取出我需要的那部分
以下是服务器返回的数据

    [{
      "procDef.name": "请假流程",
      "task.assignee": "admin",
      "task.executionId": "a25a1287decc4aea97fda5c8c4a49e4a",
      "task.name": "领导审核",
      "count": "11",
      "task.createTime": 1558608917000,
      "procDef.version": 5,
      "task.id": "ffbf1b3ca9f543eea2402d3c365900e2",
      "task.taskDefinitionKey": "node0",
      "task.processInstanceId": "a25a1287decc4aea97fda5c8c4a49e4a",
      "vars": {
        "busId": "ad629b4986a34f0bace9892cfc1b8788",
        "type": "tealeave",
        "title": "11",
        "applyUserId": "张大壮"
      },
      "status": "todo"
    }, {
      "procDef.name": "请假流程",
      "task.assignee": "admin",
      "task.executionId": "e8065adf4db344fc92165c732ed85156",
      "task.processDefinitionId": "tealeave:5:e1b5cc7f26744495b7340434876fc8fc",
      "task.name": "领导审核",
      "count": "11",
      "task.createTime": 1557399272000,
      "procDef.version": 5,
      "task.id": "99f7797ddad14969ad477a050fcee336",
      "task.taskDefinitionKey": "node0",
      "task.processInstanceId": "e8065adf4db344fc92165c732ed85156",
      "vars": {
        "busId": "288dee733e074e73becbd5bf889b2447",
        "type": "tealeave",
        "title": "youshi",
        "applyUserId": "lilaoshi"
      },
      "status": "todo"
    }, {
      "procDef.name": "请假流程",
      "task.assignee": "admin",
      "task.executionId": "5fcb2da62b8042dfaae7a6dead57eb3b",
      "task.processDefinitionId": "tealeave:5:e1b5cc7f26744495b7340434876fc8fc",
      "task.name": "领导审核",
      "count": "11",
      "task.createTime": 1557392981000,
      "procDef.version": 5,
      "task.id": "0efe25339021449e9583c9e6395a1ea4",
      "task.taskDefinitionKey": "node1",
      "task.processInstanceId": "5fcb2da62b8042dfaae7a6dead57eb3b",
      "vars": {
        "busId": "5f88a073e4294cc78116011a3667a070",
        "node0Pass": true,
        "title": "噢噢噢噢哦哦哦哦哦哦",
        "type": "tealeave",
        "applyUserId": "李三"
      }]

我只需要这些数据中几项
"procDef.name","task.name","task.createTime",还有"vars"中的"applyUserId"
放入我下面的数据中:

     info: [{
      "proccessname": "请假",
      "curretprocess": "领导审核",
      "createTime": 1557399272000,
      "applyUserId": "张xx"
      }]

直接赋值会有问题 比如proccessname=list[0].procDef.name 后面的name会报错说undefined ,请问如何处理

另外 proccessname 只有前个字 比如'请假流程'只留'请假'2字

createTime时间戳转换到年-月-日格式

谢谢 新手真不太会

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题