Commit 568dc59e authored by Damon's avatar Damon

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

parents 833802ec e2e85b81
const UNI_APP = {
apiUrl: 'http://192.168.0.204:8760',
apiUrl: 'http://192.168.0.208:8760',
qn_base_url: 'https://qn-static.banshouhui.com/study/',
qn_asset_url: 'http://deudn.c.pp.cc/',
uCenterUrl: 'http://192.168.0.5:8093/',//'http://rest-u.yunya.com/'
uCenterUrl: 'http://192.168.0.5:8093/', //'http://rest-u.yunya.com/'
argoDebugMode: 1,
version: 'v1.0.0',
}
......
......@@ -79,8 +79,13 @@ let learnApiFun = function(vm) {
let getMyQuestionWarehouseList = async (params = {}) =>
await vm.$u.get('/rest/question/query/getMyQuestionWarehouseList', params)
let bindCard = async (params = {}) =>
await vm.$u.post('/rest/card/bind', params)
let searchQuestion = async (params = {}) =>
await vm.$u.get(`/rest/question/searchQuestion/${params.questionWarehouseId}`, params)
await vm.$u.get(
`/rest/question/searchQuestion/${params.questionWarehouseId}`,
params
)
const learnApi = {
getQuestion,
......@@ -101,7 +106,8 @@ let learnApiFun = function(vm) {
queryExamRecord,
queryExamRecordOne,
getMyQuestionWarehouseList,
searchQuestion
bindCard,
searchQuestion,
}
return learnApi
}
......
......@@ -55,7 +55,7 @@ const install = (Vue, vm) => {
} else {
// 如果返回false,则会调用Promise的reject回调,
vm.$u.toast(data.msg)
return data
return false
}
} else if (res.statusCode === 401) {
// 登录过期
......@@ -68,6 +68,7 @@ const install = (Vue, vm) => {
} else {
// HTTP状态非200
vm.$u.toast(data.msg || '服务器错误')
return false
}
}
}
......
......@@ -17,7 +17,10 @@
></u-navbar>
<view class="content">
<view class="exam-title-view" @click="$u.throttle(handleSelect, 500)">
<text>{{ title }}</text>
<view class="title-loading" v-if="loading">
<u-loading mode="flower"></u-loading>
</view>
<text v-else>{{ title }}</text>
<u-icon class="icon-view" name="arrow-up-fill"></u-icon>
</view>
<view v-if="noExam" class="tip-view">
......@@ -108,6 +111,8 @@ export default {
detail: { questionWarehouse: {} },
selected: {},
data: {},
relationId: 0, // 绑卡用
loading: false,
}
},
computed: {
......@@ -131,7 +136,7 @@ export default {
{
name: '全部试题',
label: this.examText,
leftLabel: this.selected.count, // 已做题目数
leftLabel: String(this.finishCount), // 已做题目数
image: process.uniEnv.qn_base_url + 'quanbushiti.png',
},
{
......@@ -141,9 +146,14 @@ export default {
},
]
},
finishCount() {
return this.questionList.reduce((accumulator, currentValue) => {
if (currentValue.id) accumulator++
return accumulator
}, 0)
},
examText() {
return this.info.cardId ? '/' + this.selected.totalExam : '题库进阶练习'
return this.info.cardId ? '/' + this.info.totalExam : '题库进阶练习'
},
info() {
return {
......@@ -152,7 +162,9 @@ export default {
this.detail.questionWarehouse && this.detail.questionWarehouse.cardId,
provinceName: this.provinceName,
experience:
this.selected.state && !this.detail.questionWarehouse.cardId
this.selected.state &&
(!this.detail.questionWarehouse ||
!this.detail.questionWarehouse.cardId)
? true
: false,
pass: this.$u.random(95, 99) + '%',
......@@ -240,17 +252,27 @@ export default {
this.visible = info.state
this.queryMyQuestionWarehouseDetail(this.selected.id)
}
let refresh = page.refresh
if (refresh) {
page.refresh = null
this.queryMyQuestionWarehouseDetail(this.info.id)
}
},
methods: {
// 题库详情
async queryQuestionWarehouseById(id) {
let res = await this.$u.api
queryQuestionWarehouseById(id) {
this.$u.api
.queryQuestionWarehouseById(id)
.then((res) => {
this.loading = false
this.data = res || { questionWarehouse: {} }
this.selected = this.data.questionWarehouse
})
.catch((err) => {
this.loading = false
console.log(err)
})
this.data = res || { questionWarehouse: {} }
this.selected = this.data.questionWarehouse
// this.$u.vuex(
// 'experience',
// this.selected.state && !this.detail.questionWarehouse.cardId
......@@ -259,14 +281,20 @@ export default {
// )
},
// 学生查询题库首页
async queryMyQuestionWarehouseDetail(id) {
let res = await this.$u.api
queryMyQuestionWarehouseDetail(id) {
this.loading = true
this.$u.api
.queryMyQuestionWarehouseDetail(id)
.then((res) => {
this.detail = res || { questionWarehouse: {} }
this.relationId = res.questionWarehouse.id
this.queryQuestionWarehouseById(
res.questionWarehouse.questionWarehouseId
)
})
.catch((err) => {
console.log(err)
})
this.detail = res || { questionWarehouse: {} }
this.queryQuestionWarehouseById(res.questionWarehouse.questionWarehouseId)
},
handleSelect() {
......@@ -301,6 +329,9 @@ export default {
// this.show = true
this.$u.route({
url: 'pages/learn/detail',
params: {
relationId: this.relationId,
},
})
}
} else {
......@@ -319,6 +350,9 @@ export default {
this.$u.route({
url: 'pages/learn/' + str,
params: {
relationId: this.relationId,
},
})
},
handleClickItem(key) {
......@@ -375,6 +409,9 @@ export default {
// this.show = true
this.$u.route({
url: 'pages/learn/detail',
params: {
relationId: this.relationId,
},
})
} else {
// 未选题库
......@@ -399,6 +436,9 @@ export default {
// this.show = true
this.$u.route({
url: 'pages/learn/detail',
params: {
relationId: this.relationId,
},
})
} else {
this.$u.route({
......@@ -466,10 +506,12 @@ export default {
font-size: 40rpx;
display: flex;
align-items: center;
.titleImage {
width: 40rpx;
height: 40rpx;
margin-right: 14rpx;
.title-loading {
width: 240rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
}
.icon-view {
font-size: 24rpx;
......
......@@ -50,7 +50,9 @@
<script>
export default {
data() {
return {}
return {
relationId: 0, // 绑卡用
}
},
computed: {
......@@ -74,7 +76,11 @@ export default {
}
},
},
onLoad() {},
onLoad(e) {
if (e && e.relationId) {
this.relationId = e.relationId
}
},
methods: {
handleClick() {
wx.scanCode({
......@@ -83,9 +89,10 @@ export default {
console.log(res)
if (res.result) {
this.$u.route({
url: 'pages/learn/manualBinding',
url: 'pages/learn/boundTest',
params: {
code: res.result,
relationId: this.relationId,
},
})
}
......@@ -93,7 +100,14 @@ export default {
})
},
handleClickBuy() {},
handleChange() {},
handleChange() {
this.$u.route({
url: 'pages/learn/manualBinding',
params: {
relationId: this.relationId,
},
})
},
},
}
</script>
......@@ -132,7 +146,7 @@ export default {
.first-line {
display: flex;
align-items: center;
margin-bottom: 56rpx;
margin-bottom: 50rpx;
.blue-text {
color: #2953ff;
......
......@@ -9,27 +9,34 @@
title-bold
></u-navbar>
<view class="body-view">
<image class="image-view" :src="successImage"></image>
<view class="content-view">学习卡已绑定成功</view>
<view class="tip-view">可以前往首页进行答题或模拟考试学习</view>
<!-- <image class="image-view" :src="successImage"></image> -->
<view class="content-view">是否绑定该学习卡</view>
<view class="tip-view">学习卡完成绑定后,不支持解绑操作</view>
<view class="bottom-view">
<u-button
:customStyle="buttonStyle"
@click="handleClick"
type="primary"
shape="circle"
:loading="loading"
>
去首页
绑定
</u-button>
</view>
</view>
<view>
<u-toast ref="uToast" />
</view>
</view>
</template>
<script>
export default {
data() {
return {}
return {
loading: false,
param: { cardNumber: '', cardSecret: '' },
}
},
computed: {
......@@ -41,9 +48,9 @@ export default {
guize: '出题规则',
}
},
successImage() {
return process.uniEnv.qn_base_url + 'shenqingtijiaochenggong.png'
},
// successImage() {
// return process.uniEnv.qn_base_url + 'shenqingtijiaochenggong.png'
// },
buttonStyle() {
return {
height: '104rpx',
......@@ -55,12 +62,44 @@ export default {
}
},
},
onLoad() {},
onLoad(e) {
if (e && e.code) {
var code = e.code
this.param.cardNumber = code.slice(0, 15)
this.param.cardSecret = code.slice(15)
}
if (e && e.relationId) {
this.param.questionWarehouseId = e.relationId
}
},
methods: {
handleClick() {
uni.switchTab({
url: '/pages/index/index',
})
this.loading = true
this.$u.api
.bindCard(this.param)
.then((res) => {
this.$refs.uToast.show({
title: '绑定成功',
type: 'success',
duration: 1500,
callback: () => {
this.setPageInfo()
uni.switchTab({
url: '/pages/index/index',
})
},
})
})
.catch((err) => {
this.loading = false
})
},
setPageInfo() {
var pages = getCurrentPages()
if (pages.length >= 2) {
var page = pages[pages.length - 2]
page.refresh = true
}
},
},
}
......@@ -84,13 +123,13 @@ export default {
.body-view {
height: 100%;
overflow: auto;
padding-top: 100rpx;
padding-top: 200rpx;
text-align: center;
.image-view {
margin-top: 100rpx;
width: 224rpx;
height: 224rpx;
}
// .image-view {
// margin-top: 100rpx;
// width: 224rpx;
// height: 224rpx;
// }
.content-view {
font-size: 40rpx;
color: #2953ff;
......@@ -99,7 +138,7 @@ export default {
.tip-view {
font-size: 26rpx;
color: #9ea5bb;
margin-top: 10rpx;
margin-top: 14rpx;
}
.bottom-view {
margin-top: 180rpx;
......
......@@ -91,6 +91,7 @@ import md5 from '@/common/md5.js'
export default {
data() {
return {
relationId: 0, // 绑卡用
info: {
title: '高处安装、维护、拆除作业人员题库',
money: 80.0,
......@@ -180,11 +181,18 @@ export default {
]
},
},
onLoad() {},
onLoad(e) {
if (e && e.relationId) {
this.relationId = e.relationId
}
},
methods: {
handleClick() {
this.$u.route({
url: 'pages/learn/boundQuestions',
params: {
relationId: this.relationId,
},
})
},
handleClickBuy() {
......@@ -194,7 +202,7 @@ export default {
openId: this.openId,
}
uni.showLoading({
title: '加载中'
title: '加载中',
})
this.$u.api.payOrder(data).then((res) => {
uni.hideLoading()
......@@ -228,7 +236,7 @@ export default {
outTradeNo: no,
}
uni.showLoading({
title: '支付中'
title: '支付中',
})
this.$u.api.payQuery(params).then((res) => {
uni.hideLoading()
......
......@@ -17,7 +17,7 @@
<view class="field-view">
<input
type="number"
class="input-code"
class="input-view"
:value="code"
placeholder="请输入卡号"
:placeholder-style="placeplaceholderStyle"
......@@ -29,7 +29,7 @@
<view class="field-title">学习卡密码</view>
<view class="field-view">
<input
class="input-password"
class="input-view"
password
:value="password"
placeholder="请输入密码"
......@@ -43,6 +43,7 @@
<u-button
:customStyle="customStyle"
@click="handleClick"
:loading="loading"
type="primary"
shape="circle"
>
......@@ -54,6 +55,9 @@
>
</view>
</view>
<view>
<u-toast ref="uToast" />
</view>
</view>
</template>
......@@ -66,6 +70,8 @@ export default {
code: '',
password: '',
focus: true,
loading: false,
relationId: 0,
}
},
......@@ -93,9 +99,44 @@ export default {
return 'color:#9EA5BB;font-size:28rpx'
},
},
onLoad(e) {},
onLoad(e) {
if (e && e.relationId) {
this.relationId = e.relationId
}
},
methods: {
handleClick() {},
handleClick() {
this.loading = true
this.$u.api
.bindCard({
cardNumber: this.code,
cardSecret: this.password,
questionWarehouseId: this.relationId,
})
.then((res) => {
this.$refs.uToast.show({
title: '绑定成功',
type: 'success',
duration: 1500,
callback: () => {
this.setPageInfo()
uni.switchTab({
url: '/pages/index/index',
})
},
})
})
.catch((err) => {
this.loading = false
})
},
setPageInfo() {
var pages = getCurrentPages()
if (pages.length >= 2) {
var page = pages[pages.length - 2]
page.refresh = true
}
},
},
}
</script>
......@@ -146,6 +187,10 @@ export default {
justify-content: center;
border-right: 12rpx;
padding: 0 24rpx;
.input-view {
width: 100%;
text-align: center;
}
}
}
......
......@@ -84,10 +84,10 @@ export default {
})
},
// 获取题库列表
async loadList() {
loadList() {
this.loading = true
let param = {}
let res = await this.$u.api
this.$u.api
.getMyQuestionWarehouseList(param)
.then((res) => {
this.loading = false
......
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