| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- import common from '../../utils/util';
- import server from '../../utils/main';
- const app = getApp();
- var categoryID = "";
- var categoryName = "";
- var categoryNum = "";
- var SelectID = 0;
- Page({
- data: {
- version: app.globalData.version,
- FileUrl: app.globalData.fileUrl,
- filter:'all',
- IsShowMenu:false,
- CategoryID:1,
- },
- onLoad: function(options) {
- categoryID = options.id;
- categoryName = options.name;
- categoryNum = options.num;
- //console.log(category);
- this.getList();
- this.setData({
- CategoryNum:categoryNum,
- CategoryID: categoryID,
- Containnerheight: server.getWindowHeight(),
- });
- },
- getList: function() {
- this.buildList();
- wx.setNavigationBarTitle({
- title: categoryName + " 题卡仓库",
- });
- },
- gotoDetail:function(e){
- SelectID = e.currentTarget.dataset.id;
- var arr = wx.getStorageSync('SelectIDArray');
- if (!arr)
- arr=[];
- for(var i=0;i<arr.length;i++){
- if (arr[i] == SelectID){
- arr.splice(i,0);
- break;
- }
- }
- arr.push(SelectID);
- wx.setStorageSync('SelectIDArray', arr);
- this.buildList();
- wx.navigateTo({
- url: '../main/detail?id=' + SelectID,
- });
- },
- buildList:function(){
- var that=this;
- var arrID = categoryID.split(",");
- var list = [];
- var data = wx.getStorageSync('QuestionTypeList');
- var arr = wx.getStorageSync('SelectIDArray');
- for (var i = 0; i < data.length; i++) {
- for (var j = 0; j < arrID.length; j++) {
- if (data[i].ID == arrID[j]) {
- for (var k = 0; k < data[i].List.length; k++) {
- data[i].List[k].CategoryLevel = data[i].Name;
-
- for (var n = 0; n < arr.length; n++) {
- //data[i].List[k].SelectItem = "";
- if (arr[n] == data[i].List[k].ID){
- data[i].List[k].SelectItem ="boxLeft";
- }
- }
- data[i].List[k].Select = false;
- if (SelectID == data[i].List[k].ID)
- data[i].List[k].Select = true;
- if (this.data.filter == "vertical"){
- if (data[i].List[k].QuestionNumber3>0)
- list.push(data[i].List[k]);
- }
- else{
- list.push(data[i].List[k]);
- }
- }
- break;
- }
- }
- }
- this.setData({
- QuestionTypeList: list,
- });
- setTimeout(function(){
- var query = wx.createSelectorQuery();
- query.select('.line4').boundingClientRect();
- query.exec(function (res) {
- //console.log("top2:" + (res[0].top));
- var LineLongHeight = Number(res[0].top) * 2-200;
- // if (that.data.CategoryNum == 1 )
- // LineLongHeight+=430;
- // else if (that.data.CategoryNum == 2)
- // LineLongHeight += 320;
- // else if (that.data.CategoryNum == 3)
- // LineLongHeight += 280;
- // else if (that.data.CategoryNum == 4)
- // LineLongHeight += 30;
- console.log("LineLongHeight:" + LineLongHeight);
- that.setData({
- LineLongHeight: LineLongHeight,
- });
- });
- },200);
-
- },
- menuClick:function(e){
- this.data.filter = e.currentTarget.dataset.id;
- this.setData({
- filter: this.data.filter,
- IsShowMenu: false,
- });
- this.buildList();
- },
- closeMenu: function () {
- this.setData({
- IsShowMenu: false,
- });
- },
- openMenu: function () {
- this.setData({
- IsShowMenu: true,
- });
- },
- onShareAppMessage: function() {
- return {
- title: app.globalData.ShareTitle,
- path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImageUrl,
- }
- },
- })
|