chengjie 4 mesi fa
parent
commit
8f56b639d3

+ 27 - 0
pages/behaviors/commonBehavior.js

@@ -0,0 +1,27 @@
1
+/**
2
+ * 引导容器相关行为
3
+ * 用于共享引导容器相关的方法和属性
4
+ */
5
+module.exports = Behavior({
6
+  methods: {
7
+    /**
8
+     * 关闭引导容器
9
+     * 设置IsShowGuideContainer为false并保存到本地存储
10
+     */
11
+    closeGuideContainer: function() {
12
+      this.setData({
13
+        IsShowGuideContainer: false,
14
+      });
15
+      wx.setStorageSync('IsShowGuideContainer', false);
16
+    },
17
+    setDataBoolean:function(e){
18
+      let name=e.currentTarget.dataset.name;
19
+      let saveData=e.currentTarget.dataset.savedata;
20
+      this.data[name] = !this.data[name];
21
+      this.setData(this.data);
22
+
23
+      if (saveData)
24
+        wx.setStorageSync(name, saveData);
25
+    },
26
+  }
27
+})

+ 3 - 11
pages/main/article.js

@@ -1,6 +1,7 @@
1
 import common from '../../utils/util';
1
 import common from '../../utils/util';
2
 import main from '../../utils/main';
2
 import main from '../../utils/main';
3
 import animation from '../../utils/animation';
3
 import animation from '../../utils/animation';
4
+import commonBehavior from '../behaviors/commonBehavior';
4
 
5
 
