chengjie 4 月之前
父节点
当前提交
753daee2da
共有 3 个文件被更改,包括 10 次插入5 次删除
  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
 // app.js
1
 // app.js
2
 App({
2
 App({
3
   globalData: {
3
   globalData: {
4
-    Version: "1.0.6",
5
-    //IsProduction: true,
4
+    Version: "1.0.7",
5
+    IsProduction: true,
6
     ShareTitle: "阅读理解+答题",
6
     ShareTitle: "阅读理解+答题",
7
     SharePath: "pages/index/index",
7
     SharePath: "pages/index/index",
8
     ShareImage: '../images/pic_07.png',
8
     ShareImage: '../images/pic_07.png',
@@ -33,6 +33,7 @@ App({
33
     SelectedWords:[],//选中的单词
33
     SelectedWords:[],//选中的单词
34
     ocrReady: false,//
34
     ocrReady: false,//
35
     Generating:false,//生成文章中
35
     Generating:false,//生成文章中
36
+    GeneratingStart:false,//生成文章中已经开始
36
   },
37
   },
37
   onLaunch: function (options) {
38
   onLaunch: function (options) {
38
     let that=this;
39
     let that=this;

+ 1 - 0
pages/main/article.js

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

+ 6 - 3
utils/main.js

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