Browse Source

新增错题本样式

Limengbo 6 years ago
parent
commit
85b639470b
4 changed files with 20 additions and 6 deletions
  1. 17 1
      pages/mistakes/mistakes.js
  2. 1 1
      pages/mistakes/mistakes.wxml
  3. 1 3
      pages/mistakes/mistakes.wxss
  4. 1 1
      utils/APIClient.js

+ 17 - 1
pages/mistakes/mistakes.js

@@ -16,7 +16,9 @@ Page({
     courseIndex: 0,
     flag: true,
     switchs: true,
-    errorData: {}
+    errorData: {},
+    errImgW: '',
+    errImgH: '',
   },
 
   particulars: function (e) {
@@ -37,6 +39,20 @@ Page({
     }
   },
 
+  //获取image宽高
+  imageLoad: function (e) {
+    let height = e.detail.height;
+    let width = e.detail.width;
+    //设置图片宽度
+    //const imgW = width * .9;
+    //设置图片高度
+    //const imgH = imgW * (height / width);
+    this.setData({
+      errImgW: width + 'rpx',
+      errImgH: height + 'rpx'
+    })
+  },
+
   /*tab切换*/
   tab (e) {
     const index = e.currentTarget.dataset.index;

+ 1 - 1
pages/mistakes/mistakes.wxml

@@ -55,7 +55,7 @@
   <view class="mistakes-dialog" hidden='{{switchs}}'>
     <image class="error-questions" src="{{errorData.img}}"></image>
     <scroll-view scroll-y class='mistakes-dialog-scroll'>
-      <image class="error-analysis" src="{{errorData.analysis}}"></image>
+       <image class="error-analysis" src="{{errorData.analysis}}" bindload="imageLoad" style="width: {{errImgW}}; height: {{errImgH}}"></image>
     </scroll-view>
     <image class="close" src="../image/close.png" bindtap='closeDialog'></image>
   </view>   

+ 1 - 3
pages/mistakes/mistakes.wxss

@@ -128,7 +128,7 @@
   position: absolute;
   left: 5%;
   top: 478rpx;
-  height: 620rpx;
+  height: 50%;
 }
 
 .error-questions {
@@ -142,8 +142,6 @@
 }
 
 .error-analysis {
-    width: 90%;
-    height: 620rpx;
     border-radius: 0 0 20rpx 20rpx;
 }
 

+ 1 - 1
utils/APIClient.js

@@ -243,6 +243,6 @@ module.exports = {
     let data = { 
       qid
      }
-    return request.getInstance().url('https://weixin.efunbox.cn/customer/question/getAnalysis').data(data).send();
+    return request.getInstance().url('https://schedule.api.ai160.com/customer/question/getAnalysis').data(data).send();
   },				
 }