Browse Source

新增高频词库

y595705120 2 years ago
parent
commit
77253f5ddb

+ 5 - 4
app.json

@@ -1,18 +1,16 @@
 {
   "pages": [
     "pages/index/index",
+    "pages/my/index/index",
     "pages/exam/index/index",
     "pages/exam/answerIndex/index",
-    
     "pages/exam/answer/answer",
     "pages/exam/group/group",
     "pages/exam/paper/paper",
     "pages/exam/do/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",
@@ -23,7 +21,10 @@
     "pages/exam/read/index",
     "pages/exam/error/index",
     "pages/exam/record/index",
-    "pages/train/index/index"
+    "pages/post/post",
+    "pages/train/index/index", 
+    "pages/train/limitHome/index",
+    "pages/train/limit/index"
   ],
   "tabBar": {
     "color": "#6e6d6b",

+ 10 - 0
app.wxss

@@ -136,6 +136,12 @@ page {
 .pt20{ padding-top: 20rpx;}
 .pt30{ padding-top: 30rpx;}
 
+.pb20{ padding-bottom: 20rpx;}
+.pb30{ padding-bottom: 30rpx;}
+
+.mb20{ margin-bottom: 20rpx;}
+.mb30{ margin-bottom: 30rpx;}
+
 .p10{ padding:10rpx;}
 .p20{ padding:20rpx;}
 .p30{ padding:30rpx;}
@@ -220,4 +226,8 @@ button::after {
 .slide-image {
   width: 100%;
   height: 150px;
+}
+
+.br20{
+  border-radius: 20rpx;
 }

+ 36 - 4
pages/index/index.js

@@ -1,5 +1,3 @@
-//index.js
-//获取应用实例
 const app = getApp()
 
 Page({
@@ -9,6 +7,9 @@ Page({
       "/assets/carousel/2.png",
       "/assets/carousel/3.png"
     ],
+    tableData: [],
+    from: 0,
+    size: 10,
     indicatorDots: false,
     autoplay: true,
     interval: 4000,
@@ -20,8 +21,39 @@ Page({
       swiperIndex: e.detail.current,
     })
   },
-  onLoad: function(){
+  onLoad: function(options) {
+    this.setData({
+      spinShow: true
+    });
+    this.search(true)
   },
-  onShareAppMessage: function(){
+  onPullDownRefresh() {
+    this.setData({ spinShow: true });
+    if (!this.loading) {
+      this.setData({ from:0,tableData:[]});
+      this.search(true)
+    }
+  },
+  onReachBottom() {
+    console.log( "onReachBottom", this.loading, this.data.from)
+    if (!this.loading && this.data.from > -1) {
+      this.search(false)
+    }
+  },
+  search: function(override) {
+    let _this = this
+    let param = {from: override?0:this.data.from, size:this.data.size}
+    app.formPost('Post.getPostList', param ).then(res => {
+      _this.setData({spinShow: false});
+      wx.stopPullDownRefresh()
+      if (res.code === 200) {
+        const re = res.data
+        console.log( re )
+        _this.setData({
+          from: re.from,
+          tableData: override ? re.list : this.data.tableData.concat(re.list)
+        });
+      }
+    })
   }
 })

+ 13 - 12
pages/index/index.wxml

@@ -26,18 +26,19 @@
 </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>
-
-  <navigator url="/pages/train/index/index" hover-class="navigator-hover" open-type="switchTab">
-    <image src="/assets/nav/1.png" mode="aspectFill" class="nav-item"></image>
-  </navigator>
-
-  <navigator url="/pages/study/index/index" hover-class="navigator-hover" open-type="switchTab">
-    <image src="/assets/nav/3.png" mode="aspectFill" class="nav-item"></image>
-  </navigator>
-
+  <i-cell-group>
+      <i-cell wx:for="{{tableData}}" 
+        data-item="item" 
+        wx:key="postId" 
+        title="{{item.title}}" 
+        is-link 
+        url="/pages/post/post?postId={{item.postId}}" 
+        label="{{item.publishTime}}"
+      />
+    </i-cell-group>
+</view>
+<view wx:if="{{from==-1}}"  style="text-align:center;margin-top:40rpx">
+  <view class="padding">没有更多了</view>
 </view>
 
 <view class="cu-tabbar-height"> </view>

+ 17 - 11
pages/my/index/index.wxml

@@ -16,20 +16,26 @@
 
 <view>
   <i-cell-group i-class="my-group-margin">
-    <i-cell title="{{filter.phoneFormat(userInfo.phone)||'---'}}" is-link>
-      <i-icon type="mobilephone_fill" slot="icon" size="20" />
+    <i-cell title="高频题库" is-link url="/pages/train/limit/index">
+      <i-icon type="like" slot="icon" size="20" />
     </i-cell>
 
-    <i-cell title="{{userInfo.nickname ||'---'}}" is-link>
-      <i-icon type="mine_fill" slot="icon" size="20" />
+    <i-cell title="{{filter.phoneFormat(userInfo.phone)||'---'}}" >
+      <i-icon type="mobilephone" slot="icon" size="20" />
     </i-cell>
 
-    <i-cell title="{{filter.cardIdFormat(userInfo.cardId) ||'---'}}" is-link>
-      <i-icon type="businesscard_fill" slot="icon" size="20" />
+    <i-cell title="{{userInfo.nickname ||'---'}}" >
+      <i-icon type="mine" slot="icon" size="20" />
     </i-cell>
+
+    <i-cell title="{{filter.cardIdFormat(userInfo.cardId) ||'---'}}" >
+      <i-icon type="businesscard" slot="icon" size="20" />
+    </i-cell>
+
+   
   </i-cell-group>
 </view>
-
+<!-- 
 <view>
   <i-cell-group i-class="my-group-margin">
     <i-cell title="设置" >
@@ -38,21 +44,21 @@
     <i-cell title="反馈" >
       <i-icon type="praise_fill" slot="icon" size="20" />
     </i-cell>
-    <i-cell title="关于" is-link url="/pages/dashboard/index">
+    <i-cell title="关于" >
       <i-icon type="prompt_fill" slot="icon" size="20" />
     </i-cell>
   </i-cell-group>
-</view>
+</view> -->
 
 <view>
   <i-cell-group i-class="my-group-margin">
     <i-cell title="退出登入" bind:click="logOut">
-      <i-icon type="flashlight_fill" slot="icon" size="20" />
+      <i-icon type="flashlight" slot="icon" size="20" />
     </i-cell>
   </i-cell-group>
 </view>
 
-<view class="copyright">宁德市建筑工程技术服务行业协会[2]</view>
+<view class="copyright">宁德市建筑工程技术服务行业协会</view>
 
 <i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
 <i-message id="message" />

+ 34 - 0
pages/post/post.js

@@ -0,0 +1,34 @@
+const app = getApp()
+Page({
+
+  data: {
+    postId:0,
+    info:{},
+    content:''
+  },
+  onLoad: function (options) {
+    let postId = +options.postId||7356;
+    this.setData({postId})
+  },
+  onShow: function(){
+    this.loadData()
+  },
+  loadData(){
+    let postId = this.data.postId
+    app.formPost( "Post.getPostInfo", {postId}).then( res=>{
+      if( res.code == 200 ){
+        let info = res.data
+        this.setData({info})
+      }
+    })
+  },
+  onShareAppMessage: function () {
+    let {postId, title} = this.data.info;
+    return {
+      title: title,
+      path: `/pages/post/post?postId=${postId}`
+    }
+  }
+})
+
+ 

+ 6 - 0
pages/post/post.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+      "i-icon": "/component/iView/icon/index"
+    },
+    "enablePullDownRefresh": true
+  }

+ 16 - 0
pages/post/post.wxml

@@ -0,0 +1,16 @@
+<view>
+  <view class="artical-title fc">
+    {{info.title}}
+  </view>
+
+  <view class=" tc">
+    <text> {{info.publishTime}}</text>
+    <i-icon type="browse" size="20" color="#80848f" />
+    {{info.viewCount}}
+  </view>
+
+  <view class="wxParse artical-content">
+    <rich-text nodes="{{info.content}}" space="emsp" ></rich-text>
+  </view>
+</view>
+

+ 22 - 0
pages/post/post.wxss

@@ -0,0 +1,22 @@
+/* pages/post/post.wxss */
+page{
+  background:white;
+}
+.artical-title{
+  text-align:center;
+  font-size:36rpx;
+  font-weight: 800;
+  margin-top:10rpx;
+  padding:20rpx;
+  background: #ffffff;
+}
+.bsmall{
+  color:#409eff;
+}
+.artical-content{
+  padding-left: 30rpx;
+  font-size: 30rpx;
+  line-height:180%;
+  padding-right: 30rpx;
+}
+.w80{ width:90%}

+ 0 - 1
pages/train/index/index.wxml

@@ -38,7 +38,6 @@
         <i-icon type="flag" size="40" color="#e96900a0" />
         <text>学时证明</text>
       </navigator>
-
       <navigator class="cate-item"  url="/pages/study/market/index?type=岗前培训" >
         <i-icon type="shop_fill" size="40" color="#e96900a0" />
         <text>所有课程</text>

+ 43 - 0
pages/train/limit/index.js

@@ -0,0 +1,43 @@
+//index.js
+
+const util = require("../../../utils/util")
+
+//获取应用实例
+const app = getApp()
+
+Page({
+  data: {
+    info:{},
+    groups: [],
+    isOpen: false,
+    userInfo:{}
+  },
+  onShow: function(){
+    app.checkLogin( userInfo =>{
+      this.setData({userInfo})
+      // 已经实名认证
+      this.indexLoad()
+    })
+  },
+  onPullDownRefresh() {
+    if (!this.loading) {
+      this.indexLoad( this.stopPullDownRefresh )
+    }
+  },
+  stopPullDownRefresh(){
+    wx.stopPullDownRefresh()
+  },
+  indexLoad: function( cb ) {
+    let _this = this
+    app.formPost('Exam.getUserLimitPaperList', {}).then(res => {
+      if (res.code === 200) {
+        let groups = res.data.groups||[];
+        _this.setData({
+          groups: groups,
+          isOpen: groups.length>0
+        });
+       cb&&cb() 
+      }
+    })
+  }
+})

+ 15 - 0
pages/train/limit/index.json

@@ -0,0 +1,15 @@
+{
+  "usingComponents": {
+    "i-panel": "/component/iView/panel/index",
+    "i-cell-group": "/component/iView/cell-group/index",
+    "i-cell": "/component/iView/cell/index",
+    "i-collapse": "/component/iView/collapse/index",
+    "i-collapse-item": "/component/iView/collapse-item/index",
+    "i-message": "/component/iView/message/index",
+    "i-spin": "/component/iView/spin/index",
+    "i-icon": "/component/iView/icon/index",
+    "i-badge": "/component/iView/badge/index"
+  },
+  "enablePullDownRefresh": true,
+  "navigationBarTitleText": "鸿锵在线教育-高频题库"
+}

+ 25 - 0
pages/train/limit/index.wxml

@@ -0,0 +1,25 @@
+<wxs module="enumItem" src="../../../wxs/enumItem.wxs"></wxs>
+<view>
+  <view>
+    <swiper indicator-dots="false" autoplay="true" interval="5000" duration="1000">
+      <swiper-item>
+        <image src="/assets/carousel/1.png" class="slide-image" />
+      </swiper-item>
+      <swiper-item>
+        <image src="/assets/carousel/2.png" class="slide-image" />
+      </swiper-item>
+      <swiper-item>
+        <image src="/assets/carousel/3.png" class="slide-image" />
+      </swiper-item>
+    </swiper>
+  </view>
+  <view class="p20 br20">
+    <i-cell-group>
+      <i-cell wx:for="{{groups}}" data-item="item" wx:key="id" title="{{item.name}}" is-link value="进入题库" i-class="mt20 p20 br20"
+        url="/pages/train/limitHome/index?groupId={{item.groupId}}" label="{{item.startAt}} 到 {{item.endAt}}" />
+    </i-cell-group>
+  </view>
+  <view wx:if="{{!isOpen}}" class="tc m20 p20">
+    <text class="tc fc">还未开通高频题库</text>
+  </view>
+</view>

+ 35 - 0
pages/train/limit/index.wxss

@@ -0,0 +1,35 @@
+/**index.wxss**/
+
+.caption-wrap {
+  background-color: white;
+  margin-top: 15px;
+}
+
+.caption-title {
+  background-color: #f7f7f7;
+  display: block;
+  margin-left: 5px;
+}
+
+.index-collapse {
+  font-size: 14px;
+  line-height: 24px;
+}
+
+.index-collapse-item {
+  padding: 8px 15px !important;
+  border: 0px !important;
+}
+
+.slide-image {
+  width: 100%;
+  height: 150px;
+}
+
+.index-cell {
+  padding: 5px 15px !important;
+}
+
+p{
+  display: none;
+}

+ 39 - 0
pages/train/limitHome/index.js

@@ -0,0 +1,39 @@
+let app = getApp()
+Page({
+  data: {
+    groupId: 0,
+    tableData: [],
+    types:{
+      1:'判断题',
+      2:'单选题',
+      3:'多选题',
+      4:'案例题'
+    }
+  },
+  onLoad: function(options) {
+    let groupId = +options.groupId||1;
+    this.setData({ groupId });
+  },
+  onShow: function () {
+    app.checkLogin( userInfo =>{
+      this.setData({userInfo, from:0})
+      this.loadData()
+    })
+  },
+  gotoAnswer(e){
+    let item = e.currentTarget.dataset.item;
+    let groupId = this.data.groupId
+    console.log( item )
+    wx.navigateTo({
+      url: `/pages/exam/answer/answer?groupId=${groupId}&type=${item.type}&count=${item.count}`
+    })
+  },
+  loadData: function(){
+    let param= {groupId: this.data.groupId}
+    app.formPost('Exam.InitGroupAnswer', param ).then(res => {
+      if( res.code == 200){
+        this.setData({tableData: res.data})
+      }
+    })
+  }
+})

+ 16 - 0
pages/train/limitHome/index.json

@@ -0,0 +1,16 @@
+{
+  "usingComponents": {
+    "i-panel": "/component/iView/panel/index",
+    "i-cell-group": "/component/iView/cell-group/index",
+    "i-cell": "/component/iView/cell/index",
+    "i-collapse": "/component/iView/collapse/index",
+    "i-collapse-item": "/component/iView/collapse-item/index",
+    "i-message": "/component/iView/message/index",
+    "i-spin": "/component/iView/spin/index",
+    "i-icon": "/component/iView/icon/index",
+    "i-button": "/component/iView/button/index",
+    "i-badge": "/component/iView/badge/index"
+  },
+  "enablePullDownRefresh": true,
+  "navigationBarTitleText": "顺序做题"
+}

+ 54 - 0
pages/train/limitHome/index.wxml

@@ -0,0 +1,54 @@
+
+  <view class="mb20">
+    <swiper indicator-dots="false" autoplay="true" interval="5000" duration="1000">
+      <swiper-item>
+        <image src="/assets/carousel/1.png" class="slide-image" />
+      </swiper-item>
+      <swiper-item>
+        <image src="/assets/carousel/2.png" class="slide-image" />
+      </swiper-item>
+      <swiper-item>
+        <image src="/assets/carousel/3.png" class="slide-image" />
+      </swiper-item>
+    </swiper>
+</view>
+<navigator class="card-wrapper" wx:for="{{tableData}}" wx:key="index" 
+  url="/pages/exam/answer/answer?groupId={{groupId}}&type={{item.type}}&count={{item.count}}">
+  <view class="i-class i-card i-card-radus" data-id="{{item.id}}" data-out="{{item.isOut}}"  bindtap="gotoDetail" >
+    <view class="i-class i-card-header mt10">
+      <view class="i-card-header-title" style="font-size:36rpx">
+        {{types[item.type]}} 
+      </view>
+      <view class="i-card-header-extra" style="font-size:28rpx" >
+        共计【{{item.count}}】题
+      </view>
+    </view>
+  </view>
+</navigator>
+
+<navigator url="/pages/exam/collection/index?groupId={{groupId}}" class="card-wrapper">
+  <view class="i-class i-card i-card-radus" data-id="{{item.id}}" data-out="{{item.isOut}}"  bindtap="gotoDetail" >
+    <view class="i-class i-card-header mt10">
+      <view class="i-card-header-title tc" style="font-size:36rpx">
+        我的错题
+      </view>
+
+      <view class="i-card-header-extra" style="font-size:28rpx" >
+        进入
+      </view>
+    </view>
+  </view>
+</navigator>
+
+  <navigator url="/pages/exam/do/index?id={{groupId}}" class="card-wrapper">
+    <view class="i-class i-card i-card-radus" data-id="{{item.id}}" data-out="{{item.isOut}}"  bindtap="gotoDetail" >
+    <view class="i-class i-card-header mt10">
+      <view class="i-card-header-title tc" style="font-size:36rpx">
+        模拟考试
+      </view>
+      <view class="i-card-header-extra" style="font-size:28rpx" >
+        开始
+      </view>
+    </view>
+  </view>
+  </navigator>

+ 14 - 0
pages/train/limitHome/index.wxss

@@ -0,0 +1,14 @@
+@import '/component/iView/card/index.wxss';
+.i-card-radus{
+   border-radius: 10rpx;
+   margin-top: 10rpx;
+   background-color: #fff;
+}
+
+page{
+  background-color: #fafafa;
+}
+
+.card-wrapper{
+  margin-bottom: 24rpx;
+}

+ 1 - 1
project.config.json

@@ -23,7 +23,7 @@
     "compileHotReLoad": false,
     "useMultiFrameRuntime": true,
     "useApiHook": true,
-    "useApiHostProcess": false,
+    "useApiHostProcess": true,
     "babelSetting": {
       "ignore": [],
       "disablePlugins": [],