| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- List: [],
- IsSelectGrade: false,
- TestSelectGrade: 0,
- },
- onLoad: function (options) {
- if (options.UserID){
- app.globalData.userInfo={};
- app.globalData.userInfo.UserID=options.UserID;
- }
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- });
- main.getHanzi(function (arr) {
- if (!arr) {
- wx.removeStorageSync("HanziUpdateTime");
- wx.removeStorageSync("HanziAll");
- main.getHanzi(function (arr) {});
- }
- });
- },
- onShow: function () {
- this.getTestReportList();
- },
- showSelectGrade: function () {
- var that = this;
- that.setData({
- IsSelectGrade: true,
- });
- },
- closeSelectGrade: function () {
- var that = this;
- that.setData({
- IsSelectGrade: false,
- });
- },
- goto: function (e) {
- var url = e.currentTarget.dataset.url;
- wx.navigateTo({
- url: url,
- });
- },
- getTestReportList: function () {
- var that = this;
- that.setData({
- GradeArr: [{
- Name: "一年级",
- Name2: "语文一年级",
- Select: "Select",
- List: [{
- ID: 1,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "上学期",
- Finish: 0,
- Total: 12,
- Image: "../images/examine_subject_a001.png"
- }, {
- ID: 13,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "上学期",
- Finish: 0,
- Total: 26,
- Image: "../images/examine_subject_a001.png"
- }, {
- ID: 2,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "下学期",
- Finish: 0,
- Total: 14,
- Image: "../images/examine_subject_a002.png"
- }, {
- ID: 14,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "下学期",
- Finish: 0,
- Total: 28,
- Image: "../images/examine_subject_a002.png"
- }]
- },
- {
- Name: "二年级",
- Name2: "语文二年级",
- Select: "",
- List: [{
- ID: 3,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "上学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a003.png"
- }, {
- ID: 15,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "上学期",
- Finish: 0,
- Total: 28,
- Image: "../images/examine_subject_a003.png"
- }, {
- ID: 4,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "下学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a004.png"
- }, {
- ID: 16,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "下学期",
- Finish: 0,
- Total: 29,
- Image: "../images/examine_subject_a004.png"
- }]
- },
- {
- Name: "三年级",
- Name2: "语文三年级",
- Select: "",
- List: [{
- ID: 5,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "上学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a005.png"
- }, {
- ID: 17,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "上学期",
- Finish: 0,
- Total: 28,
- Image: "../images/examine_subject_a005.png"
- }, {
- ID: 6,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "下学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a006.png"
- }, {
- ID: 18,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "下学期",
- Finish: 0,
- Total: 21,
- Image: "../images/examine_subject_a006.png"
- }]
- },
- {
- Name: "四年级",
- Name2: "语文四年级",
- Select: "",
- List: [{
- ID: 7,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "上学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a007.png"
- }, {
- ID: 19,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "上学期",
- Finish: 0,
- Total: 20,
- Image: "../images/examine_subject_a007.png"
- }, {
- ID: 8,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "下学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a008.png"
- }, {
- ID: 20,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "下学期",
- Finish: 0,
- Total: 20,
- Image: "../images/examine_subject_a008.png"
- }]
- },
- {
- Name: "五年级",
- Name2: "语文五年级",
- Select: "",
- List: [{
- ID: 9,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "上学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a009.png"
- }, {
- ID: 21,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "上学期",
- Finish: 0,
- Total: 21,
- Image: "../images/examine_subject_a009.png"
- }, {
- ID: 10,
- Type: "Shizi",
- Name: "语文识字",
- Name2: "下学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a010.png"
- }, {
- ID: 22,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "下学期",
- Finish: 0,
- Total: 16,
- Image: "../images/examine_subject_a010.png"
- }
- ]
- },
- {
- Name: "六年级",
- Name2: "语文六年级",
- Select: "",
- List: [
- {
- ID: 23,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "上学期",
- Finish: 0,
- Total: 18,
- Image: "../images/examine_subject_a011.png"
- }, {
- ID: 24,
- Type: "Shizi",
- Name: "语文写字",
- Name2: "下学期",
- Finish: 0,
- Total: 12,
- Image: "../images/examine_subject_a012.png"
- },
- ]
- },
- {
- Name: "英语常用单词",
- Name2: "英语常用单词",
- Select: "",
- List: [
- {
- ID: 101,
- Type: "Word",
- Name: "常用单词1",
- Name2: "词汇1~220",
- Finish: 0,
- Total: 22,
- Image: "../images/examine_subject_b001.png"
- },
- {
- ID: 102,
- Type: "Word",
- Name: "常用单词2",
- Name2: "词汇221~500",
- Finish: 0,
- Total: 28,
- Image: "../images/examine_subject_b002.png"
- },
- {
- ID: 103,
- Type: "Word",
- Name: "常用单词3",
- Name2: "词汇500~1000",
- Finish: 0,
- Total: 50,
- Image: "../images/examine_subject_b003.png"
- },
- {
- ID: 104,
- Type: "Word",
- Name: "常用单词4",
- Name2: "词汇1001~1500",
- Finish: 0,
- Total: 50,
- Image: "../images/examine_subject_b004.png"
- },
- {
- ID: 105,
- Type: "Word",
- Name: "常用单词5",
- Name2: "词汇1501~2000",
- Finish: 0,
- Total: 50,
- Image: "../images/examine_subject_b005.png"
- },
- ]
- },
- ],
- })
- var userid = app.globalData.userInfo.UserID;
- main.getData('GetTestReportList?UserID=' + userid, function (data) {
- if (data) {
- var dataTemp = [];
- for (var i = 0; i < data.length; i++) {
- for (var j = 0; j < dataTemp.length; j++) {
- if (dataTemp[j].Name[0] == data[i].Name[0] &&
- dataTemp[j].Name[1] == data[i].Name[1] &&
- dataTemp[j].TestType == data[i].TestType &&
- data[i].IsFinished == 1
- ) {
- dataTemp.splice(j, 1);
- break;
- }
- }
- dataTemp.push(data[i]);
- if (data[i].Name[0].indexOf("英语")>=0){
- if (data[i].TestRightStr){
- data[i].TestRightStr=data[i].TestRightStr.split(",");
- }
- if (data[i].TestWrongStr){
- data[i].TestWrongStr=data[i].TestWrongStr.split(",");
- }
- if (data[i].TestSkipStr){
- data[i].TestSkipStr=data[i].TestSkipStr.split(",");
- }
- if (data[i].TestExistStr){
- data[i].TestExistStr=data[i].TestExistStr.split(",");
- }
- }
-
-
- if (!data[i].TestRightStr)
- data[i].TestRightStr="";
- if (!data[i].TestWrongStr)
- data[i].TestWrongStr="";
- if (!data[i].TestSkipStr)
- data[i].TestSkipStr="";
- if (!data[i].TestExistStr)
- data[i].TestExistStr="";
-
- }
- for (var i = 0; i < dataTemp.length; i++) {
- var name = dataTemp[i].Name[0].split(" ");
- for (var j = 0; j < that.data.GradeArr.length; j++) {
- var item = that.data.GradeArr[j];
- if (name[0] == item.Name) {
- for (var k = 0; k < item.List.length; k++) {
- if (name[1] == item.List[k].Name && name[2] == item.List[k].Name2) {
- if (dataTemp[i].IsFinished == 1)
- item.List[k].Finish++;
- }
- }
- }
- }
- }
- for (var j = 0; j < that.data.GradeArr.length; j++) {
- var item = that.data.GradeArr[j];
- for (var k = 0; k < item.List.length; k++) {
- item.List[k].Finished = Math.round(100 * item.List[k].Finish / item.List[k].Total);
- }
- }
- that.setData({
- TestReport: data,
- GradeArr: that.data.GradeArr,
- });
- wx.setStorageSync("UserTestReport", data);
- common.getStorageValue(that, "TestSelectGrade", 0, function () {
- that.onSelectGrade({
- currentTarget: {
- dataset: {
- value: that.data.TestSelectGrade
- }
- }
- });
- });
- }
- });
- },
- 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,
- });
- this.closeSelectGrade();
- 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");
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|