y595705120 3 years ago
parent
commit
39467a7846

+ 1 - 7
app.json

@@ -2,28 +2,22 @@
   "pages": [
     "pages/index/index",
     "pages/study/exam/index",
+    "pages/user/identify/index",    
     "pages/study/course/index",
     "pages/my/index/index",
     "pages/study/index/index",
-    
     "pages/study/sign/index",
-    
     "pages/study/market/index",
-    
     "pages/exam/index/index",
-    "pages/user/identify/index",
     "pages/user/bind/index",
     "pages/user/register/index",
-    
     "pages/my/message/info/index",
     "pages/my/message/list/index",
     "pages/exam/read/index",
     "pages/exam/do/index",
     "pages/exam/error/index",
     "pages/exam/record/index",
-    "pages/study/play/index",
     "pages/train/index/index"
-    
   ],
   "tabBar": {
     "color": "#6e6d6b",

+ 2 - 1
app.wxss

@@ -2,7 +2,8 @@
 @import '/component/iView/button/index.wxss';
 @import '/component/iView/radio/index.wxss';
 @import '/component/iView/input/index.wxss';
-
+@import '/assets/css/style.wxss';
+@import '/assets/css/select.wxss';
 page {
   /* Color 可以自定义相关配色 *//* 标准色 */
   --red: #e54d42;

+ 16 - 0
assets/css/select.wxss

@@ -0,0 +1,16 @@
+checkbox {
+  margin:10rpx;
+  height: auto;
+  /* font-size:16rpx; */
+}
+/*checkbox 选项框大小  */
+checkbox .wx-checkbox-input {
+  width: 40rpx;
+  height: 40rpx;
+  flex: none;
+}
+.radio .wx-radio-input{
+  width: 40rpx;
+  height: 40rpx;
+  flex: none;
+}

+ 48 - 0
assets/css/style.wxss

@@ -0,0 +1,48 @@
+.f-header {
+  display: -webkit-box;
+  display: -webkit-flex;
+  display: -ms-flexbox;
+  display: flex;
+  -webkit-box-align: center;
+  -webkit-align-items: center;
+      -ms-flex-align: center;
+          align-items: center;
+  height: 120rpx;
+  padding: 6rpx 30rpx 8rpx;
+  background: #fff;
+}
+.f-header image {
+    -webkit-flex-shrink: 0;
+        -ms-flex-negative: 0;
+            flex-shrink: 0;
+    width: 80rpx;
+    height: 80rpx;
+    margin-right: 20rpx;
+}
+.f-header .tit-box {
+    -webkit-box-flex: 1;
+    -webkit-flex: 1;
+        -ms-flex: 1;
+            flex: 1;
+    display: -webkit-box;
+    display: -webkit-flex;
+    display: -ms-flexbox;
+    display: flex;
+    -webkit-box-orient: vertical;
+    -webkit-box-direction: normal;
+    -webkit-flex-direction: column;
+        -ms-flex-direction: column;
+            flex-direction: column;
+}
+.f-header .tit {
+    font-size: 34rpx;
+    line-height: 1.3;
+}
+.f-header .tit2 {
+    font-size: 24rpx;
+    color: #909399;
+}
+.f-header .icon-you {
+    font-size: 34rpx;
+    color: #909399;
+}

+ 0 - 17
pages/exam/do/index.wxss

@@ -74,20 +74,3 @@
   margin-top: 10px;
   margin-bottom: 20px;
 }
-
-checkbox {
-  margin:10rpx;
-  height: auto;
-  /* font-size:16rpx; */
-}
-/*checkbox 选项框大小  */
-checkbox .wx-checkbox-input {
-  width: 40rpx;
-  height: 40rpx;
-  flex: none;
-}
-.radio .wx-radio-input{
-  width: 40rpx;
-  height: 40rpx;
-  flex: none;
-}

+ 1 - 1
pages/exam/index/index.wxml

@@ -45,7 +45,7 @@
       </button>
     </view>
 
-    <i-panel title="练习科目">
+    <i-panel>
       <view class="cate-section">
         <view wx:for="{{groups}}" wx:key="groupId" class="cate-item cate-item-3">
           <button class="cate-item" wx:if="{{item.isBuy}}" bindtap="gotoExam" data-id="{{item.groupId}}">

+ 3 - 4
pages/index/index.wxml

@@ -17,16 +17,15 @@
   </view>
 </view>
 
-<view class="f-header m-t">
+<!-- <view class="f-header m-t">
   <image src="/assets/h1.png"></image>
   <view class="tit-box">
     <text class="tit">业务选择</text>
     <text class="tit2">items</text>
   </view>
-</view>
-
-<view class="m-t">
+</view> -->
 
+<view>
   <navigator url="/pages/exam/index/index" hover-class="navigator-hover" open-type="switchTab">
     <image src="/assets/nav/4.png" mode="aspectFill" class="nav-item"></image>    
   </navigator>

+ 0 - 49
pages/index/index.wxss

@@ -45,55 +45,6 @@ swiper image {
   width: 100%;
 }
 
-.f-header {
-  display: -webkit-box;
-  display: -webkit-flex;
-  display: -ms-flexbox;
-  display: flex;
-  -webkit-box-align: center;
-  -webkit-align-items: center;
-      -ms-flex-align: center;
-          align-items: center;
-  height: 120rpx;
-  padding: 6rpx 30rpx 8rpx;
-  background: #fff;
-}
-.f-header image {
-    -webkit-flex-shrink: 0;
-        -ms-flex-negative: 0;
-            flex-shrink: 0;
-    width: 80rpx;
-    height: 80rpx;
-    margin-right: 20rpx;
-}
-.f-header .tit-box {
-    -webkit-box-flex: 1;
-    -webkit-flex: 1;
-        -ms-flex: 1;
-            flex: 1;
-    display: -webkit-box;
-    display: -webkit-flex;
-    display: -ms-flexbox;
-    display: flex;
-    -webkit-box-orient: vertical;
-    -webkit-box-direction: normal;
-    -webkit-flex-direction: column;
-        -ms-flex-direction: column;
-            flex-direction: column;
-}
-.f-header .tit {
-    font-size: 34rpx;
-    line-height: 1.3;
-}
-.f-header .tit2 {
-    font-size: 24rpx;
-    color: #909399;
-}
-.f-header .icon-you {
-    font-size: 34rpx;
-    color: #909399;
-}
-
 .nav-item{
   width: 670rpx;
   margin-left: 40rpx;

+ 5 - 14
pages/my/index/index.wxml

@@ -16,25 +16,16 @@
 
 <view>
   <i-cell-group i-class="my-group-margin">
-    <i-cell is-link>
+    <i-cell title="{{filter.phoneFormat(userInfo.phone)||'---'}}" is-link>
       <i-icon type="mobilephone_fill" slot="icon" size="20" />
-      <button  class="plain tl">
-        {{filter.phoneFormat(userInfo.phone)||"---"}}
-      </button>
     </i-cell>
 
-    <i-cell is-link>
-      <i-icon type="editor" slot="icon" size="20" />
-      <button class="plain tl">
-        {{userInfo.nickname ||"---"}}
-      </button>
+    <i-cell title="{{userInfo.nickname ||'---'}}" is-link>
+      <i-icon type="mine_fill" slot="icon" size="20" />
     </i-cell>
 
-    <i-cell is-link>
-      <i-icon type="editor" slot="icon" size="20" />
-      <button class="plain tl">
-        {{filter.cardIdFormat(userInfo.cardId)||"---"}}
-      </button>
+    <i-cell title="{{filter.cardIdFormat(userInfo.cardId) ||'---'}}" is-link>
+      <i-icon type="businesscard_fill" slot="icon" size="20" />
     </i-cell>
   </i-cell-group>
 </view>

+ 1 - 1
pages/study/course/index.js

@@ -108,13 +108,13 @@ Page({
       scrollTop: 0,
       duration: 1000
    })
-
     if( item.url ){
       this.setData({onPlay: true, item})
       return;
     }
     app.formPost('study.GetMedia', {id:item.id}).then( res => {
       if( res.code == 200){
+        if( !res.data ) return
         item.url = res.data
         mediaList[index] = item;
         this.setData({onPlay: true, item, mediaList})

+ 0 - 3
pages/study/course/index.wxml

@@ -35,9 +35,6 @@
     </view>
   </view>
 
-
-
-
   <view wx:for="{{mediaList}}" wx:for-item="item" wx:for-index="index" wx:key="index" class="mt20">
     <i-card title="{{item.name}}" bindtap="playMedia" data-index="{{index}}">
       <view slot="content">视频学时: {{item.xs/10}}</view>

+ 2 - 2
pages/study/exam/index.js

@@ -11,7 +11,7 @@ Page({
     index:0,
     score:0,
     useTime:0,
-    item: {},
+    item: {index:0},
     info: {},
     list: [],
   },
@@ -87,7 +87,7 @@ Page({
   },
   checkboxChange( e ){
     let item = this.data.item
-    item.select = e.detail.value.sort()
+    item.select = parseInt(e.detail.value.sort().join(''))
     console.log( "radioChange", item)
     this.setData({item})
   },

+ 7 - 14
pages/study/exam/index.wxml

@@ -9,7 +9,7 @@
 	</view>
 	
 
-	<i-panel i-class="exam-panel-title">
+	<i-panel i-class="exam-panel-title" >
 		<i-cell-group i-class="exam-cell">
 			<!-- 单选题 -->
 			<i-cell wx:if="{{item.type==2}}">
@@ -31,7 +31,7 @@
 			<i-cell wx:if="{{item.type==3}}">
 				<view>
 					<text> [多]{{item.title}} </text>
-					<checkbox-group class="checkbox-answer" style="margin-top:30rpx" bindchange="checkboxChange">
+					<checkbox-group class="checkbox-answer" style="margin-top:10rpx" bindchange="checkboxChange">
 						<label class="checkbox" wx:for="{{preList}}" wx:key="index" wx:for-item="answer"
 							wx:if="{{item['answer'+(index+1)]}}">
 							<view class="checkbox-answer">
@@ -67,18 +67,11 @@
 	</i-panel>
 </view>
 
-<view class="bg-white">
-	<i-row >
-		<i-col span="4" wx:for="{{30}}" i-class="col-class">
-			<view class="item-select {{info.answers[index].select>0?'is-select':''}}" bindtap="selectquestion" data-index="{{index}}" > {{index+1}} </view>
-		</i-col>
-
-		<i-col span="4" wx:for="{{10}}" i-class="col-class" >
-			<view class="item-select {{info.answers[index+30].select>0?'is-select':''}}" bindtap="selectquestion" data-index="{{index+30}}"> {{index+31}} </view>
-		</i-col>
-
-		<i-col span="4" wx:for="{{10}}" i-class="col-class" >
-			<view class="item-select {{info.answers[index+40].select>0?'is-select':''}}" bindtap="selectquestion" data-index="{{index+40}}"> {{index+41}} </view>
+<view class="bg-white p20">
+	<i-row wx:for="{{10}}" wx:for-index="row">
+		<i-col  wx:for="{{5}}" wx:for-index="cell" style="float:left;width:20%;text-alignP:center">
+			<view class="item-select {{filter.isExamSelect( 5*row+cell, info)}} " 
+				bindtap="selectquestion" data-index="{{5*row+cell}}" > {{5*row+cell+1}} </view>
 		</i-col>
 	</i-row>
 </view>

+ 28 - 2
pages/study/exam/index.wxss

@@ -54,9 +54,35 @@
   margin: 20rpx;
   margin-top: 10rpx;
   text-align: center;
-  height: 40rpx;
+  height: 50rpx;
 }
+
+.un-select{
+  width: 50rpx;
+  height: 50rpx;
+  
+  line-height: 50rpx;
+  border-radius: 100%;
+}
+
+.cur-select{
+  background: lightblue !important;
+  color:red;
+  width: 50rpx;
+  height: 50rpx;
+  font-size: 900;
+  line-height: 50rpx;
+  border-radius: 100%;
+}
+
 .is-select{
   background: #dadada;
-  margin: 0rpx;
+  width: 50rpx;
+  height: 50rpx;
+  line-height: 50rpx;
+  border-radius: 100%;
+}
+
+.exam-cell{
+  min-height: 500rpx;
 }

+ 0 - 52
pages/study/play/index.js

@@ -1,52 +0,0 @@
-function getRandomColor() {
-  const rgb = []
-  for (let i = 0; i < 3; ++i) {
-    let color = Math.floor(Math.random() * 256).toString(16)
-    color = color.length == 1 ? '0' + color : color
-    rgb.push(color)
-  }
-  return '#' + rgb.join('')
-}
-
-Page({
-  onReady(res) {
-    this.videoContext = wx.createVideoContext('myVideo')
-  },
-  inputValue: '',
-  data: {
-    src: '',
-    danmuList: [
-      {
-        text: '第 1s 出现的弹幕',
-        color: '#ff0000',
-        time: 1
-      },
-      {
-        text: '第 3s 出现的弹幕',
-        color: '#ff00ff',
-        time: 3
-      }]
-  },
-  bindInputBlur(e) {
-    this.inputValue = e.detail.value
-  },
-  bindButtonTap() {
-    const that = this
-    wx.chooseVideo({
-      sourceType: ['album', 'camera'],
-      maxDuration: 60,
-      camera: ['front', 'back'],
-      success(res) {
-        that.setData({
-          src: res.tempFilePath
-        })
-      }
-    })
-  },
-  bindSendDanmu() {
-    this.videoContext.sendDanmu({
-      text: this.inputValue,
-      color: getRandomColor()
-    })
-  }
-})

+ 0 - 3
pages/study/play/index.json

@@ -1,3 +0,0 @@
-{
-  "usingComponents": {}
-}

+ 0 - 15
pages/study/play/index.wxml

@@ -1,15 +0,0 @@
-<view class="section tc">
-  <video
-    id="myVideo"
-    src="http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"
-    danmu-list="{{danmuList}}"
-    enable-danmu
-    danmu-btn
-    controls
-  ></video>
-  <view class="btn-area">
-    <button bindtap="bindButtonTap">获取视频</button>
-    <input bindblur="bindInputBlur" />
-    <button bindtap="bindSendDanmu">发送弹幕</button>
-  </view>
-</view>

+ 0 - 1
pages/study/play/index.wxss

@@ -1 +0,0 @@
-/* pages/course/play/index.wxss */

+ 20 - 5
pages/user/identify/index.js

@@ -20,6 +20,9 @@ Page({
   },
   onShow: function () {
     app.getUserInfo( studyUser =>{
+      if( !studyUser.token ){
+        studyUser = wx.getStorageSync('@identify')||{}
+      }
       this.setData({studyUser})
     })
   },
@@ -96,13 +99,25 @@ Page({
       util.showMsg("图片上传失败")
       return
     }
+    let type = this.data.type;
     util.showBusy("识别图片中")
-    let info = this.data.info
+    let studyUser = this.data.studyUser
     let showcamara= false
-    app.formPost('Auth.wxUploadImg', {url}).then(res => {
-      util.showBusy("上传成功")
-      Object.assign( info, res)
-      this.setData({info,showcamara})
+    app.formPost('Auth.wxUploadImg', {url, type}).then(res => {
+      if( res.code == 200 ){
+        util.showBusy("上传成功")
+        if ( type =="card"){
+          studyUser.cardImg = url
+          studyUser.address = res.data.Address
+          studyUser.nickname = res.data.Name
+          studyUser.cardId = res.data.IDNumber
+          studyUser.gender = res.data.Gender
+        }else{
+          studyUser.cardBackImg = url
+        }
+        wx.setStorageSync('@identify', studyUser)
+        this.setData({studyUser,showcamara})
+      }
     })
   },
   chooseImg: function () {

+ 4 - 2
utils/util.js

@@ -1,6 +1,7 @@
 // const baseUrl = "http://192.168.3.2:8000/"
 const baseUrl = "https://edu.ndjsxh.cn:8443/"
 const ossUrl = "https://sm-sign.oss-cn-shanghai.aliyuncs.com/cert/"
+const md5 = require('./md5.js');
 
 const formatTime = date => {
   const year = date.getFullYear()
@@ -56,9 +57,10 @@ var uploadFile = (tempFilePaths, fun) =>{
   let version= "1.0"
   let mtime = parseInt(Date.now() / 1000);
   // 未登入
-  let sign = "hall_" + version +  mtime;
+  let signstr = "hall_" + version +  mtime;
+  let sign = md5.md5(signstr).toLowerCase()
   wx.uploadFile({
-    url: `${murl}?t=${mtime}&v=1&s=${sign}`,
+    url: `${murl}?t=${mtime}&v=1&s=${sign}&u=0`,
     filePath: tempFilePaths,
     name: "avatar",
     header:header,

+ 9 - 0
wxs/exam-fun.wxs

@@ -50,6 +50,14 @@ var filter = {
     if( index == select)  return true;
     select = ""+select
     return select.indexOf( index )>-1;
+  },
+  isExamSelect: function( index, info ){
+    if( !info.answers ) return '';
+    if( index >= info.answers.length ) return '';
+    var select = ""
+    if( index == info.index ) select += 'cur-select';
+    if( info.answers[index].select>0 ) select += ' is-select';
+    return select||'un-select'
   }
 }
 // 导出对外暴露的属性
@@ -61,5 +69,6 @@ module.exports = {
   phoneFormat: filter.phoneFormat,
   getMultResult:filter.getMultResult,
   cardIdFormat:filter.cardIdFormat,
+  isExamSelect: filter.isExamSelect,
   numberToArray: filter.numberToArray,
 }