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

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(){ choosequestioncat:function(){
wx.navigateTo({ wx.navigateTo({
url: '/pages/questioncat/index', url: '/pages/questioncat/index?type=2',
})
},
choosequestioncat2:function(){
wx.navigateTo({
url: '/pages/questioncat/index?type=3',
}) })
}, },
start1:function(){ start1:function(){

View File

@ -4,7 +4,14 @@
<view class="page__desc">选择题库分类进行练习。</view> <view class="page__desc">选择题库分类进行练习。</view>
</view> </view>
<view class="page__bd page__bd_spacing"> <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__title">已选分类</view>
<view class="weui-cells weui-cells_after-title" style="height: 5.3em"> <view class="weui-cells weui-cells_after-title" style="height: 5.3em">
{{catsname}} {{catsname}}

View File

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