Commit 3e990722 authored by Facius's avatar Facius

Merge branch 'dev-v1.0.0' of https://git.banshouhui.com/wuzhenzhe/study into dev-v1.0.0

parents a489113d 1cf9bdba
......@@ -4,11 +4,10 @@ export default {
globalData: {
// 开发环境
uniEnv: process.uniEnv,
questionList: [],
orgId: -1
questionList: []
},
onLaunch: function(options) {
this.globalData.orgId = options?.orgId || -1
this.$u.vuex('orgId', options?.query?.orgId || -1)
// 版本更新
this.updateApp()
},
......
......@@ -68,12 +68,13 @@ let learnApiFun = function(vm) {
let submitExamRecord = async (params = {}) =>
await vm.$u.post('/rest/question/submit/examRecord', params)
// 学练记录
let queryExamRecord = async (params = {}) =>
await vm.$u.post('/rest/question/queryExamRecord', params)
// 查询考试成绩
let queryExamRecordOne = async (params = {}) =>
await vm.$u.get(`/rest/question/queryExamRecord/${params.id}`, params)
await vm.$u.get(`/rest/question/queryExamRecordById/${params.id}`, params)
// 学员获取自己的题库
let getMyQuestionWarehouseList = async (params = {}) =>
......
......@@ -2,8 +2,8 @@
<view @click.stop="itemChange(item.id)" class="list-item">
<view :class="['u-flex', 'head', { selected: item.id === arrIndex }]">
<view class="titles">
<text>{{ item.type }}</text
>{{ item.title }}
<view class="type">{{ item.type }}</view>
<u-parse :html="keyword, item.title | toRed"></u-parse>
</view>
<view class="u-flex arrow" v-show="item.id !== arrIndex">
<text>展开</text>
......@@ -56,7 +56,7 @@ export default {
answerSheet,
answerExplanation,
},
props: ['item', 'arrIndex'],
props: ['item', 'arrIndex', 'keyword'],
computed: {
collectImg() {
const name = this.item?.collectionFlag ? 'collected.png' : 'collect.png'
......@@ -66,6 +66,12 @@ export default {
return this.item?.collectionFlag || false
},
},
filters:{
toRed:function(content, keyword) {
const reslut = keyword.replace(''+content+'', "<text style='color:red'>"+content+"</text>")
return reslut
},
},
methods: {
itemChange(id) {
this.$emit('arrowDown', id)
......@@ -98,13 +104,17 @@ export default {
flex: 1;
height: 60rpx;
overflow: hidden;
text {
.type {
background: #9ea5bb;
color: #fff;
padding: 8rpx 20rpx;
margin-right: 10rpx;
margin: 10rpx 10rpx 0 0;
font-size: 20rpx;
border-radius: 50rpx 0 50rpx 50rpx;
float: left;
height: 45rpx;
line-height: 45rpx;
width: 100rpx;
text-align: center;
}
}
.arrow {
......
......@@ -130,7 +130,7 @@ export default {
},
computed: {
orgIdText() {
return getApp().globalData.orgId
return this.orgId
},
title() {
return this.selected.title || '请选择题库'
......
......@@ -174,7 +174,7 @@ export default {
current: 0,
// 仅仅记录swiper的位置
currentIndex: 0,
swiperDuration: '500',
swiperDuration: '800',
// 分页数据
currentPage: 1,
pageSize: 100,
......
......@@ -133,7 +133,7 @@ export default {
},
]
const data = {
instrtutionId: getApp().globalData.orgId,
instrtutionId: this.orgId,
orders: JSON.stringify(lists),
openId: this.openId,
}
......
......@@ -206,7 +206,7 @@ export default {
},
]
const data = {
instrtutionId: getApp().globalData.orgId,
instrtutionId: this.orgId,
orders: JSON.stringify(lists),
openId: this.openId,
}
......
......@@ -97,6 +97,7 @@ export default {
},
data() {
return {
id: '',
info: {},
show: false,
}
......@@ -172,22 +173,35 @@ export default {
return this.$u.random(random[0], random[1])
},
},
onLoad() {
let options = wx.getLaunchOptionsSync()
if (!options.query?.id) {
onShareAppMessage(res) {
return {
title: '模考大师',
path: `/pages/learn/score?id=${this.id}`
}
},
onLoad(options) {
if (options) {
this.id = options.id
} else {
let option = wx.getLaunchOptionsSync()
this.id = option.query.id
}
if (!this.id) {
this.$u.route({
url: 'pages/index/index',
type: 'tab',
})
return
}
this.init(options.query?.id)
this.init()
},
methods: {
init(id) {
init() {
uni.showLoading({
title: '加载中',
})
this.$u.api.queryExamRecordOne({ id: id }).then((res) => {
this.$u.api.queryExamRecordOne({ id: this.id }).then((res) => {
uni.hideLoading()
if (res) {
const echoMap = res.echoMap
......
......@@ -61,7 +61,7 @@ export default {
code: code,
avatar: userInfo.avatarUrl,
nickname: userInfo.nickName,
orgId: getApp().globalData.orgId,
orgId: this.orgId,
}
uni.showLoading({
title: '加载中',
......
......@@ -31,7 +31,9 @@
v-for="(item, index) in section"
:key="index"
:begin="item.begin"
:arrId.sync="arrId"
:end="item.end"
:keyword="keyword"
></my-section>
<u-loadmore :status="loadStatus" :margin-bottom="40" />
</view>
......@@ -49,7 +51,7 @@
</template>
<script>
import { list } from './list.js'
import { getList, setList } from './list.js'
import mySection from './my-section.vue'
export default {
components: {
......@@ -66,11 +68,13 @@ export default {
isLoadMore: false, //是否加载中
total: 0,
section: [],
arrId: ''
}
},
onLoad(e) {
this.keyword = e ? decodeURIComponent(e.keyword) : ''
this.lists = list
setList([])
this.lists = getList()
},
onReady() {
this.init()
......@@ -137,6 +141,7 @@ export default {
begin: this.lists.length - records.length,
end: this.lists.length,
})
this.arrId = this.lists[0].id
if (records.length < this.pageSize) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
......@@ -159,7 +164,9 @@ export default {
this.$u.vuex('searchHistory', history)
this.currentPage = 1
this.lists = []
setList([])
this.section = []
this.arrId = ''
this.init()
}
}
......
export const list = []
\ No newline at end of file
let list = []
export function setList(lists) {
list = lists
}
export function getList() {
return list
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
:key="index"
:item="item"
:arrIndex.sync="arrIndex"
:keyword.sync="keyword"
@arrowDown="arrowDown"
@arrowUp="arrowUp"
@collection="collection($event, index)"
......@@ -13,14 +14,14 @@
</template>
<script>
import { list } from './list.js'
import { getList } from './list.js'
import searchItem from '@/components/search-item/index.vue'
export default {
components: {
searchItem,
},
props: ['begin', 'end'],
props: ['begin', 'end', 'arrId', 'keyword'],
data() {
return {
list: [],
......@@ -28,7 +29,9 @@ export default {
}
},
created() {
const list = getList()
this.list = list.slice(this.begin, this.end)
if(this.arrId) this.arrIndex = this.arrId
},
methods: {
arrowDown(e) {
......
......@@ -19,7 +19,8 @@ let saveStateKeys = [
'tipStatus',
'questionWarehouseId',
'relationId', // 绑卡用
'answerCount'
'answerCount',
'orgId'
]
// 保存变量到本地存储中
......@@ -51,6 +52,7 @@ const store = new Vuex.Store({
questionWarehouseId: lifeData.questionWarehouseId
? lifeData.questionWarehouseId
: '1414854649273384960', // 科目ID
orgId: lifeData.orgId ? lifeData.orgId : -1, // 机构ID
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version: '1.0.0',
questionList: {}, // 练习列表
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment