123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- // compontents/tarbar/tarbar.js
- const util = require('../../utils/util.js');
- Component({
- /**
- * 组件的属性列表
- * 第一次进入课程的nav
- */
- properties: {
-
- },
- /**
- * 组件的初始数据
- */
- data: {
- motto: ['我的','错题本','语文','数学','中文','英语','科学','艺术'],
- navBtnSelectIdx: 0,
- left: 0
- },
- /**
- * 组件的方法列表
- */
- methods: {
- navItemTap: function (e) {
- //更改navBtnSelectIdx加class
- let index = e.target.dataset.index;
- if (index != this.navBtnSelectIdx) {
- this.setData({ navBtnSelectIdx: index});
- }
- //移动nav
- if (index <= 2) {
- this.setData({ left: 0 });
- }
- if(index > 2){
- this.setData({left: 200 });
- }
- if(index == 0) {
- wx.redirectTo({
- url: '../index/index?ind=0'
- })
- }
- if(index == 1) {
- wx.redirectTo({
- url: '../mistakes/mistakes?ind=1'
- })
- }
- if(index == 2) {
- wx.redirectTo({
- url: '../language/language?ind=2'
- })
- }
- if(index == 3) {
- wx.redirectTo({
- url: '../mathematics/mathematics?ind=3'
- })
- }
- if(index == 4) {
- wx.redirectTo({
- url: '../chinese/chinese?ind=4'
- })
- }
- if(index == 5) {
- wx.redirectTo({
- url: '../english/english?ind=5'
- })
- }
- if(index == 6) {
- wx.redirectTo({
- url: '../science/science?ind=6'
- })
- }
- if(index == 7) {
- wx.redirectTo({
- url: '../art/art?ind=7'
- })
- }
- }
- },
- ready() {
- let options = util.getUrl();
- const ind = options.ind || util.convertObject(unescape(options.scene)).ind;
- if(ind) {
- this.setData({ navBtnSelectIdx: ind});
- }
- if (ind <= 2) {
- this.setData({ left: 0 });
- }
- if(ind > 2){
- this.setData({left: 200 });
- }
- }
- })
|