5
 const Theme=[{
6
 const Theme=[{
6
     "Name":"DarkColor",
7
     "Name":"DarkColor",
@@ -17,6 +18,7 @@ const Theme=[{
17
 const app = getApp();
18
 const app = getApp();
18
 
19
 
19
 Page({
20
 Page({
21
+  behaviors: [commonBehavior],
20
   data: {
22
   data: {
21
     Words:"",
23
     Words:"",
22
     IsShowFirstOpen:true,
24
     IsShowFirstOpen:true,
@@ -521,12 +523,6 @@ Page({
521
       showAnimation: 'remind-slide-down'
523
       showAnimation: 'remind-slide-down'
522
     });
524
     });
523
   },
525
   },
524
-  closeGuideContainer:function(){
525
-    this.setData({
526
-      IsShowGuideContainer:false,
527
-    });
528
-    wx.setStorageSync('IsShowGuideContainer', false);
529
-  },
530
   goto: function (e) {
526
   goto: function (e) {
531
     let that=this;
527
     let that=this;
532
     var url=e.currentTarget.dataset.url;
528
     var url=e.currentTarget.dataset.url;
@@ -534,11 +530,7 @@ Page({
534
       url: url,
530
       url: url,
535
     });
531
     });
536
   },
532
   },
537
-  // 阻止示例面板的触摸事件传递到底层
538
-  catchTouchMove: function(e) {
539
-    // 这个函数不需要做任何事情,只需要捕获事件防止冒泡
540
-    return false;
541
-  },
533
+  catchTouchMove: main.catchTouchMove,
542
   onShareAppMessage: function () {
534
   onShareAppMessage: function () {
543
     return {
535
     return {
544
       title: app.globalData.ShareTitle,
536
       title: app.globalData.ShareTitle,

+ 3 - 9
pages/main/article.wxml

@@ -134,16 +134,10 @@
134
 </view>
134
 </view>
135
 </block>
135
 </block>
136
 
136
 
137
+<!-- 引入引导模板 -->
138
+<import src="../templates/guide-container.wxml"/>
137
 <!-- 显示引导 -->
139
 <!-- 显示引导 -->
138
-<view  wx:if="{{IsShowGuideContainer}}" class="panelGuideContainer container FlexColumn">
139
-  <view class="panelGuideContainerTop panelGuideContainer0" style='height:{{panelGuideContainerTop}}rpx;' catchtouchmove="catchTouchMove"></view>
140
-  <view class="panelGuideContainerLeft panelGuideContainer0" style='top:{{panelGuideContainerTop}}rpx;width:{{panelGuideContainerWidth1}}rpx;height:{{panelGuideContainerHeight1}}rpx;' catchtouchmove="catchTouchMove"></view>
141
-  <view class="panelGuideContainerRight panelGuideContainer0" style='top:{{panelGuideContainerTop}}rpx;left:{{panelGuideContainerLeft2}}rpx;height:{{panelGuideContainerHeight1}}rpx;' catchtouchmove="catchTouchMove"></view>
142
-  <view class="panelGuideContainerBottom panelGuideContainer0" style='top:{{panelGuideContainerTop+panelGuideContainerHeight1-1}}rpx;height:{{Containnerheight}}rpx;' catchtouchmove="catchTouchMove"></view>
143
-  <image class="panelGuideContainerImage {{panelGuideContainerImage}}" style="left:{{panelGuideContainerImageLeft}}rpx;top:{{panelGuideContainerImageTop}}rpx;" src="../images/{{panelGuideContainerImage}}.png" catchtouchmove="catchTouchMove">
144
-    <view class="panelGuideContainerClose FlexColumn" style="left:{{panelGuideContainerCloseLeft}}rpx;top:{{panelGuideContainerCloseTop}}rpx;" catchtap="closeGuideContainer"></view>
145
-  </image>
146
-</view>
140
+<template is="guide-container" data="{{IsShowGuideContainer, panelGuideContainerTop, panelGuideContainerWidth1, panelGuideContainerHeight1, panelGuideContainerLeft2, Containnerheight, panelGuideContainerImage, panelGuideContainerImageLeft, panelGuideContainerImageTop, panelGuideContainerCloseLeft, panelGuideContainerCloseTop}}"/>
147
 
141
 
148
 <!-- 显示生成出错 -->
142
 <!-- 显示生成出错 -->
149
 <view wx:if="{{IsBuildError}}" class="container {{ThemeCSS}} FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
143
 <view wx:if="{{IsBuildError}}" class="container {{ThemeCSS}} FlexColumn" style='min-height:{{Containnerheight}}rpx;'>

+ 3 - 11
pages/main/index.js

@@ -1,10 +1,12 @@
1
 import common from '../../utils/util';
1
 import common from '../../utils/util';
2
 import main from '../../utils/main';
2
 import main from '../../utils/main';
3
 import animation from '../../utils/animation';
3
 import animation from '../../utils/animation';
4
+import commonBehavior from '../behaviors/commonBehavior';
4
 
5
 
5
 const app = getApp();
6
 const app = getApp();
6
 
7
 
7
 Page({
8
 Page({
9
+  behaviors: [commonBehavior],
8
   data: {
10
   data: {
9
     IsShowRemind:false,
11
     IsShowRemind:false,
10
     remindAnimation: "",
12
     remindAnimation: "",
@@ -71,17 +73,7 @@ Page({
71
     main.showGuideContainer(that,"#txtWordsInput",0,110,"pic_ha01",396,248,-5);
73
     main.showGuideContainer(that,"#txtWordsInput",0,110,"pic_ha01",396,248,-5);
72
     wx.setStorageSync('IsShowGuideContainer', true);
74
     wx.setStorageSync('IsShowGuideContainer', true);
73
   },
75
   },
74
-  closeGuideContainer:function(){
75
-    this.setData({
76
-      IsShowGuideContainer:false,
77
-    });
78
-    wx.setStorageSync('IsShowGuideContainer', false);
79
-  },
80
-  // 阻止示例面板的触摸事件传递到底层
81
-  catchTouchMove: function(e) {
82
-    // 这个函数不需要做任何事情,只需要捕获事件防止冒泡
83
-    return false;
84
-  },
76
+  catchTouchMove: main.catchTouchMove,
85
   onShareAppMessage: function () {
77
   onShareAppMessage: function () {
86
     return {
78
     return {
87
       title: app.globalData.ShareTitle,
79
       title: app.globalData.ShareTitle,

+ 3 - 9
pages/main/index.wxml

@@ -56,13 +56,7 @@
56
   </view>
56
   </view>
57
 </view>
57
 </view>
58
 
58
 
59
+<!-- 引入引导模板 -->
60
+<import src="../templates/guide-container.wxml"/>
59
 <!-- 显示引导 -->
61
 <!-- 显示引导 -->
60
-<view  wx:if="{{IsShowGuideContainer}}" class="panelGuideContainer container FlexColumn">
61
-  <view class="panelGuideContainerTop panelGuideContainer0" style='height:{{panelGuideContainerTop}}rpx;' catchtouchmove="catchTouchMove"></view>
62
-  <view class="panelGuideContainerLeft panelGuideContainer0" style='top:{{panelGuideContainerTop}}rpx;width:{{panelGuideContainerWidth1}}rpx;height:{{panelGuideContainerHeight1}}rpx;' catchtouchmove="catchTouchMove"></view>
63
-  <view class="panelGuideContainerRight panelGuideContainer0" style='top:{{panelGuideContainerTop}}rpx;left:{{panelGuideContainerLeft2}}rpx;height:{{panelGuideContainerHeight1}}rpx;' catchtouchmove="catchTouchMove"></view>
64
-  <view class="panelGuideContainerBottom panelGuideContainer0" style='top:{{panelGuideContainerTop+panelGuideContainerHeight1-1}}rpx;height:{{Containnerheight}}rpx;' catchtouchmove="catchTouchMove"></view>
65
-  <image class="panelGuideContainerImage {{panelGuideContainerImage}}" style="left:{{panelGuideContainerImageLeft}}rpx;top:{{panelGuideContainerImageTop}}rpx;" src="../images/{{panelGuideContainerImage}}.png" catchtouchmove="catchTouchMove">
66
-    <view class="panelGuideContainerClose FlexColumn" style="left:{{panelGuideContainerCloseLeft}}rpx;top:{{panelGuideContainerCloseTop}}rpx;" catchtap="closeGuideContainer"></view>
67
-  </image>
68
-</view>
62
+<template is="guide-container" data="{{IsShowGuideContainer, panelGuideContainerTop, panelGuideContainerWidth1, panelGuideContainerHeight1, panelGuideContainerLeft2, Containnerheight, panelGuideContainerImage, panelGuideContainerImageLeft, panelGuideContainerImageTop, panelGuideContainerCloseLeft, panelGuideContainerCloseTop}}"/>

+ 3 - 11
pages/main/paste.js

@@ -1,5 +1,6 @@
1
 import common from '../../utils/util';
1
 import common from '../../utils/util';
2
 import main from '../../utils/main';
2
 import main from '../../utils/main';
3
+import commonBehavior from '../behaviors/commonBehavior';
3
 
4
 
4
 const COUNT_MAX=10;
5
 const COUNT_MAX=10;
5
 const app = getApp();
6
 const app = getApp();
@@ -8,6 +9,7 @@ let EntryWords="";//进来的单词,用于返回恢复
8
 let IsEdit=false;  //是否编辑过,编辑过不恢复
9
 let IsEdit=false;  //是否编辑过,编辑过不恢复
9
 
10
 
10
 Page({
11
 Page({
12
+  behaviors: [commonBehavior],
11
   data: {
13
   data: {
12
     Words:"",
14
     Words:"",
13
     importWordStr:"",//输入过的单词
15
     importWordStr:"",//输入过的单词
@@ -76,12 +78,6 @@ Page({
76
       app.globalData.SelectedWords=EntryWords;
78
       app.globalData.SelectedWords=EntryWords;
77
     }
79
     }
78
   },
80
   },
79
-  
80
-  showExample:function(){
81
-    this.setData({
82
-      IsShowExample:!this.data.IsShowExample,
83
-    });
84
-  },
85
   setWordsArr:function(data){
81
   setWordsArr:function(data){
86
     let that=this;
82
     let that=this;
87
     let words=[];
83
     let words=[];
@@ -119,11 +115,7 @@ Page({
119
     });
115
     });
120
     IsEdit=false;
116
     IsEdit=false;
121
   },
117
   },
122
-  // 阻止示例面板的触摸事件传递到底层
123
-  catchTouchMove: function(e) {
124
-    // 这个函数不需要做任何事情,只需要捕获事件防止冒泡
125
-    return false;
126
-  },
118
+  catchTouchMove: main.catchTouchMove,
127
   onShareAppMessage: function () {
119
   onShareAppMessage: function () {
128
     return {
120
     return {
129
       title: app.globalData.ShareTitle,
121
       title: app.globalData.ShareTitle,

+ 5 - 10
pages/main/paste.wxml

@@ -2,7 +2,7 @@
2
   <view class="panel1 FlexColumn">
2
   <view class="panel1 FlexColumn">
3
     <view class="text01">格式1行1个</view>
3
     <view class="text01">格式1行1个</view>
4
     <view class="panel11 FlexRow" >
4
     <view class="panel11 FlexRow" >
5
-      <view class="panel111 FlexRow" bind:tap="showExample">
5
+      <view class="panel111 FlexRow" bind:tap="setDataBoolean" data-name="IsShowExample">
6
         <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
6
         <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
7
         <view>示范</view>
7
         <view>示范</view>
8
       </view>
8
       </view>
@@ -27,12 +27,7 @@
27
 </view>
27
 </view>
28
 
28
 
29
 
29
 
30
-<view wx:if="{{IsShowExample}}" class="panelExample container FlexColumn" style='min-height:{{Containnerheight}}rpx;' catchtouchmove="catchTouchMove">
31
-  <scroll-view scroll-y="true" class="exampleScrollView" style='height:{{Containnerheight}}rpx;'>
32
-    <image src="../images/pic_h02.png" class="pic_h01"></image>
33
-  </scroll-view>
34
-  <image src="../images/pic_04.png" class="pic_04"></image>
35
-  <view class="panelExampleBtn FlexColumn" catch:tap="showExample">
36
-    <view class="panelExampleBtn1">关闭</view>
37
-  </view>
38
-</view>
30
+<!-- 引入示例面板模板 -->
31
+<import src="../templates/example-panel.wxml"/>
32
+<!-- 显示示例面板 -->
33
+<template is="example-panel" data="{{IsShowExample, Containnerheight, exampleImagePath: '../images/pic_h02.png'}}"/>

+ 3 - 10
pages/main/selectword.js

@@ -1,10 +1,12 @@
1
 import common from '../../utils/util';
1
 import common from '../../utils/util';
2
 import main from '../../utils/main';
2
 import main from '../../utils/main';
3
+import commonBehavior from '../behaviors/commonBehavior';
3
 
4
 
4
 const COUNT_MAX=10;
5
 const COUNT_MAX=10;
5
 const app = getApp();
6
 const app = getApp();
6
 
7
 
7
 Page({
8
 Page({
9
+  behaviors: [commonBehavior],
8
   data: {
10
   data: {
9
     IsShowAlert:false,
11
     IsShowAlert:false,
10
     Count:0,
12
     Count:0,
@@ -122,16 +124,7 @@ Page({
122
       });
124
       });
123
     }
125
     }
124
   },
126
   },
125
-  showExample:function(){
126
-    this.setData({
127
-      IsShowExample:!this.data.IsShowExample,
128
-    });
129
-  },
130
-  // 阻止示例面板的触摸事件传递到底层
131
-  catchTouchMove: function(e) {
132
-    // 这个函数不需要做任何事情,只需要捕获事件防止冒泡
133
-    return false;
134
-  },
127
+  catchTouchMove: main.catchTouchMove,
135
   onShareAppMessage: function () {
128
   onShareAppMessage: function () {
136
     return {
129
     return {
137
       title: app.globalData.ShareTitle,
130
       title: app.globalData.ShareTitle,

+ 6 - 11
pages/main/selectword.wxml

@@ -3,7 +3,7 @@
3
     <view class="panel1 FlexColumn">
3
     <view class="panel1 FlexColumn">
4
       <view class="text01">至少选1个</view>
4
       <view class="text01">至少选1个</view>
5
       <view class="panel11 FlexRow" >
5
       <view class="panel11 FlexRow" >
6
-        <view class="panel111 FlexRow" bind:tap="showExample">
6
+        <view class="panel111 FlexRow" catch:tap="setDataBoolean" data-name="IsShowExample">
7
           <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
7
           <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
8
           <view>示范</view>
8
           <view>示范</view>
9
         </view>
9
         </view>
@@ -31,7 +31,7 @@
31
       <image src="../images/pic_05.png" class="pic_05"></image>
31
       <image src="../images/pic_05.png" class="pic_05"></image>
32
       <view class="text05">未识别到单词</view>
32
       <view class="text05">未识别到单词</view>
33
       <view class="text06">请拍摄含有英语单词、句子的画面</view>
33
       <view class="text06">请拍摄含有英语单词、句子的画面</view>
34
-      <view class="panelNull1 FlexRow" catch:tap="showExample">
34
+      <view class="panelNull1 FlexRow" catch:tap="setDataBoolean" data-name="IsShowExample">
35
         <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
35
         <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
36
         <view>提升识别质量</view>
36
         <view>提升识别质量</view>
37
       </view>
37
       </view>
@@ -56,12 +56,7 @@
56
 </view>
56
 </view>
57
 
57
 
58
 
58
 
59
-<view wx:if="{{IsShowExample}}" class="panelExample container FlexColumn" style='min-height:{{Containnerheight}}rpx;' catchtouchmove="catchTouchMove">
60
-  <scroll-view scroll-y="true" class="exampleScrollView" style='height:{{Containnerheight}}rpx;'>
61
-    <image src="../images/pic_h03.png" class="pic_h01"></image>
62
-  </scroll-view>
63
-  <image src="../images/pic_04.png" class="pic_04"></image>
64
-  <view class="panelExampleBtn FlexColumn" catch:tap="showExample">
65
-    <view class="panelExampleBtn1">关闭</view>
66
-  </view>
67
-</view>
59
+<!-- 引入示例面板模板 -->
60
+<import src="../templates/example-panel.wxml"/>
61
+<!-- 显示示例面板 -->
62
+<template is="example-panel" data="{{IsShowExample, Containnerheight, exampleImagePath: '../images/pic_h03.png'}}"/>

+ 3 - 27
pages/main/wordsinput.js

@@ -1,11 +1,13 @@
1
 import common from '../../utils/util';
1
 import common from '../../utils/util';
2
 import main from '../../utils/main';
2
 import main from '../../utils/main';
3
 import animation from '../../utils/animation';
3
 import animation from '../../utils/animation';
4
+import commonBehavior from '../behaviors/commonBehavior';
4
 
5
 
5
 const app = getApp();
6
 const app = getApp();
6
 let isFocus=true;
7
 let isFocus=true;
7
 
8
 
8
 Page({
9
 Page({
10
+  behaviors: [commonBehavior],
9
   data: {
11
   data: {
10
     Words:[],
12
     Words:[],
11
     IsShowAlert:false,
13
     IsShowAlert:false,
@@ -245,28 +247,6 @@ Page({
245
       }
247
       }
246
     });
248
     });
247
   },
249
   },
248
-  setMenu:function(){
249
-    this.setData({
250
-      IsShowSetPanel:!this.data.IsShowSetPanel,
251
-    });
252
-  },
253
-  showExample:function(){
254
-    this.setData({
255
-      IsShowExample:!this.data.IsShowExample,
256
-    });
257
-  },
258
-  showGuideRemind:function(){
259
-    this.setData({
260
-      IsShowGuideRemind:!this.data.IsShowGuideRemind,
261
-    });
262
-    wx.setStorageSync('IsShowGuideRemind', 2);
263
-  },
264
-  closeGuideContainer:function(){
265
-    this.setData({
266
-      IsShowGuideContainer:false,
267
-    });
268
-    wx.setStorageSync('IsShowGuideContainer', false);
269
-  },
270
   keyboardOK:function(e){
250
   keyboardOK:function(e){
271
     if (wx.getStorageSync('IsShowGuideContainer')){
251
     if (wx.getStorageSync('IsShowGuideContainer')){
272
       return ;
252
       return ;
@@ -441,11 +421,7 @@ Page({
441
   showRemind:function(e){
421
   showRemind:function(e){
442
     animation.toggleRemindWithAnimation(this);
422
     animation.toggleRemindWithAnimation(this);
443
   },
423
   },
444
-  // 阻止示例面板的触摸事件传递到底层
445
-  catchTouchMove: function(e) {
446
-    // 这个函数不需要做任何事情,只需要捕获事件防止冒泡
447
-    return false;
448
-  },
424
+  catchTouchMove: main.catchTouchMove,
449
   onShareAppMessage: function () {
425
   onShareAppMessage: function () {
450
     return {
426
     return {
451
       title: app.globalData.ShareTitle,
427
       title: app.globalData.ShareTitle,

+ 10 - 21
pages/main/wordsinput.wxml

@@ -2,7 +2,7 @@
2
   <view class="panel1 FlexColumn">
2
   <view class="panel1 FlexColumn">
3
     <view class="text01">输入单词 5-10个</view>
3
     <view class="text01">输入单词 5-10个</view>
4
     <view class="panel11 FlexRow" >
4
     <view class="panel11 FlexRow" >
5
-      <view class="panel111 FlexRow" bind:tap="showExample">
5
+      <view class="panel111 FlexRow" bind:tap="setDataBoolean" data-name="IsShowExample">
6
         <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
6
         <image src="../images/sysIcon_a01.png" class="sysIcon_a01"></image>
7
         <view>示范</view>
7
         <view>示范</view>
8
       </view>
8
       </view>
@@ -36,7 +36,7 @@
36
       <text class="panelGuideText1">新手引导</text>
36
       <text class="panelGuideText1">新手引导</text>
37
       <text>带您体验</text>
37
       <text>带您体验</text>
38
     </text>
38
     </text>
39
-    <view class="panelGuide2 FlexRow" bind:tap="showGuideRemind">
39
+    <view class="panelGuide2 FlexRow" bind:tap="setDataBoolean" data-name="IsShowGuideRemind" data-savedata="2">
40
       <image src="../images/sysIcon_a03.png" class="sysIcon_a03"></image>
40
       <image src="../images/sysIcon_a03.png" class="sysIcon_a03"></image>
41
     </view>
41
     </view>
42
   </view>
42
   </view>
@@ -100,33 +100,22 @@
100
       <view>生成短文</view>
100
       <view>生成短文</view>
101
     </view>
101
     </view>
102
 
102
 
103
-    <view class="panelClose FlexRow" capture-bind:tap="setMenu">
103
+    <view class="panelClose FlexRow" capture-bind:tap="setDataBoolean" data-name="IsShowSetPanel">
104
       <view class="panelClose1 FlexRow">
104
       <view class="panelClose1 FlexRow">
105
         <image src="../images/sysIcon_a03.png" class="sysIcon_a03"></image>
105
         <image src="../images/sysIcon_a03.png" class="sysIcon_a03"></image>
106
       </view>
106
       </view>
107
     </view>
107
     </view>
108
   </view>
108
   </view>
109
 </view>
109
 </view>
110
+<!-- 引入引导模板 -->
111
+<import src="../templates/guide-container.wxml"/>
110
 <!-- 显示引导 -->
112
 <!-- 显示引导 -->
111
-<view  wx:if="{{IsShowGuideContainer}}" class="panelGuideContainer container FlexColumn">
112
-  <view class="panelGuideContainerTop panelGuideContainer0" style='height:{{panelGuideContainerTop}}rpx;' catchtouchmove="catchTouchMove"></view>
113
-  <view class="panelGuideContainerLeft panelGuideContainer0" style='top:{{panelGuideContainerTop}}rpx;width:{{panelGuideContainerWidth1}}rpx;height:{{panelGuideContainerHeight1}}rpx;' catchtouchmove="catchTouchMove"></view>
114
-  <view class="panelGuideContainerRight panelGuideContainer0" style='top:{{panelGuideContainerTop}}rpx;left:{{panelGuideContainerLeft2}}rpx;height:{{panelGuideContainerHeight1}}rpx;' catchtouchmove="catchTouchMove"></view>
115
-  <view class="panelGuideContainerBottom panelGuideContainer0" style='top:{{panelGuideContainerTop+panelGuideContainerHeight1-1}}rpx;height:{{Containnerheight}}rpx;' catchtouchmove="catchTouchMove"></view>
116
-  <image class="panelGuideContainerImage {{panelGuideContainerImage}}" style="left:{{panelGuideContainerImageLeft}}rpx;top:{{panelGuideContainerImageTop}}rpx;" src="../images/{{panelGuideContainerImage}}.png" catchtouchmove="catchTouchMove">
117
-    <view class="panelGuideContainerClose FlexColumn" style="left:{{panelGuideContainerCloseLeft}}rpx;top:{{panelGuideContainerCloseTop}}rpx;" catchtap="closeGuideContainer"></view>
118
-  </image>
119
-</view>
113
+<template is="guide-container" data="{{IsShowGuideContainer, panelGuideContainerTop, panelGuideContainerWidth1, panelGuideContainerHeight1, panelGuideContainerLeft2, Containnerheight, panelGuideContainerImage, panelGuideContainerImageLeft, panelGuideContainerImageTop, panelGuideContainerCloseLeft, panelGuideContainerCloseTop}}"/>
120
 
114
 
121
-<view wx:if="{{IsShowExample}}" class="panelExample container FlexColumn" style='min-height:{{Containnerheight}}rpx;' catchtouchmove="catchTouchMove">
122
-  <scroll-view scroll-y="true" class="exampleScrollView" style='height:{{Containnerheight}}rpx;'>
123
-    <image src="../images/pic_h01.png" class="pic_h01"></image>
124
-  </scroll-view>
125
-  <image src="../images/pic_04.png" class="pic_04"></image>
126
-  <view class="panelExampleBtn FlexColumn" catch:tap="showExample">
127
-    <view class="panelExampleBtn1">关闭</view>
128
-  </view>
129
-</view>
115
+<!-- 引入示例面板模板 -->
116
+<import src="../templates/example-panel.wxml"/>
117
+<!-- 显示示例面板 -->
118
+<template is="example-panel" data="{{IsShowExample, Containnerheight, exampleImagePath: '../images/pic_h01.png'}}"/>
130
 
119
 
131
 <view wx:if="{{IsShowRemind}}" class="panelRemindParent {{remindAnimation}} container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
120
 <view wx:if="{{IsShowRemind}}" class="panelRemindParent {{remindAnimation}} container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
132
   <view class="panelRemind FlexColumn">
121
   <view class="panelRemind FlexColumn">

+ 12 - 0
pages/templates/example-panel.wxml

@@ -0,0 +1,12 @@
1
+<!-- 示例面板模板 -->
2
+<template name="example-panel">
3
+  <view wx:if="{{IsShowExample}}" class="panelExample container FlexColumn" style='min-height:{{Containnerheight}}rpx;' catchtouchmove="catchTouchMove">
4
+    <scroll-view scroll-y="true" class="exampleScrollView" style='height:{{Containnerheight}}rpx;'>
5
+      <image src="{{exampleImagePath}}" class="pic_h01"></image>
6
+    </scroll-view>
7
+    <image src="../images/pic_04.png" class="pic_04"></image>
8
+    <view class="panelExampleBtn FlexColumn" catch:tap="setDataBoolean" data-name="IsShowExample">
9
+      <view class="panelExampleBtn1">关闭</view>
10
+    </view>
11
+  </view>
12
+</template>

+ 13 - 0
pages/templates/guide-container.wxml

@@ -0,0 +1,13 @@
1
+
2
+<!-- 显示引导模板 -->
3
+<template name="guide-container">
4
+  <view wx:if="{{IsShowGuideContainer}}" class="panelGuideContainer container FlexColumn">
5
+    <view class="panelGuideContainerTop panelGuideContainer0" style='height:{{panelGuideContainerTop}}rpx;' catchtouchmove="catchTouchMove"></view>
6
+    <view class="panelGuideContainerLeft panelGuideContainer0" style='top:{{panelGuideContainerTop}}rpx;width:{{panelGuideContainerWidth1}}rpx;height:{{panelGuideContainerHeight1}}rpx;' catchtouchmove="catchTouchMove"></view>
7
+    <view class="panelGuideContainerRight panelGuideContainer0" style='top:{{panelGuideContainerTop}}rpx;left:{{panelGuideContainerLeft2}}rpx;height:{{panelGuideContainerHeight1}}rpx;' catchtouchmove="catchTouchMove"></view>
8
+    <view class="panelGuideContainerBottom panelGuideContainer0" style='top:{{panelGuideContainerTop+panelGuideContainerHeight1-1}}rpx;height:{{Containnerheight}}rpx;' catchtouchmove="catchTouchMove"></view>
9
+    <image class="panelGuideContainerImage {{panelGuideContainerImage}}" style="left:{{panelGuideContainerImageLeft}}rpx;top:{{panelGuideContainerImageTop}}rpx;" src="../images/{{panelGuideContainerImage}}.png" catchtouchmove="catchTouchMove">
10
+      <view class="panelGuideContainerClose FlexColumn" style="left:{{panelGuideContainerCloseLeft}}rpx;top:{{panelGuideContainerCloseTop}}rpx;" catchtap="closeGuideContainer"></view>
11
+    </image>
12
+  </view>
13
+</template>

+ 7 - 0
utils/main.js

@@ -230,6 +230,12 @@ function showGuideContainer(obj,myClass,imageLeft,imageTop,imageName,closeLeft,c
230
 }
230
 }
231
 
231
 
232
 
232
 
233
+// 阻止示例面板的触摸事件传递到底层
234
+function catchTouchMove(e) {
235
+  // 这个函数不需要做任何事情,只需要捕获事件防止冒泡
236
+  return false;
237
+}
238
+
233
 module.exports = {
239
 module.exports = {
234
   getData: getData,
240
   getData: getData,
235
   postData: postData,
241
   postData: postData,
@@ -239,4 +245,5 @@ module.exports = {
239
   checkGenerating:checkGenerating,
245
   checkGenerating:checkGenerating,
240
   getPageInfo:getPageInfo,
246
   getPageInfo:getPageInfo,
241
   showGuideContainer:showGuideContainer,
247
   showGuideContainer:showGuideContainer,
248
+  catchTouchMove: catchTouchMove,
242
 }
249
 }