zoukankan      html  css  js  c++  java
  • async和await的应用

    community-survey-sys项目

    ShareQuestionnaireModal.vue:

        async queryShareScope () {
          let releaseSet = getReleaseSet({ wjId: this.wjId })
          let dictList = queryWjDictList({ type: 'PLATFORM' })
          // let appId = getAppid({code: 'share'})
    
          await Promise.all([releaseSet, dictList]).then(([releaseRes, dictListRes]) => {
            let platformList = []
            let dictList = []
            if (releaseRes.data.code === '0') {
              platformList = releaseRes.data.data.platformList
    //          platformList = [
    //            {
    //              createTime: 1952001,
    //              id: 2,
    //              platformCode: 'scpg',
    //              status: 1,
    //              updateTime: 1952001,
    //              wjId: 132006
    //            }]
              console.log('platformList', platformList)
            } else {
              this.showToast(releaseRes.data.message)
              return
            }
    
            if (dictListRes.data.code === '0') {
              dictList = dictListRes.data.data.dictList
            } else {
              this.showToast(dictListRes.data.message)
              return
            }
            this.shareList = platformList.map(item => {
              let name = ''
    //          dictList = [{code: 1, name: '印力', value: 'scpg'}]
              dictList.forEach(subitem => {
                if (subitem.value === item.platformCode) {
                  name = subitem.name
                }
              })
              return {appName: name, platformCode: item.platformCode}
            })
            this.shareList.map((item, index) => {
              if (item.appName === '印力') {
                this.shareList.splice(index, 1)
              }
            })
    
            // if (appIdRes.data.code === '0') {
            //   this.appId = appIdRes.data.data.list
            // } else {
            //   // this.showToast(appIdRes.data.message) // 这里总是-1,影响界面,先关掉提示
            // }
            // this.appId.map((item, index) => {
            //   this.shareList.push({appName: item.val, platformCode: 'scpg', appId: item.appId})
            // })
            console.log('dictList', dictList)
            console.log('shareList', this.shareList)
            // this.toggleTab(0)
          })
          getAppid({code: 'share'}).then(appIdRes => {
            if (appIdRes.data.code === '0') {
              this.appId = appIdRes.data.data.list
            } else {
              // this.showToast(appIdRes.data.message) // 这里总是-1,影响界面,先关掉提示
            }
            this.appId.map((item, index) => {
              this.shareList.push({appName: item.val, platformCode: 'scpg', appId: item.appId})
            })
          }).catch(err => {
            console.log('err:', err)
          })
          this.toggleTab(0)
        },
  • 相关阅读:
    webform文件上传加水印
    2017-6-6 ASP.NET Ajax版页面无刷新三级联动
    2017-6-5 Ajax应用
    转【 正则表达式】
    2017-6-4 JQuery中的选择器和动画 弹窗遮罩
    Linq 组合分页查询
    2017-6-2 Linq高级查询和函数
    2017-6-3 JQuery中的Dom操作和事件
    WebForm母版页
    WebForm内置对象:Application和ViewState、Repeater的Command用法
  • 原文地址:https://www.cnblogs.com/benbendu/p/12572744.html
Copyright © 2011-2022 走看看