liyongli 3 anni fa
parent
commit
50372f5ee4

BIN
miniprogram/images/answer-select.png


BIN
miniprogram/images/answer.png


+ 0 - 11
miniprogram/images/arrow.svg

@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg width="8px" height="14px" viewBox="0 0 8 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-    <title>☀ iOS/☀ 图标/线型/icons_outlined_arrow@3x</title>
-    <g id="控件" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" fill-opacity="0.3">
-        <g id="4.列表/z.覆盖层/右边/箭头" transform="translate(-334.000000, -21.000000)" fill="#000000">
-            <g id="☀-iOS/☀-图标/线型/icons_outlined_arrow" transform="translate(332.000000, 16.000000)">
-                <path d="M2.45405845,6.58064919 L3.51471863,5.51998901 L9.29361566,11.298886 C9.68374096,11.6890113 9.6872014,12.318069 9.29361566,12.7116547 L3.51471863,18.4905518 L2.45405845,17.4298916 L7.87867966,12.0052704 L2.45405845,6.58064919 Z" id="Combined-Shape"></path>
-            </g>
-        </g>
-    </g>
-</svg>

BIN
miniprogram/images/confirm-word1.png


BIN
miniprogram/images/database.png


BIN
miniprogram/images/deploy_step1.png


BIN
miniprogram/images/deploy_step2.png


BIN
miniprogram/images/error.png


BIN
miniprogram/images/logo.png


BIN
miniprogram/images/my-select.png


BIN
miniprogram/images/my.png


BIN
miniprogram/images/rank.png


BIN
miniprogram/images/select.png


BIN
miniprogram/images/share.png


BIN
miniprogram/images/sort-select.png


BIN
miniprogram/images/sort.png


BIN
miniprogram/images/title8.png


BIN
miniprogram/images/warning.png


BIN
miniprogram/images/wave.png


BIN
miniprogram/images/wrong-select.png


BIN
miniprogram/images/wrong.png


+ 25 - 12
miniprogram/pages/answer/index.js

@@ -22,22 +22,25 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    let reset = options.reset
     wx.setNavigationBarTitle({
       title: app.globalData.selectQuestion.name
     })
     let height = wx.getSystemInfoSync().windowHeight;
     let li = app.globalData.selectQuestion.list || {};
