소스 검색

判断是否可以展开

Limengbo 6 년 전
부모
커밋
11cfcfe288

BIN
.DS_Store


+ 37 - 6
.idea/workspace.xml

@@ -1,7 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ChangeListManager">
-    <list default="true" id="4f17d6f9-a5b0-4bb4-9071-d9334baf6515" name="Default" comment="" />
+    <list default="true" id="4f17d6f9-a5b0-4bb4-9071-d9334baf6515" name="Default" comment="">
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/pages/index/index.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/pages/index/index.wxml" afterDir="false" />
+    </list>
     <ignored path="$PROJECT_DIR$/.tmp/" />
     <ignored path="$PROJECT_DIR$/temp/" />
     <ignored path="$PROJECT_DIR$/tmp/" />
@@ -12,6 +15,15 @@
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
     <option name="LAST_RESOLUTION" value="IGNORE" />
   </component>
+  <component name="FileEditorManager">
+    <leaf>
+      <file leaf-file-name="lessonList.wxml" pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/compontents/lesson_list/lessonList.wxml">
+          <provider selected="true" editor-type-id="text-editor" />
+        </entry>
+      </file>
+    </leaf>
+  </component>
   <component name="FindInProjectRecents">
     <findStrings>
       <find>downUp</find>
@@ -41,6 +53,7 @@
       <foldersAlwaysOnTop value="true" />
     </navigator>
     <panes>
+      <pane id="Scope" />
       <pane id="ProjectPane">
         <subPane>
           <expand>
@@ -53,11 +66,21 @@
               <item name="efunbox-schedule-miniApps" type="462c0819:PsiDirectoryNode" />
               <item name="compontents" type="462c0819:PsiDirectoryNode" />
             </path>
+            <path>
+              <item name="efunbox-schedule-miniApps" type="b2602c69:ProjectViewProjectNode" />
+              <item name="efunbox-schedule-miniApps" type="462c0819:PsiDirectoryNode" />
+              <item name="compontents" type="462c0819:PsiDirectoryNode" />
+              <item name="lesson_list" type="462c0819:PsiDirectoryNode" />
+            </path>
+            <path>
+              <item name="efunbox-schedule-miniApps" type="b2602c69:ProjectViewProjectNode" />
+              <item name="efunbox-schedule-miniApps" type="462c0819:PsiDirectoryNode" />
+              <item name="pages" type="462c0819:PsiDirectoryNode" />
+            </path>
           </expand>
           <select />
         </subPane>
       </pane>
-      <pane id="Scope" />
     </panes>
   </component>
   <component name="PropertiesComponent">
@@ -90,16 +113,19 @@
       <updated>1524652260223</updated>
       <workItem from="1524652261658" duration="616000" />
       <workItem from="1524663262852" duration="109000" />
+      <workItem from="1524705659225" duration="247000" />
+      <workItem from="1524792294462" duration="506000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="725000" />
+    <option name="totallyTimeSpent" value="1478000" />
   </component>
   <component name="ToolWindowManager">
     <frame x="0" y="0" width="1440" height="900" extended-state="0" />
+    <editor active="true" />
     <layout>
-      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.19861111" />
       <window_info anchor="bottom" id="TODO" order="6" />
       <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
       <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
@@ -113,9 +139,9 @@
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
       <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
-      <window_info anchor="bottom" id="Find" order="1" />
-      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
       <window_info anchor="bottom" id="Message" order="0" />
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
+      <window_info anchor="bottom" id="Find" order="1" />
     </layout>
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -124,4 +150,9 @@
   <component name="VcsContentAnnotationSettings">
     <option name="myLimit" value="2678400000" />
   </component>
+  <component name="editorHistoryManager">
+    <entry file="file://$PROJECT_DIR$/compontents/lesson_list/lessonList.wxml">
+      <provider selected="true" editor-type-id="text-editor" />
+    </entry>
+  </component>
 </project>

+ 12 - 5
compontents/lesson_list/lessonList.js

