|
@@ -1,5 +1,5 @@
|
|
|
const getHeight = require("../../utils/getRheRemainingHeight");
|
|
|
-
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -10,37 +10,52 @@ Page({
|
|
|
searchContent: "", //搜索内容
|
|
|
mainActiveIndex: 0, //分类选择器打开分类的下标
|
|
|
activeId: null, //分类选择器选择id
|
|
|
- items: [{
|
|
|
- text: '所有城市',
|
|
|
- children: [{
|
|
|
- text: '温州',
|
|
|
- id: '温州',
|
|
|
- },
|
|
|
- {
|
|
|
- text: '杭州',
|
|
|
- id: '杭州',
|
|
|
- },
|
|
|
- ],
|
|
|
- }, {
|
|
|
- text: '可选城市',
|
|
|
- children: [{
|
|
|
- text: '嘉兴',
|
|
|
- id: '嘉兴',
|
|
|
- },
|
|
|
- {
|
|
|
- text: '台州',
|
|
|
- id: '台州',
|
|
|
- },
|
|
|
- ],
|
|
|
- }, ]
|
|
|
+ showText: null, //左上显示文本
|
|
|
+ items: [], //分类列表
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
+ this.selectMenu(0);
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "saletool.courseware.courseware",
|
|
|
+ "method": "selectList",
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 10,
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ "sorttype": 2,
|
|
|
+ "sat_courseware_classid": 31
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
+ /* 查询菜单分类 */
|
|
|
+ selectMenu(index) {
|
|
|
+ if (index == '5') return wx.showToast({
|
|
|
+ title: '加载失败,请稍后再试',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "saletool.courseware.courseware",
|
|
|
+ "method": "selectMenu",
|
|
|
+ "content": {}
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.msg != '成功') return this.selectMenu(index + 1)
|
|
|
+ let str = JSON.stringify(res.data).replace(/classname/g, 'text').replace(/sat_courseware_classid/g, 'id');
|
|
|
+ this.setData({
|
|
|
+ items: JSON.parse(str)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
onClickNav({
|
|
|
detail = {}
|
|
|
}) {
|
|
@@ -52,10 +67,11 @@ Page({
|
|
|
onClickItem({
|
|
|
detail = {}
|
|
|
}) {
|
|
|
- const activeId = this.data.activeId === detail.id ? null : detail.id;
|
|
|
- console.log(activeId)
|
|
|
+ const activeId = this.data.activeId === detail.id ? null : detail.id,
|
|
|
+ showText = this.data.showText === detail.text ? null : detail.text;
|
|
|
this.setData({
|
|
|
- activeId
|
|
|
+ activeId,
|
|
|
+ showText
|
|
|
});
|
|
|
},
|
|
|
/**
|