小程序练习自建分类共享分类

This commit is contained in:
caoqianming 2020-11-17 21:45:55 +08:00
parent 5affde5711
commit 81b9647dce
3 changed files with 20 additions and 4 deletions

View File

@ -119,7 +119,12 @@ wx.getStorage({
},
choosequestioncat:function(){
wx.navigateTo({
url: '/pages/questioncat/index',
url: '/pages/questioncat/index?type=2',
})
},
choosequestioncat2:function(){
wx.navigateTo({
url: '/pages/questioncat/index?type=3',
})
},
start1:function(){

View File

@ -4,7 +4,14 @@
<view class="page__desc">选择题库分类进行练习。</view>
</view>
<view class="page__bd page__bd_spacing">
<button class="weui-btn" type="primary" bindtap='choosequestioncat'>选择分类</button>
<view style="width:50%;float:left">
<button class="weui-btn" type="primary" bindtap='choosequestioncat'>自建分类</button>
</view>
<view style="width:50%;float:left;">
<button class="weui-btn" type="primary" bindtap='choosequestioncat2' style="margin-left:2px">共享分类</button>
</view>
<view class="weui-cells__title">已选分类</view>
<view class="weui-cells weui-cells_after-title" style="height: 5.3em">
{{catsname}}

View File

@ -11,13 +11,17 @@ Page({
selectList: [], //已选择的元素列表
originalList: [], //最原始的数据列表
indexList: [], //存储目录层级的数组,用于准确的返回上一层
selectList: [], //已选中的人员列表
selectList: [], //已选中的人员列表,
type:2
},
onLoad: function (options) {
wx.setNavigationBarTitle({
title: '选择分类'
})
if(options.type){
this.data.type = options.type
}
this.init();
},
@ -25,7 +29,7 @@ Page({
//上次选中的列表,用于判断是不是取消选中了
this.lastTimeSelect = []
wx.request({
url: getApp().globalData.serverUrl + 'api/questioncat?a=tree3',
url: getApp().globalData.serverUrl + 'api/questioncat?a=tree' + this.data.type.toString(),
header: {
'content-type': 'application/json', // 默认值
'Cookie': getApp().globalData.sessionId,