chengjie преди 4 месеца
родител
ревизия
35597abda1

+ 19 - 2
components/alert-tip/alert-tip.js

@@ -7,7 +7,7 @@ Component({
7
       value: ''
7
       value: ''
8
     },
8
     },
9
     // 容器背景颜色
9
     // 容器背景颜色
10
-    containerbgColor: {
10
+    containerBgColor: {
11
       type: String,
11
       type: String,
12
       value: '#e3e3e3'
12
       value: '#e3e3e3'
13
     },
13
     },
@@ -43,11 +43,27 @@ Component({
43
     alertClass: ''
43
     alertClass: ''
44
   },
44
   },
45
 
45
 
46
+  data: {
47
+    isShow: false,
48
+    alertClass: '',
49
+    isProcessing: false  // 新增标志,表示是否正在处理提示
50
+  },
51
+
46
   methods: {
52
   methods: {
47
     // 显示提示
53
     // 显示提示
48
     showAlert: function(content) {
54
     showAlert: function(content) {
49
       const that = this;
55
       const that = this;
50
       
56
       
57
+      // 如果当前已有提示在显示或处理中,则忽略此次调用
58
+      if (this.data.isProcessing) {
59
+        return;
60
+      }
61
+      
62
+      // 标记为正在处理中
63
+      this.setData({
64
+        isProcessing: true
65
+      });
66
+      
51
       // 如果传入了content参数,则更新content属性
67
       // 如果传入了content参数,则更新content属性
52
       if (content) {
68
       if (content) {
53
         this.setData({
69
         this.setData({
@@ -71,7 +87,8 @@ Component({
71
         setTimeout(function() {
87
         setTimeout(function() {
72
           that.setData({
88
           that.setData({
73
             isShow: false,
89
             isShow: false,
74
-            alertClass: ''
90
+            alertClass: '',
91
+            isProcessing: false  // 处理完成,重置标志
75
           });
92
           });
76
         }, that.data.fadeOutDuration);
93
         }, that.data.fadeOutDuration);
77
       }, that.data.duration);
94
       }, that.data.duration);

+ 1 - 1
components/alert-tip/alert-tip.wxml

@@ -1,4 +1,4 @@
1
-<view class="alert-container {{alertClass}} FlexRow" wx:if="{{isShow}}" style="background-color: {{containerbgColor}};">
1
+<view class="alert-container {{alertClass}} FlexRow" wx:if="{{isShow}}" style="background: {{containerBgColor}};">
2
   <view class="alert-content FlexRow" style="background-color: {{bgColor}};">
2
   <view class="alert-content FlexRow" style="background-color: {{bgColor}};">
3
     <image src="{{iconPath}}" class="alert-icon"></image>
3
     <image src="{{iconPath}}" class="alert-icon"></image>
4
     <view class="alert-text" style="color: {{textColor}};">{{content}}</view>
4
     <view class="alert-text" style="color: {{textColor}};">{{content}}</view>

+ 0 - 1
pages/main/mywords.js

@@ -8,7 +8,6 @@ Page({
8
   data: {
8
   data: {
9
     IsShowSelect:false,
9
     IsShowSelect:false,
10
     IsShowRemind:false,
10
     IsShowRemind:false,
11
-    IsShowAlert:false,
12
     AlertClass:"",
11
     AlertClass:"",
13
     Sort1:"panel112",
12
     Sort1:"panel112",
14
     Sort2:"",
13
     Sort2:"",

+ 56 - 49
pages/main/mywords.wxml

@@ -1,64 +1,71 @@
1
 <view class="container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
1
 <view class="container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
2
-  <view class="panel1 FlexRow">
3
-    <view wx:if="{{IsShowSelect}}" class="panel12 panel13 FlexRow" bind:tap="selecItem" data-index="all">全选</view>
4
-    <view class="panel11 FlexRow">
5
-      <view class="panel111 {{Sort1}} FlexRow" bind:tap="sortWord" data-issort="0">时间</view>
6
-      <view class="panel111 {{Sort2}} FlexRow" bind:tap="sortWord" data-issort="1">A - Z</view>
2
+  <block wx:if="{{List.length==0}}">
3
+    <view class="textNull1">无内容</view>
4
+    <view class="textNull2">在文章中点击单词可收藏</view>
5
+  </block>
6
+  <block wx:if="{{List.length>0}}">
7
+    <view class="panel1 FlexRow">
8
+      <view wx:if="{{IsShowSelect}}" class="panel12 panel13 FlexRow" bind:tap="selecItem" data-index="all">全选</view>
9
+      <view class="panel11 FlexRow">
10
+        <view class="panel111 {{Sort1}} FlexRow" bind:tap="sortWord" data-issort="0">时间</view>
11
+        <view class="panel111 {{Sort2}} FlexRow" bind:tap="sortWord" data-issort="1">A - Z</view>
12
+      </view>
13
+      <view wx:if="{{!IsShowSelect}}" class="panel12 FlexRow" bind:tap="setDataBoolean" data-name="IsShowSelect">多选</view>
14
+      <view wx:if="{{IsShowSelect}}" class="panel12 FlexRow" bind:tap="setDataBoolean" data-name="IsShowSelect">取消</view>
7
     </view>
15
     </view>
8
-    <view wx:if="{{!IsShowSelect}}" class="panel12 FlexRow" bind:tap="setDataBoolean" data-name="IsShowSelect">多选</view>
9
-    <view wx:if="{{IsShowSelect}}" class="panel12 FlexRow" bind:tap="setDataBoolean" data-name="IsShowSelect">取消</view>
10
-  </view>
11
 
16
 
12
-  <alert-tip id="alertTip" 
13
-    container-bg-color="#E3E3E3" 
14
-    bg-color="#CA4B15" 
15
-    text-color="#FFFFFF" 
16
-    icon-path="../../pages/images/sysIcon_b11.png"
17
-    duration="2000"
18
-    fade-out-duration="2000">
19
-  </alert-tip>
17
+    <alert-tip id="alertTip" 
18
+      container-bg-color="#E3E3E3" 
19
+      bg-color="#CA4B15" 
20
+      text-color="#FFFFFF" 
21
+      icon-path="../../pages/images/sysIcon_b11.png"
22
+      duration="2000"
23
+      fade-out-duration="2000">
24
+    </alert-tip>
20
 
25
 
21
-  <view style="height: 100rpx;"></view>
22
-  <view class="panel2 FlexColumn">
23
-    <view style="height: 20rpx;"></view>
24
-    <view class="panel2Item FlexRow" wx:for="{{List}}" wx:key="index" bind:tap="selecItem" data-index="{{index}}">
25
-      <view class="panel2ItemSelect FlexRow" wx:if="{{IsShowSelect}}">
26
-        <view class="panel2ItemSelectNo" wx:if="{{!item.Selected}}" ></view>
27
-        <view class="panel2ItemSelectNo panel2ItemSelected FlexRow"  wx:if="{{item.Selected}}">
28
-          <image src="../images/sysIcon_a11.png" class="sysIcon_a11"></image>
26
+    <view style="height: 100rpx;"></view>
27
+    <view class="panel2 FlexColumn">
28
+      <view style="height: 20rpx;"></view>
29
+      <view class="panel2Item FlexRow" wx:for="{{List}}" wx:key="index" bind:tap="selecItem" data-index="{{index}}">
30
+        <view class="panel2ItemSelect FlexRow" wx:if="{{IsShowSelect}}">
31
+          <view class="panel2ItemSelectNo" wx:if="{{!item.Selected}}" ></view>
32
+          <view class="panel2ItemSelectNo panel2ItemSelected FlexRow"  wx:if="{{item.Selected}}">
33
+            <image src="../images/sysIcon_a11.png" class="sysIcon_a11"></image>
34
+          </view>
29
         </view>
35
         </view>
30
-      </view>
31
-      <view class="panel2ItemLeft">{{item.Word}}</view>
32
-      <view class="panel2ItemRight FlexRow" wx:if="{{!IsShowSelect}}">
33
-        <view class="panel2ItemRight1 FlexRow" bind:tap="showRemindStart" data-type="0" data-word="{{item.Word}}">
34
-          <image src="../images/sysIcon_a39.png" class="sysIcon_a39"></image>
36
+        <view class="panel2ItemLeft">{{item.Word}}</view>
37
+        <view class="panel2ItemRight FlexRow" wx:if="{{!IsShowSelect}}">
38
+          <view class="panel2ItemRight1 FlexRow" bind:tap="showRemindStart" data-type="0" data-word="{{item.Word}}">
39
+            <image src="../images/sysIcon_a39.png" class="sysIcon_a39"></image>
40
+          </view>
35
         </view>
41
         </view>
36
       </view>
42
       </view>
37
     </view>
43
     </view>
38
-  </view>
39
 
44
 
40
-  <view style="height: 150rpx;" hidden="{{!IsShowSelect}}"></view>
45
+    <view style="height: 150rpx;" hidden="{{!IsShowSelect}}"></view>
41
 
46
 
42
-  <view class="panelFooter FlexRow" wx:if="{{IsShowSelect}}">
43
-    <view class="panelFooter1 FlexRow">
44
-      <view class="panelFooter11 panelFooter10 FlexColumn" >
45
-        <view class="text03">{{Count}}</view>
46
-        <view class="text02">已选</view>
47
-      </view>
48
-      <view class="panelFooter12 panelFooter10 FlexColumn" catch:tap="showRemindStart" data-type="1" >
49
-        <image src="../images/sysIcon_a14.png" class="sysIcon_a14"></image>
50
-        <view class="text02">删除</view>
51
-      </view>
52
-      <view class="panelFooter12 panelFooter10 FlexColumn" catch:tap="showRemindStart" data-type="2"  >
53
-        <image src="../images/sysIcon_a40.png" class="sysIcon_a14"></image>
54
-        <view class="text02">生成文章</view>
55
-      </view>
56
-      <view class="panelFooter13 panelFooter10 FlexColumn" catch:tap="showRemindStart" data-type="3" >
57
-        <image src="../images/sysIcon_a41.png" class="sysIcon_a14"></image>
58
-        <view class="text02">导到秒过</view>
47
+    <view class="panelFooter FlexRow" wx:if="{{IsShowSelect}}">
48
+      <view class="panelFooter1 FlexRow">
49
+        <view class="panelFooter11 panelFooter10 FlexColumn" >
50
+          <view class="text03">{{Count}}</view>
51
+          <view class="text02">已选</view>
52
+        </view>
53
+        <view class="panelFooter12 panelFooter10 FlexColumn" catch:tap="showRemindStart" data-type="1" >
54
+          <image src="../images/sysIcon_a14.png" class="sysIcon_a14"></image>
55
+          <view class="text02">删除</view>
56
+        </view>
57
+        <view class="panelFooter12 panelFooter10 FlexColumn" catch:tap="showRemindStart" data-type="2"  >
58
+          <image src="../images/sysIcon_a40.png" class="sysIcon_a14"></image>
59
+          <view class="text02">生成文章</view>
60
+        </view>
61
+        <view class="panelFooter13 panelFooter10 FlexColumn" catch:tap="showRemindStart" data-type="3" >
62
+          <image src="../images/sysIcon_a41.png" class="sysIcon_a14"></image>
63
+          <view class="text02">导到秒过</view>
64
+        </view>
59
       </view>
65
       </view>
60
     </view>
66
     </view>
61
-  </view>
67
+  </block>
68
+  
62
 </view>
69
 </view>
63
 
70
 
64
 <view wx:if="{{IsShowRemind}}" class="panelRemindParent {{parentAnimation}} container FlexColumn" style='min-height:{{Containnerheight}}rpx;{{VectorCSS}}'>
71
 <view wx:if="{{IsShowRemind}}" class="panelRemindParent {{parentAnimation}} container FlexColumn" style='min-height:{{Containnerheight}}rpx;{{VectorCSS}}'>

+ 9 - 0
pages/main/mywords.wxss

@@ -2,6 +2,15 @@
2
   background: #E3E3E3;
2
   background: #E3E3E3;
3
   color: #4D4D4D;
3
   color: #4D4D4D;
4
 }
4
 }
5
+.textNull1{
6
+  margin-top: 460rpx;
7
+  font-size: 28rpx;
8
+}
9
+.textNull2{
10
+  margin-top: 10rpx;
11
+  font-size: 24rpx;
12
+  font-weight: 400;
13
+}
5
 
14
 
6
 .panel1 {
15
 .panel1 {
7
   width: 100%;
16
   width: 100%;

+ 1 - 1
pages/main/ocr.js

@@ -146,7 +146,7 @@ Page({
146
         throw new Error('未识别到有效文字')
146
         throw new Error('未识别到有效文字')
147
       }
147
       }
148
 
148
 
149
-      debugger;
149
+      //debugger;
150
       // 6.提取英文单词
150
       // 6.提取英文单词
151
       const engTexts=this.extractEnglishWords(texts);
151
       const engTexts=this.extractEnglishWords(texts);
152
 
152
 

+ 2 - 6
pages/main/selectword.js

@@ -8,7 +8,6 @@ const app = getApp();
8
 Page({
8
 Page({
9
   behaviors: [commonBehavior],
9
   behaviors: [commonBehavior],
10
   data: {
10
   data: {
11
-    IsShowAlert:false,
12
     Count:0,
11
     Count:0,
13
     CountMax:COUNT_MAX,
12
     CountMax:COUNT_MAX,
14
     Words:[],
13
     Words:[],
@@ -25,7 +24,7 @@ Page({
25
   onShow:function(e){
24
   onShow:function(e){
26
     let that = this;
25
     let that = this;
27
     let words=app.globalData.OCRWords;
26
     let words=app.globalData.OCRWords;
28
-    debugger;
27
+    //debugger;
29
     that.data.Words=[];
28
     that.data.Words=[];
30
     let list=app.globalData.SelectedWords;
29
     let list=app.globalData.SelectedWords;
31
     let count=0;
30
     let count=0;
@@ -77,7 +76,6 @@ Page({
77
       this.setData({
76
       this.setData({
78
         Words:list,
77
         Words:list,
79
         Count:count,
78
         Count:count,
80
-        IsShowAlert:false,
81
       });
79
       });
82
     }
80
     }
83
   },
81
   },
@@ -109,9 +107,7 @@ Page({
109
   },
107
   },
110
   submit:function(){
108
   submit:function(){
111
     if (this.data.Count==0){
109
     if (this.data.Count==0){
112
-      this.setData({
113
-        IsShowAlert:true,
114
-      });
110
+      this.selectComponent('#alertTip').showAlert("请至少选择1个单词");
115
     }
111
     }
116
     else{
112
     else{
117
       let list=this.data.Words;
113
       let list=this.data.Words;

+ 3 - 1
pages/main/selectword.json

@@ -1,4 +1,6 @@
1
 {
1
 {
2
   "navigationBarTitleText": "选单词",
2
   "navigationBarTitleText": "选单词",
3
-  "usingComponents": {}
3
+  "usingComponents": {
4
+    "alert-tip": "../../components/alert-tip/alert-tip"
5
+  }
4
 }
6
 }

+ 8 - 6
pages/main/selectword.wxml

@@ -11,12 +11,14 @@
11
       </view>
11
       </view>
12
     </view>
12
     </view>
13
 
13
 
14
-    <view class="panel10 FlexRow" wx:if="{{IsShowAlert}}">
15
-      <view class="panel101 FlexRow">
16
-        <image src="../images/sysIcon_b11.png" class="sysIcon_a03"></image>
17
-        <view class="text03">请至少选择1个单词</view>
18
-      </view>
19
-    </view>
14
+    <alert-tip id="alertTip" 
15
+      container-bg-color="linear-gradient(180deg, #004433 0%, rgba(0,46,34,0.80) 100%)" 
16
+      bg-color="#CA4B15" 
17
+      text-color="#FFFFFF" 
18
+      icon-path="../../pages/images/sysIcon_b11.png"
19
+      duration="3000"
20
+      fade-out-duration="2000">
21
+    </alert-tip>
20
 
22
 
21
     <view class="panel2 FlexRow">
23
     <view class="panel2 FlexRow">
22
       <view class="panel21 FlexRow">
24
       <view class="panel21 FlexRow">

+ 0 - 24
pages/main/selectword.wxss

@@ -33,30 +33,6 @@
33
   margin-right: 10rpx;
33
   margin-right: 10rpx;
34
 }
34
 }
35
 
35
 
36
-.panel10{
37
-  position: fixed;
38
-  top:0;
39
-  width: 100%;
40
-  height:100rpx;
41
-  z-index: 10;
42
-  justify-content: flex-start;
43
-  align-items: flex-start;
44
-  background-image: linear-gradient(180deg, #004433 0%, rgba(0,46,34,0.80) 100%);
45
-}
46
-
47
-.panel101{
48
-  background: #CA4B15;
49
-  border-radius: 10rpx;
50
-  height:70rpx;
51
-  margin: 20rpx 0 0 30rpx;
52
-  padding: 0 30rpx;
53
-}
54
-
55
-.text03{
56
-  font-size:24rpx;
57
-  color:#fff;
58
-  margin-left: 20rpx;
59
-}
60
 
36
 
61
 .sysIcon_a03{
37
 .sysIcon_a03{
62
   width:20rpx;
38
   width:20rpx;

+ 21 - 20
pages/main/wordsinput.js

@@ -10,7 +10,6 @@ Page({
10
   behaviors: [commonBehavior],
10
   behaviors: [commonBehavior],
11
   data: {
11
   data: {
12
     Words:[],
12
     Words:[],
13
-    IsShowAlert:false,
14
     IsShowSetPanel:false,
13
     IsShowSetPanel:false,
15
     IsShowFirstOpen:false,
14
     IsShowFirstOpen:false,
16
     IsShowExample:false,
15
     IsShowExample:false,
@@ -173,10 +172,14 @@ Page({
173
         break;
172
         break;
174
       }
173
       }
175
     }
174
     }
176
-    that.setData({
177
-      IsShowAlert:b,
178
-      AlertContent:"请勿使用数字、符号、句子等非英语单词内容"
179
-    });
175
+
176
+    if (b){
177
+      this.selectComponent('#alertTip').showAlert("请勿使用数字、符号、句子等非英语单词内容");
178
+      return false;
179
+    }
180
+    else{
181
+      return true;
182
+    }
180
   },
183
   },
181
   setArticleParam:function(e){
184
   setArticleParam:function(e){
182
     let that=this;
185
     let that=this;
@@ -189,25 +192,23 @@ Page({
189
       }
192
       }
190
     }
193
     }
191
     if (count<5){
194
     if (count<5){
192
-      that.setData({
193
-        IsShowAlert:true,
194
-        AlertContent:"请输入至少5个英语单词或词组"
195
-      });
195
+      this.selectComponent('#alertTip').showAlert("请输入至少5个英语单词或词组");
196
     }
196
     }
197
     else{
197
     else{
198
-      that.checkMsgSec(function(result){
199
-        if (result){
200
-          that.setData({
201
-            IsShowAlert:false,
202
-            IsShowSetPanel:true,
203
-          });
198
+      if (that.isShowAlert()){
199
+        that.checkMsgSec(function(result){
200
+          if (result){
201
+            that.setData({
202
+              IsShowSetPanel:true,
203
+            });
204
 
204
 
205
-          if (wx.getStorageSync("IsShowGuideContainer")){
206
-            
207
-            main.showGuideContainer(that,"#btnLevel1",150,-50,"pic_ha04",135,167);
205
+            if (wx.getStorageSync("IsShowGuideContainer")){
206
+              
207
+              main.showGuideContainer(that,"#btnLevel1",150,-50,"pic_ha04",135,167);
208
+            }
208
           }
209
           }
209
-        }
210
-      });
210
+        });
211
+      }
211
     }
212
     }
212
   },
213
   },
213
   //敏感词判断
214
   //敏感词判断

+ 3 - 1
pages/main/wordsinput.json

@@ -1,4 +1,6 @@
1
 {
1
 {
2
   "navigationBarTitleText": "文章制作",
2
   "navigationBarTitleText": "文章制作",
3
-  "usingComponents": {}
3
+  "usingComponents": {
4
+    "alert-tip": "../../components/alert-tip/alert-tip"
5
+  }
4
 }
6
 }

+ 9 - 6
pages/main/wordsinput.wxml

@@ -10,12 +10,15 @@
10
       <view class="panel112 FlexRow" bind:tap="clearInput" data-id="0">清空</view>
10
       <view class="panel112 FlexRow" bind:tap="clearInput" data-id="0">清空</view>
11
     </view>
11
     </view>
12
   </view>
12
   </view>
13
-  <view class="panel10 FlexRow" wx:if="{{IsShowAlert}}">
14
-    <view class="panel101 FlexRow">
15
-      <image src="../images/sysIcon_b11.png" class="sysIcon_a03"></image>
16
-      <view class="text03">{{AlertContent}}</view>
17
-    </view>
18
-  </view>
13
+  
14
+  <alert-tip id="alertTip" 
15
+    container-bg-color="linear-gradient(180deg, #004433 0%, rgba(0,46,34,0.80) 100%)" 
16
+    bg-color="#CA4B15" 
17
+    text-color="#FFFFFF" 
18
+    icon-path="../../pages/images/sysIcon_b11.png"
19
+    duration="3000"
20
+    fade-out-duration="2000">
21
+  </alert-tip>
19
 
22
 
20
   <view class="panel2 FlexColumn">
23
   <view class="panel2 FlexColumn">
21
     <block wx:for="{{Words}}" wx:key="index">
24
     <block wx:for="{{Words}}" wx:key="index">

+ 0 - 25
pages/main/wordsinput.wxss

@@ -38,31 +38,6 @@
38
   margin-right: 10rpx;
38
   margin-right: 10rpx;
39
 }
39
 }
40
 
40
 
41
-.panel10{
42
-  position: fixed;
43
-  top:0;
44
-  width: 100%;
45
-  height:100rpx;
46
-  z-index: 10;
47
-  justify-content: flex-start;
48
-  align-items: flex-start;
49
-  background-image: linear-gradient(180deg, #004433 0%, rgba(0,46,34,0.80) 100%);
50
-}
51
-
52
-.panel101{
53
-  background: #CA4B15;
54
-  border-radius: 10rpx;
55
-  height:70rpx;
56
-  margin: 20rpx 0 0 30rpx;
57
-  padding: 0 30rpx;
58
-}
59
-
60
-.text03{
61
-  font-size:24rpx;
62
-  color:#fff;
63
-  margin-left: 20rpx;
64
-}
65
-
66
 .sysIcon_a03{
41
 .sysIcon_a03{
67
   width:20rpx;
42
   width:20rpx;
68
   height:20rpx;
43
   height:20rpx;