| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- import constant from '../../utils/constant';
- const app = getApp();
- Page({
- data: {
- List: [],
- TestSelectGrade: 0,
- IsIPhoneX: app.globalData.IsIPhoneX,
- IsIPad: app.globalData.IsIPad,
- ScrollLeft: 0,
- },
- onLoad: function (options) {
- if (options.UserID) {
- app.globalData.userInfo = {};
- app.globalData.userInfo.UserID = options.UserID;
- }
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- Subject: "CHN",
- });
- main.getHanzi(function () {
- main.getEnglish(function () {
-
- });
- });
- },
- onShow: function () {
- this.getTestReportList();
- },
- selectSubject: function (e) {
- var subject = e.currentTarget.dataset.type;
- var that = this;
- that.setData({
- Subject: subject,
- });
- },
- goto: function (e) {
- var url = e.currentTarget.dataset.url;
- if (url == "../other/userbook") {
- } else if (e.currentTarget.dataset.type == "Shici") {
- var name1 = e.currentTarget.dataset.name1;
- name1 = name1.replace("语文古诗文", "语文");
- url = "./item?testtype=recite&name1=" + name1 + "&bookid=" + e.currentTarget.dataset.bookid;
- } else if (e.currentTarget.dataset.type == "Word" && e.currentTarget.dataset.bookid == 100) {
- var name1 = e.currentTarget.dataset.name1;
- url = "./item?testtype=read&name1=" + name1 + "&name2=英文字母&bookid=100";
- } else if (e.currentTarget.dataset.name1 && e.currentTarget.dataset.bookid) {
- url = "./list?name1=" + e.currentTarget.dataset.name1 + "&id=" + e.currentTarget.dataset.bookid;
- }
- wx.navigateTo({
- url: url,
- });
- },
- getTestReportList: function () {
- var that = this;
-
- var userid = app.globalData.userInfo.UserID;
- main.GetTestReportList(userid,function (data,GradeArrResult) {
- that.setData({
- TestReport: data,
- GradeArr: GradeArrResult,
- });
-
- common.getStorageValue(that, "TestSelectGrade", 0, function () {
- that.onSelectGrade({
- currentTarget: {
- dataset: {
- value: that.data.TestSelectGrade
- }
- }
- });
- if (that.data.TestSelectGrade < 9) {
- that.setData({
- Subject: "CHN",
- });
- if (that.data.TestSelectGrade > 4) {
- that.setData({
- ScrollLeft: 500,
- });
- }
- } else {
- that.setData({
- Subject: "ENG",
- });
- if (that.data.TestSelectGrade > 11) {
- that.setData({
- ScrollLeft: 500,
- });
- }
- }
- });
- });
- },
- onSelectGrade: function (e) {
- var index = e.currentTarget.dataset.value;
- for (var i = 0; i < this.data.GradeArr.length; i++)
- this.data.GradeArr[i].Select = "";
- this.data.GradeArr[index].Select = "Select";
- this.setData({
- TestSelectGrade: index,
- GradeArr: this.data.GradeArr,
- });
- wx.setStorageSync("TestSelectGrade", index);
- },
- gotoTestReportInfo: function (e) {
- var id = e.currentTarget.dataset.id;
- var userid = app.globalData.userInfo.UserID;
- main.GetTestReportInfo(id, function (data) {
- wx.setStorageSync("TestTask", data);
- wx.navigateTo({
- url: "./report?type=edit",
- });
- });
- },
- onUnload: function () {
- wx.removeStorageSync("UserTestReport");
- },
- gotoReLaunch: function (e) {
- var url = e.currentTarget.dataset.url;
- wx.reLaunch({
- url: url,
- });
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|