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