chengjie 4 months ago
parent
commit
753daee2da
3 changed files with 10 additions and 5 deletions
  1. 3 2
      app.js
  2. 1 0
      pages/main/article.js
  3. 6 3
      utils/main.js

+ 3 - 2
app.js

@@ -1,8 +1,8 @@
1 1
 // app.js
2 2
 App({
3 3
   globalData: {
4
-    Version: "1.0.6",
5
-    //IsProduction: true,
4
+    Version: "1.0.7",
5
+    IsProduction: true,
6 6
     ShareTitle: "阅读理解+答题",
7 7
     SharePath: "pages/index/index",
8 8
     ShareImage: '../images/pic_07.png',
@@ -33,6 +33,7 @@ App({
33 33
     SelectedWords:[],//选中的单词
34 34
     ocrReady: false,//
35 35
     Generating:false,//生成文章中
36
+    GeneratingStart:false,//生成文章中已经开始
36 37
   },
37 38
   onLaunch: function (options) {
38 39
     let that=this;

+ 1 - 0
pages/main/article.js

@@ -142,6 +142,7 @@ Page({
142 142
       AIVersion:that.data.AIVersion
143 143
     }, function (data) {
144 144
       app.globalData.Generating=false;
145
+      app.globalData.GeneratingStart=false;
145 146
       if (data){
146 147
         if (data=="-1"){
147 148
           that.setData({

+ 6 - 3
utils/main.js

@@ -11,7 +11,7 @@ function getData(url, callback) {
11 11
   //console.log("加密后的结果为===",url);
12 12
   wx.request({
13 13
     url: app.globalData.serverUrl + url,
14
-    timeout:120000,
14
+    timeout:150000,
15 15
     success: function (res) {
16 16
       if (res.statusCode)
17 17
         common.checkError(res.statusCode);
@@ -39,7 +39,7 @@ function postData(url, postData, callback) {
39 39
   wx.request({
40 40
     url: app.globalData.serverUrl + url,
41 41
     method: "POST",
42
-    timeout:120000,
42
+    timeout:150000,
43 43
     data: postData,
44 44
     success: function (res) {
45 45
       if (res.statusCode)
@@ -155,7 +155,8 @@ function onSelect(obj,event,callback){
155 155
 
156 156
 function checkGenerating(){
157 157
   let that=this;
158
-  if (app.globalData.Generating){
158
+  if (app.globalData.Generating && !app.globalData.GeneratingStart){
159
+    app.globalData.GeneratingStart=true;
159 160
     let timeStart=new Date().getTime();
160 161
     let intervalGenerate=setInterval(function(){
161 162
       let time=(new Date().getTime()-timeStart)/1000;
@@ -166,6 +167,8 @@ function checkGenerating(){
166 167
         if (!(page.NavigationDepth==3 
167 168
           && page.CurrentRoute=="pages/main/article" 
168 169
           && page.BackFromPage=="pages/main/article")){
170
+            app.globalData.Generating=false;
171
+            app.globalData.GeneratingStart=false;
169 172
             wx.showModal({
170 173
               title: '通知',
171 174
               content: '文章生成好了。',