-    for (let i = 0; i < li.length; i++) {
-      const item = li[i];
-      let l = []
-      for (let key in item.options) {
-        l.push({
-          name: key,
-          option: item.options[key],
-          checked: false
-        })
+    if(reset != 1){
+      for (let i = 0; i < li.length; i++) {
+        const item = li[i];
+        let l = []
+        for (let key in item.options) {
+          l.push({
+            name: key,
+            option: item.options[key],
+            checked: false
+          })
+        }
+        li[i].options = l;
       }
-      li[i].options = l;
     }
     this.answer = new Array(li.length).fill([]);
     this.setData({
@@ -134,10 +137,13 @@ Page({
       queId: app.globalData.selectQuestion._id,
       userId: app.globalData.userInfo._openid,
       startTime: this.actTime,
+      istrue: [],
       endTime: new Date(),
       answer: this.answer
     };
+    p.duration = p.endTime - p.startTime;
     let score = 0;
+
     for (let i = 0; i < app.globalData.selectQuestion.list.length; i++) {
       let an = this.answer[i].join(",")
       const v = app.globalData.selectQuestion.list[i];
@@ -145,6 +151,7 @@ Page({
       v.answer.map(r => {
         isAdd = (new RegExp(r.select)).test(an)
       })
+      p.istrue.push(isAdd);
       if (v.answer.length === this.answer[i].length && isAdd) score++;
     }
     p.score = score;
@@ -156,8 +163,13 @@ Page({
         data: p
       }
     }).then(res => {
-      console.log(res);
-
+      wx.hideLoading()
+      if(res.result.code !== 0) return wx.showToast({
+        title: '网络繁忙'
+      })
+      wx.reLaunch({
+        url: '/pages/result/index?data=' + JSON.stringify(res.result.data || {}),
+      })
     }).catch(err => {
       console.log(err)
       wx.hideLoading()
@@ -189,6 +201,7 @@ Page({
    */
   onUnload: function () {
     if (this.interval) clearInterval(this.interval);
+    console.log()
   },
 
   /**

+ 11 - 1
miniprogram/pages/detail/index.js

@@ -8,7 +8,8 @@ Page({
   data: {
     detail: {},
     playUrl: "",
-    videoData:{}
+    videoData:{},
+    imgList: []
   },
 
   /**
@@ -61,6 +62,15 @@ Page({
       playUrl: ""
     })
   },
+  bindload(e){
+    const list = this.data.imgList || [];
+    let height =339/ e.detail.width * e.detail.height
+    list[e.target.dataset.index] = height;
+    console.log(list);
+    this.setData({
+      imgList: list
+    })
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 1 - 1
miniprogram/pages/detail/index.wxml

@@ -3,5 +3,5 @@
 <import src="./template/video/index.wxml"></import>
 <view class="detail">
   <template wx:if="{{detail.type === 'text'}}" is="text" data="{{...detail}}"></template>
-  <template wx:if="{{detail.type === 'video'}}" is="video" data="{{...detail, playUrl, videoData}}"></template>
+  <template wx:if="{{detail.type === 'video'}}" is="video" data="{{...detail, playUrl, videoData, imgList}}"></template>
 </view>

+ 3 - 2
miniprogram/pages/detail/index.wxss

@@ -1,6 +1,7 @@
 /* pages/detail/index.wxss */
 .detail {
   min-height: 100%;
+  padding: 0 12rpx;
   box-sizing: border-box;
 }
 
@@ -23,8 +24,8 @@
 .detail .videoList {
   box-sizing: border-box;
   display: inline-block;
-  width: 375rpx;
-  padding: 14px 12px;
+  width: 363rpx;
+  padding: 12rpx;
 }
 
 .detail .mantle {

+ 6 - 2
miniprogram/pages/detail/template/video/index.wxml

@@ -1,6 +1,9 @@
 <template name="video">
   <view class="videoList" wx:for="{{content || []}}" wx:key="title" data-url="{{item.url}}" bindtap="playVideo">
-    <image style="width: 100%;" src="{{item.imgUrl}}"></image>
+    <image bindload="bindload" data-index="{{index}}" wx:if="{{!imgList[index]}}" style="width: 339rpx;" src="{{item.imgUrl}}">
+    </image>
+    <image bindload="bindload" wx:if="{{imgList[index]}}" style="height:{{imgList[index] + 'rpx;width: 339rpx;'}}"
+      src="{{item.imgUrl}}"></image>
     <view class="titleStyle" wx:if="{{item.title}}">{{item.title}}</view>
     <view class="titleStyle">播放次数:{{item.play_count}}</view>
   </view>
@@ -11,6 +14,7 @@
       <view class="left"></view>
       <view class="right"></view>
     </view>
-    <video style="height:{{videoData.height}}px;width:{{videoData.width}}px" bindloadedmetadata="bindloadedmetadata" class="playVideo" src="{{playUrl}}"></video>
+    <video style="height:{{videoData.height}}px;width:{{videoData.width}}px" bindloadedmetadata="bindloadedmetadata"
+      class="playVideo" src="{{playUrl}}"></video>
   </view>
 </template>

+ 1 - 1
miniprogram/pages/problemPage/index.js

@@ -6,7 +6,7 @@ Page({
    * 页面的初始数据
    */
   Page: 1,
-  Size: 5,
+  Size: 10,
   isMore: true,
   data: {
     question: [],

+ 2 - 2
miniprogram/pages/record/index.js

@@ -6,7 +6,7 @@ Page({
    * 页面的初始数据
    */
   Page: 1,
-  Size: 5,
+  Size: 20,
   data: {
     list: []
   },
@@ -66,7 +66,7 @@ Page({
     let out = y;
     m > 9 ? out += '-' + m : out += '-0' + m;
     d > 9 ? out += '-' + d + ' ' : out += '-0' + d + ' ';
-    h > 9 ? out += h + ":" : out += h + ':';
+    h > 9 ? out += h + ":" : out += '0' + h + ':';
     min > 9 ? out += min + ":" : out += '0' + min + ':';
     s > 9 ? out += s : out += '0' + s;
     return out;

+ 34 - 3
miniprogram/pages/result/index.js

@@ -5,16 +5,47 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    detail: {},
+    scrollheight: 0
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    if (!options.data) return wx.redirectTo({
+      url: '/pages/problemPage/index',
+    })
+    const detail = JSON.parse(options.data);
+    const sys = wx.getSystemInfoSync();
+    console.log(sys);
+    const query = wx.createSelectorQuery();
+    query.selectAll('.getHeight').boundingClientRect(rect => {
+      let heightAll = 0;
+      rect.map((currentValue, index, arr) => {
+        heightAll += currentValue.height
+      })
+      this.setData({
+        scrollheight: sys.windowHeight - heightAll
+      })
+    }).exec();
+
+
+    detail.durationText = Math.floor(detail.duration / 3600000);
+    if (detail.durationText) detail.durationText += "时";
+    let min = Math.floor(detail.duration % 3600000 / 60000);
+    if (min) detail.durationText += min + "分";
+    let s = Math.floor(detail.duration % 60000 / 1000);
+    if (s) detail.durationText += s + "秒";
+    this.setData({
+      detail
+    })
+  },
+  reset() {
+    wx.reLaunch({
+      url: '/pages/answer/index?reset=1'
+    })
   },
-
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 19 - 2
miniprogram/pages/result/index.wxml

@@ -1,3 +1,20 @@
 <!--pages/result/index.wxml-->
-<view>本次答题获得:
-</view>
+<view class="result">
+  <view class="head getHeight">
+    <view class="title">{{detail.score}}分</view>
+    <view class="subTitle">答题用时:{{detail.durationText || '0秒'}}</view>
+  </view>
+
+  <scroll-view class="body" style="height: {{scrollheight - 15}}px" scroll-y="{{true}}">
+    <view class="queAnswer" style="color: {{item ? '#63BD4F': '#FD5454'}};border-color:{{item ? '#63BD4F': '#FD5454'}}" wx:for="{{detail.istrue}}" wx:key="index">
+      <view class="tag" style="background-color: {{item ? '#63BD4F': '#FD5454' }};">
+        <view wx:if="{{item}}">∨</view>
+        <view wx:else>×</view>
+      </view>
+      {{index + 1}}
+    </view>
+  </scroll-view>
+  <view class="footer getHeight">
+    <button style="background-color: #0E8EF4;" bindtap="reset" type="primary">再答一次</button>
+  </view>
+</view>

File diff suppressed because it is too large
+ 12 - 1
miniprogram/pages/result/index.wxss


Some files were not shown because too many files changed in this diff