|
@@ -71,7 +71,7 @@
|
|
|
arr2: ['请选择楼栋'],
|
|
arr2: ['请选择楼栋'],
|
|
|
arr3: ['请选择楼层'],
|
|
arr3: ['请选择楼层'],
|
|
|
arr4: ['请选择房间'],
|
|
arr4: ['请选择房间'],
|
|
|
- array1: ["黄家湖校区", "墨轩湖校区"], //选择器的值
|
|
|
|
|
|
|
+ array1: [], //选择器的值
|
|
|
array2: [],
|
|
array2: [],
|
|
|
array3: [],
|
|
array3: [],
|
|
|
array4: [],
|
|
array4: [],
|
|
@@ -83,92 +83,99 @@
|
|
|
dis_num2: 1, //选择器disable属性,是否禁用
|
|
dis_num2: 1, //选择器disable属性,是否禁用
|
|
|
dis_num3: 1,
|
|
dis_num3: 1,
|
|
|
dis_num4: 1,
|
|
dis_num4: 1,
|
|
|
|
|
+ options: '',
|
|
|
// dis_num5: 1,
|
|
// dis_num5: 1,
|
|
|
allData: [], //所有数据
|
|
allData: [], //所有数据
|
|
|
storage: {} //存放选择数据
|
|
storage: {} //存放选择数据
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
|
// console.log(options)
|
|
// console.log(options)
|
|
|
- // 拆分楼栋和宿舍号
|
|
|
|
|
- var str = options.roomSelect;
|
|
|
|
|
- var arr = new Array();
|
|
|
|
|
- var i = 0;
|
|
|
|
|
- while (i < str.length) {
|
|
|
|
|
- var tmp = str.charCodeAt(i)
|
|
|
|
|
- var s = "";
|
|
|
|
|
- while (str.charCodeAt(i) < 256) {
|
|
|
|
|
- s = s + str.charAt(i);
|
|
|
|
|
- i++;
|
|
|
|
|
- }
|
|
|
|
|
- arr.push(s);
|
|
|
|
|
- s = "";
|
|
|
|
|
- while (str.charCodeAt(i) > 256) {
|
|
|
|
|
- s = s + str.charAt(i);
|
|
|
|
|
- i++;
|
|
|
|
|
- }
|
|
|
|
|
- arr.push(s);
|
|
|
|
|
- }
|
|
|
|
|
- // for (i = 0; i < arr.length; i++) {
|
|
|
|
|
- // console.log(arr[i], i);
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ this.options = options
|
|
|
|
|
+ // 请求校区、楼栋、层好、宿舍号等数据
|
|
|
this.requestAllData()
|
|
this.requestAllData()
|
|
|
-
|
|
|
|
|
- // this.nschool = this.allData.data.length
|
|
|
|
|
-
|
|
|
|
|
- // 自动填充
|
|
|
|
|
- if (arr.length > 0) {
|
|
|
|
|
- if (arr[1] != null && arr[1].length > 0) {
|
|
|
|
|
- this.arr1 = [arr[1]]
|
|
|
|
|
- }
|
|
|
|
|
- let len = arr[2].length
|
|
|
|
|
- if (arr[2] != null && len > 0) {
|
|
|
|
|
- this.arr2 = [arr[2].substring(0, len - 3) + '栋']
|
|
|
|
|
- this.arr3 = [arr[2].substring(len - 3, len - 2) + '层']
|
|
|
|
|
- this.arr4 = [arr[2]]
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.sel1(this.arr1)
|
|
|
|
|
- this.sel2(this.arr2)
|
|
|
|
|
- this.sel3(this.arr3)
|
|
|
|
|
- this.sel4(this.arr4)
|
|
|
|
|
-
|
|
|
|
|
- this.add_class1 = 1
|
|
|
|
|
- this.add_class2 = 1
|
|
|
|
|
- this.add_class3 = 1
|
|
|
|
|
- this.add_class4 = 1
|
|
|
|
|
-
|
|
|
|
|
- this.dis_num2 = 0
|
|
|
|
|
- this.dis_num3 = 0
|
|
|
|
|
- this.dis_num4 = 0
|
|
|
|
|
- }
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 请求楼栋、楼层、宿舍等信息
|
|
|
|
|
+ */
|
|
|
async requestAllData() {
|
|
async requestAllData() {
|
|
|
const res = await this.$myRequest({
|
|
const res = await this.$myRequest({
|
|
|
- host: 'code',
|
|
|
|
|
- url: '',
|
|
|
|
|
|
|
+ host: 'ceshi',
|
|
|
|
|
+ url: 'http://5a69iw.natappfree.cc',
|
|
|
// method: 'POST',
|
|
// method: 'POST',
|
|
|
header: {
|
|
header: {
|
|
|
'content-type': 'application/json'
|
|
'content-type': 'application/json'
|
|
|
- },
|
|
|
|
|
- data: {
|
|
|
|
|
- // 'access_token': this.access_token
|
|
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- console.log(res)
|
|
|
|
|
|
|
+ this.allData = res
|
|
|
|
|
+ this.nschool = res.data.length
|
|
|
|
|
+ this.array1 = []
|
|
|
|
|
|
|
|
- // this.allData = res.data.data
|
|
|
|
|
|
|
+ for (var i = 0; i < this.nschool; i++) {
|
|
|
|
|
+ this.array1.push(res.data[i].school)
|
|
|
|
|
+ }
|
|
|
|
|
+ // 拆分之前选好的楼栋和宿舍号
|
|
|
|
|
+ if (this.options.roomSelect != '') {
|
|
|
|
|
+ var str = this.options.roomSelect;
|
|
|
|
|
+ var arr = new Array();
|
|
|
|
|
+ var i = 0;
|
|
|
|
|
+ while (i < str.length) {
|
|
|
|
|
+ var tmp = str.charCodeAt(i)
|
|
|
|
|
+ var s = "";
|
|
|
|
|
+ while (str.charCodeAt(i) < 256) {
|
|
|
|
|
+ s = s + str.charAt(i);
|
|
|
|
|
+ i++;
|
|
|
|
|
+ }
|
|
|
|
|
+ arr.push(s);
|
|
|
|
|
+ s = "";
|
|
|
|
|
+ while (str.charCodeAt(i) > 256) {
|
|
|
|
|
+ s = s + str.charAt(i);
|
|
|
|
|
+ i++;
|
|
|
|
|
+ }
|
|
|
|
|
+ arr.push(s);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 自动填充
|
|
|
|
|
+ if (arr.length > 0) {
|
|
|
|
|
+ if (arr[1] != null && arr[1].length > 0) {
|
|
|
|
|
+ this.arr1 = [arr[1]]
|
|
|
|
|
+ }
|
|
|
|
|
+ let len = arr[2].length
|
|
|
|
|
+ if (arr[2] != null && len > 0) {
|
|
|
|
|
+ this.arr2 = [arr[2].substring(0, len - 3) + '栋']
|
|
|
|
|
+ this.arr3 = [arr[2].substring(len - 3, len - 2) + '层']
|
|
|
|
|
+ this.arr4 = [arr[2]]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.sel1(this.arr1)
|
|
|
|
|
+ this.sel2(this.arr2)
|
|
|
|
|
+ this.sel3(this.arr3)
|
|
|
|
|
+ this.sel4(this.arr4)
|
|
|
|
|
+
|
|
|
|
|
+ this.add_class1 = 1
|
|
|
|
|
+ this.add_class2 = 1
|
|
|
|
|
+ this.add_class3 = 1
|
|
|
|
|
+ this.add_class4 = 1
|
|
|
|
|
+
|
|
|
|
|
+ this.dis_num2 = 0
|
|
|
|
|
+ this.dis_num3 = 0
|
|
|
|
|
+ this.dis_num4 = 0
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 选择校区
|
|
|
|
|
+ */
|
|
|
changeSelect1(e) {
|
|
changeSelect1(e) {
|
|
|
this.sel1(e.detail.value)
|
|
this.sel1(e.detail.value)
|
|
|
},
|
|
},
|
|
|
// 根据参数的值选中
|
|
// 根据参数的值选中
|
|
|
sel1(index) {
|
|
sel1(index) {
|
|
|
// console.log(index)
|
|
// console.log(index)
|
|
|
|
|
+ // console.log(typeof(index))
|
|
|
this.arr1 = this.array1;
|
|
this.arr1 = this.array1;
|
|
|
|
|
|
|
|
//获取选择器1的值
|
|
//获取选择器1的值
|
|
@@ -203,7 +210,7 @@
|
|
|
this.index2 = 0
|
|
this.index2 = 0
|
|
|
this.index3 = 0
|
|
this.index3 = 0
|
|
|
this.index4 = 0
|
|
this.index4 = 0
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.room = ''
|
|
this.room = ''
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -247,7 +254,7 @@
|
|
|
this.arr4 = ['请选择房间']
|
|
this.arr4 = ['请选择房间']
|
|
|
this.index3 = 0
|
|
this.index3 = 0
|
|
|
this.index4 = 0
|
|
this.index4 = 0
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.room = ''
|
|
this.room = ''
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -261,6 +268,7 @@
|
|
|
this.sel3(e.detail.value)
|
|
this.sel3(e.detail.value)
|
|
|
},
|
|
},
|
|
|
sel3(index) {
|
|
sel3(index) {
|
|
|
|
|
+ // console.log(index)
|
|
|
this.arr3 = this.array3;
|
|
this.arr3 = this.array3;
|
|
|
|
|
|
|
|
for (var i = 0; i < this.floors; i++) {
|
|
for (var i = 0; i < this.floors; i++) {
|
|
@@ -288,7 +296,7 @@
|
|
|
if (typeof(index) == 'string') {
|
|
if (typeof(index) == 'string') {
|
|
|
this.arr4 = ['请选择房间']
|
|
this.arr4 = ['请选择房间']
|
|
|
this.index4 = 0
|
|
this.index4 = 0
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.room = ''
|
|
this.room = ''
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -327,21 +335,21 @@
|
|
|
// console.log(this.array4[this.index4])
|
|
// console.log(this.array4[this.index4])
|
|
|
// console.log(this.room)
|
|
// console.log(this.room)
|
|
|
},
|
|
},
|
|
|
- //跳转页面
|
|
|
|
|
|
|
+ //跳转缴费页面
|
|
|
navigateToIndex(e) {
|
|
navigateToIndex(e) {
|
|
|
// console.log(e)
|
|
// console.log(e)
|
|
|
var roomSelect = e.currentTarget.dataset.room;
|
|
var roomSelect = e.currentTarget.dataset.room;
|
|
|
this.storage.roomSelect = roomSelect;
|
|
this.storage.roomSelect = roomSelect;
|
|
|
this.storage.dom = this.array4[this.index4];
|
|
this.storage.dom = this.array4[this.index4];
|
|
|
- // console.log(roomSelect)
|
|
|
|
|
if (this.room != '') {
|
|
if (this.room != '') {
|
|
|
uni.redirectTo({
|
|
uni.redirectTo({
|
|
|
- url: '../jiaofei/jiaofei?o=select&item=' + encodeURIComponent(JSON.stringify(this.storage)),
|
|
|
|
|
|
|
+ url: '../jiaofei/jiaofei?o=select&item=' + encodeURIComponent(JSON.stringify(this
|
|
|
|
|
+ .storage)),
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
- icon:'success',
|
|
|
|
|
- title:'请选择'
|
|
|
|
|
|
|
+ icon: 'success',
|
|
|
|
|
+ title: '宿舍号不完整'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|