chengjie 7 年之前
父节点
当前提交
97786f8447

+ 14 - 1
app.js

@@ -17,7 +17,10 @@ App({
17 17
     version: "0.1.3",
18 18
     IsProduction: false,
19 19
     ProgramID: 105,
20
-    StartSecond: 4,
20
+    AppID: "wx313a8f2c0741efe1",
21
+    ShareTitle: "认真练习,告别粗心",
22
+    ShareImageUrl: '../../images/programsystem_screenshot_pic01.png',
23
+
21 24
     fileUrl: "https://math-1253256735.file.myqcloud.com/",
22 25
     serverUrl: "https://www.kylx365.com/apiData/",
23 26
     serverUrlServer: "https://www.kylx365.com/apiData/",
@@ -25,5 +28,15 @@ App({
25 28
     audioUrlBaidu: "https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=abcdxxx&tok=[token]&tex=[word]&vol=9&per=1&spd=8&pit=5",
26 29
     Key: "kylx365_chengjie",
27 30
     IV: "kylx365hongliren",
31
+    
32
+    systemInfo: null,
33
+    userInfo: null,
34
+    SourceID: 0,//来源ID
35
+    DayNumber: 0,//使用天数
36
+    PayMoney: 9.8,//产品销售价
37
+    BaiduToken: "",//百度开发平台token
38
+    IsShow: 0,
39
+    NewUserNumberMax: 6,//邀请新用户最大值
40
+    IsSaveCustom: false,//是否保存了定制
28 41
   }
29 42
 })

+ 4 - 4
app.json

@@ -1,12 +1,12 @@
1 1
 {
2 2
   "pages": [
3
+    "pages/index/index",
4
+    "pages/main/item",
3 5
     "pages/main/answer",
4 6
     "pages/main/detail",
7
+    "pages/main/print",
5 8
     "pages/main/list",
6
-    "pages/main/default",
7
-    "pages/index/index",
8
-    "pages/index/detail",
9
-    "pages/index/list"
9
+    "pages/main/default"
10 10
   ],
11 11
   "window": {
12 12
     "backgroundTextStyle": "light",

文件差异内容过多而无法显示
+ 10 - 0
app.wxss


二进制
images/answer.png


二进制
images/questioncollection_headline_plate.png


+ 0 - 22
pages/index/detail.js

@@ -1,22 +0,0 @@
1
-import common from '../../utils/util';
2
-import server from '../../utils/main';
3
-
4
-var app = getApp();
5
-
6
-Page({
7
-  data: {
8
-    List:[],
9
-  },
10
-  onLoad: function (options) {
11
-    var id=options.id;
12
-    this.gotoDetail(id);
13
-  },
14
-  gotoDetail: function (id) {
15
-    var that=this;
16
-    server.getData('GetQuestionTypesPrint?ID=' + id, function (data) {
17
-      that.setData({
18
-        List:data.QuestionList,
19
-      })
20
-    });
21
-  },
22
-})

+ 0 - 12
pages/index/detail.wxml

@@ -1,12 +0,0 @@
1
-<view class="container FlexColumn">
2
-  <movable-area class="movable">
3
-    <movable-view class="table FlexColumn" inertia="true" out-of-bounds="true" damping="30" friction="1" scale="true" scale-min="0.05" scale-max="10" scale-value="1" x="{{x}}" y="{{y}}" direction="all">
4
-      <view class="td FlexRow" wx:for="{{List}}" wx:key="index">
5
-        <view class="tdIndex">({{index+1}})</view>
6
-        <view class="tdNumA">{{item.A}}</view>
7
-        <view class="tdNumAB">{{item.OperateAB}}</view>
8
-        <view class="tdNumA">{{item.B}}</view>
9
-      </view>
10
-    </movable-view>
11
-  </movable-area>
12
-</view>

+ 0 - 38
pages/index/detail.wxss

@@ -1,38 +0,0 @@
1
-.container {
2
-  background-color: #fff;
3
-  justify-content: flex-start;
4
-  align-items: flex-start;
5
-} 
6
-
7
-.movable{
8
-  width:100%;
9
-  height:1334rpx;
10
-}
11
-
12
-.table{
13
-  width:2100rpx;
14
-  height:2970rpx;
15
-  font-size:72rpx;
16
-  justify-content: flex-start;
17
-  flex-wrap: wrap;
18
-}
19
-
20
-.td{
21
-  width:800rpx;
22
-  height:200rpx;
23
-  text-align: center;
24
-  line-height: 200rpx;
25
-}
26
-
27
-.tdIndex{
28
-  width:20rpx;
29
-  color:#dddddd;
30
-  margin-right: 60rpx;
31
-  font-size:40rpx;
32
-}
33
-
34
-.bg{
35
-  width:2100rpx;
36
-  height:2970rpx;
37
-}
38
-

+ 140 - 30
pages/index/index.js

@@ -1,54 +1,164 @@
1 1
 import common from '../../utils/util';
2 2
 import server from '../../utils/main';
3 3
 
4
-const app = getApp()
4
+const app = getApp();
5
+var timeout2, timeout3;
6
+
5 7
 Page({
6 8
   data: {
7 9
     version: app.globalData.version,
8 10
     FileUrl: app.globalData.fileUrl,
9 11
   },
10
-  onLoad: function () {
12
+  onLoad: function(options) {
13
+    if (options) {
14
+      if (options.UserID) {
15
+        console.log("UserID:" + options.UserID);
16
+        app.globalData.introducer = options.UserID;
17
+      }
18
+      if (options.SourceID) {
19
+        console.log("SourceID:" + options.SourceID);
20
+        app.globalData.SourceID = options.SourceID;
21
+      }
22
+      // 扫码介绍人
23
+      if (options.scene) {
24
+        var scene = decodeURIComponent(options.scene);
25
+        console.log("scene:" + scene);
26
+        var introducer = 0;
27
+        if (scene.indexOf("UserID") >= 0)
28
+          introducer = scene.substr(scene.indexOf("UserID") + 7);
29
+        console.log("introducer:" + introducer);
30
+        app.globalData.introducer = scene;
31
+      }
32
+    }
11 33
     this.setData({
12 34
       Containnerheight: server.getWindowHeight(),
13 35
     });
14
-    this.updateProgram();
36
+
37
+    this.getUserInfo();
15 38
   },
16
-  updateProgram: function () {
17
-    if (wx.canIUse("getUpdateManager")) {
18
-      const updateManager = wx.getUpdateManager();
39
+  //得到用户信息
40
+  getUserInfo: function(cb) {
41
+    var that = this
42
+    //调用登录接口
43
+    wx.login({
44
+      success: function(res0) {
45
+        app.globalData.userInfo = {};
46
+        app.globalData.userInfo.Code = res0.code;
47
+        //console.log("Code:" + res0.code);
19 48
 
20
-      updateManager.onCheckForUpdate(function (res) {
21
-        // 请求完新版本信息的回调
22
-        console.log(res.hasUpdate)
23
-      });
49
+        wx.getSetting({
50
+          scope: "scope.userInfo",
51
+          success(res) {
52
+            if (!res.authSetting['scope.userInfo']) {
53
+              app.globalData.userInfo.nickName = "陌生用户";
54
+              app.globalData.userInfo.language = "";
55
+              app.globalData.userInfo.gender = "0";
56
+              app.globalData.userInfo.city = "";
57
+              app.globalData.userInfo.province = "";
58
+              app.globalData.userInfo.country = "";
59
+              app.globalData.userInfo.avatarUrl = "";
60
+              that.login(app.globalData.userInfo);
61
+            } else {
62
+              wx.getUserInfo({
63
+                withCredentials: false,
64
+                success: function(res) {
65
+                  app.globalData.userInfo = res.userInfo;
66
+
67
+                  app.globalData.userInfo.NickName = app.globalData.userInfo.nickName;
68
+                  app.globalData.userInfo.AvatarUrl = app.globalData.userInfo.avatarUrl;
69
+
70
+                  app.globalData.userInfo.Code = res0.code;
71
+                  that.login(app.globalData.userInfo);
72
+
73
+                },
74
+                fail: function(res) {
75
+                  that.login(app.globalData.userInfo);
76
+                }
77
+              });
24 78
 
25
-      updateManager.onUpdateReady(function () {
26
-        wx.showModal({
27
-          title: '更新提示',
28
-          content: '新版本已经准备好,是否重启应用?',
29
-          success: function (res) {
30
-            if (res.confirm) {
31
-              // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
32
-              updateManager.applyUpdate()
33 79
             }
34 80
           }
35 81
         });
82
+      },
83
+      fail: function() {
84
+        timeout2 = setTimeout(function() {
85
+          that.getUserInfo();
86
+          console.log("reboot:" + new Date().getTime());
87
+        }, 2000);
88
+      }
89
+    });
90
+  },
91
+
92
+  login: function(param) {
93
+    var that = this;
36 94
 
95
+    server.getLocalHost(function() {
96
+      server.postData('MathLogin', {
97
+        Code: param.Code,
98
+        NickName: param.nickName,
99
+        Language: param.language,
100
+        Gender: param.gender,
101
+        City: param.city,
102
+        Province: param.province,
103
+        Country: param.country,
104
+        AvatarUrl: param.avatarUrl,
105
+        Introducer: app.globalData.introducer,
106
+        UserSource: app.globalData.userSource,
107
+        SourceID: app.globalData.SourceID,
108
+        LastUserSource: app.globalData.userSource,
109
+        Brand: app.globalData.systemInfo.brand,
110
+        Model: app.globalData.systemInfo.model,
111
+        PixelRatio: app.globalData.systemInfo.pixelRatio,
112
+        ScreenWidth: app.globalData.systemInfo.screenWidth,
113
+        ScreenHeight: app.globalData.systemInfo.screenHeight,
114
+        WindowWidth: app.globalData.systemInfo.windowWidth,
115
+        WindowHeight: app.globalData.systemInfo.windowHeight,
116
+        WXLanguage: app.globalData.systemInfo.language,
117
+        WXVersion: app.globalData.systemInfo.version,
118
+        System: app.globalData.systemInfo.system,
119
+        Platform: app.globalData.systemInfo.platform,
120
+        SDKVersion: app.globalData.systemInfo.SDKVersion,
121
+        ProgramVersion: app.globalData.Version,
122
+      }, function(data) {
123
+        //console.log("UserInfo:" + data);
124
+        if (!data) {
125
+          timeout3 = setTimeout(function() {
126
+            that.getUserInfo();
127
+            console.log("reboot:" + new Date().getTime());
128
+          }, 2000);
129
+        } else {
130
+          app.globalData.userInfo = data;
131
+
132
+          //app.globalData.userInfo.AvatarUrl = param.avatarUrl;
133
+          that.getQuestionType(function() {
134
+            setTimeout(function() {
135
+              wx.redirectTo({
136
+                url: '../main/default'
137
+              })
138
+            }, 2000);
139
+          });
140
+        }
37 141
       });
38
-    }
142
+
143
+    });
144
+
145
+  },
146
+  getQuestionType: function(callback) {
147
+    var that = this;
148
+    server.getData('GetQuestionTypes?Mode=2', function(data) {
149
+      if (data) {
150
+        //var arr = common.Decrypt(data);
151
+        var arr=data;
152
+        wx.setStorageSync("QuestionTypeList", arr);
153
+        callback();
154
+      }
155
+    });
39 156
   },
40 157
   onShareAppMessage: function () {
41 158
     return {
42
-      title: '',
43
-      path: 'pages/index/index',
44
-      success: function (res) {
45
-      },
46
-      fail: function (err) {
47
-        console.log(err);
48
-      },
49
-      complete: function (res) {
50
-        console.log(res);
51
-      },
159
+      title: app.globalData.ShareTitle,
160
+      path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
161
+      imageUrl: app.globalData.ShareImageUrl,
52 162
     }
53 163
   },
54
-})
164
+})

+ 4 - 2
pages/index/index.wxss

@@ -11,14 +11,16 @@
11 11
 }
12 12
 
13 13
 .text1 {
14
-  margin-top: 142rpx;
14
+  position: fixed;
15
+  top: 142rpx;
15 16
   color: #fff;
16 17
   font-size: 48rpx;
17 18
   text-shadow: 0 7rpx 0 #112331;
18 19
 }
19 20
 
20 21
 .panel {
21
-  margin-top: 20rpx;
22
+  position: fixed;
23
+  top: 229rpx;
22 24
   color: #fff;
23 25
   font-size: 24rpx;
24 26
   width:281rpx;

+ 0 - 109
pages/index/list.js

@@ -1,109 +0,0 @@
1
-import common from '../../utils/util';
2
-import server from '../../utils/main';
3
-
4
-var app = getApp();
5
-var category = 0;
6
-
7
-Page({
8
-
9
-  /**
10
-   * 页面的初始数据
11
-   */
12
-  data: {
13
-    FileUrl: app.globalData.fileUrl,
14
-  },
15
-
16
-  /**
17
-   * 生命周期函数--监听页面加载
18
-   */
19
-  onLoad: function (options) {
20
-    this.setData({
21
-      Containnerheight: server.getWindowHeight(),
22
-    });
23
-    category = options.id;
24
-    console.log(category);
25
-    this.getList();
26
-  },
27
-
28
-  onPullDownRefresh: function () {
29
-    this.getList();
30
-  },
31
-
32
-  onShow: function () {
33
-    var that = this;
34
-    that.getList();
35
-  },
36
-
37
-  getList: function () {
38
-    this.setData({
39
-      Level: category,
40
-    });
41
-
42
-    var data = wx.getStorageSync('QuestionTypeList');
43
-    for (var i = 0; i < data.length; i++) {
44
-      if (data[i].ID == category) {
45
-        
46
-        this.setData({
47
-          QuestionTypeList: data[i].List,
48
-        });
49
-        wx.setNavigationBarTitle({
50
-          title: data[i].Name,
51
-        });
52
-        break;
53
-      }
54
-    }
55
-  },
56
-  gotoDetail: function (e) {
57
-    var questionTypeID = e.currentTarget.dataset.id;
58
-    wx.navigateTo({
59
-      url: './detail?id=' + questionTypeID
60
-    });
61
-  },
62
-  gotoPrint: function (e) {
63
-    var that=this;
64
-    var id = e.currentTarget.dataset.id;
65
-    server.getData('GetQuestionTypesPrint?ID='+id, function (data) {
66
-      that.downImage(data);
67
-    });
68
-  },
69
-  downImage:function(filename){
70
-    var that = this;
71
-    wx.showLoading({
72
-      title: '下载中',
73
-    });
74
-    setTimeout(function(){
75
-      wx.downloadFile({
76
-        url: "https://print-1253256735.file.myqcloud.com/" + filename + ".png",
77
-        success: function (res) {
78
-          wx.hideLoading();
79
-          wx.previewImage({
80
-            current: res.tempFilePath, // 当前显示图片的http链接
81
-            urls: [res.tempFilePath] // 需要预览的图片http链接列表
82
-          })
83
-        },
84
-        fail: function () {
85
-          wx.hideLoading();
86
-          that.downImage(filename);
87
-        }
88
-      });
89
-    },2000);
90
-  },
91
-  onShareAppMessage: function () {
92
-    var that = this;
93
-    return {
94
-      title: '',
95
-      path: 'pages/index/start?UserID=' + app.globalData.userInfo.UserID,
96
-      imageUrl: app.globalData.fileUrl + 'images3/Extend/02.png',
97
-      success: function (res) {
98
-        
99
-      },
100
-      fail: function (err) {
101
-        console.log(err);
102
-      },
103
-      complete: function (res) {
104
-        console.log("shareComplete:" + res);
105
-      },
106
-    }
107
-  },
108
-
109
-})

+ 0 - 1
pages/index/list.json

@@ -1 +0,0 @@
1
-{}

+ 0 - 32
pages/index/list.wxml

@@ -1,32 +0,0 @@
1
-<view class="container FlexColumn" style="min-height:{{Containnerheight}}rpx;">
2
-
3
-  <view class="ViewContainerTitle1 Width100 FlexRow">
4
-    <view class="Left FlexRow">
5
-      题卡
6
-    </view>
7
-    <view></view>
8
-  </view>
9
-  <view class="ViewContainerContent2 Width100 FlexRow" wx:for="{{QuestionTypeList}}" wx:key="index" bindtap="gotoDetail" data-id="{{item.ID}}">
10
-    <view class="ViewContainerContent2_1 Left FlexColumn">
11
-      <view class="FlexRow">
12
-        <image class="ListIcon" src="{{FileUrl}}images/QuestionLibrary/QuestionTypesIcon1.png?2"  />
13
-        <view class="Left20">{{item.Name}}</view>
14
-        <view class="Left20 difficulty">{{item.DifficultyName}}</view>
15
-      </view>
16
-      <view class="ExampleContainer FlexRow">
17
-        <view class="letterSpacing">{{item.Example[0]}}</view>
18
-        <image class="XieGang" src="{{FileUrl}}images/xiegang.png" />
19
-        <view class="letterSpacing">{{item.Example[1]}}</view>
20
-        <image class="XieGang" src="{{FileUrl}}images/xiegang.png" wx:if="{{item.Example[2]}}" />
21
-        <view class="letterSpacing">{{item.Example[2]}}</view>
22
-      </view>
23
-    </view>
24
-    <view class="Right FlexRow">
25
-      
26
-      <image class="PrintIcon" src="../../images/print.png"  />
27
-        
28
-    </view>
29
-  </view>
30
-  <view class="footerHeight"></view>
31
-
32
-</view>

+ 0 - 59
pages/index/list.wxss

@@ -1,59 +0,0 @@
1
-
2
-.ViewContainerTitle1 {
3
-  background-color: #f0f0f0;
4
-  font-size: 28rpx;
5
-  font-weight: 500;
6
-  height: 100rpx;
7
-  justify-content: space-between;
8
-}
9
-
10
-.ViewContainerContent2 {
11
-  height: 132rpx;
12
-  background-color: #fff;
13
-  justify-content: space-between;
14
-  border-bottom: 1rpx solid #f0f0f0;
15
-  font-size: 30rpx;
16
-}
17
-
18
-.ViewContainerContent2_1{
19
-  justify-content: flex-start;
20
-  align-items: flex-start;
21
-}
22
-
23
-.ListIcon {
24
-  width: 36rpx;
25
-  height: 30rpx;
26
-}
27
-
28
-.Left20{
29
-  margin-left: 20rpx;
30
-}
31
-
32
-.XieGang {
33
-  margin: 0 10rpx 0 10rpx;
34
-  width:14rpx;
35
-  height:18rpx;
36
-}
37
-
38
-.ExampleContainer {
39
-  margin: 5rpx 0 0 60rpx;
40
-  font-size: 24rpx;
41
-  font-style: italic;
42
-  font-weight: 200;
43
-  justify-content: flex-start;
44
-}
45
-
46
-.letterSpacing {
47
-  letter-spacing: 6rpx;
48
-}
49
-
50
-.difficulty{
51
-  font-size:22rpx;
52
-  color:#9B9B9B;
53
-
54
-}
55
-
56
-.PrintIcon{
57
-  width:72rpx;
58
-  height:54rpx;
59
-}

+ 5 - 2
pages/main/answer.wxml

@@ -21,7 +21,7 @@
21 21
 
22 22
   <view class="panel0 FlexColumn">
23 23
     <view class="panel00 FlexRow">
24
-      <view class="panel0MainBG panel0Main">
24
+      <view class="panel0MainBG panel0Main" bindtap='selectItem'>
25 25
         <view class="line2"></view>
26 26
         <view class="item FlexColumn">
27 27
           <view class="itemLine0"></view>
@@ -42,10 +42,13 @@
42 42
               <view class="title30">#</view>
43 43
               <view class="title31">48</view>
44 44
               <image class="universalpic_new_red_size01" src="../../images/universalpic_new_red_size01.png" />
45
-
46 45
             </view>
47 46
           </view>
48 47
           <view class="itemLine1"></view>
48
+          <view class="itemLineSelected" wx:if="{{true}}">
49
+            <image class="universalpic_select_on_orange" src="../../images/universalpic_select_on_orange.png" />
50
+              
51
+          </view>
49 52
         </view>
50 53
 
51 54
         <view class="item FlexColumn">

+ 34 - 18
pages/main/answer.wxss

@@ -24,7 +24,6 @@
24 24
   z-index: 20;
25 25
 }
26 26
 
27
-
28 27
 .panelTop {
29 28
   width: 710rpx;
30 29
   position: absolute;
@@ -32,65 +31,67 @@
32 31
   z-index: 30;
33 32
   justify-content: space-between;
34 33
 }
34
+
35 35
 .panelTop .panelTop0 {
36 36
   width: 280rpx;
37 37
   height: 90rpx;
38 38
   margin-left: 50rpx;
39 39
 }
40
+
40 41
 .panelTop .panelTop1 {
41 42
   margin-right: 69rpx;
42 43
 }
44
+
43 45
 .panelTop .panelTop00 {
44 46
   width: 280rpx;
45 47
   height: 80rpx;
46
-
47 48
   border-top-left-radius: 20rpx;
48 49
   border-top-right-radius: 20rpx;
49
-  background-color: #D79E59;
50
+  background-color: #d79e59;
50 51
 }
52
+
51 53
 .panelTop .line {
52 54
   width: 280rpx;
53 55
   height: 10rpx;
54
-  background-color: #B98043;
56
+  background-color: #b98043;
55 57
 }
56 58
 
57 59
 .panelTop .text {
58 60
   color: #fff;
59 61
   font-size: 26rpx;
60
-  text-shadow: 3rpx 3rpx 3rpx #906A3C, 
61
-    3rpx -3rpx 3rpx #906A3C, 
62
-    -3rpx 3rpx 3rpx #906A3C, 
63
-    -3rpx -3rpx 3rpx #906A3C;
62
+  text-shadow: 3rpx 3rpx 3rpx #906a3c,
63
+                 3rpx -3rpx 3rpx #906a3c,
64
+                 -3rpx 3rpx 3rpx #906a3c,
65
+                 -3rpx -3rpx 3rpx #906a3c;
64 66
 }
65 67
 
66
-
67 68
 .panelTop .btn {
68 69
   width: 16rpx;
69 70
   height: 16rpx;
70
-  background-color: #9EE74F;
71
+  background-color: #9ee74f;
71 72
   margin-right: 10rpx;
72 73
   border-radius: 3rpx;
73 74
   box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.10);
74 75
 }
75 76
 
76 77
 .panelTop .btn {
77
-  background-color: #F0BE7B;
78
+  background-color: #f0be7b;
78 79
 }
79 80
 
80 81
 .panelTop .text2 {
81
-  text-shadow: 3rpx 3rpx 6rpx #C34738, 
82
-  3rpx -3rpx 6rpx #C34738, 
83
-  -3rpx 3rpx 6rpx #C34738, 
84
-  -3rpx -3rpx 6rpx #C34738;
82
+  text-shadow: 3rpx 3rpx 6rpx #c34738,
83
+                 3rpx -3rpx 6rpx #c34738,
84
+                 -3rpx 3rpx 6rpx #c34738,
85
+                 -3rpx -3rpx 6rpx #c34738;
85 86
 }
86 87
 
87
-.universalpic_select_on_white{
88
+.universalpic_select_on_white {
88 89
   width: 30rpx;
89 90
   height: 30rpx;
90 91
   margin-right: 20rpx;
91 92
 }
92 93
 
93
-.universalpic_select_on_gray{
94
+.universalpic_select_on_gray {
94 95
   width: 30rpx;
95 96
   height: 30rpx;
96 97
   margin-right: 12rpx;
@@ -147,6 +148,7 @@
147 148
   height: 130rpx;
148 149
   background-color: #797c7d;
149 150
   justify-content: space-between;
151
+  position: relative;
150 152
 }
151 153
 
152 154
 .panel0 .itemLine0 {
@@ -177,6 +179,20 @@
177 179
   background-color: #5e6164;
178 180
 }
179 181
 
182
+.panel0 .itemLineSelected {
183
+  width: 100%;
184
+  height: 120rpx;
185
+  background-color: rgba(0, 0, 0, 0.60);
186
+  position: absolute;
187
+  top:0;
188
+}
189
+
190
+.universalpic_select_on_orange{
191
+  width: 30rpx;
192
+  height: 30rpx;
193
+  margin: 50rpx 0 0 42rpx;
194
+}
195
+
180 196
 .questioncard_icon {
181 197
   width: 54rpx;
182 198
   height: 60rpx;
@@ -266,7 +282,7 @@
266 282
   height: 30rpx;
267 283
   position: absolute;
268 284
   top: -15rpx;
269
-  left:40rpx;
285
+  left: 40rpx;
270 286
 }
271 287
 
272 288
 .textFooter {

+ 151 - 14
pages/main/default.js

@@ -1,32 +1,169 @@
1 1
 import common from '../../utils/util';
2 2
 import server from '../../utils/main';
3 3
 
4
-const app = getApp()
4
+const app = getApp();
5
+var code;
6
+
5 7
 Page({
6 8
   data: {
7 9
     version: app.globalData.version,
8 10
     FileUrl: app.globalData.fileUrl,
11
+    NickName: "陌生用户",
12
+    IsMember: 0,
13
+    AvatarUrl: "",
14
+    IsAccredit: false,
9 15
   },
10
-  onLoad: function () {
16
+  onLoad: function() {
11 17
     this.setData({
12 18
       Containnerheight: server.getWindowHeight(),
13 19
       ProgramList: server.getProgramList(),
20
+      NickName: app.globalData.userInfo.NickName,
21
+      AvatarUrl: app.globalData.userInfo.AvatarUrl,
22
+    });
23
+
24
+    var that = this;
25
+    wx.getSetting({
26
+      success(res) {
27
+        if (res.authSetting['scope.userInfo']) {
28
+          that.setData({
29
+            IsAccredit: true,
30
+          });
31
+        } else {
32
+          //付费用户请去授权
33
+          if (app.globalData.userInfo.IsMember == 1) {
34
+            wx.navigateTo({
35
+              url: '../about/payfinished?type=accredit',
36
+            });
37
+          }
38
+        }
39
+      }
40
+    });
41
+
42
+    wx.login({
43
+      success: function (res0) {
44
+        code = res0.code;
45
+      }
46
+    });
47
+
48
+
49
+    this.updateProgram();
50
+  },
51
+  gotoList:function(e){
52
+    var id=e.currentTarget.dataset.id;
53
+    var categoryArray = [{}, { Num: 1, Name: "一年级", Array: [1, 2] }, { Num: 2, Name: "二年级", Array: [3, 4] }, { Num: 3, Name: "三年级", Array: [5, 6] }, { Num: 4,Name: "四年级及以上", Array: [7] }];
54
+
55
+    wx.navigateTo({
56
+      url: '../main/list?id=' + categoryArray[id].Array.join(",") + "&name=" + categoryArray[id].Name + "&num=" + categoryArray[id].Num,
57
+    });
58
+  },
59
+  gotoAnswer:function(){
60
+    wx.navigateTo({
61
+      url: '../main/answer',
62
+    });
63
+  },
64
+  getBindGetUserInfo(e) {
65
+    console.log(e.detail);
66
+    var that = this;
67
+    var res = e.detail;
68
+    if (res.errMsg && res.errMsg == "getUserInfo:fail auth deny") {
69
+      app.globalData.userInfo.NickName = "陌生用户";
70
+      app.globalData.userInfo.AvatarUrl = "../../images/universalpic_face_default_black_size01.png";
71
+      app.globalData.userInfo.language = "";
72
+      app.globalData.userInfo.gender = "0";
73
+      app.globalData.userInfo.city = "";
74
+      app.globalData.userInfo.province = "";
75
+      app.globalData.userInfo.country = "";
76
+      // that.hasGetShareInfo(app.globalData.userInfo);
77
+      that.setData({
78
+        IsAccredit: false,
79
+      });
80
+    } else {
81
+      var userID = app.globalData.userInfo.UserID;
82
+      app.globalData.userInfo = res.userInfo;
83
+      app.globalData.userInfo.UserID = userID;
84
+      app.globalData.userInfo.NickName = app.globalData.userInfo.nickName;
85
+      app.globalData.userInfo.AvatarUrl = app.globalData.userInfo.avatarUrl;
86
+
87
+      // that.hasGetShareInfo(app.globalData.userInfo);
88
+      that.setData({
89
+        IsAccredit: true,
90
+        NickName: app.globalData.userInfo.NickName,
91
+        AvatarUrl: app.globalData.userInfo.AvatarUrl
92
+      });
93
+
94
+      app.globalData.userInfo.iv = res.iv;
95
+      app.globalData.userInfo.encryptedData = res.encryptedData;
96
+
97
+      app.globalData.userInfo.Code = code;
98
+      that.login(app.globalData.userInfo);
99
+      
100
+    }
101
+  },
102
+  login: function(param) {
103
+    var that = this;
104
+    server.getLocalHost(function() {
105
+      server.postData('MathLogin', {
106
+        Code: param.Code,
107
+        NickName: param.nickName,
108
+        Language: param.language,
109
+        Gender: param.gender,
110
+        City: param.city,
111
+        Province: param.province,
112
+        Country: param.country,
113
+        AvatarUrl: param.avatarUrl,
114
+        ProgramVersion: app.globalData.Version,
115
+        Introducer: app.globalData.introducer,
116
+        UserSource: app.globalData.userSource,
117
+        SourceID: app.globalData.SourceID,
118
+        LastUserSource: app.globalData.userSource,
119
+        iv: param.iv,
120
+        encryptedData: param.encryptedData,
121
+      }, function(data) {
122
+
123
+      });
124
+    });
125
+  },
126
+
127
+  switchProgram: function(e) {
128
+    wx.navigateToMiniProgram({
129
+      appId: e.currentTarget.dataset.appid,
130
+      path: e.currentTarget.dataset.path,
131
+      extraData: {},
132
+      success(res) {
133
+        // 打开成功
134
+      }
14 135
     });
136
+  },
137
+  gotoFeedback: function() {
138
+    server.gotoFeedback();
139
+  },
140
+  updateProgram: function() {
141
+    const updateManager = wx.getUpdateManager();
15 142
 
143
+    updateManager.onCheckForUpdate(function(res) {
144
+      // 请求完新版本信息的回调
145
+      console.log(res.hasUpdate)
146
+    });
147
+
148
+    updateManager.onUpdateReady(function() {
149
+      wx.showModal({
150
+        title: '更新提示',
151
+        content: '新版本已经准备好,是否重启应用?',
152
+        success: function(res) {
153
+          if (res.confirm) {
154
+            // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
155
+            updateManager.applyUpdate()
156
+          }
157
+        }
158
+      });
16 159
 
160
+    });
17 161
   },
18
-  onShareAppMessage: function () {
162
+  onShareAppMessage: function() {
19 163
     return {
20
-      title: '',
21
-      path: 'pages/index/index',
22
-      success: function (res) {
23
-      },
24
-      fail: function (err) {
25
-        console.log(err);
26
-      },
27
-      complete: function (res) {
28
-        console.log(res);
29
-      },
164
+      title: app.globalData.ShareTitle,
165
+      path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
166
+      imageUrl: app.globalData.ShareImageUrl,
30 167
     }
31 168
   },
32
-})
169
+})

+ 1 - 1
pages/main/default.json

@@ -2,7 +2,7 @@
2 2
   "navigationBarBackgroundColor": "#B9DC5D",
3 3
   "navigationBarTextStyle": "black",
4 4
   "navigationBarTitleText": "数学计算题",
5
-  "backgroundColor": "#B9DC5D",
5
+  "backgroundColor": "#583027",
6 6
   "backgroundTextStyle": "light",
7 7
   "enablePullDownRefresh": false
8 8
 }

+ 15 - 11
pages/main/default.wxml

@@ -16,10 +16,7 @@
16 16
         </view>
17 17
         <view class="panel001 FlexRow">
18 18
           <view class="panel0010 FlexRow">
19
-            <image class="homepage_question_illus_grade01" src="../../images/homepage_question_illus_grade01.png" />
20
-            <image class="homepage_question_illus_grade01" src="../../images/homepage_question_illus_grade02.png" />
21
-            <image class="homepage_question_illus_grade01" src="../../images/homepage_question_illus_grade03.png" />
22
-            <image class="homepage_question_illus_grade01" src="../../images/homepage_question_illus_grade04.png" />
19
+            <image wx:for="{{[1,2,3,4]}}" wx:key="index" bindtap='gotoList' data-id="{{item}}" class="homepage_question_illus_grade01" src="../../images/homepage_question_illus_grade0{{item}}.png" />
23 20
           </view>
24 21
         </view>
25 22
         <image class="universalpic_line_zigzag_brown_down" src="../../images/universalpic_line_zigzag_brown_down.png" />
@@ -40,12 +37,17 @@
40 37
               </view>
41 38
               <view class="line2 line"></view>
42 39
               <view class="panel002000 FlexRow">
43
-                <view class="btn">
40
+                <button wx:if="{{!IsAccredit}}" open-type="getUserInfo" class="btn" bindgetuserinfo="getBindGetUserInfo">
44 41
                   <view class="btn1">
45 42
                     登录
46 43
                   </view>
44
+                </button>
45
+                <view class="btn" wx:if="{{IsAccredit}}" >
46
+                  <view class="btn1">
47
+                    设置
48
+                  </view>
47 49
                 </view>
48
-                <view class="btn2 btn">
50
+                <view class="btn2 btn" bindtap='gotoAnswer'>
49 51
                   <view class="btn3 btn1">
50 52
                     答案
51 53
                   </view>
@@ -53,7 +55,8 @@
53 55
               </view>
54 56
             </view>
55 57
             <view class="panel00201 FlexRow">
56
-              <image class="universalpic_face_default_black_size01" src="../../images/universalpic_face_default_black_size01.png" />
58
+              <image wx:if="{{!IsAccredit}}" class="universalpic_face_default_black_size01" src="../../images/universalpic_face_default_black_size01.png" />
59
+              <image wx:if="{{IsAccredit}}" class="universalpic_face_default_black_size01" src="{{AvatarUrl}}" />
57 60
             </view>
58 61
           </view>
59 62
           <image class="homepage_clipboard_illus_clip" src="../../images/homepage_clipboard_illus_clip.png" />
@@ -69,17 +72,18 @@
69 72
               <view class="panel003000 FlexRow">
70 73
                 <view>帮助</view>
71 74
                 <view class="line"></view>
72
-                <view>反馈</view>
75
+                <view bindtap='gotoFeedback'>反馈</view>
73 76
                 <view class="line"></view>
74 77
                 <view>合作</view>
75 78
               </view>
76 79
             </view>
77
-            <view class="btn4 btn">
80
+            <button class="btn4 btn" open-type="share">
78 81
               <view class="btn5 btn1 FlexColumn">
79 82
                 <image class="universalpic_share_size01" src="../../images/universalpic_share_size01.png" />
80 83
                 <view>转发分享</view>
81 84
               </view>
82
-            </view>
85
+            </button>
86
+
83 87
           </view>
84 88
 
85 89
           <view class="panel0031 FlexColumn">
@@ -88,7 +92,7 @@
88 92
             </view>
89 93
             <view class="line"></view>
90 94
             <block wx:for="{{ProgramList}}" wx:key="index">
91
-              <view class="panel00311 FlexRow">
95
+              <view class="panel00311 FlexRow" bindtap='switchProgram' data-appid='{{item.appId}}' data-path='{{item.path}}'>
92 96
                 <view class="panel003110 FlexRow">
93 97
                   <image class="universalpic_product_kousuan_icon_size01" src="../../images/{{item.imageName}}.png" />
94 98
                   <view class="text">{{item.Name}}</view>

+ 9 - 0
pages/main/default.wxss

@@ -184,6 +184,13 @@
184 184
   background-color: #035834;
185 185
   border-radius: 8rpx;
186 186
   position: relative;
187
+  padding-left: 0;
188
+  padding-right: 0;
189
+}
190
+
191
+
192
+.btn::after {
193
+  border: 0px;
187 194
 }
188 195
 
189 196
 .btn1 {
@@ -268,6 +275,8 @@
268 275
   width: 140rpx;
269 276
   height: 154rpx;
270 277
   border-radius: 20rpx;
278
+
279
+  
271 280
 }
272 281
 
273 282
 .btn5 {

+ 221 - 8
pages/main/detail.js

@@ -1,29 +1,242 @@
1 1
 import common from '../../utils/util';
2 2
 import server from '../../utils/main';
3 3
 
4
-const app = getApp()
4
+const app = getApp();
5
+var times=1;
6
+
5 7
 Page({
6 8
   data: {
7 9
     version: app.globalData.version,
8 10
     FileUrl: app.globalData.fileUrl,
11
+    IsShowMenu:false,
12
+    filter:'horizontal',
13
+    PageNumber:1,
14
+    IsFinished: false,
9 15
   },
10
-  onLoad: function () {
16
+  onLoad: function(options) {
17
+    var id = options.id;
11 18
     this.setData({
12 19
       Containnerheight: server.getWindowHeight(),
20
+      ID:id,
21
+    });
22
+    var systemInfo = wx.getSystemInfoSync();
23
+    if (systemInfo.system && systemInfo.system.indexOf("Android") >= 0) {
24
+      times=2;
25
+    }
26
+    this.getDetail(id);
27
+    
28
+  },
29
+  getDetail: function(id) {
30
+    var item;
31
+    var data = wx.getStorageSync('QuestionTypeList');
32
+    for (var i = 0; i < data.length; i++) {
33
+      for (var k = 0; k < data[i].List.length; k++) {
34
+        if (id == data[i].List[k].ID) {
35
+          item = data[i].List[k];
36
+          item.Example[0] = item.Example[0].replace("+", " + ").replace("-", " - ").replace("×", " × ").replace("÷", " ÷ ");
37
+          item.Example[1] = item.Example[1].replace("+", " + ").replace("-", " - ").replace("×", " × ").replace("÷", " ÷ ");
38
+          break;
39
+        }
40
+      }
41
+    }
42
+    this.setData({
43
+      QuestionTypeItem: item,
44
+    });
45
+  },
46
+  gotoAnswer: function (e) {
47
+    wx.navigateTo({
48
+      url: '../main/answer',
49
+    });
50
+  },
51
+  getFinish:function(){
52
+    this.setData({
53
+      IsFinished: true,
54
+    });
55
+    this.getList(this.data.ID);
56
+  },
57
+
58
+  getList: function (id) {
59
+    var that = this;
60
+
61
+    server.getLocalHost(function () {
62
+      server.getData('GetQuestionTypesPrint?ID=' + id, function (data) {
63
+        //console.log("UserInfo:" + data);
64
+        if (data) {
65
+          that.saveImage(data);
66
+        }
67
+      });
68
+
69
+    });
70
+  },
71
+  saveImage: function (item) {
72
+    var that = this;
73
+    var ctx = wx.createCanvasContext("Canvas", that);
74
+    ctx.setFillStyle('white');
75
+    ctx.fillRect(0, 0, 1050, 1485);
76
+    ctx.setTextAlign('left');
77
+    ctx.setTextBaseline('top');
78
+    ctx.fillStyle = "#000000";
79
+    ctx.setFontSize(32);
80
+    ctx.fillText(item.Name, 60, 45);
81
+
82
+
83
+    ctx.setFontSize(12);
84
+    ctx.fillText(item.CagegoryName, 60, 90);
85
+    ctx.fillText("共" + item.QuestionList.length + "道题", 60, 125);
86
+    ctx.fillText("第 1 / 1 页", 60, 147);
87
+    ctx.fillText("答案检索号", 768, 60);
88
+
89
+    ctx.setTextAlign('right');
90
+    ctx.fillText("出题时间 " + item.CreateTime, 875, 94);
91
+    ctx.fillText("微信扫一扫 计时看答案", 875, 111);
92
+    ctx.fillText("《数学计算题》选题 打印 扫码 批改", 875, 137);
93
+    ctx.setFontSize(32);
94
+    ctx.fillText("99", 875, 50);
95
+    ctx.drawImage("../../images/answer.png", 890, 54, 100, 100);
96
+
97
+    ctx.setTextBaseline('middle');
98
+    var xStart = 60;
99
+    var yStart = 247;
100
+    var index = 0;
101
+    for (var i = 0; i < 3; i++) {
102
+      for (var j = 0; j < 20; j++) {
103
+        index++;
104
+        ctx.setTextAlign('left');
105
+        ctx.setFontSize(12);
106
+        ctx.fillText("(", xStart + i * 310, yStart + j * 59);
107
+        ctx.setTextAlign('center');
108
+        ctx.fillText(index, xStart + i * 310 + 13, yStart + j * 59);
109
+        ctx.setTextAlign('left');
110
+        ctx.fillText(")", xStart + i * 310 + 22, yStart + j * 59);
111
+
112
+        ctx.setFontSize(24);
113
+
114
+        var A = item.QuestionList[index - 1].A.toString();
115
+        if (item.QuestionList[index - 1].HiddenColumn == "A")
116
+          A = "____";
117
+        var OperateAB = item.QuestionList[index - 1].OperateAB.toString();
118
+        console.log(OperateAB);
119
+        var B = item.QuestionList[index - 1].B.toString();
120
+        if (item.QuestionList[index - 1].HiddenColumn == "B")
121
+          B = "____";
122
+        var equation = A + " " + OperateAB + " " + B;
123
+        if (item.QuestionList[index - 1].C) {
124
+          var OperateBC = item.QuestionList[index - 1].OperateBC.toString();
125
+          var C = item.QuestionList[index - 1].C.toString();
126
+          equation += " " + OperateBC + " " + C;
127
+          if (item.QuestionList[index - 1].D) {
128
+            var OperateCD = item.QuestionList[index - 1].OperateCD.toString();
129
+            var D = item.QuestionList[index - 1].D.toString();
130
+            equation += " " + OperateCD + " " + D;
131
+          }
132
+        }
133
+        equation += " = ";
134
+        var R = item.QuestionList[index - 1].R.toString();
135
+        if (item.QuestionList[index - 1].HiddenColumn == "R")
136
+          R = "";
137
+        equation += R;
138
+
139
+        var num = xStart + i * 310 + 31;
140
+        ctx.setTextAlign('center');
141
+        for (var n = 0; n < equation.length; n++) {
142
+          var len = getLength(equation[n]);
143
+          num += len;
144
+          if (equation[n] == ".") {
145
+            ctx.fillText(equation[n], num + 3, yStart + j * 59);
146
+          } else {
147
+            var h = 0;
148
+            if (equation[n] == "_")
149
+              h = 8;
150
+            ctx.fillText(equation[n], num, yStart + j * 59 + h);
151
+          }
152
+        }
153
+      }
154
+    }
155
+
156
+
157
+    ctx.draw(true, function (n) {
158
+      var w=1050,h=1485;
159
+      
160
+
161
+      wx.canvasToTempFilePath({
162
+        x: 0,
163
+        y: 0,
164
+        width: w*times,
165
+        height: h*times,
166
+        //destWidth: w*times,
167
+        //destHeight: h*times,
168
+        canvasId: 'Canvas',
169
+        success: function (res2) {
170
+          console.log(res2.tempFilePath);
171
+          wx.previewImage({
172
+            current: res2.tempFilePath, // 当前显示图片的http链接
173
+            urls: [res2.tempFilePath] // 需要预览的图片http链接列表
174
+          });
175
+        }
176
+      })
13 177
     });
178
+
179
+    function getLength(str) {
180
+      switch (str) {
181
+        case "0":
182
+        case "1":
183
+        case "2":
184
+        case "3":
185
+        case "4":
186
+        case "5":
187
+        case "6":
188
+        case "7":
189
+        case "8":
190
+        case "9":
191
+          return 15;
192
+        case ".":
193
+          return 8;
194
+        default:
195
+          return 12;
196
+      }
197
+    }
198
+
14 199
   },
15
-  onShareAppMessage: function () {
200
+  changePageNumber: function (e) {
201
+    var id = Number(e.currentTarget.dataset.id);
202
+    this.data.PageNumber+=id;
203
+    if (this.data.PageNumber<1)
204
+      this.data.PageNumber=1;
205
+    else if (this.data.PageNumber > 5)
206
+      this.data.PageNumber = 5;
207
+
208
+    this.setData({
209
+      PageNumber: this.data.PageNumber,
210
+    });
211
+  },
212
+  menuClick: function (e) {
213
+    this.data.filter = e.currentTarget.dataset.id;
214
+    this.setData({
215
+      filter: this.data.filter,
216
+      IsShowMenu: false,
217
+    });
218
+  },
219
+  closeMenu: function () {
220
+    this.setData({
221
+      IsShowMenu: false,
222
+    });
223
+  },
224
+  openMenu: function () {
225
+    this.setData({
226
+      IsShowMenu: true,
227
+    });
228
+  },
229
+  onShareAppMessage: function() {
16 230
     return {
17 231
       title: '',
18 232
       path: 'pages/index/index',
19
-      success: function (res) {
20
-      },
21
-      fail: function (err) {
233
+      success: function(res) {},
234
+      fail: function(err) {
22 235
         console.log(err);
23 236
       },
24
-      complete: function (res) {
237
+      complete: function(res) {
25 238
         console.log(res);
26 239
       },
27 240
     }
28 241
   },
29
-})
242
+})

+ 91 - 48
pages/main/detail.wxml

@@ -3,10 +3,10 @@
3 3
   <image class="questioncard_icon desaturate" src="{{FileUrl}}questioncard_icon_grade0606_size01.png" />
4 4
   <view class="Example">
5 5
     <view class="Example1">
6
-      34 * 50 + 27
6
+      {{QuestionTypeItem.Example[0]}}
7 7
     </view>
8 8
     <view class="Example1">
9
-      42 * 21 - 12
9
+      {{QuestionTypeItem.Example[1]}}
10 10
     </view>
11 11
   </view>
12 12
 
@@ -15,7 +15,7 @@
15 15
   <view class="line1 FlexColumn">
16 16
     <image class="makepaper_headline_illus_board FlexColumn" src="../../images/makepaper_headline_illus_board.png" />
17 17
     <view class="text">
18
-      四则运算a*b+c
18
+      {{QuestionTypeItem.Name}}
19 19
     </view>
20 20
   </view>
21 21
   <view class="line2"></view>
@@ -25,17 +25,29 @@
25 25
   <view class="line4"></view>
26 26
   <view class="panel1 FlexColumn">
27 27
     <view class="text1">算式类型</view>
28
-    <view class="text2">横式</view>
29
-    <view class="text3 FlexRow">
30
-      <image class="universalpic_attention_black_size01" src="../../images/universalpic_attention_black_size01.png" />
31
-      <view class="text31">本知识点不适用竖式运算</view>
32
-    </view>
33 28
 
34
-    <image class="universalpic_indicator_cell_size01" src="../../images/universalpic_indicator_cell_size01.png" />
35
-    <view class="panel10 FlexRow">
36
-      <view class="btnSelect">横式+竖式</view>
37
-      <view class="btnAddSub"></view>
38
-    </view>
29
+    <block wx:if="{{QuestionTypeItem.QuestionNumber3==0}}">
30
+      <view class="text2">横式</view>
31
+      <view class="text3 FlexRow">
32
+        <image class="universalpic_attention_black_size01" src="../../images/universalpic_attention_black_size01.png" />
33
+        <view class="text31">本知识点不适用竖式运算</view>
34
+      </view>
35
+    </block>
36
+
37
+    <block wx:if="{{QuestionTypeItem.QuestionNumber3>0}}">
38
+      <view class="text2_1"></view>
39
+      <image class="universalpic_indicator_cell_size01" src="../../images/universalpic_indicator_cell_size01.png" />
40
+      <view class="panel10 FlexRow" bindtap='openMenu'>
41
+        <view class="btnSelect">
42
+
43
+          <block wx:if="{{filter=='horizontal'}}">横式</block>
44
+          <block wx:if="{{filter=='vertical'}}">竖式</block>
45
+          <block wx:if="{{filter=='all'}}">横式+竖式</block>
46
+
47
+        </view>
48
+        <view class="btnAddSub"></view>
49
+      </view>
50
+    </block>
39 51
 
40 52
     <image class="universalpic_line_dashed_size01" src="../../images/universalpic_line_dashed_size01.png" />
41 53
 
@@ -43,56 +55,87 @@
43 55
 
44 56
     <image class="universalpic_value_cell_size01" src="../../images/universalpic_value_cell_size01.png" />
45 57
     <view class="panel10 FlexRow">
46
-      <view class="btnAddSub"></view>
47
-      <view class="Number">8</view>
48
-      <view class="btnAddSub"></view>
58
+      <view class="btnAddSub" bindtap='changePageNumber' data-id="-1"></view>
59
+      <view class="Number">{{PageNumber}}</view>
60
+      <view class="btnAddSub" bindtap='changePageNumber' data-id="1"></view>
49 61
     </view>
50 62
 
51 63
     <view class="text5">每份含 9道题目</view>
52 64
 
53 65
     <image class="universalpic_line_dashed_size01" src="../../images/universalpic_line_dashed_size01.png" />
54 66
 
55
-    <view class="btn">
67
+    <view class="btn" bindtap='getFinish'>
56 68
       <view class="btn1">
57 69
         出题
58 70
       </view>
59 71
     </view>
60 72
   </view>
61 73
   <image class="universalpic_line_zigzag_black_down" src="../../images/universalpic_line_zigzag_black_down.png" />
62
-  <image class="universalpic_line_zigzag_black_up" src="../../images/universalpic_line_zigzag_black_up.png" />
63
-
64
-  <view class="panel2 FlexColumn">
65
-    <view class="panel20 FlexRow">
66
-      <image class="universalpic_right_white_size01" src="../../images/universalpic_right_white_size01.png" />
67
-    </view>
68
-    <view class="text6">完成了</view>
69
-    <view class="text7">题目以图片格式保存到手机相册,共 6张</view>
70
-    <view class="panel21 FlexRow">
71
-      <view class="panel210"></view>
72
-      <view class="panel210"></view>
73
-      <view class="panel210"></view>
74
-      <view class="panel210"></view>
75
-      <view class="panel210"></view>
76
-      <view class="panel210"></view>
77
-    </view>
74
+  <block wx:if="{{IsFinished}}">
75
+    <image class="universalpic_line_zigzag_black_up" src="../../images/universalpic_line_zigzag_black_up.png" />
76
+    <view class="panel2 FlexColumn">
77
+      <view class="panel20 FlexRow">
78
+        <image class="universalpic_right_white_size01" src="../../images/universalpic_right_white_size01.png" />
79
+      </view>
80
+      <view class="text6">完成了</view>
81
+      <view class="text7">题目以图片格式保存到手机相册,共 6张</view>
82
+      <view class="panel21 FlexRow">
83
+        <view class="panel210"></view>
84
+        <view class="panel210"></view>
85
+        <view class="panel210"></view>
86
+        <view class="panel210"></view>
87
+        <view class="panel210"></view>
88
+        <view class="panel210"></view>
89
+      </view>
78 90
 
79
-    <image class="universalpic_line_dashed_size01" src="../../images/universalpic_line_dashed_size01.png" />
80
-    <view class="text8">然后...</view>
81
-    <view class="panel22 FlexRow">
82
-      <view class="panel220 FlexColumn">
83
-        <view class="panel2200 FlexColumn">
84
-          <image class="universalpic_print_gray_size01" src="../../images/universalpic_print_gray_size01.png" />
91
+      <image class="universalpic_line_dashed_size01" src="../../images/universalpic_line_dashed_size01.png" />
92
+      <view class="text8">然后...</view>
93
+      <view class="panel22 FlexRow">
94
+        <view class="panel220 FlexColumn">
95
+          <view class="panel2200 FlexColumn">
96
+            <image class="universalpic_print_gray_size01" src="../../images/universalpic_print_gray_size01.png" />
97
+          </view>
98
+          <text class="text9">请到手机相册打印图片或转存到PC</text>
85 99
         </view>
86
-        <text class="text9">请到手机相册打印图片或转存到PC</text>
87
-      </view>
88
-      <view class="panel220 FlexColumn">
89
-        <view class="panel2200 FlexColumn">
90
-          <image class="universalpic_write_gray_size01" src="../../images/universalpic_write_gray_size01.png" />
100
+        <view class="panel220 FlexColumn">
101
+          <view class="panel2200 FlexColumn">
102
+            <image class="universalpic_write_gray_size01" src="../../images/universalpic_write_gray_size01.png" />
103
+          </view>
104
+          <text class="text9">题目做完后,在首页的批改栏目中看查看答案</text>
105
+          <text class="text10" bindtap='gotoAnswer'>看答案</text>
91 106
         </view>
92
-        <text class="text9">题目做完后,在首页的批改栏目中看查看答案</text>
93
-        <text class="text10">看答案</text>
94 107
       </view>
95 108
     </view>
96
-  </view>
109
+  </block>
97 110
   <view class="line5"></view>
98
-</view>
111
+
112
+  <view class="menu FlexColumn" wx:if="{{IsShowMenu}}">
113
+    <view class="text1">算式类型</view>
114
+    <view class="panel FlexRow" bindtap='menuClick' data-id="horizontal">
115
+      <view>横式</view>
116
+      <image wx:if="{{filter=='horizontal'}}" class="universalpic_select_on_black" src="../../images/universalpic_select_on_black.png" />
117
+
118
+    </view>
119
+    <view class="line"></view>
120
+    <view class="panel FlexRow" bindtap='menuClick' data-id="vertical">
121
+      <view>竖式</view>
122
+      <image wx:if="{{filter=='vertical'}}" class="universalpic_select_on_black" src="../../images/universalpic_select_on_black.png" />
123
+
124
+    </view>
125
+    <view class="line"></view>
126
+    <view class="panel FlexRow" bindtap='menuClick' data-id="all">
127
+      <view>横式+竖式</view>
128
+      <image wx:if="{{filter=='all'}}" class="universalpic_select_on_black" src="../../images/universalpic_select_on_black.png" />
129
+
130
+    </view>
131
+    <view class="line"></view>
132
+    <view class="line2"></view>
133
+    <view class="line"></view>
134
+    <view class="panel FlexRow" bindtap='closeMenu'>
135
+      <view>取消</view>
136
+    </view>
137
+
138
+  </view>
139
+
140
+</view>
141
+<canvas class='Canvas' canvas-id="Canvas"></canvas>

+ 57 - 0
pages/main/detail.wxss

@@ -1,6 +1,7 @@
1 1
 .container {
2 2
   background-color: #4F4745;
3 3
   justify-content: flex-start;
4
+  width: 100%; 
4 5
 }
5 6
 
6 7
 .makepaper_headline_illus_lab{
@@ -98,6 +99,10 @@
98 99
   margin-top: 30rpx;
99 100
   color:#d2d2d2;
100 101
 }
102
+.panel1 .text2_1{
103
+  margin-top: 30rpx;
104
+  height:100rpx;
105
+}
101 106
 .panel1 .text3{
102 107
   font-size:24rpx;
103 108
   margin-top: 10rpx;
@@ -305,3 +310,55 @@
305 310
 }
306 311
 
307 312
 
313
+.menu {
314
+  position: fixed;
315
+  bottom: 0;
316
+  width: 100%;
317
+  background-color: #d2d2d2;
318
+  z-index: 30;
319
+}
320
+
321
+.menu .text1 {
322
+  font-size: 24rpx;
323
+  margin: 30rpx;
324
+}
325
+
326
+.menu .panel {
327
+  font-size: 36rpx;
328
+  height: 111rpx;
329
+  width: 100%;
330
+  background-color: #fff;
331
+  position: relative;
332
+}
333
+
334
+.menu .line {
335
+  height: 2rpx;
336
+  width: 100%;
337
+  background-color: #e3e3e3;
338
+}
339
+
340
+.menu .line2 {
341
+  height: 20rpx;
342
+  width: 100%;
343
+  background-color: #d2d2d2;
344
+}
345
+
346
+.universalpic_select_on_black {
347
+  height: 30rpx;
348
+  width: 30rpx;
349
+  position: absolute;
350
+  left:40rpx;
351
+  top:40rpx;
352
+}
353
+
354
+
355
+.Canvas{
356
+  width: 1050px; 
357
+  height: 1485px;
358
+  position: fixed;
359
+  left:760rpx;
360
+  top:0rpx;
361
+}
362
+
363
+
364
+

+ 65 - 0
pages/main/item.js

@@ -0,0 +1,65 @@
1
+import common from '../../utils/util';
2
+import server from '../../utils/main';
3
+
4
+const app = getApp()
5
+Page({
6
+  data: {
7
+    version: app.globalData.version,
8
+    FileUrl: app.globalData.fileUrl,
9
+  },
10
+  onLoad: function() {
11
+    this.setData({
12
+      Containnerheight: server.getWindowHeight(),
13
+      TestDivEquation1: [{ Type: 'number', Array: ['', '', '', '1', '2', '3'] },
14
+      {
15
+        Type: 'number',
16
+        Array: ['×', '', '', '', '4', '5', '0', '0']
17
+      },
18
+      {
19
+        Type: 'line',
20
+        Array: ['1', '1', '1', '1', '1', '1', '1', '1']
21
+      },
22
+      { Type: 'number', Array: ['', '', '', '6', '1', '5'] },
23
+      { Type: 'number', Array: ['', '', '4', '9', '2'] },
24
+      {
25
+        Type: 'line',
26
+        Array: ['1', '1', '1', '1', '1', '1', '1', '1']
27
+      },
28
+      {
29
+        Type: 'number',
30
+        Array: ['', '', '5', '5', '3', '5', '0', '0']
31
+      }],
32
+      TestDivEquation2: [{
33
+        Type: 'number',
34
+        Array: ['', '', '', '', '0', '.', '6', '2', '5']
35
+      },
36
+      {
37
+        Type: 'line',
38
+        Array: ['', '', '0.5', '1', '1', '1', '1', '1', '1']
39
+      },
40
+      { Type: 'number', Array: ['5', '6', '√', '3', '5', '0'] },
41
+      { Type: 'number', Array: ['', '', '', '3', '3', '6'] },
42
+      { Type: 'line', Array: ['', '', '', '1', '1', '1'] },
43
+      { Type: 'number', Array: ['', '', '', '', '1', '4', '0'] },
44
+      { Type: 'number', Array: ['', '', '', '', '1', '1', '2'] },
45
+      { Type: 'line', Array: ['', '', '', '', '1', '1', '1'] },
46
+      { Type: 'number', Array: ['', '', '', '', '', '2', '8', '0'] },
47
+      { Type: 'number', Array: ['', '', '', '', '', '2', '8', '0'] },
48
+      { Type: 'line', Array: ['', '', '', '', '', '1', '1', '1'] },
49
+      { Type: 'number', Array: ['', '', '', '', '', '', '', '0'] }]
50
+    });
51
+  },
52
+  onShareAppMessage: function() {
53
+    return {
54
+      title: '',
55
+      path: 'pages/index/index',
56
+      success: function(res) {},
57
+      fail: function(err) {
58
+        console.log(err);
59
+      },
60
+      complete: function(res) {
61
+        console.log(res);
62
+      },
63
+    }
64
+  },
65
+})

+ 8 - 0
pages/main/item.json

@@ -0,0 +1,8 @@
1
+{
2
+  "navigationBarBackgroundColor": "#fff",
3
+  "navigationBarTextStyle": "black",
4
+  "navigationBarTitleText": "四则运算",
5
+  "backgroundColor": "#fff",
6
+  "backgroundTextStyle": "light",
7
+  "enablePullDownRefresh": false
8
+}

+ 116 - 0
pages/main/item.wxml

@@ -0,0 +1,116 @@
1
+<view class="container FlexColumn" style="min-height:{{Containnerheight}}rpx;">
2
+  <view class="panel0 FlexRow">
3
+    <view class="panelLeft">快翻</view>
4
+    <view class="panelRight FlexRow">
5
+      <view class="btn1 btn">1</view>
6
+      <view class="btn">4</view>
7
+      <view class="btn">7</view>
8
+    </view>
9
+  </view>
10
+  <view class="panel1 panel0 FlexRow">
11
+    <view class="panelLeft">听答案</view>
12
+    <view class="panelRight FlexRow">
13
+
14
+      <view class="btn4 btn2">
15
+        <view class="btn3 FlexRow">
16
+          <image class="universalpic_rewind_white_size01" src="../../images/universalpic_rewind_white_size01.png" />
17
+        </view>
18
+      </view>
19
+      <view class="btn2">
20
+        <view class="btn3 FlexRow">
21
+          <image class="universalpic_play_white_size01" src="../../images/universalpic_play_white_size01.png" />
22
+        </view>
23
+      </view>
24
+    </view>
25
+  </view>
26
+  <view class="panel2 panel1 panel0 FlexRow">
27
+    <view class="panelLeft">答案</view>
28
+    <view>
29
+    </view>
30
+  </view>
31
+
32
+  <view class="panelRowTop panel0 FlexRow">
33
+    <view class="panelLeft1 panelLeft">第一列</view>
34
+    <view>
35
+    </view>
36
+  </view>
37
+  <view class="panelRowBody panel0 FlexRow">
38
+    <view class="panelLeft FlexRow">
39
+      <view class="number">1</view>
40
+      <view class="answer">7</view>
41
+    </view>
42
+    <view class="panelRight FlexRow">
43
+      <view class="equation">1 + 6 =</view>
44
+      <image class="formula_btn_show" src="../../images/formula_btn_show.png" />
45
+    </view>
46
+  </view>
47
+  <view class="line FlexRow">
48
+    <view class="line1"></view>
49
+  </view>
50
+  <view class="panelRowBody panel0 FlexRow">
51
+    <view class="panelLeft FlexRow">
52
+      <view class="number">2</view>
53
+      <view class="answer">28</view>
54
+    </view>
55
+    <view class="panelRight FlexRow">
56
+      <view class="equation">159 -131 =</view>
57
+      <image class="formula_btn_show" src="../../images/formula_btn_show.png" />
58
+    </view>
59
+  </view>
60
+  <view class="line FlexRow">
61
+    <view class="line1"></view>
62
+  </view>
63
+  <view class="panelRowBody panel0 FlexRow">
64
+    <view class="panelLeft FlexRow">
65
+      <view class="number">3</view>
66
+      <view class="answer">553500</view>
67
+    </view>
68
+    <view class="panelRight FlexRow">
69
+      <view class="equation">123 × 4500 =</view>
70
+      <image class="formula_btn_show" src="../../images/formula_btn_hide.png" />
71
+    </view>
72
+  </view>
73
+
74
+  <view class="panelRowBody panel0 FlexColumn">
75
+    <view class="panelAnswer FlexColumn">
76
+      <view class="panelAnswerRow FlexRow" wx:for='{{TestDivEquation1}}' wx:key="index">
77
+        <view class="panelAnswerCol FlexRow" wx:for='{{item.Array}}' wx:key="i" wx:for-item="col" wx:for-index="i">
78
+          <view class="colNumber" wx:if="{{item.Type=='number' && col!='√' && col!='.'}}">{{col}}</view>
79
+          <view class="colDot" wx:if="{{item.Type=='number' && col=='.'}}">{{col}}</view>
80
+          <image wx:if="{{item.Type=='number' && col=='√'}}" class="formula_division_size01" src="../../images/formula_division_size01.png" />
81
+          <view class="colLine" wx:if="{{item.Type=='line' && col=='1'}}"></view>
82
+          <view class="colLineHalf" wx:if="{{item.Type=='line' && col=='0.5'}}"></view>
83
+          <view class="colLineNull" wx:if="{{item.Type=='line' && col==''}}"></view>
84
+        </view>
85
+      </view>
86
+    </view>
87
+  </view>
88
+  <view class="line FlexRow">
89
+    <view class="line1"></view>
90
+  </view>
91
+  <view class="panelRowBody panel0 FlexRow">
92
+    <view class="panelLeft FlexRow">
93
+      <view class="number">4</view>
94
+      <view class="answer">0.625</view>
95
+    </view>
96
+    <view class="panelRight FlexRow">
97
+      <view class="equation">35 ÷ 56 =</view>
98
+      <image class="formula_btn_show" src="../../images/formula_btn_hide.png" />
99
+    </view>
100
+  </view>
101
+
102
+  <view class="panelRowBody panel0 FlexColumn">
103
+    <view class="panelAnswer FlexColumn">
104
+      <view class="panelAnswerRow FlexRow" wx:for='{{TestDivEquation2}}' wx:key="index">
105
+        <view class="panelAnswerCol FlexRow" wx:for='{{item.Array}}' wx:key="i" wx:for-item="col" wx:for-index="i">
106
+          <view class="colNumber" wx:if="{{item.Type=='number' && col!='√' && col!='.'}}">{{col}}</view>
107
+          <view class="colDot" wx:if="{{item.Type=='number' && col=='.'}}">{{col}}</view>
108
+          <image wx:if="{{item.Type=='number' && col=='√'}}" class="formula_division_size01" src="../../images/formula_division_size01.png" />
109
+          <view class="colLine" wx:if="{{item.Type=='line' && col=='1'}}"></view>
110
+          <view class="colLineHalf" wx:if="{{item.Type=='line' && col=='0.5'}}"></view>
111
+          <view class="colLineNull" wx:if="{{item.Type=='line' && col==''}}"></view>
112
+        </view>
113
+      </view>
114
+    </view>
115
+  </view>
116
+</view>

+ 185 - 0
pages/main/item.wxss

@@ -0,0 +1,185 @@
1
+.container {
2
+  background-color: #F0F0F0;
3
+  justify-content: flex-start;
4
+}
5
+
6
+.panel0 {
7
+  background-color: #fff;
8
+  width:100%;
9
+  min-height:110rpx;
10
+  justify-content: space-between;
11
+}
12
+
13
+.panelLeft{
14
+  margin-left: 30rpx;
15
+  font-size: 28rpx;
16
+}
17
+
18
+.panelRight{
19
+  margin-right: 30rpx;
20
+  font-size: 24rpx;
21
+  font-family: 'Roboto-Bold';
22
+}
23
+.panelRight .btn{
24
+  margin-left: 30rpx;
25
+  width:60rpx;
26
+  height:50rpx;
27
+  text-align: center;
28
+  line-height: 50rpx;
29
+}
30
+.panelRight .btn1{
31
+  border-radius: 4rpx;
32
+  color:#fff;
33
+  background-color: #2E2E2E;
34
+}
35
+
36
+.panel1 {
37
+  background-color: #F8F8F8;
38
+  height:120rpx;
39
+}
40
+
41
+
42
+.panelRight .btn2 {
43
+  width: 200rpx;
44
+  height: 70rpx;
45
+  background-color: #146392;
46
+  border-radius: 8rpx;
47
+  position: relative;
48
+  margin-left: 30rpx;
49
+}
50
+
51
+.panelRight .btn3 {
52
+  width: 100%;
53
+  height: 60rpx;
54
+  background-color: #169DED;
55
+  border-radius: 8rpx;
56
+}
57
+
58
+.panelRight .btn4 {
59
+  width: 130rpx;
60
+}
61
+
62
+.universalpic_play_white_size01{
63
+  width: 25rpx;
64
+  height: 30rpx;
65
+}
66
+
67
+.universalpic_rewind_white_size01{
68
+  width: 50rpx;
69
+  height: 30rpx;
70
+}
71
+
72
+.panel2 {
73
+  background-color: #F0F0F0;
74
+}
75
+
76
+.panelRowTop{
77
+  background-color: #D2D2D2;
78
+  height:50rpx;
79
+}
80
+
81
+.panelRowTop .panelLeft1{
82
+  font-size: 22rpx;
83
+}
84
+
85
+.panelRowBody{
86
+  background-color: #F0F0F0;
87
+}
88
+
89
+.panelRowBody .number{
90
+  text-align: center;
91
+  width:46rpx;
92
+  height:36rpx;
93
+  line-height: 36rpx;
94
+  border-radius: 4rpx;
95
+  color:#fff;
96
+  background-color: #2E2E2E;
97
+  font-family: 'Roboto-Bold';
98
+  font-size:22rpx;
99
+}
100
+.panelRowBody .answer{
101
+  font-size:48rpx;
102
+  margin-left: 40rpx;
103
+  font-family: 'Roboto-Regular';
104
+}
105
+
106
+.panelRowBody .equation{
107
+  font-size:26rpx;
108
+  margin-right: 20rpx;
109
+  color:#8C8C8C;
110
+  font-family: 'Roboto-Regular';
111
+}
112
+
113
+
114
+.panelRowBody{
115
+  background-color: #F0F0F0;
116
+}
117
+
118
+.line{
119
+  width:100%;
120
+  height:1rpx;
121
+  justify-content: flex-end;
122
+}
123
+
124
+.line .line1{
125
+  width:720rpx;
126
+  height:1rpx;
127
+  background-color: #D2D2D2;
128
+}
129
+
130
+.formula_btn_show{
131
+  width: 30rpx;
132
+  height: 34rpx;
133
+}
134
+
135
+.panelAnswer{
136
+  margin: 53rpx 0 41rpx 0;
137
+  align-items: flex-start;
138
+}
139
+
140
+.panelAnswer .panelAnswerRow{
141
+}
142
+
143
+.panelAnswer .panelAnswerCol{
144
+  justify-content: flex-start;
145
+}
146
+
147
+.formula_division_size01{
148
+  width:27rpx;
149
+  height:77rpx;
150
+  margin: -20rpx 25rpx 0 5rpx;
151
+}
152
+
153
+.panelAnswer .colNumber{
154
+  font-size:48rpx;
155
+  margin: 10rpx 15rpx;
156
+  font-family: 'Roboto-Regular';
157
+  width:27rpx;
158
+  height:57rpx;
159
+  text-align: center;
160
+}
161
+.panelAnswer .colDot{
162
+  font-size:48rpx;
163
+  margin: 10rpx -8rpx 0 -5rpx;
164
+  font-family: 'Roboto-Regular';
165
+  width:13rpx;
166
+  height:57rpx;
167
+  text-align: center;
168
+}
169
+.panelAnswer .colLine{
170
+  height: 2rpx;
171
+  background-color: #000;
172
+  width:55rpx;
173
+  margin: 10rpx 0rpx;
174
+}
175
+.panelAnswer .colLineNull{
176
+  width:27rpx;
177
+  height:2rpx;
178
+  margin: 10rpx 15rpx;
179
+}
180
+.panelAnswer .colLineHalf{
181
+  width:14rpx;
182
+  height:2rpx;
183
+  margin: 0rpx 0 0 28rpx;
184
+  background-color: #000;
185
+}

+ 107 - 14
pages/main/list.js

@@ -1,29 +1,122 @@
1 1
 import common from '../../utils/util';
2 2
 import server from '../../utils/main';
3 3
 
4
-const app = getApp()
4
+const app = getApp();
5
+var categoryID = "";
6
+var categoryName = "";
7
+var categoryNum = "";
8
+var SelectID = 0;
9
+
5 10
 Page({
6 11
   data: {
7 12
     version: app.globalData.version,
8 13
     FileUrl: app.globalData.fileUrl,
14
+    filter:'all',
15
+    IsShowMenu:false,
16
+    CategoryID:1,
9 17
   },
10
-  onLoad: function () {
18
+  onLoad: function(options) {
19
+    categoryID = options.id;
20
+    categoryName = options.name;
21
+    categoryNum = options.num;
22
+    //console.log(category);
23
+    this.getList();
11 24
     this.setData({
25
+      CategoryNum:categoryNum,
26
+      CategoryID: categoryID,
12 27
       Containnerheight: server.getWindowHeight(),
13 28
     });
14 29
   },
15
-  onShareAppMessage: function () {
30
+  getList: function() {
31
+    this.buildList();
32
+    wx.setNavigationBarTitle({
33
+      title: categoryName + " 题卡仓库",
34
+    });
35
+  },
36
+  gotoDetail:function(e){
37
+    SelectID = e.currentTarget.dataset.id;
38
+    var arr = wx.getStorageSync('SelectIDArray');
39
+    if (!arr)
40
+      arr=[];
41
+    for(var i=0;i<arr.length;i++){
42
+      if (arr[i] == SelectID){
43
+        arr.splice(i,0);
44
+        break;
45
+      }
46
+    }
47
+
48
+    arr.push(SelectID);
49
+    wx.setStorageSync('SelectIDArray', arr);
50
+    this.buildList();
51
+
52
+    wx.navigateTo({
53
+      url: '../main/detail?id=' + SelectID,
54
+    });
55
+  },
56
+  buildList:function(){
57
+    var arrID = categoryID.split(",");
58
+    var list = [];
59
+
60
+    var data = wx.getStorageSync('QuestionTypeList');
61
+    var arr = wx.getStorageSync('SelectIDArray');
62
+    for (var i = 0; i < data.length; i++) {
63
+      for (var j = 0; j < arrID.length; j++) {
64
+        if (data[i].ID == arrID[j]) {
65
+          for (var k = 0; k < data[i].List.length; k++) {
66
+            data[i].List[k].CategoryLevel = data[i].Name;
67
+
68
+            
69
+            for (var n = 0; n < arr.length; n++) {
70
+              //data[i].List[k].SelectItem = "";
71
+              if (arr[n] == data[i].List[k].ID){
72
+                data[i].List[k].SelectItem ="boxLeft";
73
+              }
74
+            }
75
+
76
+            data[i].List[k].Select = false;
77
+            if (SelectID == data[i].List[k].ID)
78
+              data[i].List[k].Select = true;
79
+
80
+            if (this.data.filter == "vertical"){
81
+              if (data[i].List[k].QuestionNumber3>0)
82
+                list.push(data[i].List[k]);
83
+            }
84
+            else{
85
+                list.push(data[i].List[k]);
86
+            }
87
+          }
88
+          break;
89
+        }
90
+      }
91
+    }
92
+
93
+    this.setData({
94
+      QuestionTypeList: list,
95
+    });
96
+  },
97
+  menuClick:function(e){
98
+    this.data.filter = e.currentTarget.dataset.id;
99
+    this.setData({
100
+      filter: this.data.filter,
101
+      IsShowMenu: false,
102
+    });
103
+    this.buildList();
104
+  },
105
+  closeMenu: function () {
106
+    this.setData({
107
+      IsShowMenu: false,
108
+    });
109
+  },
110
+  openMenu: function () {
111
+    this.setData({
112
+      IsShowMenu: true,
113
+    });
114
+  },
115
+  onShareAppMessage: function() {
16 116
     return {
17
-      title: '',
18
-      path: 'pages/index/index',
19
-      success: function (res) {
20
-      },
21
-      fail: function (err) {
22
-        console.log(err);
23
-      },
24
-      complete: function (res) {
25
-        console.log(res);
26
-      },
117
+      title: app.globalData.ShareTitle,
118
+      path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
119
+      imageUrl: app.globalData.ShareImageUrl,
27 120
     }
28 121
   },
29
-})
122
+})

+ 51 - 54
pages/main/list.wxml

@@ -4,64 +4,41 @@
4 4
   <view class="line2"></view>
5 5
   <view class="line3"></view>
6 6
   <image class="questioncollection_headline_root" src="../../images/questioncollection_headline_root.png" />
7
-  <image class="questioncollection_headline_light" src="../../images/questioncollection_headline_light.png" />
8
-
9
-  <image class="questioncollection_headline_shelf_illus_grade01" src="../../images/questioncollection_headline_shelf_illus_grade01.png" /> 
10
-  
11
-  <image class="questioncollection_headline_plate" src="../../images/questioncollection_headline_plate.png" /> 
12 7
   
8
+  <image class="questioncollection_headline_light" src="../../images/questioncollection_headline_light.png" bindtap='openMenu'/>
9
+  <image class="questioncollection_headline_shelf_illus_grade0{{CategoryNum}}" src="../../images/questioncollection_headline_shelf_illus_grade0{{CategoryNum}}.png"  bindtap='openMenu' />
10
+  <image class="questioncollection_headline_plate" src="../../images/questioncollection_headline_plate.png" wx:if="{{filter=='vertical'}}"/>
13 11
 
14
-  
15
-  <image class="questioncollection_shelf_board" src="../../images/questioncollection_shelf_board.png" />
16
-  <view class="boxLeft questioncard FlexRow">
17
-    <image class=" questioncollection_shelf_box" src="../../images/questioncollection_shelf_box.png" />
18
-    <image class="questioncard_icon" src="{{FileUrl}}questioncard_icon_grade0602_size01.png" />
19
-    <view class="title FlexColumn">
20
-      <view class="title1">
21
-        四则运算a+b+c
22
-      </view>
23
-      <view class="title2 FlexRow">
24
-        <view class="title20 FlexRow">
25
-          四则运算
12
+
13
+  <block wx:for="{{QuestionTypeList}}" wx:key="index">
14
+    <image class="questioncollection_shelf_board" src="../../images/questioncollection_shelf_board.png" bindtap='gotoDetail' data-id="{{item.ID}}" />
15
+    <view class="{{item.SelectItem}} questioncard FlexRow" bindtap='gotoDetail' data-id="{{item.ID}}">
16
+      <image class=" questioncollection_shelf_box" src="../../images/questioncollection_shelf_box.png" />
17
+      <image class="questioncard_icon" src="{{FileUrl}}questioncard_icon_grade0602_size01.png" />
18
+      <view class="title FlexColumn">
19
+        <view class="title1">
20
+          {{item.Name}}
26 21
         </view>
27
-        <view class="line"></view>
28
-        <view class="title21 FlexRow">
29
-          简单
22
+        <view class="title2 FlexRow">
23
+          <view class="title20 FlexRow">
24
+            {{item.CategoryLevel}}
25
+          </view>
26
+          <view class="line"></view>
27
+          <view class="title21 FlexRow">
28
+            {{item.DifficultyName}}
29
+          </view>
30 30
         </view>
31 31
       </view>
32
-    </view>
33
-    <image class="questioncollection_shelf_box_tape" src="../../images/questioncollection_shelf_box_tape.png" />
34
-    <view class="title3">有竖式</view>
32
+      <image wx:if="{{item.SelectItem!='boxLeft'}}" class="questioncollection_shelf_box_tape" src="../../images/questioncollection_shelf_box_tape.png" />
33
+      <view class="title3" wx:if="{{item.QuestionNumber3>0}}">有竖式</view>
35 34
 
36
-    <image class="questioncollection_shelf_here" src="../../images/questioncollection_shelf_here.png" />
37
-    
38
-  </view>
35
+      <image wx:if="{{item.Select}}" class="questioncollection_shelf_here" src="../../images/questioncollection_shelf_here.png" />
39 36
 
40
-  <image class="questioncollection_shelf_board" src="../../images/questioncollection_shelf_board.png" />
41
-  <view class="boxRight questioncard FlexRow">
42
-    <image class=" questioncollection_shelf_box" src="../../images/questioncollection_shelf_box.png" />
43
-    <image class="questioncard_icon" src="{{FileUrl}}questioncard_icon_grade0602_size01.png" />
44
-    <view class="title FlexColumn">
45
-      <view class="title1">
46
-        四则运算a+b+c
47
-      </view>
48
-      <view class="title2 FlexRow">
49
-        <view class="title20 FlexRow">
50
-          四则运算
51
-        </view>
52
-        <view class="line"></view>
53
-        <view class="title21 FlexRow">
54
-          简单
55
-        </view>
56
-      </view>
57 37
     </view>
58
-    <image class="questioncollection_shelf_box_tape" src="../../images/questioncollection_shelf_box_tape.png" />
59
-    <!-- <view class="title3">有竖式</view> -->
60
-    <!-- <image class="questioncollection_shelf_here" src="../../images/questioncollection_shelf_here.png" /> -->
61
-    
62
-  </view>
63 38
 
64
-  <image class="questioncollection_shelf_board" src="../../images/questioncollection_shelf_board.png" />
39
+  </block>
40
+
41
+  <!-- <image class="questioncollection_shelf_board" src="../../images/questioncollection_shelf_board.png" />
65 42
   <view class="boxRight questioncard FlexRow desaturate">
66 43
     <image class=" questioncollection_shelf_box" src="../../images/questioncollection_shelf_box.png" />
67 44
     <image class="questioncard_icon" src="{{FileUrl}}questioncard_icon_grade0602_size01.png" />
@@ -80,25 +57,45 @@
80 57
       </view>
81 58
     </view>
82 59
     <image class="questioncollection_shelf_box_tape" src="../../images/questioncollection_shelf_box_tape.png" />
83
-    <!-- <view class="title3">有竖式</view> -->
84
-    <!-- <image class="questioncollection_shelf_here" src="../../images/questioncollection_shelf_here.png" /> -->
85 60
     
86 61
     <image class="universalpic_lock_locked_black_size01" src="../../images/universalpic_lock_locked_black_size01.png" />
87 62
 
88
-  </view>
63
+  </view> -->
89 64
 
90 65
   <image class="questioncollection_shelf_footer_illus" src="../../images/questioncollection_shelf_footer_illus.png" />
91 66
   <view class="line4"></view>
92 67
 
93 68
   <view class="line5"></view>
94 69
 
95
-  <view class="lineLeft lineLong FlexRow">
70
+  <view class="lineLeft lineLong FlexRow" style="height:{{ (540+QuestionTypeList.length*190) }}rpx;">
96 71
     <view class="lineLong1">
97 72
     </view>
98 73
   </view>
99
-  <view class="lineRight lineLong FlexRow">
74
+  <view class="lineRight lineLong FlexRow" style="height:{{ (540+QuestionTypeList.length*190) }}rpx;">
100 75
     <view class="lineLong2">
101 76
     </view>
102 77
   </view>
103 78
 
79
+  <view class="menu FlexColumn" wx:if="{{IsShowMenu}}">
80
+    <view class="text1">筛选题卡</view>
81
+    <view class="panel FlexRow" bindtap='menuClick' data-id="all">
82
+      <view>全部</view>
83
+      <image wx:if="{{filter=='all'}}" class="universalpic_select_on_black" src="../../images/universalpic_select_on_black.png" />
84
+
85
+    </view>
86
+    <view class="line"></view>
87
+    <view class="panel FlexRow" bindtap='menuClick' data-id="vertical">
88
+      <view>仅竖式</view>
89
+      <image wx:if="{{filter=='vertical'}}" class="universalpic_select_on_black" src="../../images/universalpic_select_on_black.png" />
90
+
91
+    </view>
92
+    <view class="line"></view>
93
+    <view class="line2"></view>
94
+    <view class="line"></view>
95
+    <view class="panel FlexRow" bindtap='closeMenu'>
96
+      <view>取消</view>
97
+    </view>
98
+
99
+  </view>
100
+
104 101
 </view>

+ 81 - 24
pages/main/list.wxss

@@ -48,13 +48,28 @@
48 48
   height: 160rpx;
49 49
   margin-top: 10rpx;
50 50
 }
51
+.questioncollection_headline_shelf_illus_grade02 {
52
+  width: 545rpx;
53
+  height: 140rpx;
54
+  margin-top: 10rpx;
55
+}
56
+.questioncollection_headline_shelf_illus_grade03 {
57
+  width: 580rpx;
58
+  height: 140rpx;
59
+  margin-top: 10rpx;
60
+}
61
+.questioncollection_headline_shelf_illus_grade04 {
62
+  width: 529rpx;
63
+  height: 130rpx;
64
+  margin-top: 10rpx;
65
+}
51 66
 
52
-.questioncollection_headline_plate{
67
+.questioncollection_headline_plate {
53 68
   width: 112rpx;
54 69
   height: 70rpx;
55 70
   position: absolute;
56
-  top:240rpx;
57
-  left:60rpx;
71
+  top: 240rpx;
72
+  left: 60rpx;
58 73
 }
59 74
 
60 75
 .questioncollection_shelf_board {
@@ -141,12 +156,11 @@
141 156
   top: 70rpx;
142 157
 }
143 158
 
144
-
145
-.questioncollection_shelf_here{
159
+.questioncollection_shelf_here {
146 160
   width: 130rpx;
147 161
   height: 60rpx;
148 162
   position: absolute;
149
-  left:-16rpx;
163
+  left: -16rpx;
150 164
   bottom: 0rpx;
151 165
   z-index: 20;
152 166
 }
@@ -158,14 +172,13 @@
158 172
   right: 34rpx;
159 173
 }
160 174
 
161
-.questioncollection_shelf_footer_illus{
175
+.questioncollection_shelf_footer_illus {
162 176
   width: 630rpx;
163 177
   height: 318rpx;
164 178
   margin-top: 0rpx;
165 179
   z-index: 10;
166 180
 }
167 181
 
168
-
169 182
 .line4 {
170 183
   width: 100%;
171 184
   height: 100rpx;
@@ -176,39 +189,83 @@
176 189
 .line5 {
177 190
   width: 100%;
178 191
   height: 50rpx;
179
-  background-color: #514A47;
192
+  background-color: #514a47;
180 193
 }
181 194
 
182 195
 .lineLong {
183 196
   width: 30rpx;
184
-  height: 1100rpx;
197
+  height: 540rpx;
185 198
   border-radius: 8rpx;
186
-  background-color: #4D4D4D;
199
+  background-color: #4d4d4d;
187 200
 }
188 201
 
189 202
 .lineLeft {
190 203
   position: absolute;
191
-  top:168rpx;
192
-  left:30rpx;
204
+  top: 168rpx;
205
+  left: 30rpx;
193 206
   justify-content: flex-end;
194 207
 }
208
+
195 209
 .lineRight {
196 210
   position: absolute;
197
-  top:168rpx;
198
-  right:30rpx;
211
+  top: 168rpx;
212
+  right: 30rpx;
199 213
   justify-content: flex-start;
200 214
 }
201
-.lineLong1{
202
-  background-color: #6B6B6B;
203
-  height:100%;
204
-  width:10rpx;
215
+
216
+.lineLong1 {
217
+  background-color: #6b6b6b;
218
+  height: 100%;
219
+  width: 10rpx;
205 220
   border-top-right-radius: 8rpx;
206 221
   border-bottom-right-radius: 8rpx;
207 222
 }
208
-.lineLong2{
209
-  background-color: #6B6B6B;
210
-  height:100%;
211
-  width:10rpx;
223
+
224
+.lineLong2 {
225
+  background-color: #6b6b6b;
226
+  height: 100%;
227
+  width: 10rpx;
212 228
   border-top-left-radius: 8rpx;
213 229
   border-bottom-left-radius: 8rpx;
214
-}
230
+}
231
+
232
+.menu {
233
+  position: fixed;
234
+  bottom: 0;
235
+  width: 100%;
236
+  background-color: #d2d2d2;
237
+  z-index: 30;
238
+}
239
+
240
+.menu .text1 {
241
+  font-size: 24rpx;
242
+  margin: 30rpx;
243
+}
244
+
245
+.menu .panel {
246
+  font-size: 36rpx;
247
+  height: 111rpx;
248
+  width: 100%;
249
+  background-color: #fff;
250
+  position: relative;
251
+}
252
+
253
+.menu .line {
254
+  height: 2rpx;
255
+  width: 100%;
256
+  background-color: #e3e3e3;
257
+}
258
+
259
+.menu .line2 {
260
+  height: 20rpx;
261
+  width: 100%;
262
+  background-color: #d2d2d2;
263
+}
264
+
265
+.universalpic_select_on_black {
266
+  height: 30rpx;
267
+  width: 30rpx;
268
+  position: absolute;
269
+  left:40rpx;
270
+  top:40rpx;
271
+}

+ 164 - 0
pages/main/print.js

@@ -0,0 +1,164 @@
1
+import common from '../../utils/util';
2
+import server from '../../utils/main';
3
+
4
+const app = getApp()
5
+Page({
6
+  data: {
7
+    Left: 0,
8
+  },
9
+  onLoad: function(options) {
10
+    var id = options.id;
11
+    id = 179;
12
+    this.getList(id);
13
+  },
14
+  getList: function(id) {
15
+    var that = this;
16
+
17
+    server.getLocalHost(function() {
18
+      server.getData('GetQuestionTypesPrint?ID=' + id, function(data) {
19
+        //console.log("UserInfo:" + data);
20
+        if (data) {
21
+          that.saveImage(data);
22
+        }
23
+      });
24
+
25
+    });
26
+  },
27
+  saveImage: function(item) {
28
+    var that = this;
29
+    var ctx = wx.createCanvasContext("Canvas", that);
30
+    ctx.setFillStyle('white');
31
+    ctx.fillRect(0, 0, 1050, 1485);
32
+    ctx.setTextAlign('left');
33
+    ctx.setTextBaseline('top');
34
+    ctx.fillStyle = "#000000";
35
+    ctx.setFontSize(32);
36
+    ctx.fillText(item.Name, 60, 45);
37
+
38
+
39
+    ctx.setFontSize(12);
40
+    ctx.fillText(item.CagegoryName, 60, 90);
41
+    ctx.fillText("共" + item.QuestionList.length + "道题", 60, 125);
42
+    ctx.fillText("第 1 / 1 页", 60, 147);
43
+    ctx.fillText("答案检索号", 768, 60);
44
+
45
+    ctx.setTextAlign('right');
46
+    ctx.fillText("出题时间 " + item.CreateTime, 875, 94);
47
+    ctx.fillText("微信扫一扫 计时看答案", 875, 111);
48
+    ctx.fillText("《数学计算题》选题 打印 扫码 批改", 875, 137);
49
+    ctx.setFontSize(32);
50
+    ctx.fillText("99", 875, 50);
51
+    ctx.drawImage("../../images/answer.png", 890, 54, 100, 100);
52
+
53
+    ctx.setTextBaseline('middle');
54
+    var xStart = 60;
55
+    var yStart = 247;
56
+    var index = 0;
57
+    for (var i = 0; i < 3; i++) {
58
+      for (var j = 0; j < 20; j++) {
59
+        index++;
60
+        ctx.setTextAlign('left');
61
+        ctx.setFontSize(12);
62
+        ctx.fillText("(", xStart + i * 310, yStart + j * 59);
63
+        ctx.setTextAlign('center');
64
+        ctx.fillText(index, xStart + i * 310 + 13, yStart + j * 59);
65
+        ctx.setTextAlign('left');
66
+        ctx.fillText(")", xStart + i * 310 + 22, yStart + j * 59);
67
+
68
+        ctx.setFontSize(24);
69
+
70
+        var A = item.QuestionList[index - 1].A.toString();
71
+        if (item.QuestionList[index - 1].HiddenColumn == "A")
72
+          A = "____";
73
+        var OperateAB = item.QuestionList[index - 1].OperateAB.toString();
74
+        console.log(OperateAB);
75
+        var B = item.QuestionList[index - 1].B.toString();
76
+        if (item.QuestionList[index - 1].HiddenColumn == "B")
77
+          B = "____";
78
+        var equation = A + " " + OperateAB + " " + B;
79
+        if (item.QuestionList[index - 1].C) {
80
+          var OperateBC = item.QuestionList[index - 1].OperateBC.toString();
81
+          var C = item.QuestionList[index - 1].C.toString();
82
+          equation += " " + OperateBC + " " + C;
83
+          if (item.QuestionList[index - 1].D) {
84
+            var OperateCD = item.QuestionList[index - 1].OperateCD.toString();
85
+            var D = item.QuestionList[index - 1].D.toString();
86
+            equation += " " + OperateCD + " " + D;
87
+          }
88
+        }
89
+        equation += " = ";
90
+        var R = item.QuestionList[index - 1].R.toString();
91
+        if (item.QuestionList[index - 1].HiddenColumn == "R")
92
+          R = "";
93
+        equation += R;
94
+
95
+        var num = xStart + i * 310 + 31;
96
+        ctx.setTextAlign('center');
97
+        for (var n = 0; n < equation.length; n++) {
98
+          var len = getLength(equation[n]);
99
+          num += len;
100
+          if (equation[n] == ".") {
101
+            ctx.fillText(equation[n], num + 3, yStart + j * 59);
102
+          } else {
103
+            var h=0;
104
+            if (equation[n]=="_")
105
+              h=8;
106
+            ctx.fillText(equation[n], num, yStart + j * 59+h);
107
+          }
108
+        }
109
+      }
110
+    }
111
+
112
+
113
+    ctx.draw(true, function(n) {
114
+      wx.canvasToTempFilePath({
115
+        x: 0,
116
+        y: 0,
117
+        width: 2100,
118
+        height: 2970,
119
+        destWidth: 2100,
120
+        destHeight: 2970,
121
+        canvasId: 'Canvas',
122
+        success: function (res2) {
123
+          console.log(res2.tempFilePath);
124
+          wx.previewImage({
125
+            current: res2.tempFilePath, // 当前显示图片的http链接
126
+            urls: [res2.tempFilePath] // 需要预览的图片http链接列表
127
+          });
128
+        }
129
+      })
130
+    });
131
+
132
+    function getLength(str) {
133
+      switch (str) {
134
+        case "0":
135
+        case "1":
136
+        case "2":
137
+        case "3":
138
+        case "4":
139
+        case "5":
140
+        case "6":
141
+        case "7":
142
+        case "8":
143
+        case "9":
144
+          return 15;
145
+        case ".":
146
+          return 8;
147
+        default:
148
+          return 12;
149
+      }
150
+    }
151
+
152
+  },
153
+  moveLeft: function() {
154
+    this.setData({
155
+      Left: this.data.Left + 375,
156
+    });
157
+  },
158
+  moveRight: function() {
159
+    this.setData({
160
+      Left: this.data.Left - 375,
161
+    });
162
+  }
163
+});
164
+

pages/index/detail.json → pages/main/print.json


+ 6 - 0
pages/main/print.wxml

@@ -0,0 +1,6 @@
1
+<view class="panel">
2
+<canvas class='Canvas' style='left:{{Left}}rpx;' canvas-id="Canvas"></canvas>
3
+<view class="btnLeft" bindtap='moveLeft'>左</view>
4
+<view class="btnRight" bindtap='moveRight'>右</view>
5
+
6
+</view>

+ 28 - 0
pages/main/print.wxss

@@ -0,0 +1,28 @@
1
+.panel{
2
+  width: 2100rpx; 
3
+  height: 2970rpx;
4
+}
5
+.Canvas{
6
+  width: 2100rpx; 
7
+  height: 2970rpx;
8
+  background-color:#f2f2f2;
9
+  /* z-index: 50; */
10
+  position: absolute;
11
+  left:0rpx;
12
+  top:0rpx;
13
+}
14
+
15
+.btnLeft{
16
+  position: fixed;
17
+  bottom: 30rpx;
18
+  left:30rpx;
19
+  background-color: #ddd;
20
+}
21
+
22
+.btnRight{
23
+  position: fixed;
24
+  bottom: 30rpx;
25
+  right:30rpx;
26
+  background-color: #ddd;
27
+}
28
+

+ 22 - 3
project.config.json

@@ -8,7 +8,7 @@
8 8
 		"newFeature": true
9 9
 	},
10 10
 	"compileType": "miniprogram",
11
-	"libVersion": "1.9.93",
11
+	"libVersion": "2.0.9",
12 12
 	"appid": "wx1fef080f74481cbd",
13 13
 	"projectname": "%E6%95%B0%E5%AD%A6%E8%AE%A1%E7%AE%97%E9%A2%98",
14 14
 	"isGameTourist": false,
@@ -30,8 +30,27 @@
30 30
 			"list": []
31 31
 		},
32 32
 		"miniprogram": {
33
-			"current": -1,
34
-			"list": []
33
+			"current": 2,
34
+			"list": [
35
+				{
36
+					"id": 0,
37
+					"name": "list",
38
+					"pathName": "pages/main/list",
39
+					"query": "id=3&name=三年级"
40
+				},
41
+				{
42
+					"id": 1,
43
+					"name": "detail",
44
+					"pathName": "pages/main/detail",
45
+					"query": "id=101"
46
+				},
47
+				{
48
+					"id": 2,
49
+					"name": "print",
50
+					"pathName": "pages/main/print",
51
+					"query": "id=172"
52
+				}
53
+			]
35 54
 		}
36 55
 	}
37 56
 }

+ 1 - 0
utils/main.js

@@ -305,6 +305,7 @@ function gotoFeedback() {
305 305
   });
306 306
 }
307 307
 
308
+
308 309
 module.exports = {
309 310
   getData: getData,
310 311
   postData: postData,

+ 13 - 0
utils/util.js

@@ -14,6 +14,17 @@ function formatTime(date) {
14 14
   return [year, month, day].map(formatNumber).join('.') + ' ' + [hour, minute, second].map(formatNumber).join(':')
15 15
 }
16 16
 
17
+
18
+function formatDateCHS(date) {
19
+  var year = date.getFullYear()
20
+  var month = addZero(date.getMonth() + 1, 2);
21
+  var day = addZero(date.getDate(), 2);
22
+  var hour = addZero(date.getHours(), 2);
23
+  var minute = addZero(date.getMinutes(), 2);
24
+
25
+  return year + "年" + month + "月" + day + "日 "+hour+":"+minute;
26
+}
27
+
17 28
 function formatNumber(n) {
18 29
   n = n.toString()
19 30
   return n[1] ? n : '0' + n
@@ -21,6 +32,7 @@ function formatNumber(n) {
21 32
 
22 33
 //给字符串左侧补零
23 34
 function addZero(str, length) {
35
+  str=str.toString();
24 36
   while (str.length < length) {
25 37
     str = "0" + str;
26 38
   }
@@ -288,6 +300,7 @@ function getStorageValue(obj, name, defaultStatus, callback) {
288 300
 
289 301
 module.exports = {
290 302
   formatTime: formatTime,
303
+  formatDateCHS: formatDateCHS,
291 304
   getMinuteSecond: getMinuteSecond,
292 305
   random: Random,
293 306
   randomArray: RandomArray,