企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
``` Page({ data: { navtab: [0, 1, 1, 1, 1], show: [0, 1, 1, 1], zhuanshu: false, alllist: "",// shownext: true, showcontent: true, codeALL: [], //所有code code: 'code01' }, // 下一步 /* 个人尝试封装show和navbar 点击下一步 假设为1 当前index=0,*/ getnextdata(index, stepName) { var newdata = this.data.codeALL; var navtab = this.data.navtab; var show = this.data.show; navtab[index] = 1 navtab[index + 1] = 0 show[index + 1] = 0 if (newdata[index] == undefined) { newdata.push(this.data.code) } this.setData({ navtab: navtab, show: show, codeALL: newdata }) // 获取下一步的数据 this.getData(newdata.join(","), stepName) }, nextStep() { console.log(1) var navtab = this.data.navtab if (navtab[0] == 0) { this.getnextdata(0, "STEP2") } else if (navtab[1] == 0) { this.getnextdata(1, "STEP3") } else if (navtab[2] == 0) { this.getnextdata(2, "STEP4") } else { this.getnextdata(3, "STEP5") } }, // 获取上一步的数据 gettodata(index,stepName) { var newdata = this.data.codeALL; var navtab = this.data.navtab; var show = this.data.show; navtab[index] = 1; navtab[index - 1] = 0; show[index] = 1 newdata.pop() this.setData({ navtab: navtab, show: show, codeALL: newdata }) // 获取上一步的数据 this.getData(newdata.join(","), stepName) }, // 上一步 /* 假设当前index为1 当前code_str = "code11" 获取数据为 "STEP1"*/ toStep() { var navtab = this.data.navtab if (navtab[1] == 0) { this.gettodata(1, "STEP1") } else if (navtab[2] == 0) { this.gettodata(2, "STEP2") } else if (navtab[3] == 0) { this.gettodata(3, "STEP3") } else { this.gettodata(4, "STEP4") } }, // 定制完成 complete() { let that = this; that.setData({ zhuanshu: true, shownext: false, showcontent: false, }) let allCode = that.data.codeALL; allCode[5] = that.data.code that.setData({ codeALL: allCode }) }, ``` ``` // 重新定制 restore() { let that = this; that.setData({ zhuanshu: false, shownext: true, showcontent: true, }) that.setData({ codeALL: [], navtab: [0, 1, 1, 1, 1], show: [0, 1, 1, 1], }) }, ``` ``` getData(newdata = "",stepName = "STEP1") { let that = this; core.get('sale/activity/step', { code_str: newdata , setpName: stepName }, function (result) { console.log(result) that.setData({ alllist: result.all_list, code: result.all_list[1][0].product_code // code1: result.all_list, //1 // code2: result.all_list[1][0].product_code, //1 // code3: result.all_list[2][0].product_code, //1 // code4: result.all_list[3][0].product_code, //1 // code5: result.all_list[4][0].product_code, //1 }) }) }, onLoad: function (options) { this.getData() }, ```