chengjie 4 months ago
parent
commit
6ee8d3d24c

+ 1 - 1
app.js

@@ -2,7 +2,7 @@
2 2
 App({
3 3
   globalData: {
4 4
     Version: "1.0.4",
5
-    IsProduction: true,
5
+    //IsProduction: true,
6 6
     ShareTitle: "阅读理解+答题",
7 7
     SharePath: "pages/index/index",
8 8
     ShareImage: '../images/pic_07.png',

BIN
pages/.DS_Store


BIN
pages/images/pic_03.png


BIN
pages/images/sysIcon_a17.png


BIN
pages/images/sysIcon_b08.gif


+ 42 - 12
pages/main/article.js

@@ -56,12 +56,13 @@ Page({
56 56
       Containnerheight: main.getWindowHeight(),
57 57
       Words:words,
58 58
       WordsStr:wordsStr,
59
+      Level:options.Level,
60
+      ArticleStyle:options.ArticleStyle,
61
+      AIVersion:options.AIVersion,
59 62
       IsShowFirstOpen:!hiddenhelp,
60 63
       IsShowLightColor:IsShowLightColor,
61 64
       IsShowKeyword:IsShowKeyword,
62 65
       IsBuildError:false,
63
-      Level:options.Level,
64
-      ArticleStyle:options.ArticleStyle,
65 66
       IsBuilding:false,
66 67
     });
67 68
 
@@ -70,6 +71,12 @@ Page({
70 71
     else  
71 72
       that.init(options);
72 73
     that.setTheme();
74
+
75
+    // //测试
76
+    // that.setData({
77
+    //   IsBuilding:true,
78
+    // });
79
+    // that.getChoicenessArticle();
73 80
   },
74 81
   getArticleByID:function(id){
75 82
     let that=this;
@@ -91,10 +98,9 @@ Page({
91 98
   init:function(options){
92 99
     let that=this;
93 100
     let interval=0;
94
-    //小学初中文章生成时间短
95 101
     that.data.CountDown=30;
96
-    //高中大学文章生成时间长
97
-    if (that.data.Level>=2){
102
+    //1.5文章生成时间长
103
+    if (that.data.AIVersion=="1.5"){
98 104
       that.setData({
99 105
         CountDown:60,
100 106
       });
@@ -114,7 +120,8 @@ Page({
114 120
     main.postData('GenerateArticle?UserID='+app.globalData.userInfo.UserID, {
115 121
       Words:words,
116 122
       Level:that.data.Level,
117
-      ArticleStyle:that.data.ArticleStyle
123
+      ArticleStyle:that.data.ArticleStyle,
124
+      AIVersion:that.data.AIVersion
118 125
     }, function (data) {
119 126
       if (data){
120 127
         if (data=="-1"){
@@ -134,6 +141,20 @@ Page({
134 141
         clearInterval(interval);
135 142
       }
136 143
     });
144
+
145
+    that.getChoicenessArticle();
146
+  },
147
+
148
+  //得到精选文章
149
+  getChoicenessArticle:function(){
150
+    let that=this;
151
+    main.getData('GetYJBDCArticleList?IsChoiceness=1', function (data) {
152
+      if (data) {
153
+        that.setData({
154
+          ChoicenessList:data,
155
+        });
156
+      }
157
+    });
137 158
   },
138 159
   
139 160
   updateData:function(content){
@@ -373,7 +394,12 @@ Page({
373 394
       success: function(res) {
374 395
         // 将arraybuffer转为临时文件
375 396
         const fsm = wx.getFileSystemManager();
376
-        const tempFilePath = `${wx.env.USER_DATA_PATH}/temp_${Date.now()}.pdf`;
397
+        let time=common.formatTime(new Date(),"-");
398
+        time=common.ReplaceAllString(time,"-","");
399
+        time=common.ReplaceAllString(time,":","");
400
+        time=common.ReplaceAllString(time," ","_");
401
+        time=time.substring(2,time.length-2);        
402
+        const tempFilePath = `${wx.env.USER_DATA_PATH}/语境背单词_${time}.pdf`;
377 403
         
378 404
         try {
379 405
           fsm.writeFileSync(
@@ -418,12 +444,9 @@ Page({
418 444
     });
419 445
   },
420 446
   // 处理导航栏返回按钮点击事件
421
-  back: function() {
422
-    if (this.data.IsBuilding) {
423
-      return; // 如果正在生成文章,不执行返回操作
424
-    }
425
-    
447
+  onUnload: function() {
426 448
     if (!this.data.ID){
449
+      app.globalData.SelectedWords=[];
427 450
       wx.navigateBack({
428 451
         delta: 1,
429 452
       });
@@ -463,6 +486,13 @@ Page({
463 486
       showAnimation: 'remind-slide-down'
464 487
     });
465 488
   },
489
+  goto: function (e) {
490
+    let that=this;
491
+    var url=e.currentTarget.dataset.url;
492
+    wx.navigateTo({
493
+      url: url,
494
+    });
495
+  },
466 496
   onShareAppMessage: function () {
467 497
     return {
468 498
       title: app.globalData.ShareTitle,

+ 2 - 5
pages/main/article.json

@@ -1,7 +1,4 @@
1 1
 {
2
-  "navigationBarTitleText": "文章",
3
-  "navigationStyle": "custom",
4
-  "usingComponents": {
5
-    "navigation-bar": "/components/navigation-bar/navigation-bar"
6
-  }
2
+  "navigationBarTitleText":"文章",
3
+  "usingComponents": {}
7 4
 }

+ 15 - 16
pages/main/article.wxml

@@ -1,11 +1,3 @@
1
-<navigation-bar
2
-  title="文章"
3
-  back="{{!IsBuilding}}"
4
-  background="{{ThemeCSS === 'DarkColor' ? '#004433' : '#D0ECD3'}}"
5
-  color="{{ThemeCSS === 'DarkColor' ? '#ffffff' : '#151815'}}"
6
-  extClass="fixed-nav {{ThemeCSS}}"
7
-  bind:back="back"
8
-></navigation-bar>
9 1
 <block wx:if="{{!IsBuilding && !IsBuildError}}">
10 2
 <!-- 正常文章 -->
11 3
 <view  class="{{ThemeCSS}} container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
@@ -142,7 +134,7 @@
142 134
 </block>
143 135
 
144 136
 <!-- 显示生成出错 -->
145
-<view wx:if="{{IsBuildError}}" class="container {{ThemeCSS}} FlexColumn" style='min-height:{{Containnerheight+140}}rpx;'>
137
+<view wx:if="{{IsBuildError}}" class="container {{ThemeCSS}} FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
146 138
   <view class="{{ThemeCSS}} panelError FlexColumn">
147 139
     <image  wx:if="{{ThemeCSS=='DarkColor'}}"  src="../images/sysIcon_b14.png" class="sysIcon_b14"></image>
148 140
     <image  wx:if="{{ThemeCSS=='LightColor'}}" src="../images/sysIcon_b15.png" class="sysIcon_b14"></image>
@@ -152,7 +144,7 @@
152 144
 </view>
153 145
 
154 146
 <!-- 显示生成中 -->
155
-<view wx:if="{{IsBuilding}}" class="container panelBuildindParent {{ThemeCSS}} FlexColumn" style='min-height:{{Containnerheight+140}}rpx;'>
147
+<view wx:if="{{IsBuilding}}" class="container panelBuildindParent {{ThemeCSS}} FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
156 148
 </view>
157 149
 <image wx:if="{{IsBuilding && ThemeCSS=='DarkColor'}}" src="../images/pic_08.png" mode="widthFix" class="pic_08"></image>
158 150
 <image wx:if="{{IsBuilding && ThemeCSS=='LightColor'}}" src="../images/pic_09.png" mode="widthFix" class="pic_08"></image>
@@ -162,14 +154,21 @@
162 154
     <image src="../images/sysIcon_b08.gif" class="sysIcon_b08"></image>
163 155
     <view class="panelBuilding11 FlexColumn">
164 156
       <text class="text08" wx:if="{{CountDown>0}}">生成中…{{CountDown}}秒</text>
165
-      <text class="text08" wx:if="{{CountDown==0 && (Level=='0' || Level=='1')}}">生成中…差一点,就快好了</text>
166
-      <text class="text08" wx:if="{{CountDown==0 && (Level=='2' || Level=='3')}}">再等一等,就差一点点了</text>
167
-      <text class="text09" wx:if="{{Level=='0' || Level=='1'}}">请眨眨眼,揉揉四白穴、睛明穴、攒竹穴</text>
168
-      <text class="text09" wx:if="{{Level=='2' || Level=='3'}}">高中和大学的文章生成时间比小学和初中更长,\n这是由于单词水平要求更高且内容更为复杂。</text>
157
+      <text class="text08" wx:if="{{CountDown==0 && AIVersion=='1.0'}}">生成中…差一点,就快好了</text>
158
+      <text class="text08" wx:if="{{CountDown==0 && AIVersion=='1.5'}}">再等一等,就差一点点了</text>
159
+      <text class="text09">用1.0生成文章平均30秒,用1.5平均60秒,\n这是由于1.5的单词水平更高、思考更为深入。</text>
169 160
     </view>
170 161
     <view class="panelBuilding12 FlexColumn">
171
-      <text class="text10">Vocabulary:</text>
172
-      <text class="text11">{{WordsStr}}</text>
162
+      <text class="text10">生成后会通知您,等待时可看看这些范文:</text>
163
+      <view class="panelBuilding121 FlexRow">
164
+        <view class="panelBuilding1211 FlexRow" wx:for="{{ChoicenessList}}" wx:key="index" catch:tap="goto" data-url="./article?ID={{item.ID}}">
165
+          <image src="../images/sysIcon_a17.png" class="sysIcon_a17"></image>
166
+          <view class="panelBuilding12111 FlexColumn">
167
+            <view class="panelBuilding1211text">{{item.ArticleTitle}}</view>
168
+            <view class="panelBuilding1211text2">{{item.LevelStr}} {{item.ArticleStyle}}</view>
169
+          </view>
170
+        </view>
171
+      </view>
173 172
     </view>
174 173
   </view>
175 174
 </view>

+ 42 - 15
pages/main/article.wxss

@@ -28,7 +28,7 @@
28 28
 
29 29
 .panel1{
30 30
   width:670rpx;
31
-  margin: 180rpx 0 250rpx 0; /* 增加上边距,确保内容不会被导航栏遮挡 */
31
+  margin: 40rpx 0 250rpx 0; /* 增加上边距,确保内容不会被导航栏遮挡 */
32 32
   justify-content: flex-start;
33 33
   align-items: flex-start;
34 34
 }
@@ -185,7 +185,7 @@
185 185
 
186 186
 
187 187
 .panelError{
188
-  margin-top: 560rpx;
188
+  margin-top: 420rpx;
189 189
   font-size: 28rpx;
190 190
 }
191 191
 
@@ -654,53 +654,80 @@
654 654
 .panelBuilding1{
655 655
   width: 100%;
656 656
   position: fixed;
657
-  top:345rpx;
657
+  top:160rpx;
658 658
 }
659 659
 
660 660
 .pic_03{
661 661
   width:100%;
662
-  height:880rpx;
662
+  height:1050rpx;
663 663
   position: absolute;
664 664
   top:0;
665 665
 }
666 666
 .sysIcon_b08{
667
-  width:220rpx;
668
-  height:220rpx;
667
+  width:100%;
668
+  height:150rpx;
669 669
   position: absolute;
670
-  top:347rpx;
670
+  top: 353rpx;
671 671
   z-index: 25;
672 672
 }
673 673
 
674 674
 .panelBuilding11{
675 675
   position: absolute;
676
-  top: 170rpx;
676
+  top: 150rpx;
677
+  left:100rpx;
677 678
   color: #2E2E2E;
679
+  align-items: flex-start;
678 680
 }
679 681
 
680 682
 .text08{
681 683
   font-size: 48rpx;
682 684
 }
683 685
 .text09{
684
-  font-size: 28rpx;
685
-  text-align: center;
686
+  font-size: 24rpx;
687
+  text-align: left;
686 688
   margin-top: 20rpx;
687 689
   font-weight: 400;
688 690
 }
689 691
 
690 692
 .panelBuilding12{
691 693
   position: absolute;
692
-  top: 610rpx;
694
+  top: 533rpx;
693 695
   color: #FDAD94;
696
+  align-items: flex-start;
694 697
 }
695 698
 
696 699
 .text10{
700
+  margin-left: 30rpx;
697 701
   font-size: 24rpx;
698 702
   text-align: center;
699 703
 }
700
-.text11{
704
+
705
+.panelBuilding121{
706
+  flex-wrap: wrap;
707
+  margin-top: 30rpx;
708
+}
709
+
710
+.panelBuilding1211{
711
+  width: 300rpx;
712
+  min-height: 140rpx;
713
+  margin: 0 25rpx 20rpx 25rpx;
714
+  align-items: flex-start;
715
+}
716
+.sysIcon_a17{
717
+  width:30rpx;
718
+  height:30rpx;
719
+  margin: 5rpx 20rpx 0 0;
720
+}
721
+.panelBuilding12111{
722
+  align-items: flex-start;
723
+}
724
+.panelBuilding1211text{
725
+  width:250rpx;
701 726
   font-size: 28rpx;
702
-  text-align: center;
703
-  margin-top: 10rpx;
704 727
   font-weight: 400;
705
-  width: 640rpx;
728
+}
729
+.panelBuilding1211text2{
730
+  font-size: 24rpx;
731
+  font-weight: 400;
732
+  margin-top: 10rpx;
706 733
 }

+ 21 - 1
pages/main/wordsinput.js

@@ -21,7 +21,10 @@ Page({
21 21
       grade=[{Name:"小学",CSS:"Selected"},{Name:"初中",CSS:""},{Name:"高中",CSS:""},{Name:"大学",CSS:""}];
22 22
     let ArticleStyle=wx.getStorageSync('ArticleStyle');
23 23
     if (!ArticleStyle)
24
-      ArticleStyle=[{Name:"随机",CSS:"Selected"},{Name:"童话",CSS:""},{Name:"科幻",CSS:""},{Name:"奇幻",CSS:""},{Name:"旅行",CSS:""},{Name:"动物",CSS:""},{Name:"家庭亲子",CSS:""},{Name:"校园生活",CSS:""},{Name:"科普",CSS:""},{Name:"节日文化",CSS:""},{Name:"成长",CSS:""},{Name:"人生励志",CSS:""},{Name:"环保",CSS:""}];
24
+      ArticleStyle=[{Name:"随机",CSS:"Selected"},{Name:"童话",CSS:""},{Name:"奇幻",CSS:""},{Name:"动物",CSS:""},{Name:"校园生活",CSS:""},{Name:"家庭亲子",CSS:""},{Name:"成长",CSS:""},{Name:"科幻",CSS:""},{Name:"环保",CSS:""},{Name:"旅行",CSS:""},{Name:"科普",CSS:""},{Name:"节日文化",CSS:""},{Name:"人生励志",CSS:""}];
25
+    let AIVersion=wx.getStorageSync('AIVersion');
26
+    if (!AIVersion)
27
+      AIVersion=[{Version:"1.0",Content:"基础词汇,结构简明\n平均30秒生成",CSS:"Selected"},{Version:"1.5",Content:"词句丰富,深度表达\n平均60秒生成",CSS:""}];
25 28
   
26 29
     const hiddenhelp=wx.getStorageSync('HiddenWordInputFirstOpen');
27 30
 
@@ -29,6 +32,7 @@ Page({
29 32
       Containnerheight: main.getWindowHeight(),
30 33
       Grade:grade,
31 34
       ArticleStyle:ArticleStyle,
35
+      AIVersion:AIVersion,
32 36
       IsShowFirstOpen:!hiddenhelp,
33 37
       KeyboardBtnName:"next",
34 38
     });
@@ -199,6 +203,9 @@ Page({
199 203
     let arr=this.data.Grade;
200 204
     if (id==1)
201 205
       arr=this.data.ArticleStyle;
206
+    else if (id==2)
207
+      arr=this.data.AIVersion;
208
+      
202 209
     for(let i=0;i<arr.length;i++){
203 210
       arr[i].CSS="";
204 211
       if (i==index)
@@ -210,6 +217,12 @@ Page({
210 217
       });
211 218
       wx.setStorageSync('ArticleStyle', arr);
212 219
     }
220
+    else if (id==2){
221
+      this.setData({
222
+        AIVersion:arr,
223
+      });
224
+      wx.setStorageSync('AIVersion', arr);
225
+    }
213 226
     else{
214 227
       this.setData({
215 228
         Grade:arr,
@@ -244,6 +257,13 @@ Page({
244 257
           break;
245 258
         }
246 259
       }
260
+      arr=this.data.AIVersion;
261
+      for(let i=0;i<arr.length;i++){
262
+        if (arr[i].CSS=="Selected"){
263
+          url+="&AIVersion="+arr[i].Version;
264
+          break;
265
+        }
266
+      }
247 267
     }
248 268
 
249 269
     

+ 15 - 4
pages/main/wordsinput.wxml

@@ -6,7 +6,7 @@
6 6
         <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
7 7
         <view>示范</view>
8 8
       </view>
9
-      <view class="panel112 FlexRow" bind:tap="clearInput" data-id="0">清空全部</view>
9
+      <view class="panel112 FlexRow" bind:tap="clearInput" data-id="0">清空</view>
10 10
     </view>
11 11
   </view>
12 12
   <view class="panel10 FlexRow" wx:if="{{IsShowAlert}}">
@@ -63,15 +63,26 @@
63 63
       <view class="text04">要求</view>
64 64
     </view>
65 65
     <view class="panelMenu11 FlexColumn">
66
-      <view class="text04 text05">接近哪个年龄段的单词水平</view>
66
+      <view class="text04 text05">单词水平</view>
67 67
       <view class="panelMenu111 FlexRow">
68 68
         <view class="btn btn{{item.CSS}} FlexRow" wx:for="{{Grade}}" wx:key="index" capture-bind:tap="selectBtn" data-id="0" data-index="{{index}}">{{item.Name}}</view>
69 69
       </view>
70 70
     </view>
71 71
     <view class="panelMenu11 FlexColumn">
72
-      <view class="text04 text06">短文主题</view>
72
+      <view class="text04 text06">主题</view>
73
+      <scroll-view scroll-x="true" class="panelMenu1110">
74
+        <view class="panelMenu1111 FlexRow">
75
+          <view class="btn btn{{item.CSS}} FlexRow" wx:for="{{ArticleStyle}}" wx:key="index" capture-bind:tap="selectBtn" data-id="1" data-index="{{index}}">{{item.Name}}</view>
76
+        </view>
77
+      </scroll-view>
78
+    </view>
79
+    <view class="panelMenu11 FlexColumn">
80
+      <view class="text04 text05">模型</view>
73 81
       <view class="panelMenu111 FlexRow">
74
-        <view class="btn btn{{item.CSS}} FlexRow" wx:for="{{ArticleStyle}}" wx:key="index" capture-bind:tap="selectBtn" data-id="1" data-index="{{index}}">{{item.Name}}</view>
82
+        <view class="btn btn4 btn{{item.CSS}} FlexRow" wx:for="{{AIVersion}}" wx:key="index" capture-bind:tap="selectBtn" data-id="2" data-index="{{index}}">
83
+          <view class="btn41">{{item.Version}}</view>
84
+          <text>{{item.Content}}</text>
85
+        </view>
75 86
       </view>
76 87
     </view>
77 88
     <view class="btn2 FlexRow" catch:tap="goto" data-url="article">

+ 35 - 10
pages/main/wordsinput.wxss

@@ -21,7 +21,7 @@
21 21
   margin-left: 40rpx;
22 22
 }
23 23
 .panel112{
24
-  width: 136rpx;
24
+  width: 88rpx;
25 25
   height:73rpx;
26 26
   border: 3rpx solid #C1E1C1;
27 27
   border-radius: 20rpx;
@@ -226,6 +226,7 @@
226 226
   background: #1E1E1E;
227 227
   border-radius: 60rpx 60rpx 0 0;
228 228
   position: fixed;
229
+  color:#F0F0F0;
229 230
   bottom:0;
230 231
   justify-content: flex-start;
231 232
 }
@@ -245,12 +246,24 @@
245 246
   margin: 20rpx 0 0 40rpx;
246 247
 }
247 248
 .panelMenu111{
248
-  width:720rpx;
249
-  flex-wrap: wrap;
249
+  width:100%;
250 250
   margin: 30rpx 0 0 30rpx;
251 251
   justify-content: flex-start;
252 252
   align-items: flex-start;
253 253
 }
254
+.panelMenu1110{
255
+  width:100%;
256
+  margin: 30rpx 0 -20rpx 0;
257
+  white-space: nowrap;
258
+}
259
+.panelMenu1111{
260
+  width:1108rpx;
261
+  height:260rpx;
262
+  margin-left: 20rpx;
263
+  flex-wrap: wrap;
264
+  justify-content: flex-start;
265
+  align-items: flex-start;
266
+}
254 267
 
255 268
 .btn{
256 269
   margin: 0 20rpx 20rpx 0;
@@ -260,15 +273,9 @@
260 273
   border: 6rpx solid #303030;
261 274
   box-shadow: 0 6rpx 0 0 rgba(0,0,0,0.20);
262 275
   border-radius: 20rpx;
263
-  color:#D2D2D2;
276
+  color:#C1E1C1;
264 277
   font-size: 28rpx;
265 278
 }
266
-.btnSelected{
267
-  background: #0D4433;
268
-  border: 6rpx solid #C1E1C1;
269
-  box-shadow: 0 6rpx 0 0 rgba(0,0,0,0.10);
270
-  color: #C1E1C1;
271
-}
272 279
 
273 280
 .btn2{
274 281
   width: 650rpx;
@@ -278,6 +285,24 @@
278 285
   margin: 60rpx 0;
279 286
   font-size: 36rpx;
280 287
 }
288
+.btn4{
289
+  height:126rpx;
290
+  margin: 0 10rpx;
291
+  font-size: 24rpx;
292
+}
293
+
294
+.btnSelected{
295
+  background: #0D4433;
296
+  border: 6rpx solid #C1E1C1;
297
+  box-shadow: 0 6rpx 0 0 rgba(0,0,0,0.10);
298
+  color: #C1E1C1;
299
+}
300
+
301
+.btn41{
302
+  margin: 0 20rpx 0 0;
303
+  font-size: 28rpx;
304
+}
305
+
281 306
 .sysIcon_b01{
282 307
   width:40rpx;
283 308
   height:40rpx;