123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- // pages/plan/plan.js
- const app = getApp()
- const host = app.globalData.host;
- Page({
- data: {
- array1:['特种作业'],
- array2: [],
- array3: [],
- index1:-1,
- index2: -1,
- index3: -1,
- list:[],
- show:0,
- year: new Date().getFullYear()
- },
- onLoad: function (options) {
-
- this.getData()
- wx.request({
- url: host + '/api/wx/sujectitem',
- success: res => {
- this.setData({
- array1: res.data.data
- })
- }
- })
- },
- bindPickerChange:function(e){
- if (e.target.dataset.id == 1) {
- let list = this.data.array1[e.detail.value].children
- console.log(list)
- this.setData({
- index1: e.detail.value,
- array2:list,
- array3:[],
- index2:-1,
- index3: -1
- })
- };
- if (e.target.dataset.id == 2) {
- let list = this.data.array2[e.detail.value].children
- this.setData({
- index2: e.detail.value,
- array3: list,
- index3: -1
- })
- };
- if (e.target.dataset.id == 3) {
- this.setData({
- index3: e.detail.value
- })
- };
- // this.getData();
- },
- show:function(){
- this.setData({
- show: 0
- })
- },
- sure:function(){
- if(this.data.index1<0){
- wx.showToast({
- title: '请选择培训项目',
- icon: 'none',
- duration: 2000
- })
- }else{
- this.setData({
- show: 0
- })
- this.getData()
- }
- },
- getData:function(){
-
- wx.showLoading({
- title: '',
- })
- var parm={}
- if (this.data.index1>=0){
- parm.subject_item0 = this.data.array1[this.data.index1].name
- }
- if (this.data.index2 >= 0) {
- parm.subject_item1 = this.data.array2[this.data.index2].name
- }
- if (this.data.index3 >= 0) {
- parm.subject_item2 = this.data.array3[this.data.index3].name
- }
- wx.request({
- url: host+'/api/wx/class/list',
- method:'GET',
- data: parm,
- success:res=>{
- wx.hideLoading()
- this.setData({
- list:res.data.data
- })
- }
- })
- },
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|