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