@@ -7,6 +7,10 @@ Component({
     lessonData: {
       type: Array,
       value: []
+    },
+    height: {
+      type: String,
+      value: ''
     }
   },
 
@@ -16,7 +20,8 @@ Component({
   data: {
     flag: false,
     animationData: {},
-    downUp: '展开'
+    downUp: '展开',
+    src: '../../pages/image/toUp.png',
   },
 
   /**
@@ -25,18 +30,20 @@ Component({
   methods: {
     onTap (e) {
       let flage = e.target.dataset.flag;
-      const height = this.properties.lessonData.length * 65;
+      const height = this.properties.lessonData.length * 70;
       if(flage){
-        this.util(flage, '270rpx');
+        this.util(flage, '280rpx');
         this.setData({
           'flag': false,
-          'downUp': '展开'
+          'downUp': '展开',
+          'src':'../../pages/image/toUp.png'
       })
       } else {
         this.util(flage, height + 'rpx');
         this.setData({
           'flag': true,
-          'downUp': '收起'
+          'downUp': '收起',
+          'src': '../../pages/image/toDown.png'
         })
       }
     },

+ 8 - 2
compontents/lesson_list/lessonList.wxml

@@ -8,7 +8,7 @@
             <text>本周推荐课已经完成了</text>
         </view>
     </view>
-    <view class=" timer-shaft " animation="{{animationData}}">
+    <view class=" timer-shaft " animation="{{animationData}}" style="height: {{height}}rpx">
         <view class="art-lesson" wx:for="{{lessonData}}" wx:key="{{index}}" >
             <view class="graph">
                 <view class="yuan {{item.isStudy ? 'check' : 'no-check'}} "></view>
@@ -19,5 +19,11 @@
             </view>
         </view>
     </view>
-    <text class="unfold" data-flag="{{flag}}" bindtap="onTap">{{downUp}}</text>
+
+
+    <view class="unfold" wx-if="{{height}}">
+      <image class="dirImg" src="{{src}}"></image>
+      <text data-flag="{{flag}}" bindtap="onTap">{{downUp}}</text>
+    </view>
+    
 </view>

+ 10 - 1
compontents/lesson_list/lessonList.wxss

@@ -41,7 +41,6 @@
 
 /* 时间轴 */
 .timer-shaft {
-    height: 270rpx;
     overflow: hidden;
     margin: 0 0 68rpx 10rpx;
     padding: 0 25rpx;
@@ -113,5 +112,15 @@
     right: 28rpx;
     bottom: 24rpx;
     font-size: 28rpx;
+    line-height: 28rpx;
+    height: 28rpx;
     color: #93AAFA;
+}
+.dirImg{
+  width: 16rpx;
+  height: 9rpx;
+  position: absolute;
+  top: 50%;
+  left: -20rpx;
+  margin-top: -5rpx;
 }

+ 13 - 5
compontents/preview/preview.js

@@ -7,6 +7,10 @@ Component({
     materialData: {
       type: Array,
       value: []
+    },
+    height: {
+      type: String,
+      value: ''
     }
   },
 
@@ -16,7 +20,8 @@ Component({
   data: {
     flag: false,
     animationData: {},
-    downUp: '展开'
+    downUp: '展开',
+    src: '../../pages/image/toUp.png'
   },
 
   /**
@@ -25,18 +30,21 @@ Component({
   methods: {
     onTap (e) {
       let flage = e.target.dataset.flag;
-      const height = this.properties.materialData.length * 65;
+      const height = this.properties.materialData.length * 70;
       if(flage){
-        this.util(flage, '270rpx');
+        
+        this.util(flage, '280rpx');
         this.setData({
           'flag': false,
-          'downUp': '展开'
+          'downUp': '展开',
+          'src': '../../pages/image/toUp.png'
         })
       } else {
         this.util(flage, height + 'rpx');
         this.setData({
           'flag': true,
-          'downUp': '收起'
+          'downUp': '收起',
+          'src': '../../pages/image/toDown.png'
         })
       }
     },

+ 7 - 2
compontents/preview/preview.wxml

@@ -10,12 +10,17 @@
         </view>
     </view>
 
-    <view class="material-con" animation="{{animationData}}">
+    <view class="material-con" animation="{{animationData}}" style="height: {{height}}rpx">
         <view wx:if="{{ item.warePath && item.title}}" class="art-img" wx:for="{{materialData}}" wx:key="{{index}}">
             <text>{{item.title}}</text>
             <text data-warePath="{{item.warePath}}" bindtap="preview">点击预览</text>
         </view>
     </view>
+    
+    <view class="unfold" wx-if="{{height}}">
+      <image class="dirImg" src="{{src}}"></image>
+      <text data-flag="{{flag}}" bindtap="onTap">{{downUp}}</text>
+    </view>
 
-    <text class="unfold" data-flag="{{flag}}" bindtap="onTap">{{downUp}}</text>
+    
 </view>

+ 11 - 2
compontents/preview/preview.wxss

@@ -41,7 +41,6 @@
 
 /* 预览图片 */
 .material-con {
-    height: 270rpx;
     margin: 0 0 68rpx 10rpx;
     padding: 0 25rpx;
     overflow: hidden;
@@ -61,5 +60,15 @@
     right: 28rpx;
     bottom: 24rpx;
     font-size: 28rpx;
+    line-height: 28rpx;
+    height: 28rpx;
     color: #93AAFA;
-}
+}
+.dirImg{
+  width: 16rpx;
+  height: 9rpx;
+  position: absolute;
+  top: 50%;
+  left: -20rpx;
+  margin-top: -5rpx;
+}

+ 6 - 3
compontents/target/target.js

@@ -16,7 +16,8 @@ Component({
   data: {
     flag: false,
     animationData: {},
-    downUp: '展开'
+    downUp: '展开',
+    src: '../../pages/image/toUp.png'
   },
 
   /**
@@ -29,13 +30,15 @@ Component({
         this.util(flage, '156rpx');
         this.setData({
           'flag': false,
-          'downUp': '展开'
+          'downUp': '展开',
+          'src': '../../pages/image/toUp.png'
         })
       } else {
         this.util(flage, '200rpx');
         this.setData({
           'flag': true,
-          'downUp': '收起'
+          'downUp': '收起',
+          'src': '../../pages/image/toDown.png'
         })
       }
     },

+ 7 - 1
compontents/target/target.wxml

@@ -6,5 +6,11 @@
     <view class="{{ flag ? 'target-txt-show' : 'target-txt'}}" animation="{{animationData}}">
         <text class="week">第五周:{{wxObjectives}}</text>
     </view>
-    <text class="unfold" data-flag="{{flag}}" bindtap="onTap">{{downUp}}</text>
+
+
+    <view class="unfold">
+      <image class="dirImg" src="{{src}}"></image>
+      <text data-flag="{{flag}}" bindtap="onTap">{{downUp}}</text>
+    </view>
+
 </view>

+ 11 - 1
compontents/target/target.wxss

@@ -42,7 +42,17 @@
 .unfold {
     position: absolute;
     right: 28rpx;
-    bottom: 10rpx;
+    bottom: 24rpx;
     font-size: 28rpx;
+    line-height: 28rpx;
+    height: 28rpx;
     color: #93AAFA;
+}
+.dirImg{
+  width: 16rpx;
+  height: 9rpx;
+  position: absolute;
+  top: 50%;
+  left: -20rpx;
+  margin-top: -5rpx;
 }

BIN
pages/.DS_Store


+ 17 - 3
pages/chinese/chinese.js

@@ -12,7 +12,9 @@ Page({
     num1: 0,
     position: '',
     questionsdian: '',
-    list: ''
+    list: '',
+    lessonListHeight: '',
+    previewHeight: ''
   },
 
   /* 区分答疑和分享 */
@@ -103,10 +105,22 @@ Page({
       }, {
         "category": 3
       }).success((res) => {
-        //console.log('科目信息' + JSON.stringify(res));
+        const lessonListLength = res.data.data.lessonPage.list.length;
+        const previewLength = util.preview(res.data.data.lessonPage.list).length;
+        console.log(res)
+        if(lessonListLength > 4) {
+          this.setData({
+            lessonListHeight: 280
+          })
+        }
+        if(previewLength > 4){
+          this.setData({
+            previewHeight: 280
+          })
+        } 
         this.setData({
           courseData: res.data.data,
-          list: util.studyPageTime(res.data.data.lessonPage.list)
+          list: util.studyPageTime(res.data.data.lessonPage.list),
         })
       })
     }, function() {

+ 6 - 2
pages/chinese/chinese.wxml

@@ -9,9 +9,13 @@
           <view class="chinese">
             <target wxObjectives="{{courseData.weekCourseConfig.wxObjectives}}"/>
 
-            <lessonList lessonData="{{list}}"/>
+            <lessonList 
+            lessonData="{{list}}"
+            height="{{lessonListHeight}}"/>
 
-            <preview materialData="{{courseData.lessonPage.list}}"/>
+            <preview 
+            materialData="{{courseData.lessonPage.list}}"
+            height="{{previewHeight}}"/>
 
             <chat id="questions"
                 productionData="{{questionsData}}" 

BIN
pages/image/toDown.png


BIN
pages/image/toUp.png


+ 8 - 6
pages/index/index.wxml

@@ -53,7 +53,7 @@
               </view>
               <view class="ranking-con">
                 <view class="rank">
-                  <text>好友数: {{rankData.friendsRank.number}}</text>
+                  <text>好友数: {{rankData.friendsRank.number}}</text>
                   <text>第{{rankData.friendsRank.rank}}名</text>
                 </view>
                 <view class="rank">
@@ -65,7 +65,7 @@
                   <text>第{{rankData.expRank.rank}}名</text>
                 </view>
                 <view class="rank">
-                  <text>答题量:{{rankData.userQuestionRank.number}}</text>
+                  <text>答题量:{{rankData.userQuestionRank.number}}</text>
                   <text>第{{rankData.userQuestionRank.rank}}名</text>
                 </view>
                 <view class="rank">
@@ -83,14 +83,16 @@
                 <text>我的勋章</text>
                 <text class="{{data.metalsList.length > 0 ? 'none' : ''}}">本周还没获得</text>
               </view>
-              <view class="img">
-                <scroll-view scroll-x="true" class="medal-img" scroll-with-animation="true">
+
+              <scroll-view scroll-x="true" >
+                <view class="img">
                   <view wx:for="{{data.metalsList}}" wx:key="{{item.id}}" >    
                     <image src="{{item.img}}"></image>
                     <text>{{item.name}}</text>
                   </view>
-                </scroll-view>
-              </view>
+                </view>
+              </scroll-view>
+              
             </view>
             <!-- 课模板 -->
             <view>

+ 6 - 10
pages/index/index.wxss

@@ -147,29 +147,25 @@
 }
 
 .img {
-  width: 100%;
-  overflow: hidden;
+  display: flex;
   margin-top: 38rpx;
 }
 
-.medal-img {
-  white-space:nowrap; 
-}
-
 .img view {
-  display: inline-block;
-  text-align: center;
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
   margin-right: 15rpx;
 }
 
 .img image {
-  display: block;
   width: 100rpx;
   height: 100rpx;
 }
 
 .img text {
-  display: block;
   font-size: 24rpx;
   color: #878787;
   margin-top: 10rpx;

+ 3 - 3
pages/input_content/input_content.wxml

@@ -5,12 +5,12 @@
         <text bindtap="send">发送</text>
     </view>
     <view class="write">
-        <input placeholder="写点什么..." bindinput="bindKeyInput" type="text" />
+        <textarea placeholder="写点什么..." bindinput="bindKeyInput" auto-height />
         <view wx:if="{{type == 2}}">
-            <image src="../image/add.png" class="add" bindtap="uploading"/>
             <block wx:for="{{tempFilePath}}" wx:key="{{index}}">
-                <image src="{{item }}" bindtap="listenerButtonPreviewImage" data-index="{{index}}" style="width: 100%;"/>
+                <image class="minImg" mode='aspectFill' src="{{item}}" bindtap="listenerButtonPreviewImage" data-index="{{index}}"/>
             </block>
+            <image src="../image/add.png" class="add" bindtap="uploading"/>
         </view>
     </view>
 </view>

+ 6 - 0
pages/input_content/input_content.wxss

@@ -37,3 +37,9 @@
     height: 126rpx;
     margin-top: 30rpx;
 }
+
+.minImg{
+  width: 33.3%;
+  height: 300rpx;
+  margin: 10rpx;
+}

+ 19 - 1
utils/util.js

@@ -86,8 +86,25 @@ function strategy (str) {
   return str.split('<br>')
 }
 
-//获取当前页面传的的值
+//判断能不能预览
+function preview (arr) {
+  const studyLog = [];
+  for(let item of arr) {
+    if(item.warePath){
+      studyLog.push(
+        {
+          title: item.title, 
+          lessonId: item.lessonId,
+          warePath: item.warePath
+        }
+      )
+    }
+    
+  }
+  return studyLog;
+}
 
+//获取当前页面传的的值
 function getUrl() {
   var pages = getCurrentPages()    //获取加载的页面
   
@@ -192,6 +209,7 @@ module.exports = {
   strategy,
   gradeUpper,
   day,
+  preview,
   getUrl,
   column,
   url,