Compare commits
68 Commits
1368854459
...
dev-hxf
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b1db47383 | |||
| 79236493e6 | |||
| 59c49bfdf2 | |||
| 110e9d4adc | |||
|
|
b533581a5d | ||
| ac8acdccda | |||
| f4b6f96649 | |||
| 9ba3f6ed48 | |||
| 253ab2a80d | |||
| bfdbd3f7f3 | |||
| e3544ee06e | |||
| 7e15974ea6 | |||
| 46972d5bff | |||
| 851319e24c | |||
| 19616d56c5 | |||
| 89c4b2148e | |||
| e68a422cc8 | |||
| 2e93ad93e9 | |||
| c783ff969d | |||
| 4526430a38 | |||
| 3a0545852f | |||
| 0410e5dda9 | |||
| 0c230fa5f1 | |||
| ded28b62fb | |||
| 6834b3f9fe | |||
| 3379a9b18e | |||
| 9e871e4079 | |||
| 728fefac03 | |||
| bf05f771f7 | |||
| 287f123ac7 | |||
| 89c72e336b | |||
| 135bcc71ee | |||
| a09ef61e2f | |||
| d88f92a893 | |||
| dc340c7f4d | |||
| 0c6182e6f5 | |||
| f762ca430d | |||
| 37c5de0899 | |||
|
|
04a4a4781d | ||
| 741b5a1d29 | |||
|
|
f36cffdd37 | ||
|
|
7db9e68e77 | ||
| d82a84798c | |||
| 4bfce94c24 | |||
| c3e6002ca3 | |||
| fa6665d9f6 | |||
| 77de5d5d6e | |||
| 9e4b78882e | |||
| 5640ef7f36 | |||
| d36b01a69f | |||
| 8a1d49b47f | |||
| 0b39b49a5d | |||
| 9afe858077 | |||
| 5f6646ae4e | |||
| 3c137e8025 | |||
| 3c4e11799b | |||
| 97547afc4d | |||
| 4c4bd6236d | |||
|
|
49abbc764b | ||
| 91b90c809e | |||
| 1596959583 | |||
| 36f8a9b2cc | |||
| fa9d6a8696 | |||
|
|
78cf2fd9f7 | ||
| a7c7b410d3 | |||
| c0df8a314e | |||
| d155bd8b2d | |||
| 7c54101dd6 |
@@ -5,7 +5,6 @@ VITE_APP_TITLE = 金武联驾校
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 金武联驾校/开发环境
|
# 金武联驾校/开发环境
|
||||||
VITE_APP_BASE_API = 'http://192.168.1.2:8888/'
|
VITE_APP_BASE_API = 'https://jwl.ahduima.com/'
|
||||||
|
|
||||||
#
|
#
|
||||||
VITE_WEB_BASE_URL = 'http://192.168.1.2:8888/'
|
VITE_WEB_BASE_URL = 'https://jwl.ahduima.com'
|
||||||
@@ -5,7 +5,7 @@ VITE_APP_TITLE = 金武联驾校
|
|||||||
VITE_APP_ENV = 'production'
|
VITE_APP_ENV = 'production'
|
||||||
|
|
||||||
# 金武联驾校/开发环境
|
# 金武联驾校/开发环境
|
||||||
VITE_APP_BASE_API = 'https://i.equ-tech.com/zongheng-api/'
|
VITE_APP_BASE_API = 'https://jwl.ahduima.com/'
|
||||||
|
|
||||||
#
|
#
|
||||||
VITE_WEB_BASE_URL = 'https://i.equ-tech.com/zongheng'
|
VITE_WEB_BASE_URL = 'https://jwl.ahduima.com'
|
||||||
|
|||||||
13
src/App.vue
@@ -1,16 +1,21 @@
|
|||||||
<script>
|
<script>
|
||||||
import useUserStore from '@/jtools/store/user'
|
import useUserStore from '@/jtools/store/user'
|
||||||
import useQuestionStore from '@/jtools/store/question' //引入store
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import storage from './jtools/storage'
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function (options) {
|
||||||
|
// 如果是二维码扫描过来的,需要保存公司id
|
||||||
|
if (options.query?.scene) {
|
||||||
|
storage.set('companyId', options.query?.scene)
|
||||||
|
}
|
||||||
useUserStore().queryVipList()
|
useUserStore().queryVipList()
|
||||||
if (useUserStore().isLogin) {
|
if (useUserStore().isLogin) {
|
||||||
useQuestionStore().getOrderQuestion('1')
|
|
||||||
useUserStore().getUserInfo()
|
useUserStore().getUserInfo()
|
||||||
useUserStore().searchUserVip()
|
useUserStore().searchUserVip()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
|
useQuestionStore().getAllQuestion()
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
},
|
},
|
||||||
onHide: function () {
|
onHide: function () {
|
||||||
@@ -23,4 +28,8 @@ export default {
|
|||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
@import "uni_modules/uview-plus/index.scss";
|
@import "uni_modules/uview-plus/index.scss";
|
||||||
@import "static/style/index.scss";
|
@import "static/style/index.scss";
|
||||||
|
|
||||||
|
button::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<view class="u-back-text u-line-1 u-m-l-20" v-if="backText" :style="[backTextStyle]">{{ backText || '' }}</view>
|
<view class="u-back-text u-line-1 u-m-l-20" v-if="backText" :style="[backTextStyle]">{{ backText || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<slot name="left"></slot>
|
<slot name="left"></slot>
|
||||||
<view class="content fs32 fwb" :style="[{ top: statusBarHeight + 'px' }]"><slot></slot></view>
|
<view class="content fs16" :style="[{ top: statusBarHeight + 'px' }]"><slot></slot></view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<slot name="right"></slot>
|
<slot name="right"></slot>
|
||||||
</view>
|
</view>
|
||||||
@@ -109,17 +109,27 @@ export default {
|
|||||||
backPath: {
|
backPath: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
isDefineBack:{
|
||||||
|
type:Boolean,
|
||||||
|
default:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goBack() {
|
goBack() {
|
||||||
|
if(this.isDefineBack){
|
||||||
|
this.$emit('toBack')
|
||||||
|
}else{
|
||||||
if(this.backPath) {
|
if(this.backPath) {
|
||||||
this.$tools.routerTo(this.backPath)
|
uni.switchTab({
|
||||||
|
url:this.backPath
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -130,8 +140,8 @@ export default {
|
|||||||
.cu-bar {
|
.cu-bar {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
.content {
|
.content {
|
||||||
// width: 350rpx;
|
width: 350rpx;
|
||||||
display: flex;
|
// display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -8,3 +8,20 @@ export function getAliCompanyInfo(data) {
|
|||||||
noToken: true
|
noToken: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getCarTypeList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdCar/list',
|
||||||
|
method: 'GET',
|
||||||
|
data,
|
||||||
|
noToken: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: 'chaoyuan-api/driver/addInfo',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
9
src/jtools/api/pay.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import request from '../request/index.js';
|
||||||
|
|
||||||
|
export function prePay(data) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/applet/pay/prepay',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,10 +1,110 @@
|
|||||||
import request from '../request/index.js';
|
import request from '../request/index.js';
|
||||||
|
|
||||||
|
|
||||||
export function queryQuestion(data) {
|
export function queryQuestion(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'driver-api/tdQuestion/queryQuestion',
|
url: 'driver-api/tdQuestion/queryQuestion',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
|
noToken: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function questionCategory(data) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdQuestion/questionCategory',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
noToken: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getTestQuestion(data) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdQuestion/getTestQuestion',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function submitTest(data) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdQuestionTest/testSubmit',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function testTotal(data) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdQuestionTest/testTotal',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取配置
|
||||||
|
export function querySysConfigList(carTypeId, configKey) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdSysConfigList/querySysConfigList?configKey=' + configKey + '&carTypeId=' + carTypeId,
|
||||||
|
method: 'GET',
|
||||||
|
noToken: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//获取配置
|
||||||
|
export function querySysConfig(carTypeId, configKey) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdSysConfig/queryConfigByKey?configKey=' + configKey + '&carTypeId=' + carTypeId,
|
||||||
|
method: 'GET',
|
||||||
|
noToken: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//获取项目列表 (考试项目和基础操作)
|
||||||
|
export function queryProjectList(data) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdTestProject/queryProjectList',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
noToken:true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//
|
||||||
|
|
||||||
|
//获取专项题目数量
|
||||||
|
export function querySpecialNum(data) {
|
||||||
|
return request({
|
||||||
|
url: 'driver-api/tdQuestion/querySpecialNum',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
noToken:true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取题库版本
|
||||||
|
export function getVersion(carTypeId) {
|
||||||
|
return request({
|
||||||
|
url: '/driver-api/tdQuestionVersion/currentVersion?carTypeId='+carTypeId,
|
||||||
|
method: 'GET',
|
||||||
|
noToken:true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取题目ID
|
||||||
|
export function queryQuestionId(data) {
|
||||||
|
return request({
|
||||||
|
url: '/driver-api/tdQuestion/queryQuestionId',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
noToken:true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取模拟考试ID
|
||||||
|
export function getTestQuestionId(data) {
|
||||||
|
return request({
|
||||||
|
url: '/driver-api/tdQuestion/getTestQuestionId',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
noToken:true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ export function queryVip(data) {
|
|||||||
return request({
|
return request({
|
||||||
url: 'driver-api/tdMember/queryUserMember',
|
url: 'driver-api/tdMember/queryUserMember',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,5 +13,6 @@ export function getVipList(data) {
|
|||||||
url: 'driver-api/tdMember/queryMember',
|
url: 'driver-api/tdMember/queryMember',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
|
noToken: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
159
src/jtools/pay/index.js
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
import request from '../request/index.js';
|
||||||
|
// #ifdef H5
|
||||||
|
// import wxsdk from '@/jtools/wechat/sdk'
|
||||||
|
// #endif
|
||||||
|
// import wechat from '@/jtools/wechat/wechat'
|
||||||
|
import $platform from '@/jtools/platform';
|
||||||
|
import {prePay} from '@/jtools/api/pay'
|
||||||
|
/**
|
||||||
|
* 支付
|
||||||
|
*
|
||||||
|
* @param {String} payment = ['wechat','alipay','wallet'] - 支付方式
|
||||||
|
* @param {Object} order = {} - 订单详情
|
||||||
|
* @param {String} orderType = ['goods','recharge'] - 订单类型
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default class JtoolsPay {
|
||||||
|
|
||||||
|
|
||||||
|
// wxOfficialAccount wxMiniProgram App H5
|
||||||
|
// wechat 公众号JSSDK支付 小程序支付 微信开放平台支付 H5网页支付
|
||||||
|
// alipay 复制网址 复制网址 支付宝开放平台支付 直接跳转链接
|
||||||
|
// wallet v v v v
|
||||||
|
|
||||||
|
|
||||||
|
constructor(payment, order, orderType) {
|
||||||
|
this.payment = payment;
|
||||||
|
this.order = order;
|
||||||
|
this.orderType = orderType;
|
||||||
|
this.platform = $platform.get();
|
||||||
|
let payMehod = this.getPayMethod();
|
||||||
|
payMehod();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getPayMethod() {
|
||||||
|
var payMethod = {
|
||||||
|
'wxMiniProgram': {
|
||||||
|
'wechat': () => {
|
||||||
|
this.wxMiniProgramPay()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'App': {
|
||||||
|
'wechat': () => {
|
||||||
|
this.wechatPay()
|
||||||
|
},
|
||||||
|
'alipay': () => {
|
||||||
|
this.aliPay()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return payMethod[this.platform][this.payment];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 预支付
|
||||||
|
prepay() {
|
||||||
|
let that = this;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const p = $platform.device()
|
||||||
|
const tradeInfoType = p == 'android' ? 'Android' : p == 'ios' ? 'iOS' : 'Wap'
|
||||||
|
let params = {
|
||||||
|
"code":this.order.code,
|
||||||
|
"description": this.order.description,
|
||||||
|
"money": this.order.money,
|
||||||
|
"outTradeNo": this.order.outTradeNo,
|
||||||
|
"userId": this.order.userId,
|
||||||
|
"tradeType":'1'
|
||||||
|
}
|
||||||
|
if (uni.getStorageSync('openId')) {
|
||||||
|
params.openId = uni.getStorageSync('openId');
|
||||||
|
}
|
||||||
|
prePay(params).then(res => {
|
||||||
|
console.log('预支付',res);
|
||||||
|
if (res.code == '0000') {
|
||||||
|
resolve(res);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 微信小程序支付
|
||||||
|
async wxMiniProgramPay() {
|
||||||
|
let that = this;
|
||||||
|
let result = await this.prepay();
|
||||||
|
const params = result.data
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'wxpay',
|
||||||
|
...{
|
||||||
|
appId: params.appId, //公众号名称,由商户传入
|
||||||
|
timeStamp: params.timeStamp, //时间戳,自1970年以来的秒数
|
||||||
|
nonceStr: params.nonceStr, //随机串
|
||||||
|
package: params.packageVal,
|
||||||
|
signType: params.signType, //微信签名方式:
|
||||||
|
paySign: params.paySign, //微信签名
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
console.log(res);
|
||||||
|
that.payResult('success', result.data.orderPayNo)
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
console.log('支付取消或者失败:', err);
|
||||||
|
err.errMsg !== "requestPayment:fail cancel" && that.payResult('fail')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 支付宝支付
|
||||||
|
async aliPay() {
|
||||||
|
let that = this;
|
||||||
|
let result = await this.prepay();
|
||||||
|
if (result.code === 1) {
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'alipay',
|
||||||
|
orderInfo: result.data.pay_data, //支付宝订单数据
|
||||||
|
success: res => {
|
||||||
|
that.payResult('success')
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
err.errMsg !== "requestPayment:fail cancel" && that.payResult('fail')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 微信支付
|
||||||
|
async wechatPay() {
|
||||||
|
let that = this;
|
||||||
|
let result = await this.prepay();
|
||||||
|
console.log('微信支付');
|
||||||
|
if (result.code === 1) {
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'wxpay',
|
||||||
|
orderInfo: JSON.parse(result.data.pay_data), //微信订单数据(官方说是string。实测为object)
|
||||||
|
success: res => {
|
||||||
|
that.payResult('success')
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
err.errMsg !== "requestPayment:fail cancel" && that.payResult('fail')
|
||||||
|
console.log('支付取消或者失败:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 支付结果跳转,success:成功,fail:失败
|
||||||
|
payResult(resultType, orderPayNo) {
|
||||||
|
const that = this;
|
||||||
|
let path = 'paySuccess'
|
||||||
|
uni.navigateTo({
|
||||||
|
url: path
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,10 +29,10 @@ function service(options = {}) {
|
|||||||
title: res?.data?.message || '请重新登录',
|
title: res?.data?.message || '请重新登录',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
useUserStore().logout()
|
useUserStore().logoutWithoutToken()
|
||||||
//请求成功
|
//请求成功
|
||||||
resolved(res.data);
|
resolved(res.data);
|
||||||
} else if(res.data.code != '0000') {
|
} else if(res.data.code != '0000'&&res.data.code !='4001') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res?.data?.message || '访问出错',
|
title: res?.data?.message || '访问出错',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ import {
|
|||||||
} from 'pinia';
|
} from 'pinia';
|
||||||
import http from '@/jtools/request/index';
|
import http from '@/jtools/request/index';
|
||||||
import {
|
import {
|
||||||
queryQuestion
|
queryQuestion,
|
||||||
|
getVersion,
|
||||||
|
querySysConfig
|
||||||
} from '@/jtools/api/question';
|
} from '@/jtools/api/question';
|
||||||
import storage from '@/jtools/storage';
|
import storage from '@/jtools/storage';
|
||||||
|
|
||||||
@@ -11,21 +13,225 @@ const question = defineStore({
|
|||||||
id: 'question',
|
id: 'question',
|
||||||
state: () => ({
|
state: () => ({
|
||||||
currentCartype: storage.get('carType') || '1001',
|
currentCartype: storage.get('carType') || '1001',
|
||||||
orderQuestion: [], //顺序做题
|
currentCarName: storage.get('carName') || '小车C1/C2/C3',
|
||||||
|
orderQuestion_subject1: storage.get('question_subject1') || [], //科目一顺序做题
|
||||||
|
orderQuestion_subject4: storage.get('question_subject4') || [], //科目四顺序做题
|
||||||
|
currentIndex_subject1: 0, //科目一索引 顺序做题
|
||||||
|
currentIndex_subject4: 0, //科目四索引 顺序做题
|
||||||
|
curSubject: storage.get('curSubject') || '1',
|
||||||
|
loading_subject1: false,
|
||||||
|
loading_subject4: false,
|
||||||
|
version: storage.get('version') || ''
|
||||||
}),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// 获取顺序做题
|
resetStorage(){
|
||||||
getOrderQuestion(val) {
|
this.currentIndex_subject1=0
|
||||||
queryQuestion({
|
this.currentIndex_subject4=0
|
||||||
carTypeId: this.currentCartype,
|
this.curSubject=0
|
||||||
subject: val
|
storage.remove('curSubject')
|
||||||
}).then(res => {
|
storage.remove('wrongList_subject1')
|
||||||
if (res.code == '0000') {
|
storage.remove('wrongList_subject4')
|
||||||
this.orderQuestion = res.data
|
storage.remove('rightList_subject1')
|
||||||
|
storage.remove('rightList_subject4')
|
||||||
|
this.getAllQuestion()
|
||||||
|
},
|
||||||
|
getAllQuestion() {
|
||||||
|
this.currentCartype = storage.get('carType') || '1001'
|
||||||
|
getVersion(this.currentCartype).then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
querySysConfig(this.currentCartype, 'QuestionBank').then(res => {
|
||||||
|
const urlList = JSON.parse(res.data.configJson)
|
||||||
|
const urlOne = urlList.find(item => item.subject == '1').url
|
||||||
|
const urlFour = urlList.find(item => item.subject == '4').url
|
||||||
|
if (this.version != resp.data) {
|
||||||
|
this.version = resp.data
|
||||||
|
storage.set('version', resp.data)
|
||||||
|
this.getOrderQuestion_sub1(true, urlOne)
|
||||||
|
this.getOrderQuestion_sub4(true, urlFour)
|
||||||
|
} else {
|
||||||
|
this.getOrderQuestion_sub1(false, urlOne)
|
||||||
|
this.getOrderQuestion_sub4(false, urlOne)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
divideArray(array, numChunks) {
|
||||||
|
var chunkSize = Math.ceil(array.length / numChunks);
|
||||||
|
var dividedArray = [];
|
||||||
|
for (var i = 0; i < array.length; i += chunkSize) {
|
||||||
|
dividedArray.push(array.slice(i, i + chunkSize));
|
||||||
|
}
|
||||||
|
return dividedArray;
|
||||||
|
},
|
||||||
|
|
||||||
|
//改变当前科目
|
||||||
|
changeSubject(val) {
|
||||||
|
this.curSubject = val
|
||||||
|
storage.set('curSubject', val)
|
||||||
|
},
|
||||||
|
// 获取顺序做题科目1
|
||||||
|
getOrderQuestion_sub1(isUpdate, url) {
|
||||||
|
if (isUpdate) {
|
||||||
|
this.loading_subject1 = true
|
||||||
|
const that = this
|
||||||
|
uni.request({
|
||||||
|
url: url,
|
||||||
|
success(resp) {
|
||||||
|
if (resp.data) {
|
||||||
|
that.orderQuestion_subject1 = resp.data.data
|
||||||
|
const diveList = that.divideArray(that.orderQuestion_subject1, 5)
|
||||||
|
that.loading_subject1 = false
|
||||||
|
uni.setStorageSync('questionOneSub1', diveList[0])
|
||||||
|
uni.setStorageSync('questionOneSub2', diveList[1])
|
||||||
|
uni.setStorageSync('questionOneSub3', diveList[2])
|
||||||
|
uni.setStorageSync('questionOneSub4', diveList[3])
|
||||||
|
uni.setStorageSync('questionOneSub5', diveList[4])
|
||||||
|
const falseList = storage.get('wrongList_subject1') || []
|
||||||
|
const trueList = storage.get('rightList_subject1') || []
|
||||||
|
const falseArr = []
|
||||||
|
const rightArr = []
|
||||||
|
that.orderQuestion_subject1.forEach(item => {
|
||||||
|
if (falseList.includes(item.questionId)) {
|
||||||
|
falseArr.push(item.questionId)
|
||||||
|
}
|
||||||
|
if (trueList.includes(item.questionId)) {
|
||||||
|
rightArr.push(item.questionId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
storage.set('wrongList_subject1', falseArr)
|
||||||
|
storage.set('rightList_subject1', rightArr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
const list1 = uni.getStorageSync('questionOneSub1') || []
|
||||||
|
const list2 = uni.getStorageSync('questionOneSub2') || []
|
||||||
|
const list3 = uni.getStorageSync('questionOneSub3') || []
|
||||||
|
const list4 = uni.getStorageSync('questionOneSub4') || []
|
||||||
|
const list5 = uni.getStorageSync('questionOneSub5') || []
|
||||||
|
this.orderQuestion_subject1 = [...list1, ...list2, ...list3, ...list4, ...list5]
|
||||||
|
if (this.orderQuestion_subject1 && this.orderQuestion_subject1.length) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.loading_subject1 = true
|
||||||
|
const that = this
|
||||||
|
uni.request({
|
||||||
|
url: url,
|
||||||
|
success(resp) {
|
||||||
|
if (resp.data) {
|
||||||
|
that.orderQuestion_subject1 = resp.data.data
|
||||||
|
const diveList = that.divideArray(that.orderQuestion_subject1, 5)
|
||||||
|
that.loading_subject1 = false
|
||||||
|
uni.setStorageSync('questionOneSub1', diveList[0])
|
||||||
|
uni.setStorageSync('questionOneSub2', diveList[1])
|
||||||
|
uni.setStorageSync('questionOneSub3', diveList[2])
|
||||||
|
uni.setStorageSync('questionOneSub4', diveList[3])
|
||||||
|
uni.setStorageSync('questionOneSub5', diveList[4])
|
||||||
|
const falseList = storage.get('wrongList_subject1') || []
|
||||||
|
const trueList = storage.get('rightList_subject1') || []
|
||||||
|
const falseArr = []
|
||||||
|
const rightArr = []
|
||||||
|
that.orderQuestion_subject1.forEach(item => {
|
||||||
|
if (falseList.includes(item.questionId)) {
|
||||||
|
falseArr.push(item.questionId)
|
||||||
|
}
|
||||||
|
if (trueList.includes(item.questionId)) {
|
||||||
|
rightArr.push(item.questionId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
storage.set('wrongList_subject1', falseArr)
|
||||||
|
storage.set('rightList_subject1', rightArr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取顺序做题科目4
|
||||||
|
getOrderQuestion_sub4(isUpdate, url) {
|
||||||
|
if (isUpdate) {
|
||||||
|
this.loading_subject4 = true
|
||||||
|
const that = this
|
||||||
|
uni.request({
|
||||||
|
url: url,
|
||||||
|
success(resp) {
|
||||||
|
if (resp.data) {
|
||||||
|
that.orderQuestion_subject4 = resp.data.data
|
||||||
|
const diveList = that.divideArray(that.orderQuestion_subject4, 5)
|
||||||
|
that.loading_subject4 = false
|
||||||
|
uni.setStorageSync('questionFourSub1', diveList[0])
|
||||||
|
uni.setStorageSync('questionFourSub2', diveList[1])
|
||||||
|
uni.setStorageSync('questionFourSub3', diveList[2])
|
||||||
|
uni.setStorageSync('questionFourSub4', diveList[3])
|
||||||
|
uni.setStorageSync('questionFourSub5', diveList[4])
|
||||||
|
const falseList = storage.get('wrongList_subject4') || []
|
||||||
|
const trueList = storage.get('rightList_subject4') || []
|
||||||
|
const falseArr = []
|
||||||
|
const rightArr = []
|
||||||
|
that.orderQuestion_subject4.forEach(item => {
|
||||||
|
if (falseList.includes(item.questionId)) {
|
||||||
|
falseArr.push(item.questionId)
|
||||||
|
}
|
||||||
|
if (trueList.includes(item.questionId)) {
|
||||||
|
rightArr.push(item.questionId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
storage.set('wrongList_subject4', falseArr)
|
||||||
|
storage.set('rightList_subject4', rightArr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
const list1 = uni.getStorageSync('questionFourSub1') || []
|
||||||
|
const list2 = uni.getStorageSync('questionFourSub2') || []
|
||||||
|
const list3 = uni.getStorageSync('questionFourSub3') || []
|
||||||
|
const list4 = uni.getStorageSync('questionFourSub4') || []
|
||||||
|
const list5 = uni.getStorageSync('questionFourSub5') || []
|
||||||
|
this.orderQuestion_subject4 = [...list1, ...list2, ...list3, ...list4, ...list5]
|
||||||
|
if (this.orderQuestion_subject4 && this.orderQuestion_subject4.length) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.loading_subject4 = true
|
||||||
|
const that = this
|
||||||
|
uni.request({
|
||||||
|
url: url,
|
||||||
|
success(resp) {
|
||||||
|
if (resp.data) {
|
||||||
|
that.orderQuestion_subject4 = resp.data.data
|
||||||
|
const diveList = that.divideArray(that.orderQuestion_subject4, 5)
|
||||||
|
that.loading_subject4 = false
|
||||||
|
uni.setStorageSync('questionFourSub1', diveList[0])
|
||||||
|
uni.setStorageSync('questionFourSub2', diveList[1])
|
||||||
|
uni.setStorageSync('questionFourSub3', diveList[2])
|
||||||
|
uni.setStorageSync('questionFourSub4', diveList[3])
|
||||||
|
uni.setStorageSync('questionFourSub5', diveList[4])
|
||||||
|
const falseList = storage.get('wrongList_subject4') || []
|
||||||
|
const trueList = storage.get('rightList_subject4') || []
|
||||||
|
const falseArr = []
|
||||||
|
const rightArr = []
|
||||||
|
that.orderQuestion_subject4.forEach(item => {
|
||||||
|
if (falseList.includes(item.questionId)) {
|
||||||
|
falseArr.push(item.questionId)
|
||||||
|
}
|
||||||
|
if (trueList.includes(item.questionId)) {
|
||||||
|
rightArr.push(item.questionId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
storage.set('wrongList_subject4', falseArr)
|
||||||
|
storage.set('rightList_subject4', rightArr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//获取索引
|
||||||
|
getCurrentIndex(index, val) {
|
||||||
|
this[`currentIndex_subject${val}`] = index
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { login, logout, getInfo } from '@/jtools/api/login';
|
import { login, logout, getInfo } from '@/jtools/api/login';
|
||||||
import { queryVip,getVipList } from '@/jtools/api/vip'
|
import { queryVip, getVipList } from '@/jtools/api/vip';
|
||||||
import constants from '@/jtools/constants';
|
import constants from '@/jtools/constants';
|
||||||
import storage from '@/jtools/storage';
|
import storage from '@/jtools/storage';
|
||||||
|
|
||||||
@@ -23,10 +23,11 @@ const useUserStore = defineStore({
|
|||||||
// 保存登录信息,用于重新登录
|
// 保存登录信息,用于重新登录
|
||||||
this.isLogin = true;
|
this.isLogin = true;
|
||||||
this.token = resp.data.token;
|
this.token = resp.data.token;
|
||||||
this.userInfo = resp.data
|
this.userInfo = resp.data;
|
||||||
storage.set('isLogin', true)
|
storage.set('isLogin', true);
|
||||||
storage.set('token', resp.data.token)
|
storage.set('token', resp.data.token);
|
||||||
storage.set('userInfo', resp.data)
|
storage.set('userInfo', resp.data);
|
||||||
|
storage.remove('companyId');
|
||||||
resolve(resp.data);
|
resolve(resp.data);
|
||||||
} else {
|
} else {
|
||||||
reject();
|
reject();
|
||||||
@@ -39,45 +40,53 @@ const useUserStore = defineStore({
|
|||||||
this.resetUserData();
|
this.resetUserData();
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/login/login'
|
url: '/pages/login/login'
|
||||||
})
|
});
|
||||||
resolve();
|
resolve();
|
||||||
})
|
});
|
||||||
|
},
|
||||||
|
//过期登出
|
||||||
|
logoutWithoutToken(force = false) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.resetUserData();
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
getInfo().then(resp => {
|
getInfo().then(resp => {
|
||||||
if (resp.code == '0000') {
|
if (resp.code == '0000') {
|
||||||
this.userInfo = resp.data
|
this.userInfo = resp.data;
|
||||||
storage.set('userInfo', resp.data)
|
storage.set('userInfo', resp.data);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
resetUserData() {
|
resetUserData() {
|
||||||
this.isLogin = false;
|
this.isLogin = false;
|
||||||
this.token = '';
|
this.token = '';
|
||||||
this.userInfo = {}
|
this.userInfo = {};
|
||||||
this.vipOnList = []
|
this.vipOnList = [];
|
||||||
storage.remove('isLogin')
|
storage.remove('isLogin');
|
||||||
storage.remove('token')
|
storage.remove('token');
|
||||||
storage.remove('userInfo')
|
storage.remove('userInfo');
|
||||||
},
|
},
|
||||||
// 查询当前用户的vip开通情况
|
// 查询当前用户的vip开通情况
|
||||||
searchUserVip() {
|
async searchUserVip() {
|
||||||
queryVip({ carTypeId: this.currentCartype,memberId: null, subject:'' }).then(resp => {
|
this.currentCartype = storage.get('carType') || '1001';
|
||||||
|
const resp = await queryVip({ carTypeId: this.currentCartype, memberId: null, subject: '' });
|
||||||
if (resp.code == '0000') {
|
if (resp.code == '0000') {
|
||||||
this.vipOnList = resp.data
|
this.vipOnList = resp.data;
|
||||||
}
|
}
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 查询所有的vip
|
// 查询所有的vip
|
||||||
queryVipList() {
|
queryVipList() {
|
||||||
|
this.currentCartype = storage.get('carType') || '1001';
|
||||||
getVipList({ carTypeId: this.currentCartype, memberId: null, subject: '' }).then(resp => {
|
getVipList({ carTypeId: this.currentCartype, memberId: null, subject: '' }).then(resp => {
|
||||||
if (resp.code == '0000') {
|
if (resp.code == '0000') {
|
||||||
this.vipAllList = resp.data
|
this.vipAllList = resp.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default useUserStore;
|
export default useUserStore;
|
||||||
|
|||||||
261
src/jtools/wechat/wechat.js
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
/**
|
||||||
|
* Wechat v1.1.0
|
||||||
|
* @Class Wechat
|
||||||
|
* @description jtools-wechat 1.1.0 wehcat第三方登录组件
|
||||||
|
* @Author lidongtony
|
||||||
|
* @Date 2020-05-20
|
||||||
|
* @Email lidongtony@qq.com
|
||||||
|
*/
|
||||||
|
import api from "@/jtools/request/index";
|
||||||
|
import $platform from "@/jtools/platform";
|
||||||
|
import store from "@/jtools/store";
|
||||||
|
import {
|
||||||
|
API_URL
|
||||||
|
} from "@/env";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
eventMap(event) {
|
||||||
|
let map = "";
|
||||||
|
switch (event) {
|
||||||
|
case "login":
|
||||||
|
map = "登录中...";
|
||||||
|
break;
|
||||||
|
case "refresh":
|
||||||
|
map = "更新中...";
|
||||||
|
break;
|
||||||
|
case "bind":
|
||||||
|
map = "绑定中...";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
},
|
||||||
|
|
||||||
|
async login() {
|
||||||
|
let token = "";
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
token = await this.wxMiniProgramOauth("login");
|
||||||
|
return token;
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
this.wxOfficialAccountOauth("login");
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
token = await this.wxOpenPlatformOauth("login");
|
||||||
|
return token;
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
async refresh() {
|
||||||
|
let token = "";
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
token = await this.wxMiniProgramOauth("refresh");
|
||||||
|
return token;
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
this.wxOfficialAccountOauth("refresh");
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
token = await this.wxOpenPlatformOauth("refresh");
|
||||||
|
return token;
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
async bind() {
|
||||||
|
let token = "";
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
token = await this.wxMiniProgramOauth("bind");
|
||||||
|
return token;
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
this.wxOfficialAccountOauth("bind");
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
token = await this.wxOpenPlatformOauth("bind");
|
||||||
|
return token;
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
// 微信公众号网页登录&刷新头像昵称&绑定
|
||||||
|
wxOfficialAccountOauth(event = "login") {
|
||||||
|
if ($platform.get() !== "wxOfficialAccount") {
|
||||||
|
uni.showToast({
|
||||||
|
title: "请在微信浏览器中打开",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
throw false;
|
||||||
|
}
|
||||||
|
let host = $platform.host();
|
||||||
|
let payloadObject = {
|
||||||
|
host: host,
|
||||||
|
event,
|
||||||
|
token: (event !== "login" && store.getters.isLogin) ? uni.getStorageSync("token") : ""
|
||||||
|
};
|
||||||
|
let payload = encodeURIComponent(JSON.stringify(payloadObject));
|
||||||
|
let redirect_uri = encodeURIComponent(`${API_URL}user/wxOfficialAccountOauth?payload=${payload}`);
|
||||||
|
let oauthUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + store.getters.initWechat.appid +
|
||||||
|
`&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=1`;
|
||||||
|
uni.setStorageSync("lastPage", window.location.href);
|
||||||
|
window.location = oauthUrl;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 微信公众号网页静默登录:临时登录获取OpenId 不入库不绑定用户
|
||||||
|
wxOfficialAccountBaseLogin() {
|
||||||
|
let state = encodeURIComponent(window.location.href);
|
||||||
|
window.location = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + store.getters.initWechat.appid +
|
||||||
|
`&redirect_uri=${API_URL}user/wxOfficialAccountBaseLogin&response_type=code&scope=snsapi_base&state=${state}`;
|
||||||
|
throw "stop";
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
// 微信开放平台登录
|
||||||
|
wxOpenPlatformOauth(event = "login") {
|
||||||
|
let that = this;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.login({
|
||||||
|
provider: "weixin",
|
||||||
|
success: function(loginRes) {
|
||||||
|
if (loginRes.errMsg === "login:ok") {
|
||||||
|
let authResult = loginRes.authResult;
|
||||||
|
api("user.wxOpenPlatformOauth", {
|
||||||
|
authResult,
|
||||||
|
event
|
||||||
|
}, that.eventMap(event)).then(res => {
|
||||||
|
if (res.code === 1) {
|
||||||
|
resolve(res.data.token);
|
||||||
|
} else {
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: function(res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "登录失败,请稍后再试"
|
||||||
|
});
|
||||||
|
resolve(false);
|
||||||
|
api("common.debug", {
|
||||||
|
info: res
|
||||||
|
});
|
||||||
|
},
|
||||||
|
complete: function(res) {}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
// 微信小程序静默登录
|
||||||
|
async getWxMiniProgramSessionKey(autoLogin = true) {
|
||||||
|
let sessionStatus = false;
|
||||||
|
let session_key = "";
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.checkSession({
|
||||||
|
success(res) {
|
||||||
|
if (res.errMsg === "checkSession:ok") sessionStatus = true;
|
||||||
|
},
|
||||||
|
complete() {
|
||||||
|
if (uni.getStorageSync("session_key") && sessionStatus && !autoLogin) {
|
||||||
|
resolve(uni.getStorageSync("session_key"));
|
||||||
|
} else {
|
||||||
|
uni.login({
|
||||||
|
success: function(info) {
|
||||||
|
let code = info.code;
|
||||||
|
api("user.getWxMiniProgramSessionKey", {
|
||||||
|
code: code,
|
||||||
|
autoLogin: autoLogin
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 1) {
|
||||||
|
uni.setStorageSync("session_key", res
|
||||||
|
.data.session_key);
|
||||||
|
if (autoLogin) {
|
||||||
|
if (res.data.token) {
|
||||||
|
resolve(res.data.token);
|
||||||
|
} else {
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resolve(res.data.session_key);
|
||||||
|
} else {
|
||||||
|
reject(res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 微信小程序获取用户信息登录
|
||||||
|
wxMiniProgramOauth(event = "login") {
|
||||||
|
let that = this;
|
||||||
|
let session_key = uni.getStorageSync("session_key");
|
||||||
|
uni.showLoading({
|
||||||
|
title: that.eventMap(event)
|
||||||
|
});
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.getUserProfile({ // 必须手动确认触发
|
||||||
|
desc: "完善会员资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
||||||
|
success: res => {
|
||||||
|
if (res.errMsg === "getUserProfile:ok") {
|
||||||
|
api("user.wxMiniProgramOauth", {
|
||||||
|
event,
|
||||||
|
session_key,
|
||||||
|
encryptedData: res.encryptedData,
|
||||||
|
iv: res.iv,
|
||||||
|
signature: res.signature,
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code === 1) {
|
||||||
|
resolve(res.data.token);
|
||||||
|
} else {
|
||||||
|
uni.removeStorageSync("session_key");
|
||||||
|
that.getWxMiniProgramSessionKey(false);
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: res => {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// 小程序更新
|
||||||
|
checkMiniProgramUpdate() {
|
||||||
|
if (uni.canIUse("getUpdateManager")) {
|
||||||
|
const updateManager = uni.getUpdateManager();
|
||||||
|
updateManager.onCheckForUpdate(function(res) {
|
||||||
|
// 请求完新版本信息的回调
|
||||||
|
if (res.hasUpdate) {
|
||||||
|
updateManager.onUpdateReady(function() {
|
||||||
|
uni.showModal({
|
||||||
|
title: "更新提示",
|
||||||
|
content: "新版本已经准备好,是否重启应用?",
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||||
|
updateManager.applyUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
updateManager.onUpdateFailed(function() {
|
||||||
|
// 新的版本下载失败
|
||||||
|
uni.showModal({
|
||||||
|
title: "已经有新版本了哟~",
|
||||||
|
content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
@@ -8,7 +8,8 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "金武联驾考"
|
"navigationStyle": "custom",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -86,7 +87,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/me/tijian",
|
"path": "pages/me/tijian",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "我的体检",
|
"navigationBarTitleText": "上传证件照",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -100,7 +101,14 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/index/videoVip",
|
"path": "pages/index/videoVip",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "视频精品课",
|
"navigationBarTitleText": "开通会员",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/index/testTip",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "模拟考试",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -131,6 +139,40 @@
|
|||||||
"navigationBarTitleText": "考场实况",
|
"navigationBarTitleText": "考场实况",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/index/paySuccess",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "支付结果",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"path": "pages/index/trueTest",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "真实考场模拟",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/me/uploadPic",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "上传证件照",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/index/secretPapers",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "考前密卷",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/me/changeCarType",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "切换车型",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -142,11 +184,10 @@
|
|||||||
},
|
},
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"borderStyle": "white",
|
"borderStyle": "white",
|
||||||
"selectedColor": "#333333",
|
"selectedColor": "#05C341",
|
||||||
"backgroundColor": "#FFFFFF",
|
"backgroundColor": "#FFFFFF",
|
||||||
"color": "#999999",
|
"color": "#999999",
|
||||||
"list": [
|
"list": [{
|
||||||
{
|
|
||||||
"pagePath": "pages/index/index",
|
"pagePath": "pages/index/index",
|
||||||
"iconPath": "static/image/tabbar/tab-home.png",
|
"iconPath": "static/image/tabbar/tab-home.png",
|
||||||
"selectedIconPath": "static/image/tabbar/tab-home-selected.png",
|
"selectedIconPath": "static/image/tabbar/tab-home-selected.png",
|
||||||
|
|||||||
@@ -1,22 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="box-nav">
|
<view class="box-nav">
|
||||||
<image style="width: 100%;" src="../../static/image/index/index_bg.jpg"></image>
|
<image style="width: 100%;"
|
||||||
|
src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E9%A6%96%E9%A1%B5_20230830213855.png">
|
||||||
|
</image>
|
||||||
<view class="center-box flex jc-sb ai-c">
|
<view class="center-box flex jc-sb ai-c">
|
||||||
<view class="box-item flex ai-c jc-c">
|
<view class="box-item flex ai-c jc-c">
|
||||||
<view class="flex jc-c ai-c" style="width: 230rpx;height: 230rpx;background-image: url(../../../static/image/index/green_bg.png);background-size: 100% 100%;">
|
<view class="flex jc-c ai-c relative" style="width: 230rpx;height: 230rpx;" @tap="toAnswer('顺序答题',false)">
|
||||||
|
<image style="width: 230rpx;height: 230rpx;position: absolute;left: 0;top: 0;"
|
||||||
|
src="../../../static/image/index/green_bg.png"></image>
|
||||||
<view class="btn-item flex ai-c jc-c">
|
<view class="btn-item flex ai-c jc-c">
|
||||||
<view class="text-center cor-fff" style="line-height: 40rpx;" @tap="toAnswer('顺序答题')">
|
<view class="text-center cor-fff" style="line-height: 40rpx;">
|
||||||
<view class="fs16">顺序练习</view>
|
<view class="fs16">顺序练习</view>
|
||||||
<text class="fs14">{{rightList.length+wrongList.length}}/{{orderQuestion.length}}</text>
|
<text
|
||||||
|
class="fs14">{{getDoNum}}/{{subject=='1'?orderQuestion_subject1.length:orderQuestion_subject4.length}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="box-item flex ai-c jc-c">
|
<view class="box-item flex ai-c jc-c">
|
||||||
<view class="flex jc-c ai-c" style="width: 230rpx;height: 230rpx;background-image: url(../../../static/image/index/orange_bg.png);background-size: 100% 100%;">
|
<view class="flex jc-c ai-c relative" style="width: 230rpx;height: 230rpx;" @tap="toExams('模拟考试')">
|
||||||
|
<image style="width: 230rpx;height: 230rpx;position: absolute;left: 0;top: 0;"
|
||||||
|
src="../../../static/image/index/orange_bg.png"></image>
|
||||||
<view class="btn2-item flex ai-c jc-c">
|
<view class="btn2-item flex ai-c jc-c">
|
||||||
<view class="text-center cor-fff" style="line-height: 40rpx;" @tap="toExams">
|
<view class="text-center cor-fff" style="line-height: 40rpx;">
|
||||||
<view class="fs16">模拟考试</view>
|
<view class="fs16">模拟考试</view>
|
||||||
<text class="fs14">去考试</text>
|
<text class="fs14">去考试</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -25,133 +32,340 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="padding: 0 28rpx;margin-top: 60rpx;">
|
<view style="padding: 0 28rpx;margin-top: calc(100% - 718rpx);">
|
||||||
<view class="tabs-box">
|
<view class="tabs-box">
|
||||||
<view class="wp33 flex ai-c jc-c" @tap="toVip">
|
<view class="wp33 flex ai-c jc-c" @tap="toVip">
|
||||||
<view class="text-center wp100">
|
<view class="text-center wp100">
|
||||||
<image style="width: 72rpx;height: 72rpx;margin: 0 auto"
|
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/vipicon.png">
|
||||||
src="../../static/image/index/vipicon.png">
|
|
||||||
</image>
|
</image>
|
||||||
<view class="mt5">VIP课程</view>
|
<view class="mt5">VIP课程</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wp33 flex ai-c jc-c" @tap="toAnswer('精简500题')">
|
<view class="wp33 flex ai-c jc-c" @tap="toAnswer(`精简${titleNum}题`,true)">
|
||||||
<view class="text-center wp100">
|
<view class="text-center wp100">
|
||||||
<image style="width: 72rpx;height: 72rpx;margin: 0 auto"
|
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/500icon.png">
|
||||||
src="../../static/image/index/500icon.png">
|
|
||||||
</image>
|
</image>
|
||||||
<view class="mt5">精简500题</view>
|
<view class="mt5">精简{{titleNum}}题</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wp33 flex ai-c jc-c" @tap="toExclusive">
|
<view class="wp33 flex ai-c jc-c" @tap="toExclusive">
|
||||||
<view class="text-center wp100">
|
<view class="text-center wp100">
|
||||||
<image style="width: 72rpx;height: 72rpx;margin: 0 auto"
|
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/zxicon.png">
|
||||||
src="../../static/image/index/zxicon.png">
|
|
||||||
</image>
|
</image>
|
||||||
<view class="mt5">专项练习</view>
|
<view class="mt5">专项练习</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wp33 flex ai-c jc-c" @tap="toTestRoom">
|
<view class="wp33 flex ai-c jc-c" @tap="toTestRoom">
|
||||||
<view class="text-center wp100">
|
<view class="text-center wp100">
|
||||||
<image style="width: 72rpx;height: 72rpx;margin: 0 auto;"
|
<image style="width: 72rpx;height: 72rpx;margin: 0 auto;" src="../../static/image/index/realicon.png">
|
||||||
src="../../static/image/index/realicon.png"></image>
|
</image>
|
||||||
<view class="mt5">真实考场模拟</view>
|
<view class="mt5">真实考场模拟</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wp33 flex ai-c jc-c">
|
<view class="wp33 flex ai-c jc-c" @tap="toExams('考前秘卷')">
|
||||||
<view class="text-center wp100">
|
<view class="text-center wp100">
|
||||||
<image style="width: 72rpx;height: 72rpx;margin: 0 auto"
|
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/testbeforeicon.png">
|
||||||
src="../../static/image/index/testbeforeicon.png"></image>
|
</image>
|
||||||
<view class="mt5">考前密卷</view>
|
<view class="mt5">考前秘卷</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wp33 flex ai-c jc-c" @tap="toWrongList">
|
<view class="wp33 flex ai-c jc-c" @tap="toWrongList">
|
||||||
<view class="text-center wp100">
|
<view class="text-center wp100">
|
||||||
<image style="width: 72rpx;height: 72rpx;margin: 0 auto"
|
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/worryicon.png">
|
||||||
src="../../static/image/index/worryicon.png"></image>
|
</image>
|
||||||
<view class="mt5">错题收藏</view>
|
<view class="mt5">错题收藏</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="padding: 0 28rpx;margin-top: 30rpx;" @tap="toClass">
|
<!-- <view style="padding: 0 28rpx;margin-top: 30rpx;" @tap="toClass">
|
||||||
<view class="video-box">
|
<view class="video-box">
|
||||||
<view class="flex jc-sb ai-c wp100">
|
<view class="flex jc-sb ai-c wp100">
|
||||||
<text style="color: #05C341;font-size: 36rpx;">科{{type==1?'一':'四'}}精品视频课</text>
|
<text style="color: #05C341;font-size: 36rpx;">科{{subject==1?'一':'四'}}精品视频课</text>
|
||||||
<text class="cor-666 fs12">全部10节课 ></text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c mt20">
|
<view class="flex ai-c mt20">
|
||||||
<image class="contain-box" src="../../static/image/index/index_bg.jpg"></image>
|
<view class="contain-box relative">
|
||||||
|
<image class="contain-box" src="../../../static/image/index/jpsp.png"></image>
|
||||||
|
<image class="play_btn_2" src="../../static/image/index/play.png" />
|
||||||
|
</view>
|
||||||
<view class="ml15 text-center">
|
<view class="ml15 text-center">
|
||||||
<u-button :customStyle="{width:'200rpx',height:'66rpx',borderRadius: '33rpx'}" iconColor="#fff"
|
<u-button :customStyle="{width:'200rpx',height:'66rpx',borderRadius: '33rpx'}" iconColor="#fff" text="去看视频"
|
||||||
text="去看视频" color="linear-gradient(90deg, #11DF20 0%, #00B74F 100%)" icon="play-circle">
|
color="linear-gradient(90deg, #11DF20 0%, #00B74F 100%)" icon="play-circle">
|
||||||
</u-button>
|
</u-button>
|
||||||
<view class="cor-333 fs15 fw600 mt10">科{{type==1?'一':'四'}}易错试题</view>
|
<view class="cor-333 fs15 fw600 mt10">科{{subject==1?'一':'四'}}易错试题</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState,mapActions } from 'pinia' //引入映射函数
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
import storage from '@/jtools/storage';
|
import storage from '@/jtools/storage';
|
||||||
import useQuestionStore from '@/jtools/store/question' //引入store
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import {
|
||||||
|
querySysConfig,
|
||||||
|
queryQuestionId,
|
||||||
|
getTestQuestionId
|
||||||
|
} from '@/jtools/api/question';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
type:{
|
subject: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
|
},
|
||||||
|
rightList: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
|
wrongList: {
|
||||||
|
type: Array
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
rightList:storage.get('rightList'),
|
titleNum:500,
|
||||||
wrongList:storage.get('wrongList'),
|
|
||||||
allQuestionNum: 0,
|
allQuestionNum: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(){
|
mounted() {
|
||||||
// this.allQuestionNum=useQuestionStore().orderQuestion.length
|
this.getTitle()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQuestionStore, ["orderQuestion"]) //映射函数,取出tagslist
|
...mapState(useUserStore, ["vipOnList", "token"]),
|
||||||
|
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数,取出tagslist
|
||||||
|
getDoNum() {
|
||||||
|
return this.rightList.length + this.wrongList.length
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toTestRoom(){
|
...mapActions(useUserStore, ['searchUserVip']),
|
||||||
uni.navigateTo({
|
...mapActions(useQuestionStore, ['getOrderQuestion_sub1', 'getOrderQuestion_sub4', 'getAllQuestion']),
|
||||||
url:"/pages/index/testRoom"
|
getTitle(){
|
||||||
|
const carId=storage.get('carType') || '1001'
|
||||||
|
querySysConfig(carId,'SimplifyQuestionNum').then(resp=>{
|
||||||
|
if(resp.code==='0000'){
|
||||||
|
const list = JSON.parse(resp.data.configJson)
|
||||||
|
this.titleNum=list.find(item=>item.subject==this.subject).num
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toVip(){
|
async toTestRoom() {
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url:"/pages/index/trueTest"
|
||||||
|
// })
|
||||||
|
if (this.token) {
|
||||||
|
await this.searchUserVip()
|
||||||
|
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||||
|
if (!res) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/index/videoVip"
|
url: "/pages/index/videoVip?subject=" + this.subject
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
getTestQuestionId({
|
||||||
|
versionId: this.version,
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject,
|
||||||
|
}).then(async (resp) => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
if(resp.data&&resp.data.length){
|
||||||
|
const arr = resp.data
|
||||||
|
const listJson = JSON.stringify(arr)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/trueTest?subject="+ this.subject + "&questionIdList=" + listJson
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无题目',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (resp.code === '4001') {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前题库非最新版,请更新~',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.getAllQuestion()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async toVip() {
|
||||||
|
if (this.token) {
|
||||||
|
await this.searchUserVip()
|
||||||
|
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||||
|
if (!res) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/videoVip?subject=" + this.subject
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/me/vip"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toClass() {
|
toClass() {
|
||||||
uni.navigateTo({
|
uni.showToast({
|
||||||
url:"/pages/questionBank/baseOperate"
|
title: '敬请期待',
|
||||||
|
icon: 'none'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toAnswer(title) {
|
toAnswer(title, val) {
|
||||||
|
if (title == `精简${this.titleNum}题`) {
|
||||||
|
queryQuestionId({
|
||||||
|
versionId: this.version,
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject,
|
||||||
|
isVip: '1'
|
||||||
|
}).then(async (resp) => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
if (this.token) {
|
||||||
|
await this.searchUserVip()
|
||||||
|
const result = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||||
|
let arr = []
|
||||||
|
if (result) {
|
||||||
|
if(resp.data&&resp.data.length){
|
||||||
|
const listJson = JSON.stringify(resp.data)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/questionBank?navTitle="+title
|
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject +
|
||||||
|
"&needVip=" + !result + "&questionIdList=" + listJson
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无题目',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (resp.data && resp.data.length > 3) {
|
||||||
|
arr = resp.data.slice(0, 3)
|
||||||
|
} else {
|
||||||
|
arr = resp.data
|
||||||
|
}
|
||||||
|
if(arr&&arr.length){
|
||||||
|
const listJson = JSON.stringify(arr)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject +
|
||||||
|
"&needVip=" + !result + "&questionIdList=" + listJson
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无题目',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (resp.code === '4001') {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前题库非最新版,请更新~',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.getAllQuestion()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&needVip=" +
|
||||||
|
val
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toExams(){
|
toExams(title) {
|
||||||
|
if (storage.get('token')) {
|
||||||
|
if(title=='模拟考试'){
|
||||||
|
getTestQuestionId({
|
||||||
|
versionId: this.version,
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject,
|
||||||
|
}).then(async (resp) => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
const arr = resp.data
|
||||||
|
const listJson = JSON.stringify(arr)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/practiceExams"
|
url: "/pages/index/testTip?subject=" + this.subject + "&questionIdList=" + listJson
|
||||||
})
|
})
|
||||||
|
} else if (resp.code === '4001') {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前题库非最新版,请更新~',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.getAllQuestion()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else if(title=='考前秘卷'){
|
||||||
|
const param=this.subject=='1'?{isExam1: '1'}:{isExam2: '1'}
|
||||||
|
queryQuestionId({
|
||||||
|
versionId: this.version,
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject,
|
||||||
|
...param
|
||||||
|
}).then(async (resp) => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
let arr = []
|
||||||
|
if (this.token) {
|
||||||
|
await this.searchUserVip()
|
||||||
|
const result = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||||
|
if (result) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/secretPapers?subject=" + this.subject
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (resp.data && resp.data.length > 3) {
|
||||||
|
arr = resp.data.slice(0, 3)
|
||||||
|
} else {
|
||||||
|
arr = resp.data
|
||||||
|
}
|
||||||
|
const listJson = JSON.stringify(arr)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/videoVip?subject=" + this.subject
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (resp.code === '4001') {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前题库非最新版,请更新~',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.getAllQuestion()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toExclusive() {
|
toExclusive() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/exclusiveExercise"
|
url: "/pages/questionBank/exclusiveExercise?subject=" + this.subject
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toWrongList() {
|
toWrongList() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/wrongQuestion"
|
url: "/pages/questionBank/wrongQuestion?subject=" + this.subject
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,6 +376,7 @@
|
|||||||
.box-nav {
|
.box-nav {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
height: 500rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.center-box {
|
.center-box {
|
||||||
@@ -224,4 +439,12 @@
|
|||||||
background: #00B74F;
|
background: #00B74F;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.play_btn_2 {
|
||||||
|
width: 65rpx;
|
||||||
|
height: 65rpx;
|
||||||
|
position: absolute;
|
||||||
|
left: 165.5rpx;
|
||||||
|
top: 78rpx
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,33 +1,62 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="box-nav">
|
<view class="box-nav">
|
||||||
<image style="width: 100%;" src="../../static/image/index/index_bg.png"></image>
|
<image style="width: 100%;" src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E9%A6%96%E9%A1%B5_20230830213855.png"></image>
|
||||||
<view style="width: 100%;position: absolute;top: 80px;left: 0;" class="flex jc-c">
|
<view style="width: 100%;position: absolute;top: 80px;left: 0;" class="flex jc-c" @tap="toVipVideo">
|
||||||
<image style="width: 694rpx;" mode="widthFix" src="../../../static/image/index/vipAds.png"></image>
|
<image style="width: 694rpx" mode="widthFix"
|
||||||
|
:src="subject=='2'?'https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E7%A7%91%E4%BA%8C%E9%A6%96%E9%A1%B5banner_20230830214212.png':'https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E7%A7%91%E4%B8%89%E9%A6%96%E9%A1%B5banner_20230830214245.png'">
|
||||||
|
</image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="p14lr" style="margin-top: -20px;">
|
<view class="p14lr" style="margin-top: -20px;">
|
||||||
<view class="video_box">
|
<view class="video_box">
|
||||||
<view class="flex ai-c jc-sb">
|
<view class="flex ai-c jc-sb mt5">
|
||||||
<text class="fs18 cor-000">科二考试项目讲解</text>
|
<text class="fs18 cor-000">科{{subject=='2'?'二':'三'}}考试项目讲解</text>
|
||||||
<view class="flex ai-c" style="height: 34rpx;line-height: 34rpx;">
|
<!-- <view class="flex ai-c" style="height: 34rpx;line-height: 34rpx;" @tap="changeDiverType">
|
||||||
<text style="color:#05C341;font-size: 16px;">自动挡</text>
|
<text style="color:#05C341;font-size: 16px;">{{diverTypeList[diverTypeIndex]?.configItemName}}</text>
|
||||||
<u-icon name="list" color="#05C341" size="18"></u-icon>
|
<u-icon name="list" color="#05C341" size="18"></u-icon>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="skill-sequence-panel-content-wrapper">
|
||||||
|
<scroll-view class="skill-sequence-panel-content" scroll-x :scroll-into-view="intoindex">
|
||||||
|
<view class="skill-sequence-skill-wrapper tab_iem m15tb" :class="videoIndex===index?'checked_tab':''"
|
||||||
|
v-for="(item,index) of operateList" :key="index" :id='"text"+index' @tap="checkVideo(index)">
|
||||||
|
{{item.description}}
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
<swiper class="swiper" :current="videoIndex" style="height: 362rpx;" :autoplay="false"
|
||||||
|
:disable-programmatic-animation="true" @change="onChange">
|
||||||
|
<swiper-item v-for="(item,index) of operateList" :key="index" @tap="toVideo">
|
||||||
|
<view class="p5lr wp100">
|
||||||
|
<view class="wp100 relative hide"
|
||||||
|
style="height: 362rpx;border-radius: 16rpx;overflow: hidden;">
|
||||||
|
<image style="width: 100%;height: 362rpx;position: absolute;left: 0;top: 0;" mode="widthFix"
|
||||||
|
:src="item.videoList[0].videoUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'"></image>
|
||||||
|
<image class="play_btn_2" src="../../static/image/index/play.png" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c jc-sb mt15">
|
</swiper-item>
|
||||||
<view class="tab_iem" :class="videoIndex===item.value?'checked_tab':''" v-for="(item,index) of operateList" :key="index" @tap="checkVideo(item.value)">{{item.label}}</view>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt15">
|
<view class="video_box mt10" v-if="subject=='2'">
|
||||||
<video style="width: 100%;height: 362rpx;border-radius: 16rpx;" id="myVideo" src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"></video>
|
<view class="flex ai-c jc-sb">
|
||||||
|
<text class="fs18 cor-000">基础操作讲解</text>
|
||||||
|
<view class="flex cor-666" @tap="toDetail">
|
||||||
|
<text>全部</text>
|
||||||
|
<u-icon color="#666" name="arrow-right" size="18"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="video_box mt10">
|
<view class="flex p14lr p20tb bc-fff" style="border-bottom: 1rpx solid #DDDCDC;"
|
||||||
<text class="fs18 cor-000">驾驶方法</text>
|
v-for="(item,index) of videoList" :key="index" @click="toOperateDetail(item.videoId)">
|
||||||
<view class="text-center mt10" style="width: 200rpx;" @tap="toDetail">
|
<view class="pic relative hide" style="overflow: hidden;">
|
||||||
<image style="width: 200rpx;height: 200rpx;margin-bottom: 5px;" src="../../../static/image/index/base_operate.png"></image>
|
<image class="pic" style="position: absolute;left: 0;top: 0;" mode="widthFix" :src="item.videoUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'"></image>
|
||||||
<text class="fs16 cor-000">基础操作讲解</text>
|
<image class="play_btn_3" src="../../static/image/index/play.png" />
|
||||||
<view class="fs14 cor-999 mt5">操作方法精讲</view>
|
</view>
|
||||||
|
<view class="ml10">
|
||||||
|
<text class="fs16 cor-000 fw600">{{baseList[0]?.description}}</text>
|
||||||
|
<view class="fs14 mt5 cor-666">{{item.description}}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -35,33 +64,172 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
import {
|
||||||
|
querySysConfigList,
|
||||||
|
queryProjectList
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
name: "Subject2",
|
name: "Subject2",
|
||||||
data(){
|
props: {
|
||||||
return{
|
subject: {
|
||||||
videoIndex:0,
|
type: [String, Number]
|
||||||
operateList:[{
|
|
||||||
label:"侧方停车",
|
|
||||||
value:0,
|
|
||||||
},{
|
|
||||||
label:"倒车入库",
|
|
||||||
value:1
|
|
||||||
},{
|
|
||||||
label:"曲线行驶",
|
|
||||||
value:2
|
|
||||||
},{
|
|
||||||
label:"直角转弯",
|
|
||||||
value:3
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
intoindex: '',
|
||||||
|
diverTypeIndex: 0,
|
||||||
|
diverTypeList: [],
|
||||||
|
videoIndex: 0,
|
||||||
|
projectId: undefined,
|
||||||
|
operateList: [],
|
||||||
|
baseList: [],
|
||||||
|
videoList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
// await this.getDiverType()
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useUserStore, ["vipOnList", "token"])
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useUserStore, ['searchUserVip']),
|
||||||
|
//vip视频页面
|
||||||
|
async toVipVideo(){
|
||||||
|
if (this.token) {
|
||||||
|
await this.searchUserVip()
|
||||||
|
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||||
|
if (!res) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url:"/pages/index/videoVip?subject="+this.subject
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/baseOperate?subject=" + this.subject+"&type=3"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onChange(e) {
|
||||||
|
this.videoIndex = e.detail.current
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const index = this.videoIndex - 1 < 0 ? 0 : this.videoIndex - 1
|
||||||
|
this.intoindex = "text" + index
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getOperateList() {
|
||||||
|
queryProjectList({
|
||||||
|
"carTypeId": storage.get('carType') || '1001',
|
||||||
|
"subject": String(this.subject),
|
||||||
|
"type": "2"
|
||||||
|
}).then(resp => {
|
||||||
|
if (resp.code === '0000' && resp.data &&resp.data.length) {
|
||||||
|
this.baseList = resp.data
|
||||||
|
this.videoList = resp.data[0] && resp.data[0].videoList? resp.data[0].videoList.slice(0, 5) : []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
formateTime(time) {
|
||||||
|
const h = parseInt(time / 3600)
|
||||||
|
const minute = parseInt(time / 60 % 60)
|
||||||
|
const second = Math.ceil(time % 60)
|
||||||
|
const hours = h < 10 ? '0' + h : h
|
||||||
|
const formatSecond = second > 59 ? 59 : second
|
||||||
|
return `${hours > 0 ? `${hours}:` : ''}${minute < 10 ? '0' + minute : minute}:${formatSecond < 10 ? '0' + formatSecond : formatSecond}`
|
||||||
|
},
|
||||||
|
async toVideo() {
|
||||||
|
if (this.token) {
|
||||||
|
await this.searchUserVip()
|
||||||
|
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||||
|
if (!res) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url:"/pages/index/videoVip?subject="+this.subject
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
let arr = JSON.parse(JSON.stringify(this.operateList))
|
||||||
|
arr = arr.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
videoUrl: item.videoList[0]?.videoUrl,
|
||||||
|
videoTime: this.formateTime(item.videoList[0]?.videoTime)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let jsonString = JSON.stringify(arr)
|
||||||
|
console.log('arr',jsonString);
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/videoDetail?videoList=" + jsonString + "&subject=" + this.subject +
|
||||||
|
"&projectId=" + this.projectId + "&type=1&driveType=2"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
toOperateDetail(val) {
|
||||||
|
let arr = JSON.parse(JSON.stringify(this.baseList[0].videoList))
|
||||||
|
arr = arr.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
projectId: item.videoId,
|
||||||
|
subDesc: this.baseList[0].description,
|
||||||
|
videoTime: this.formateTime(item.videoTime)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let jsonString = JSON.stringify(arr)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/videoDetail?videoList=" + jsonString + "&subject=" + this.subject +
|
||||||
|
"&projectId=" + val + "&type=2"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getVideoList() {
|
||||||
|
queryProjectList({
|
||||||
|
"carTypeId": storage.get('carType') || '1001',
|
||||||
|
"driveType": '2',
|
||||||
|
"subject": String(this.subject),
|
||||||
|
"type": "1"
|
||||||
|
}).then(resp => {
|
||||||
|
if(resp.code==='0000'){
|
||||||
|
this.operateList = resp.data
|
||||||
|
this.projectId = this.operateList[0]?.projectId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getDiverType() {
|
||||||
|
const carTypeId = storage.get('carType') || '1001'
|
||||||
|
querySysConfigList(carTypeId, 'DriveType').then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
this.diverTypeList = resp.data
|
||||||
|
this.getVideoList()
|
||||||
|
this.getOperateList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changeDiverType() {
|
||||||
|
this.diverTypeIndex = this.diverTypeIndex == 0 ? 1 : 0
|
||||||
|
this.videoIndex = 0
|
||||||
|
this.getVideoList()
|
||||||
|
this.getOperateList()
|
||||||
|
},
|
||||||
checkVideo(val) {
|
checkVideo(val) {
|
||||||
|
this.projectId = this.operateList[val]?.projectId
|
||||||
this.videoIndex = val
|
this.videoIndex = val
|
||||||
},
|
},
|
||||||
toDetail() {
|
toDetail() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/baseOperate"
|
url: "/pages/questionBank/baseOperate?subject=" + this.subject+"&type=2"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,20 +241,23 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.center-box {
|
.center-box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
top: 170rpx;
|
top: 170rpx;
|
||||||
padding: 0 28rpx;
|
padding: 0 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video_box {
|
.video_box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab_iem {
|
.tab_iem {
|
||||||
width: 145rpx;
|
padding: 0 5px;
|
||||||
height: 56rpx;
|
height: 56rpx;
|
||||||
line-height: 56rpx;
|
line-height: 56rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -94,8 +265,56 @@ export default {
|
|||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
color: #333
|
color: #333
|
||||||
}
|
}
|
||||||
|
|
||||||
.checked_tab {
|
.checked_tab {
|
||||||
background: linear-gradient(90deg, #11DF20 0%, #01B74F 100%);
|
background: linear-gradient(90deg, #11DF20 0%, #01B74F 100%);
|
||||||
color: #fff
|
color: #fff
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pic {
|
||||||
|
width: 300rpx;
|
||||||
|
height: 169rpx;
|
||||||
|
background: #00B74F;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play_btn_3 {
|
||||||
|
width: 65rpx;
|
||||||
|
height: 65rpx;
|
||||||
|
position: absolute;
|
||||||
|
left: 117.5rpx;
|
||||||
|
top: 52rpx
|
||||||
|
}
|
||||||
|
|
||||||
|
.play_btn_2 {
|
||||||
|
width: 65rpx;
|
||||||
|
height: 65rpx;
|
||||||
|
position: absolute;
|
||||||
|
left: calc((100% - 65rpx)/2);
|
||||||
|
top: 148.5rpx
|
||||||
|
}
|
||||||
|
|
||||||
|
/*scroll-view外层*/
|
||||||
|
.skill-sequence-panel-content-wrapper {
|
||||||
|
position: relative;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*scroll-view本身*/
|
||||||
|
.skill-sequence-panel-content {
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*scroll-view内层*/
|
||||||
|
.skill-sequence-skill-wrapper {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
backface-visibility: hidden;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
-webkit-backface-visibility: hidden;
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,49 +1,119 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
|
<view v-if="getLoading" class="wp100 relative" style="height: 100vh;">
|
||||||
|
<image class="wp100" mode="widthFix" src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E8%80%83%E8%AF%95%E6%8F%90%E9%86%92_20230906135037.png"></image>
|
||||||
|
<view class="wp100 flex ai-c jc-c" style="position: absolute;bottom: 0;left: 0;padding-bottom: 124rpx;">
|
||||||
|
<image style="width: 452rpx;" src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E9%87%91%E6%AD%A6%E8%81%94_20230831123333.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="!getLoading">
|
||||||
|
<j-navbar :isBack="false">金武联驾考</j-navbar>
|
||||||
<u-sticky bgColor="#fff">
|
<u-sticky bgColor="#fff">
|
||||||
<u-tabs :list="categoryList" :scrollable="false" @click="changeCategory"></u-tabs>
|
<u-tabs :list="categoryList" :current="curTab" :scrollable="false" @change="changeCategory"></u-tabs>
|
||||||
</u-sticky>
|
</u-sticky>
|
||||||
<view style="height: 100vh;background-color: rgb(245, 245, 245);">
|
<view style="background-color: rgb(245, 245, 245);">
|
||||||
<template v-if="tIndex===0 || tIndex===3">
|
<template v-if="subject=='1' || subject=='4'">
|
||||||
<Subject1 :type="tIndex+1" />
|
<Subject1 :subject="subject" :rightList="rightList" :wrongList="wrongList" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<subject2 />
|
<Subject2 :subject="subject" ref="subjectRef" />
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState,mapActions } from 'pinia' //引入映射函数
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
import useQuestionStore from '@/jtools/store/question' //引入store
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
import storage from '@/jtools/storage';
|
import storage from '@/jtools/storage';
|
||||||
|
import {
|
||||||
|
querySysConfigList,
|
||||||
|
} from '@/jtools/api/question';
|
||||||
import Subject1 from "./components/Subject1";
|
import Subject1 from "./components/Subject1";
|
||||||
import Subject2 from "./components/Subject2";
|
import Subject2 from "./components/Subject2";
|
||||||
export default {
|
export default {
|
||||||
components: {Subject1,Subject2},
|
components: {
|
||||||
|
Subject1,
|
||||||
|
Subject2
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tIndex:0,
|
show:false,
|
||||||
|
subject: storage.get('curSubject') || '1',
|
||||||
|
curTab: 0,
|
||||||
searchValue: '',
|
searchValue: '',
|
||||||
cityName: '',
|
cityName: '',
|
||||||
categoryList:[{
|
categoryList: [],
|
||||||
name:'科目1'
|
rightList: storage.get(`rightList_subject${this.subject}`) || [],
|
||||||
},{
|
wrongList: storage.get(`wrongList_subject${this.subject}`) || [],
|
||||||
name:'科目2'
|
|
||||||
},{
|
|
||||||
name:'科目3'
|
|
||||||
},{
|
|
||||||
name:'科目4'
|
|
||||||
}]
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onShow() {
|
||||||
|
this.show=true
|
||||||
|
this.getSubjectConfig()
|
||||||
|
if (this.subject == '1' || this.subject == '4') {
|
||||||
|
this.rightList = storage.get(`rightList_subject${this.subject}`) || []
|
||||||
|
this.wrongList = storage.get(`wrongList_subject${this.subject}`) || []
|
||||||
|
}
|
||||||
|
if(this.subject=='2'||this.subject=='3'){
|
||||||
|
this.$refs.subjectRef.getDiverType()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onHide(){
|
||||||
|
this.show=false
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1","curSubject","orderQuestion_subject1","orderQuestion_subject4"]), //映射函数,取出tagslist
|
||||||
|
getLoading() {
|
||||||
|
return this.loading_subject4 && this.loading_subject1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch:{
|
||||||
|
getLoading(newVal){
|
||||||
|
if(this.show){
|
||||||
|
if(newVal){
|
||||||
|
if(this.loading_subject4 && this.loading_subject1){
|
||||||
|
uni.hideTabBar();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
uni.showTabBar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useQuestionStore, ['getOrderQuestion_sub4', 'getOrderQuestion_sub1', 'changeSubject']),
|
||||||
|
//获取科目配置
|
||||||
|
getSubjectConfig() {
|
||||||
|
const carTypeId = storage.get('carType') || '1001'
|
||||||
|
querySysConfigList(carTypeId, 'Subject').then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
this.categoryList = resp.data.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
name: item.configItemName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.subject=storage.get('curSubject') || '1',
|
||||||
|
this.curTab=this.categoryList.findIndex(item=>item.configItemCode==this.subject)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
//切换科目
|
//切换科目
|
||||||
changeCategory(val){
|
async changeCategory(val) {
|
||||||
this.tIndex=val.index
|
this.subject = val.configItemCode
|
||||||
console.log(this.tIndex);
|
this.changeSubject(this.subject)
|
||||||
|
if (this.subject == '1' || this.subject == '4') {
|
||||||
|
this.rightList = storage.get(`rightList_subject${this.subject}`) || []
|
||||||
|
this.wrongList = storage.get(`wrongList_subject${this.subject}`) || []
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.subjectRef.getDiverType()
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
47
src/pages/index/paySuccess.vue
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<template>
|
||||||
|
<view class="wp100 flex jc-c bc-fff " style="height: 100vh;">
|
||||||
|
<view class="mt50 text-center flex ai-c" style="flex-direction: column;">
|
||||||
|
<view style="width: 211rpx;" class="text-center">
|
||||||
|
<image style="width: 211rpx;height: 222rpx;;" src="../../static/image/index/paysucess.jpg"></image>
|
||||||
|
</view>
|
||||||
|
<view style="width: 385rpx;" class="text-center">
|
||||||
|
<view class="fw600 fs16 cor-000 mb10">支付成功</view>
|
||||||
|
<tetx class="fs14 cor-666">恭喜您,您已成功购买VIP课程,赶紧去学习吧!</tetx>
|
||||||
|
</view>
|
||||||
|
<button class="btn mt10" @click="goBack">去学习</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
export default{
|
||||||
|
data(){
|
||||||
|
return{
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(){
|
||||||
|
useUserStore().searchUserVip()
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
goBack(){
|
||||||
|
uni.switchTab({
|
||||||
|
url:"/pages/index/index"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.btn{
|
||||||
|
width: 260rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
text-align: center;
|
||||||
|
color:#00B74F;
|
||||||
|
border: 2px solid #00B74F;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
139
src/pages/index/secretPapers.vue
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<u-loading-page :loading="getLoading" loading-text="题库更新中..."></u-loading-page>
|
||||||
|
<view class="relative" v-if="!getLoading"
|
||||||
|
style="width: 100%;background-image: url(https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E8%80%83%E5%89%8D%E5%AF%86%E5%8D%B7_20230904212623.png);background-size: 100% 100%;height: 100vh;">
|
||||||
|
<view style="position: absolute;top: 320px;" class="wp100 p35lr flex jc-sb ai-c">
|
||||||
|
<view class="paper_item" @tap="toExam({isExam1:'1'})">
|
||||||
|
<view class="topTitle">
|
||||||
|
秘卷一
|
||||||
|
</view>
|
||||||
|
<view class="bottom">
|
||||||
|
<text class="wenzi">新规考点提炼</text>
|
||||||
|
<view class="wp100 p5 mt15">
|
||||||
|
<view class="btn">
|
||||||
|
去考试
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="paper_item" @tap="toExam({isExam2:'1'})">
|
||||||
|
<view class="topTitle">
|
||||||
|
秘卷二
|
||||||
|
</view>
|
||||||
|
<view class="bottom">
|
||||||
|
<text class="wenzi">精选高频考试</text>
|
||||||
|
<view class="wp100 p5 mt15">
|
||||||
|
<view class="btn">
|
||||||
|
去考试
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import {
|
||||||
|
queryQuestionId,
|
||||||
|
getTestQuestionId
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
subject:'1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(op){
|
||||||
|
if(op.subject){
|
||||||
|
this.subject=op.subject
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1", "curSubject","version"]), //映射函数,取出tagslist
|
||||||
|
getLoading() {
|
||||||
|
return this.loading_subject4 && this.loading_subject1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useQuestionStore, ['getOrderQuestion_sub4', 'getOrderQuestion_sub1', 'changeSubject']),
|
||||||
|
toExam(param) {
|
||||||
|
queryQuestionId({
|
||||||
|
versionId: this.version,
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject,
|
||||||
|
...param
|
||||||
|
}).then(async (resp) => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
const arr = resp.data
|
||||||
|
const listJson = JSON.stringify(arr)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/practiceExams?title=考前秘卷&subject=" + this.subject + "&questionIdList=" + listJson
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.paper_item {
|
||||||
|
width: 287rpx;
|
||||||
|
height: 320rpx;
|
||||||
|
/* border: 4px solid #F8A42C; */
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topTitle {
|
||||||
|
width: 100%;
|
||||||
|
height: 85rpx;
|
||||||
|
line-height: 85rpx;
|
||||||
|
text-align: center;
|
||||||
|
background: linear-gradient(90deg, #E66501 0%, #F8A42C 100%);
|
||||||
|
border-radius: 16rpx 16rpx 0rpx 0rpx;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-family: PingFang SC;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
padding-top: 15px;
|
||||||
|
width: 100%;
|
||||||
|
height: 235rpx;
|
||||||
|
border-radius: 0rpx 0rpx 16rpx 16rpx;
|
||||||
|
border-bottom: 4px solid #F8A42C;
|
||||||
|
border-left: 4px solid #F8A42C;
|
||||||
|
border-right: 4px solid #F8A42C;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wenzi {
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-family: PingFang SC;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #7D4310;
|
||||||
|
line-height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: 246rpx;
|
||||||
|
height: 76rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 76rpx;
|
||||||
|
color: #fff;
|
||||||
|
background: linear-gradient(0deg, #E66501 0%, #F8A42C 100%);
|
||||||
|
box-shadow: 0rpx 2rpx 21rpx 0rpx #F7A12A;
|
||||||
|
border-radius: 38rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
83
src/pages/index/testTip.vue
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<template>
|
||||||
|
<view class="bc-fff hp100">
|
||||||
|
<view class="wp100 p14 flex ai-c jc-c">
|
||||||
|
<view class="text-center">
|
||||||
|
<view style="width: 64px;height: 64px;border-radius: 50%;overflow: hidden;margin-bottom: 10px;">
|
||||||
|
<u-avatar class="br-p50 overflow-h" :size="64" mp-avatar shape="circle"></u-avatar>
|
||||||
|
</view>
|
||||||
|
<text class="fs18">{{user.userName}}{{ user.userId }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="p14">
|
||||||
|
<view class="wp100 p14lr p20tb mb14" style="background-color: rgb(248, 248, 248);border-radius: 20rpx;">
|
||||||
|
<view class="flex ai-c jc-sb pb10">
|
||||||
|
<text style="color: rgb(175, 175, 175);">考试类型</text>
|
||||||
|
<text>{{carName}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c jc-sb pb10">
|
||||||
|
<text style="color: rgb(175, 175, 175);">考试标准</text>
|
||||||
|
<text>{{subject=='1'?100:50}}题/45分钟</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c jc-sb pb10">
|
||||||
|
<text style="color: rgb(175, 175, 175);">合格标准</text>
|
||||||
|
<text>90分及格(满分100分)</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c jc-sb">
|
||||||
|
<text style="color: rgb(175, 175, 175);">出题规则</text>
|
||||||
|
<text>根据公安部出题规则组卷</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<text>模拟考试不能修改答案,每错1题扣{{subject=='1'?1:2}}分,错题累计超过{{subject=='1'?10:5}}道,考试不通过</text>
|
||||||
|
</view>
|
||||||
|
<view class="p14lr wp100" style="margin-top: 30px;">
|
||||||
|
<u-button :customStyle="{width: '100%',borderRadius:'40rpx',backgroundColor:'#05C341',color:'#fff'}" text="开始考试"
|
||||||
|
@click="submit" />
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
carName:storage.get('carName') ||'小车C1/C2/C3',
|
||||||
|
questionList: '',
|
||||||
|
subject:'1',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(op) {
|
||||||
|
if (op.questionIdList) {
|
||||||
|
this.questionList = op.questionIdList
|
||||||
|
}
|
||||||
|
if(op.subject){
|
||||||
|
this.subject = op.subject
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["currentCarName"]), //映射函数,取出tagslist
|
||||||
|
user() {
|
||||||
|
return useUserStore().userInfo
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submit(){
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/practiceExams?title=模拟考试&subject=" + this.subject + "&questionIdList=" + this.questionList
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
358
src/pages/index/trueTest.vue
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
<template>
|
||||||
|
<view class="ml40 p10lr hp100 bc-f5" style="overflow-y: auto;">
|
||||||
|
<view class="flex" style="align-items: stretch;">
|
||||||
|
<view class="left hp100">
|
||||||
|
<view class="fl1 flex" style="align-items: stretch;">
|
||||||
|
<view class="info">
|
||||||
|
<view class="flex ai-c jc-c mr10 fs16" style="border: 1px solid #999;height: 32px;">
|
||||||
|
第01考台
|
||||||
|
</view>
|
||||||
|
<view class="mt10 p10tb" style="background-color: rgb(177, 222, 255);">
|
||||||
|
<view style="margin: 0 auto;width: 64px;">
|
||||||
|
<u-avatar :size="64" mp-avatar shape="circle"></u-avatar>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="p10" style="background-color: rgb(235, 235, 235);">
|
||||||
|
<view class="flex ai-c">
|
||||||
|
<text class="fs12 cor-333">姓名</text>
|
||||||
|
<view class="fl1 info-box">{{ user.userName }}{{ user.userId }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c mt5">
|
||||||
|
<text class="fs12 cor-333">类型</text>
|
||||||
|
<view class="fl1 info-box">小车</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c mt5">
|
||||||
|
<text class="fs12 cor-333">科目</text>
|
||||||
|
<view class="fl1 info-box">科目一</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="fl1 question-box">
|
||||||
|
<view class="fs14 cor-000">
|
||||||
|
{{questionIndex}} {{question.question}}
|
||||||
|
</view>
|
||||||
|
<view v-if="question.type != 1" v-for="(item, idx) in question.optionList" :key="idx"
|
||||||
|
class="mt5 fs14 cor-000">
|
||||||
|
{{item.op}}: {{item.opDesc}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ans-box">
|
||||||
|
<view class="flex ai-c">
|
||||||
|
<view class="time">
|
||||||
|
<!-- <text class="mt7">45:00</text> -->
|
||||||
|
<u-count-down ref="countDown" :time="timeCount" format="mm:ss" @change="e=>this.time=e"
|
||||||
|
@finish="timeFinish"></u-count-down>
|
||||||
|
</view>
|
||||||
|
<view class="ml20 fs16 cor-333 fwb">
|
||||||
|
您的答案:
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="question.type==1" class="flex">
|
||||||
|
<button class="btn" :class="{ done: question.yourAnswer==1 }" @tap="handleAnswer(1)">√</button>
|
||||||
|
<button class="btn" :class="{ done: question.yourAnswer==2 }" @tap="handleAnswer(2)">×</button>
|
||||||
|
</view>
|
||||||
|
<view v-else class="flex">
|
||||||
|
<template v-for="(item,index) in question.optionList" :key="index">
|
||||||
|
<button class="btn" :class="{ done: question.yourAnswer.includes(index+1) }"
|
||||||
|
@tap="handleAnswer(index+1)">{{['A','B','C','D','E','F','G'][index]}}</button>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="right" style="border: 1px solid #999;;">
|
||||||
|
<u-grid border :col="subject==1?10:5">
|
||||||
|
<u-grid-item v-for="(listItem,listIndex) in list" :key="listIndex" style="box-sizing: border-box;">
|
||||||
|
<view class="q-item" :class="{ 'current-question': questionIndex==listIndex+1, done: listItem.yourAnswer }"
|
||||||
|
@tap="questionIndex=listIndex+1">{{listIndex+1}}</view>
|
||||||
|
</u-grid-item>
|
||||||
|
</u-grid>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="operate-box">
|
||||||
|
<view class="fl1">
|
||||||
|
<view class="fs16" style="height: 20px;line-height: 20px;color: rgb(232, 72, 75);">
|
||||||
|
操作提示:{{['','判断题','单选题','多选题'][question.type]}}
|
||||||
|
</view>
|
||||||
|
<view class="fs14 cor-333" style="height: 20px;line-height: 20px;">
|
||||||
|
本题是{{getDesc(question.type)}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex">
|
||||||
|
<button :disabled="questionIndex==1" class="btn" @tap="questionIndex--">上一题</button>
|
||||||
|
<button :disabled="questionIndex==list.length" class="btn" @tap="questionIndex++">下一题</button>
|
||||||
|
<button class="btn" @tap="handleConfirm">交卷</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="img-box">
|
||||||
|
<image style="height: 100%;" mode="heightFix" :src="question.imageUrl"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
import {
|
||||||
|
getTestQuestion,
|
||||||
|
submitTest
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
subject:'1',
|
||||||
|
questionIndex: 1,
|
||||||
|
list: [],
|
||||||
|
mutiAns: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数,取出tagslis
|
||||||
|
user() {
|
||||||
|
return useUserStore().userInfo
|
||||||
|
},
|
||||||
|
question() {
|
||||||
|
if (this.questionIndex != 0 && this.list.length) {
|
||||||
|
return this.list[this.questionIndex - 1]
|
||||||
|
} else {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
timeCount() {
|
||||||
|
return this.subject == 1 ? 60 * 60 * 1000 : 45 * 60 * 1000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.fz()
|
||||||
|
},
|
||||||
|
onLoad(option) {
|
||||||
|
this.subject = option.subject || 1
|
||||||
|
if(option.questionIdList){
|
||||||
|
const idList=JSON.parse(option.questionIdList)
|
||||||
|
let arr = this[`orderQuestion_subject${this.subject}`].filter(qItem=>idList.includes(qItem.questionId))
|
||||||
|
this.list = arr.map(it => ({
|
||||||
|
...it,
|
||||||
|
yourAnswer: ''
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fz() {
|
||||||
|
wx.setPageOrientation({
|
||||||
|
orientation: 'landscape'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// _getList() {
|
||||||
|
// getTestQuestion({
|
||||||
|
// carTypeId: storage.get('carType') || '1001',
|
||||||
|
// subject: this.subject
|
||||||
|
// }).then(resp => {
|
||||||
|
// if (resp.code === '0000') {
|
||||||
|
// this.list = resp.data.map(it => ({
|
||||||
|
// ...it,
|
||||||
|
// yourAnswer: ''
|
||||||
|
// }))
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
handleAnswer(index) {
|
||||||
|
// 如果是多选
|
||||||
|
let q = this.list[this.questionIndex - 1]
|
||||||
|
if (q.type == 3) {
|
||||||
|
let arr = q.yourAnswer ? q.yourAnswer.split(',') : []
|
||||||
|
arr.includes(index + '') ? arr = arr.filter(it => it != (index + '')) : arr.push(index)
|
||||||
|
this.list[this.questionIndex - 1].yourAnswer = arr.join(',')
|
||||||
|
} else {
|
||||||
|
this.list[this.questionIndex - 1].yourAnswer = index + ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getDesc(type) {
|
||||||
|
let tt1 = ['', '判断题,', '单选题,', '多选题,'][type]
|
||||||
|
let tt2 = ['', '请判断对错!', '请在备选答案中选择你认为正确的答案!', '请在备选答案中选择多个你认为正确的答案!'][type]
|
||||||
|
return tt1 + tt2
|
||||||
|
},
|
||||||
|
|
||||||
|
handleConfirm() {
|
||||||
|
const wdLength = this.list.filter(it => !it.yourAnswer).length
|
||||||
|
if (wdLength) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '考试确认窗口',
|
||||||
|
content: `您还有${wdLength}题未答,是否确认交卷?`,
|
||||||
|
confirmText: '确认交卷',
|
||||||
|
cancelText: '继续考试',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.toSubmit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showModal({
|
||||||
|
title: '考试确认窗口',
|
||||||
|
content: `是否确认交卷?`,
|
||||||
|
confirmText: '确认交卷',
|
||||||
|
cancelText: '继续考试',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.toSubmit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
timeFinish() {
|
||||||
|
uni.showToast({
|
||||||
|
title: "考试结束,将为您自动交卷~",
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.toSubmit()
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
toSubmit() {
|
||||||
|
const restTime = this.time.hours * 60 * 60 + this.time.minutes * 60 + this.time.seconds
|
||||||
|
const score = this.list.reduce((pre, cur) => {
|
||||||
|
const isTrue = cur.trueAnswer == cur.yourAnswer.replace(/,-g/, '')
|
||||||
|
let s = 0
|
||||||
|
if (isTrue) {
|
||||||
|
s = this.subject == 1 ? 1 : 2
|
||||||
|
}
|
||||||
|
return pre + s
|
||||||
|
}, 0)
|
||||||
|
submitTest({
|
||||||
|
"carTypeId": storage.get('carType') || '1001',
|
||||||
|
"score": score,
|
||||||
|
"testTime": 60 * 60 - restTime,
|
||||||
|
subject: this.subject
|
||||||
|
}).then(resp => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '考试结束!',
|
||||||
|
icon: 'none',
|
||||||
|
complete() {
|
||||||
|
uni.navigateBack()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.info {
|
||||||
|
width: 100px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.info-box {
|
||||||
|
margin-left: 5px;
|
||||||
|
padding-left: 5px;
|
||||||
|
height: 28px;
|
||||||
|
line-height: 28px;
|
||||||
|
box-shadow: inset 2px 2px 5px #babecc, inset -5px -5px 10px #fff;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-box {
|
||||||
|
position: relative;
|
||||||
|
padding: 10px;
|
||||||
|
border-top: 1px solid #999;
|
||||||
|
border-left: 1px solid #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ans-box {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 50px;
|
||||||
|
border-top: 1px solid #999;
|
||||||
|
|
||||||
|
.time {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
width: 90px;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 16px;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
border: 1px solid #999;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '剩余时间';
|
||||||
|
position: absolute;
|
||||||
|
left: 6px;
|
||||||
|
top: 0;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #333;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
width: 270px;
|
||||||
|
|
||||||
|
.q-item {
|
||||||
|
width: 28px;
|
||||||
|
height: 27px;
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 27px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.operate-box {
|
||||||
|
padding-left: 10px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
height: 50px;
|
||||||
|
border-top: 2px solid rgb(43, 102, 167);
|
||||||
|
border-bottom: 2px solid rgb(43, 102, 167);
|
||||||
|
border-left: 1px solid #999;
|
||||||
|
border-right: 1px solid #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
margin-right: 10px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
// background-color: rgb(244, 243, 239);
|
||||||
|
font-size: 14px;
|
||||||
|
box-shadow:
|
||||||
|
0 0 4px rgba(0, 0, 0, .4),
|
||||||
|
// -7px -7px 12px rgba(255, 255, 255, .9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.img-box {
|
||||||
|
height: 120px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-question {
|
||||||
|
background-color: #93F0E4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.done {
|
||||||
|
background-color: #33FF66;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,36 +1,73 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="relative" style="height: 100vh;">
|
<view class="relative" style="height: 100vh;">
|
||||||
<image style="width: 100%;height: 600rpx;" src="../../static/image/index/vip_bg.jpg"></image>
|
<view style="height: 100%;overflow: scroll;background-color: #fff;">
|
||||||
<view class="p14">
|
<image style="width: 100%;height: 600rpx;" src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/vip%E9%A2%98%E5%BA%93_20230911211532.png"></image>
|
||||||
<view class="flex jc-sb ai-c">
|
<view style="margin-bottom: 100px;">
|
||||||
<view class="option_tem relative" :class="checkedPrice===item.priceId?'checked_item':''" v-for="(item,index) of priceList" :key="index" @click="checkPrice(item.priceId,item.money)">
|
<view class="flex jc-fa ai-c wp100 p14">
|
||||||
<text class="fw600 fs16 cor-333">{{item.title}}</text>
|
<view style="width: 33.3%;" v-for="(item, index) of priceList" :key="index">
|
||||||
<view class="mt5">
|
<view class="option_tem relative" :class="checkedId === item.memberId ? 'checked_item' : ''" @click="checkPrice(item.memberId, item.price)">
|
||||||
|
<text class="fw600 fs12 cor-333">{{ item.memberName }}</text>
|
||||||
|
<view class="mt5" v-if="!isIOS">
|
||||||
<text class="fs14" style="color: #FF6E02;">¥</text>
|
<text class="fs14" style="color: #FF6E02;">¥</text>
|
||||||
<text class="fs30 fw600" style="color: #FF6E02;">{{item.money}}</text>
|
<text class="fs30 fw600" style="color: #FF6E02;">{{ item.price }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="fs12 cor-999">长期有效</text>
|
<view v-else class="mt5">
|
||||||
<view class="bottom_box fs12 cor-333" :class="checkedPrice===item.priceId?'checked_bottom':''">赠送vip题库</view>
|
<text class="fs14" style="color: #FF6E02;">iOS暂不支持</text>
|
||||||
|
</view>
|
||||||
|
<text class="fs12 cor-999">一年有效</text>
|
||||||
|
<!-- <view class="bottom_box fs12 cor-333" :class="checkedId===item.memberId?'checked_bottom':''">赠送vip题库</view> -->
|
||||||
<view class="tag" v-if="item.all">
|
<view class="tag" v-if="item.all">
|
||||||
<text style="transform:scale(0.83);">合买更优惠</text>
|
<text style="transform:scale(0.83);">合买更优惠</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt15 intr_box">
|
</view>
|
||||||
<view class="fw600 fs16 cor-000">免费获赠<text style="color: #FF6E02;">价值68元</text>的VIP题库</view>
|
<view class="intr_box p14">
|
||||||
<view class="flex ai-c jc-sb mt15">
|
<view class="fw600 fs16 cor-000">尊享以下权益</view>
|
||||||
<view class="flex ai-c">
|
<view class="flex ai-c jc-sb mt15" v-if="subject == '1' || subject == '4'">
|
||||||
|
<view class="text-center" style="width: 33%">
|
||||||
|
<view class="wp100 flex ai-c jc-c mb5">
|
||||||
<image style="width: 63rpx;height: 63rpx;margin-right: 5px;" src="../../static/image/index/vip500.png"></image>
|
<image style="width: 63rpx;height: 63rpx;margin-right: 5px;" src="../../static/image/index/vip500.png"></image>
|
||||||
<view class="vip_item">含精简500题</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c">
|
<text>精简{{ titleNum }}题</text>
|
||||||
|
</view>
|
||||||
|
<view class="text-center" style="width: 33%;">
|
||||||
|
<view class="wp100 flex ai-c jc-c mb5">
|
||||||
|
<image style="width: 63rpx;height: 63rpx;margin-right: 5px;" src="../../static/image/index/vip_trueRoom.png"></image>
|
||||||
|
</view>
|
||||||
|
<text>真实考场模拟</text>
|
||||||
|
</view>
|
||||||
|
<view class="text-center" style="width: 33%;">
|
||||||
|
<view class="wp100 flex ai-c jc-c mb5">
|
||||||
<image style="width: 63rpx;height: 63rpx;margin-right: 5px;" src="../../static/image/index/vipmijuan.png"></image>
|
<image style="width: 63rpx;height: 63rpx;margin-right: 5px;" src="../../static/image/index/vipmijuan.png"></image>
|
||||||
<view class="vip_item">含考前密卷2套</view>
|
</view>
|
||||||
|
<text>考前密卷</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<view class="flex ai-c jc-c mt15">
|
||||||
|
<view class="flex ai-c">
|
||||||
|
<image style="width: 63rpx;height: 63rpx;margin-right: 5px;" src="../../static/image/index/vip_ksxj.png"></image>
|
||||||
|
<view class="vip_item">考试项目详解</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c mt20">
|
||||||
|
<view class="contain-box relative">
|
||||||
|
<image class="contain-box" src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E5%B0%8F%E8%BD%A6_20230911211545.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="ml15" style="text-align: left;">
|
||||||
|
<view class="cor-333 fw600">考试项目详解</view>
|
||||||
|
<view class="fs15 mt10" style="color: #9F826C ;">考试实操技巧讲解事半功倍</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wp100 p14" style="position: absolute;left: 0;bottom:20px">
|
<view class="wp100 mt15" v-if="subject == '1' || subject == '4'">
|
||||||
|
<image class="wp100" mode="widthFix" :src="picUrl"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="!isIOS" class="wp100 p14" style="position: absolute;left: 0;bottom:20px" @tap="handlePay()">
|
||||||
<view class="sub_btn flex ai-c jc-sb">
|
<view class="sub_btn flex ai-c jc-sb">
|
||||||
<text class="cor-fff fs14">¥<text class="fs24 cor-fff">{{ nowPrice }}</text></text>
|
<text class="cor-fff fs14">¥<text class="fs24 cor-fff">{{ nowPrice }}</text></text>
|
||||||
<image style="width: 276rpx;height: 88rpx;margin-top: -5px;" src="../../static/image/index/buy.png"></image>
|
<image style="width: 276rpx;height: 88rpx;margin-top: -5px;" src="../../static/image/index/buy.png"></image>
|
||||||
@@ -40,35 +77,103 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import { getVipList } from '@/jtools/api/vip'
|
||||||
|
import { querySysConfig } from '@/jtools/api/question';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import Pay from '@/jtools/pay/index.js';
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
picUrl: '',
|
||||||
|
titleNum: 500,
|
||||||
|
subject: '1',
|
||||||
|
loading: true,
|
||||||
nowPrice: 168,
|
nowPrice: 168,
|
||||||
checkedPrice:0,
|
checkedId: 0,
|
||||||
priceList:[{
|
priceList: [],
|
||||||
priceId:0,
|
order: {
|
||||||
title:'科一精品课',
|
money: 0,
|
||||||
money:168,
|
description: '会员充值'
|
||||||
all:false
|
|
||||||
},
|
},
|
||||||
{
|
isIOS: true
|
||||||
priceId:1,
|
|
||||||
title:'科四精品课',
|
|
||||||
money:168,
|
|
||||||
all:false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
priceId:2,
|
|
||||||
title:'科一+科四',
|
|
||||||
money:268,
|
|
||||||
all:true,
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onLoad(op) {
|
||||||
|
this.isIOS = this.$platform.device().includes('ios')
|
||||||
|
if (op.subject) {
|
||||||
|
this.subject = op.subject
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
this.getVipList()
|
||||||
|
this.getWXOpenId()
|
||||||
|
this.getTitle()
|
||||||
|
this.getPic()
|
||||||
|
this.$set(this.order, 'userId', this.userInfo.userId);
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useUserStore, ["userInfo"])
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getPic() {
|
||||||
|
const currentCartype = storage.get('carType') || '1001'
|
||||||
|
querySysConfig(currentCartype, 'VipDescImageUrl').then(res => {
|
||||||
|
this.picUrl = JSON.parse(res.data.configJson).url
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getTitle() {
|
||||||
|
const carId = storage.get('carType') || '1001'
|
||||||
|
querySysConfig(carId, 'SimplifyQuestionNum').then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
const list = JSON.parse(resp.data.configJson)
|
||||||
|
this.titleNum = list.find(item => item.subject == this.subject).num
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async handlePay() {
|
||||||
|
if (this.loading) {
|
||||||
|
this.loading = false
|
||||||
|
await this.getWXOpenId()
|
||||||
|
new Pay('wechat', this.order);
|
||||||
|
this.loading = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getWXOpenId() {
|
||||||
|
const that = this
|
||||||
|
uni.login({
|
||||||
|
success(res) {
|
||||||
|
that.$set(that.order, 'code', res.code);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getVipList() {
|
||||||
|
getVipList({
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject
|
||||||
|
}).then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
this.priceList = resp.data
|
||||||
|
this.checkedId = this.priceList[0].memberId
|
||||||
|
this.order.outTradeNo = this.priceList[0].memberId
|
||||||
|
this.order.money = this.priceList[0].price
|
||||||
|
this.nowPrice = this.priceList[0].price
|
||||||
|
this.priceList.forEach(item => {
|
||||||
|
if (item.subjects.length > 1) {
|
||||||
|
item.all = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
checkPrice(val, price) {
|
checkPrice(val, price) {
|
||||||
this.checkedPrice=val
|
this.checkedId = val
|
||||||
|
this.order.outTradeNo = val
|
||||||
this.nowPrice = price
|
this.nowPrice = price
|
||||||
|
this.order.money = price
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,11 +189,12 @@
|
|||||||
border-radius: 16rpx 46rpx 16rpx 16rpx;
|
border-radius: 16rpx 46rpx 16rpx 16rpx;
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checked_item {
|
.checked_item {
|
||||||
width: 228rpx;
|
|
||||||
background: #FFF0E5;
|
background: #FFF0E5;
|
||||||
border: 4px solid #FF6E02;
|
border: 4px solid #FF6E02;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom_box {
|
.bottom_box {
|
||||||
width: 214rpx;
|
width: 214rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
@@ -100,14 +206,16 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checked_bottom {
|
.checked_bottom {
|
||||||
width: 218rpx;
|
width: 218rpx;
|
||||||
border-radius: 0 0 16rpx 12rpx;
|
border-radius: 0 0 16rpx 5rpx;
|
||||||
background-color: #FF6E02;
|
background-color: #FF6E02;
|
||||||
color: #fff
|
color: #fff
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
width: 122rpx;
|
padding: 0 5px;
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
background: linear-gradient(90deg, #E66501 0%, #F8A42C 100%);
|
background: linear-gradient(90deg, #E66501 0%, #F8A42C 100%);
|
||||||
border-radius: 8rpx 20rpx 8rpx 8rpx;
|
border-radius: 8rpx 20rpx 8rpx 8rpx;
|
||||||
@@ -119,6 +227,7 @@
|
|||||||
left: 10rpx;
|
left: 10rpx;
|
||||||
top: -18rpx
|
top: -18rpx
|
||||||
}
|
}
|
||||||
|
|
||||||
.intr_box {
|
.intr_box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -126,6 +235,7 @@
|
|||||||
background: #FFF0E5;
|
background: #FFF0E5;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vip_item {
|
.vip_item {
|
||||||
width: 208rpx;
|
width: 208rpx;
|
||||||
height: 54rpx;
|
height: 54rpx;
|
||||||
@@ -135,6 +245,7 @@
|
|||||||
background: #F3D7C2;
|
background: #F3D7C2;
|
||||||
border-radius: 0rpx 10rpx 10rpx 10rpx;
|
border-radius: 0rpx 10rpx 10rpx 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub_btn {
|
.sub_btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 110rpx;
|
height: 110rpx;
|
||||||
@@ -144,4 +255,19 @@
|
|||||||
border-radius: 55rpx;
|
border-radius: 55rpx;
|
||||||
padding: 14rpx;
|
padding: 14rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.contain-box {
|
||||||
|
width: 344rpx;
|
||||||
|
height: 196rpx;
|
||||||
|
background: #00B74F;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play_btn_2 {
|
||||||
|
width: 65rpx;
|
||||||
|
height: 65rpx;
|
||||||
|
position: absolute;
|
||||||
|
left: 165.5rpx;
|
||||||
|
top: 78rpx
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<image src="/static/image/login/logo.jpg" mode="widthFix"></image>
|
<image src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E9%87%91%E6%AD%A6%E8%81%94_20230831123333.png" mode="widthFix"></image>
|
||||||
<view class="mt21 fs16 cor-333 fwb text-center">欢迎使用金联武驾考!</view>
|
<view class="mt21 fs16 cor-333 fwb text-center">欢迎使用金武联驾考!</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="list">
|
<view class="list">
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
login
|
login
|
||||||
} from '@/jtools/api/login'
|
} from '@/jtools/api/login'
|
||||||
import useUserStore from '@/jtools/store/user'
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -80,8 +81,14 @@
|
|||||||
},
|
},
|
||||||
bindLogin() {
|
bindLogin() {
|
||||||
if (isPhone(this.login.phone) && this.login.code) {
|
if (isPhone(this.login.phone) && this.login.code) {
|
||||||
useUserStore().login(this.login).then(resp => {
|
let params = { ...this.login }
|
||||||
|
if (storage.get('companyId')) {
|
||||||
|
params.id = storage.get('companyId')
|
||||||
|
}
|
||||||
|
useUserStore().login(params).then(resp => {
|
||||||
if (resp.userId) {
|
if (resp.userId) {
|
||||||
|
useUserStore().getUserInfo()
|
||||||
|
useUserStore().searchUserVip()
|
||||||
this.toHome()
|
this.toHome()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -158,5 +165,4 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
99
src/pages/me/changeCarType.vue
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="p14">
|
||||||
|
<view class="wp100 p14lr p20tb bc-fff br8 mb10 relative" style="box-sizing: border-box;" :class="checkedCar==item.carTypeId?'checked':''" v-for="(item,index) of carTypeList" :key="index" @click="changeType(item)">{{item.carName}}{{item.remark}}
|
||||||
|
<view class="p5 cor-fff fs12 br4" style="background-color:#05C341;position: absolute;right: -1rpx;top:-1rpx" v-if="checkedCar==item.carTypeId">已选</view>
|
||||||
|
</view>
|
||||||
|
<view class="wp100" style="margin-top: 40px;">
|
||||||
|
<u-button :customStyle="{width: '100%',borderRadius:'40rpx',backgroundColor:'#05C341',color:'#fff'}" text="确定"
|
||||||
|
@click="submit" />
|
||||||
|
</view>
|
||||||
|
<u-modal :show="show" title="提示" content="切换题库后上一个题库练习记录将会全部清空,确定要切换吗" showCancelButton @confirm="confirmSubmit" @cancel="cancel"></u-modal>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import {
|
||||||
|
getCarTypeList,
|
||||||
|
} from '@/jtools/api/index';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
export default{
|
||||||
|
data() {
|
||||||
|
return{
|
||||||
|
show:false,
|
||||||
|
carTypeList:[],
|
||||||
|
checkedCar: storage.get('carType') ||'1001',
|
||||||
|
checkedCarName:storage.get('carName') || '小车C1/C2/C3'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getCarTypeList()
|
||||||
|
},
|
||||||
|
computed:{
|
||||||
|
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1","curSubject"]), //映射函数,取出tagslist
|
||||||
|
getLoading() {
|
||||||
|
return this.loading_subject4 && this.loading_subject1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch:{
|
||||||
|
getLoading(newVal){
|
||||||
|
console.log(newVal);
|
||||||
|
if(newVal){
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title:'切换成功!'
|
||||||
|
})
|
||||||
|
this.cancel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
getCarTypeList(){
|
||||||
|
getCarTypeList().then(resp=>{
|
||||||
|
if(resp.code==='0000'){
|
||||||
|
this.carTypeList=resp.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changeType(item){
|
||||||
|
this.checkedCar=item.carTypeId
|
||||||
|
this.checkedCarName=item.carName+item.remark
|
||||||
|
},
|
||||||
|
submit(){
|
||||||
|
const id=storage.get('carType') ||'1001'
|
||||||
|
if(this.checkedCar==id){
|
||||||
|
uni.showToast({
|
||||||
|
title:'当前已是该车型题库!',
|
||||||
|
icon:'error'
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.show=true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel(){
|
||||||
|
this.show=false
|
||||||
|
},
|
||||||
|
confirmSubmit(){
|
||||||
|
storage.set('carType',this.checkedCar)
|
||||||
|
storage.set('carName',this.checkedCarName)
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中'
|
||||||
|
});
|
||||||
|
useQuestionStore().resetStorage()
|
||||||
|
useQuestionStore().getAllQuestion()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.checked{
|
||||||
|
border: 6rpx solid #05C341;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
<view class="bc-f5">
|
<view class="bc-f5">
|
||||||
<!-- <view class="wp100" style="background-color: #333;height: 205px;"></view> -->
|
<!-- <view class="wp100" style="background-color: #333;height: 205px;"></view> -->
|
||||||
<view class="relative" style="height: 205px;">
|
<view class="relative" style="height: 205px;">
|
||||||
<image src="/static/image/mine/mine_bg.png" mode="widthFix" style="width: 100%;"></image>
|
<image src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/vip%E8%83%8C%E6%99%AF%E7%BB%BF_20230831010645.png" mode="widthFix" style="width: 100%;"></image>
|
||||||
<view class="info flex ai-c" v-if="isLogin">
|
<view class="info flex ai-c" v-if="isLogin">
|
||||||
<u-avatar class="br-p50 overflow-h" :size="64" mp-avatar shape="circle"></u-avatar>
|
<u-avatar class="br-p50 overflow-h" :size="64" mp-avatar shape="circle"></u-avatar>
|
||||||
<view class="ml12">
|
<view class="ml12">
|
||||||
<view class="flex ai-c fs18 cor-333 fwb">
|
<view class="flex ai-c fs18 cor-333 fwb">
|
||||||
<text class="mr10">{{ user.userName }}{{ user.userId }}</text>
|
<text class="mr10">{{ user.userName }}{{ user.userId }}</text>
|
||||||
<image v-if="vipOn.length" src="/static/image/mine/vip.png" mode="widthFix" style="width: 18px;"></image>
|
<image v-if="vipOn.length" src="../../static/image/mine/vip.png" mode="widthFix" style="width: 18px;"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt5 fs14 cor-666">陪您学车 第{{ user.days }}天</view>
|
<view class="mt5 fs14 cor-666">陪您学车 第{{ user.days }}天</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="p15lr" style="transform: translateY(-90px);">
|
<view class="p15lr" style="transform: translateY(-90px);">
|
||||||
<view class="relative mb10" @tap="handleVip">
|
<view class="relative mb10" @tap="handleVip">
|
||||||
<image src="/static/image/mine/vip_bg.png" mode="widthFix" style="width: 100%;"></image>
|
<image src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/vip%E8%83%8C%E6%99%AF%E9%BB%841_20230831010645.png" mode="widthFix" style="width: 100%;"></image>
|
||||||
<view class="absolute p15lr p10tb flex ai-c jc-sb" style="left: 0;top: 0;right: 0;height: 40px;">
|
<view class="absolute p15lr p10tb flex ai-c jc-sb" style="left: 0;top: 0;right: 0;height: 40px;">
|
||||||
<view class="flex ai-c">
|
<view class="flex ai-c">
|
||||||
<view class="p3 br-p50" style="background-color: #873E1D;">
|
<view class="p3 br-p50" style="background-color: #873E1D;">
|
||||||
@@ -33,20 +33,24 @@
|
|||||||
</view>
|
</view>
|
||||||
<text class="ml5 fs16 fwb" style="color: #7E4012FF;">VIP会员</text>
|
<text class="ml5 fs16 fwb" style="color: #7E4012FF;">VIP会员</text>
|
||||||
</view>
|
</view>
|
||||||
<text v-if="vipOn.length" class="fs12" style="color: #7E4012FF;">{{expireTime}}到期</text>
|
<text v-if="!isLogin || !vipOn.length" class="fs12" style="color: #7E4012FF;">您还不是VIP会员</text>
|
||||||
|
<text v-else-if="vipOn.length" class="fs12" style="color: #7E4012FF;">{{ expireTime }}到期</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="absolute flex ai-c jc-c" style="left: 0;top: 40px;right: 0;bottom: 0;">
|
<view class="absolute flex ai-c jc-c" style="left: 0;top: 40px;right: 0;bottom: 0;">
|
||||||
<view class="text-center">
|
<view v-if="!isLogin || !vipOn.length" class="text-center">
|
||||||
<view v-if="vipOn.length" class="fs18 fwb" style="color: #7E4012FF;">{{vipText}}</view>
|
<view class="fs18 fwb" style="color: #7E4012FF;">开通VIP尊享以下权益</view>
|
||||||
<view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;">
|
<view class="fs15" style="color: #7E4012FF;">精选500题 / 真是模考 / 考前密卷</view>
|
||||||
{{ vipOn.length?'马上学习':'开通会员'}}
|
<view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;">{{ isIOS ? 'iOS暂不可用' : '立即开通' }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="vipOn.length" class="text-center">
|
||||||
|
<view class="fs18 fwb" style="color: #7E4012FF;">{{ vipText }}</view>
|
||||||
|
<view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;">马上学习</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view v-if="isLogin" class="br8 bc-fff p15 z-index2">
|
||||||
<view class="br8 bc-fff p15 z-index2">
|
|
||||||
<text class="fs16 cor-333">我的驾校</text>
|
<text class="fs16 cor-333">我的驾校</text>
|
||||||
<view v-if="user.schoolId">
|
<view v-if="user?.schoolId">
|
||||||
<div class="mt12 flex ai-c jc-sb">
|
<div class="mt12 flex ai-c jc-sb">
|
||||||
<text class="fs18 cor-000 fwb">{{ user.schoolName }}</text>
|
<text class="fs18 cor-000 fwb">{{ user.schoolName }}</text>
|
||||||
<u-button text="切换驾校" shape="circle" @click="handleChangeSchool"></u-button>
|
<u-button text="切换驾校" shape="circle" @click="handleChangeSchool"></u-button>
|
||||||
@@ -60,7 +64,8 @@
|
|||||||
<text class="ml5 fs26 cor-333 fwb" style="line-height: 26px;">{{ user.schoolPhone }}</text>
|
<text class="ml5 fs26 cor-333 fwb" style="line-height: 26px;">{{ user.schoolPhone }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="pt30 pb15">
|
<view v-else class="p15tb flex ai-c jc-sb">
|
||||||
|
<view class="fs20 cor-333 fwb">尚未绑定驾校</view>
|
||||||
<u-button text="绑定驾校" shape="circle" @click="handleChangeSchool"></u-button>
|
<u-button text="绑定驾校" shape="circle" @click="handleChangeSchool"></u-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -76,11 +81,16 @@
|
|||||||
<img src="/static/image/mine/wdtj.png" style="width: 24px;height: 24px;">
|
<img src="/static/image/mine/wdtj.png" style="width: 24px;height: 24px;">
|
||||||
</template>
|
</template>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
<u-cell size="large" title="我的题库" value="小车">
|
<u-cell size="large" title="我的题库" :value="carName" @tap="toChangeCarType">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<img src="/static/image/mine/wdtk.png" style="width: 24px;height: 24px;">
|
<img src="/static/image/mine/wdtk.png" style="width: 24px;height: 24px;">
|
||||||
</template>
|
</template>
|
||||||
</u-cell>
|
</u-cell>
|
||||||
|
<u-cell size="large" title="联系我们" @tap="callPhoneNumber">
|
||||||
|
<template #icon>
|
||||||
|
<img src="/static/image/mine/callme.png" style="width: 24px;height: 24px;">
|
||||||
|
</template>
|
||||||
|
</u-cell>
|
||||||
</u-cell-group>
|
</u-cell-group>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="isLogin" class="flex ai-c jc-c mt12 br8 bc-fff" style="height: 50px;" @tap="handleLogout">
|
<view v-if="isLogin" class="flex ai-c jc-c mt12 br8 bc-fff" style="height: 50px;" @tap="handleLogout">
|
||||||
@@ -91,6 +101,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import useUserStore from '@/jtools/store/user'
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
components: {},
|
components: {},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -131,22 +142,40 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
};
|
carName: storage.get('carName') || '小车C1/C2/C3',
|
||||||
|
isIOS: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
this.isIOS = this.$platform.device().includes('ios')
|
||||||
|
this.carName = storage.get('carName') || '小车C1/C2/C3'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 拨打电话
|
||||||
|
callPhoneNumber() {
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber: '15105693067'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toChangeCarType() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/me/changeCarType"
|
||||||
|
})
|
||||||
|
},
|
||||||
handleVip() {
|
handleVip() {
|
||||||
|
if (this.isIOS) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.isLogin) {
|
if (this.isLogin) {
|
||||||
if(this.vipOn.length) {
|
// if (this.vipOn.length) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/me/vip'
|
url: '/pages/me/vip'
|
||||||
})
|
})
|
||||||
} else {
|
// } else {
|
||||||
uni.navigateTo({
|
// uni.navigateTo({
|
||||||
url: '/pages/index/videoVip'
|
// url: '/pages/index/videoVip'
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
this.toLogin()
|
this.toLogin()
|
||||||
}
|
}
|
||||||
@@ -176,8 +205,12 @@ export default {
|
|||||||
},
|
},
|
||||||
handleTJ() {
|
handleTJ() {
|
||||||
if (this.isLogin) {
|
if (this.isLogin) {
|
||||||
uni.navigateTo({
|
// uni.navigateTo({
|
||||||
url: '/pages/me/tijian'
|
// url: '/pages/me/tijian'
|
||||||
|
// })
|
||||||
|
uni.showToast({
|
||||||
|
title: '敬请期待',
|
||||||
|
icon: 'none'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.toLogin()
|
this.toLogin()
|
||||||
|
|||||||
@@ -1,29 +1,50 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="p15 bc-f5">
|
<view class="p15 bc-f5">
|
||||||
<view class="br8 bc-fff p15lr">
|
<view class="br8 bc-fff p15lr">
|
||||||
<view class="flex ai-c bb1" style="height: 110rpx;">
|
<view class="flex jc-sb ai-c bb1" style="height: 110rpx;">
|
||||||
<view class="title">联系电话</view>
|
<view class="title">联系电话</view>
|
||||||
<view class="m30lr fs14 cor-333 fl1">15122305568</view>
|
<view class="flex">
|
||||||
|
<view class="m30lr fs14 cor-333">15122305568</view>
|
||||||
<u-icon name="arrow-right" color="#999" />
|
<u-icon name="arrow-right" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c" style="height: 110rpx;">
|
</view>
|
||||||
|
<view class="flex jc-sb ai-c bb1" style="height: 110rpx;">
|
||||||
<view class="title">地址</view>
|
<view class="title">地址</view>
|
||||||
<view class="m30lr fs14 cor-333 fl1">安徽省合肥市包河区</view>
|
<view class="flex">
|
||||||
|
<view class="m30lr fs14 cor-333">安徽省合肥市包河区</view>
|
||||||
<u-icon name="arrow-right" color="#999" />
|
<u-icon name="arrow-right" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="flex jc-sb ai-c bb1" style="height: 110rpx;">
|
||||||
|
<view class="title">身份证号</view>
|
||||||
|
<view class="m30lr fs14 cor-333">{{sfzNum}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c" style="height: 110rpx;" @tap="toUploadPic">
|
||||||
|
<view class="title">证件照</view>
|
||||||
|
<view class="m30lr fs14 cor-333 fl1"></view>
|
||||||
|
<u-icon name="arrow-right" color="#999" />
|
||||||
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
sfzNum:storage.get('sfzNum') || ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onShow(){
|
||||||
|
this.sfzNum=storage.get('sfzNum') || ''
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
toUploadPic(){
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/me/uploadPic'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,42 +1,214 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="p15 bc-f5">
|
<view class="">
|
||||||
<view class="br8 bc-fff p15lr">
|
<view class="wp100 bc-fff p14">
|
||||||
<view class="flex ai-c bb1" style="height: 110rpx;">
|
<view class="title fontColor">第一步 上传学员图像</view>
|
||||||
<view class="title">体检结果</view>
|
<view class="mt15">
|
||||||
<view class="ml30 fs14 cor-333 fl1">通过</view>
|
<!-- <u-upload width="165" height="165" :file-list=" fileList1" multiple :max-count="1" @afterRead="afterRead" @delete="deletePic" /> -->
|
||||||
|
<!-- <u-upload ref="uUpload" class="mt25" :size-type="['compressed']" :file-list="fileList1" deletable :multiple="false" :max-count="1" width="165rpx" height="165rpx" @afterRead="afterRead" @delete="deletePic" /> -->
|
||||||
|
<view style="width: 320rpx;height:300rpx;background-color: rgb(247, 255, 255);border-radius: 20rpx;">
|
||||||
|
<view style="width: 320rpx;height:240rpx;" class="flex jc-c ai-c">
|
||||||
|
<image v-if="fileList&&fileList.length" style="width: 240rpx;height: 240rpx;" :src="fileList[0].url">
|
||||||
|
</image>
|
||||||
|
<u-avatar v-else class="br-p50 overflow-h" :size="64" mp-avatar shape="circle"></u-avatar>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c" style="height: 110rpx;">
|
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" multiple :maxCount="1" width="150"
|
||||||
<view class="title">体检时间</view>
|
height="150">
|
||||||
<view class="ml30 fs14 cor-333 fl1">2023-08-10 14:35:23</view>
|
<view
|
||||||
|
style="width: 320rpx;height:60rpx;line-height:60rpx;background-color: #05C341;border-radius: 0 0 20rpx 20rpx;"
|
||||||
|
class="text-center cor-fff">
|
||||||
|
点击
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-fs" style="height: 110rpx;">
|
</u-upload>
|
||||||
<view class="title">体检时间</view>
|
</view>
|
||||||
<image class="ml30" src="/static/image/mine/tijian.png" style="width: 333rpx;" mode="widthFix"></image>
|
</view>
|
||||||
|
<view class="mt20">
|
||||||
|
<view class="title fontColor">第二步 核实后再提交</view>
|
||||||
|
<u--form labelPosition="left" labelWidth="80" :model="form" :rules="rules" ref="form1">
|
||||||
|
<u-form-item label="姓名" :required="true" prop="idCardName" borderBottom ref="item1">
|
||||||
|
<u--input v-model="form.idCardName" border="none"></u--input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="身份证号" :required="true" prop="sfzmhm" borderBottom ref="item2">
|
||||||
|
<u--input v-model="form.sfzmhm" border="none"></u--input>
|
||||||
|
</u-form-item>
|
||||||
|
</u--form>
|
||||||
|
</view>
|
||||||
|
<view style="margin-top: 20px;">
|
||||||
|
<u-button type="primary" :style="{width: '100%',borderRadius:'40rpx',backgroundColor:'#05C341'}" :disabled="saving" text="提交"
|
||||||
|
@click="submit" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import {
|
||||||
|
addInfo,
|
||||||
|
} from '@/jtools/api/index';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
const shenfenzhen = (rule, value, callback) => {
|
||||||
|
/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value) ? callback() : callback(
|
||||||
|
new Error('请输入正确的身份证号'))
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
idCardName: '',
|
||||||
|
sfzmhm: ''
|
||||||
|
},
|
||||||
|
driverLicenseImg:'',
|
||||||
|
fileList:[],
|
||||||
|
fileList1: [],
|
||||||
|
uploadList: [],
|
||||||
|
saving: false,
|
||||||
|
rules: {
|
||||||
|
idCardName: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入姓名',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
}],
|
||||||
|
sfzmhm: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入身份证号',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
},{
|
||||||
|
// 自定义验证函数,见上说明
|
||||||
|
validator: shenfenzhen,
|
||||||
|
message: '身份证号码不正确',
|
||||||
|
// 触发器可以同时用blur和change
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onReady() {
|
||||||
|
this.$refs.form1.setRules(this.rules);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 删除图片
|
||||||
|
deletePic(event) {
|
||||||
|
this.fileList1.splice(event.index, 1);
|
||||||
|
this.uploadList.splice(event.index, 1);
|
||||||
|
},
|
||||||
|
// 新增图片
|
||||||
|
async afterRead(event) {
|
||||||
|
let imageInfoObj = await uni.getImageInfo({src: event.file[0].url})
|
||||||
|
console.log(imageInfoObj);
|
||||||
|
if(imageInfoObj.width!=720&&imageInfoObj.height!=720){
|
||||||
|
uni.showToast({
|
||||||
|
icon:'error',
|
||||||
|
title:'证件照尺寸有误'
|
||||||
|
})
|
||||||
|
this.fileList=[]
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.driverLicenseImg = this.urlTobase64(event.file[0].url)
|
||||||
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||||
|
const lists = [].concat(event.file);
|
||||||
|
this.fileList=lists
|
||||||
|
this.fileList1 = [];
|
||||||
|
uni.showToast({
|
||||||
|
title:'上传成功!'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
uploadFilePromise(url) {
|
||||||
|
this.saving = true;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.uploadFile({
|
||||||
|
url: process.env.VUE_APP_BASE_API + 'mongodb/uploadFile', // 仅为示例,非真实的接口地址
|
||||||
|
filePath: url,
|
||||||
|
name: 'file',
|
||||||
|
success: (res) => {
|
||||||
|
// setTimeout(() => {
|
||||||
|
resolve(JSON.parse(res.data).data);
|
||||||
|
// }, 100);
|
||||||
|
this.saving = false;
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
resolve(null);
|
||||||
|
this.saving = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 提交
|
||||||
|
submit() {
|
||||||
|
this.$refs.form1.validate().then((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const param={
|
||||||
|
driverLicenseImg:this.driverLicenseImg,
|
||||||
|
...this.form,
|
||||||
|
schoolOrgCode:'340103000700',
|
||||||
|
operater:'1d08daf852cf4ee28f67cb583f538cbf'
|
||||||
|
}
|
||||||
|
addInfo(param).then(resp=>{
|
||||||
|
uni.showToast({
|
||||||
|
title:"提交成功!",
|
||||||
|
duration:2000,
|
||||||
|
})
|
||||||
|
setTimeout(()=>{
|
||||||
|
uni.navigateBack()
|
||||||
|
},1000)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('验证失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
urlTobase64(url){
|
||||||
|
let base64=''
|
||||||
|
console.log(url);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.getFileSystemManager().readFile({
|
||||||
|
filePath: url, //选择图片返回的相对路径
|
||||||
|
encoding: 'base64', //编码格式
|
||||||
|
success: res => { //成功的回调
|
||||||
|
console.log(res);
|
||||||
|
base64 = 'data:image/jpeg;base64,' + res.data //不加上这串字符,在页面无法显示的哦
|
||||||
|
resolve(base64);
|
||||||
|
},fail: (e) => {
|
||||||
|
console.log("图片转换失败");
|
||||||
|
reject(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.title {
|
.upload-img {
|
||||||
width: 120rpx;
|
width: 165rpx;
|
||||||
font-size: 14px;
|
height: 165rpx;
|
||||||
color: #666;
|
border: 1px dashed #c4c4c4;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.bb1 {
|
|
||||||
border-bottom: 1px solid #eee;
|
.fontColor {
|
||||||
|
color: #383838;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-textarea__count {
|
||||||
|
background-color: #f9faf9 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-upload__button>.u-icon>.u-icon__icon {
|
||||||
|
font-size: 90rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-button--square {
|
||||||
|
border-radius: 40rpx !important;
|
||||||
|
}
|
||||||
|
::v-deep .u-button--primary{
|
||||||
|
background-color: #05C341 !important;
|
||||||
|
border-color: #05C341 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
226
src/pages/me/uploadPic.vue
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
<template>
|
||||||
|
<view class="">
|
||||||
|
<view class="wp100 bc-fff p14">
|
||||||
|
<view class="title fontColor">第一步 上传学员图像</view>
|
||||||
|
<view class="mt15">
|
||||||
|
<!-- <u-upload width="165" height="165" :file-list=" fileList1" multiple :max-count="1" @afterRead="afterRead" @delete="deletePic" /> -->
|
||||||
|
<!-- <u-upload ref="uUpload" class="mt25" :size-type="['compressed']" :file-list="fileList1" deletable :multiple="false" :max-count="1" width="165rpx" height="165rpx" @afterRead="afterRead" @delete="deletePic" /> -->
|
||||||
|
<view style="width: 320rpx;height:300rpx;background-color: rgb(247, 255, 255);border-radius: 20rpx;">
|
||||||
|
<view style="width: 320rpx;height:240rpx;" class="flex jc-c ai-c">
|
||||||
|
<image v-if="fileList&&fileList.length" style="width: 240rpx;height: 240rpx;" :src="fileList[0].url">
|
||||||
|
</image>
|
||||||
|
<u-avatar v-else class="br-p50 overflow-h" :size="64" mp-avatar shape="circle"></u-avatar>
|
||||||
|
</view>
|
||||||
|
<u-upload :fileList="fileList1" :maxSize="500 * 1024" @oversize="oversize" @afterRead="afterRead"
|
||||||
|
@delete="deletePic" multiple :maxCount="1" width="150" height="150">
|
||||||
|
<view
|
||||||
|
style="width: 320rpx;height:60rpx;line-height:60rpx;background-color: #05C341;border-radius: 0 0 20rpx 20rpx;"
|
||||||
|
class="text-center cor-fff">
|
||||||
|
点击
|
||||||
|
</view>
|
||||||
|
</u-upload>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mt20">
|
||||||
|
<view class="title fontColor">第二步 核实后再提交</view>
|
||||||
|
<u--form labelPosition="left" labelWidth="80" :model="form" :rules="rules" ref="form1">
|
||||||
|
<u-form-item label="姓名" :required="true" prop="idCardName" borderBottom ref="item1">
|
||||||
|
<u--input v-model="form.idCardName" border="none"></u--input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="身份证号" :required="true" prop="sfzmhm" borderBottom ref="item2">
|
||||||
|
<u--input v-model="form.sfzmhm" border="none"></u--input>
|
||||||
|
</u-form-item>
|
||||||
|
</u--form>
|
||||||
|
</view>
|
||||||
|
<view style="margin-top: 20px;">
|
||||||
|
<u-button type="primary" :style="{width: '100%',borderRadius:'40rpx',backgroundColor:'#05C341'}"
|
||||||
|
:disabled="saving" text="提交" @click="submit" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import {
|
||||||
|
addInfo,
|
||||||
|
} from '@/jtools/api/index';
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
const shenfenzhen = (rule, value, callback) => {
|
||||||
|
/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value) ? callback() : callback(
|
||||||
|
new Error('请输入正确的身份证号'))
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
idCardName: '',
|
||||||
|
sfzmhm: storage.get('sfzNum') || ''
|
||||||
|
},
|
||||||
|
driverLicenseImg: '',
|
||||||
|
fileList: [],
|
||||||
|
fileList1: [],
|
||||||
|
uploadList: [],
|
||||||
|
saving: false,
|
||||||
|
rules: {
|
||||||
|
idCardName: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入姓名',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
}],
|
||||||
|
sfzmhm: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入身份证号',
|
||||||
|
trigger: ['blur', 'change']
|
||||||
|
}, {
|
||||||
|
// 自定义验证函数,见上说明
|
||||||
|
validator: shenfenzhen,
|
||||||
|
message: '身份证号码不正确',
|
||||||
|
// 触发器可以同时用blur和change
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onReady() {
|
||||||
|
this.$refs.form1.setRules(this.rules);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
// 文件超出大小限制
|
||||||
|
oversize() {
|
||||||
|
uni.showToast({
|
||||||
|
title: "图片最大不能超过500k",
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 删除图片
|
||||||
|
deletePic(event) {
|
||||||
|
this.fileList1.splice(event.index, 1);
|
||||||
|
this.uploadList.splice(event.index, 1);
|
||||||
|
},
|
||||||
|
// 新增图片
|
||||||
|
async afterRead(event) {
|
||||||
|
let imageInfoObj = await uni.getImageInfo({
|
||||||
|
src: event.file[0].url
|
||||||
|
})
|
||||||
|
console.log(imageInfoObj);
|
||||||
|
if (imageInfoObj.width != 260 && imageInfoObj.height != 378) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'error',
|
||||||
|
title: '证件照尺寸有误'
|
||||||
|
})
|
||||||
|
this.fileList = []
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.driverLicenseImg = await this.urlTobase64(event.file[0].url)
|
||||||
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||||
|
const lists = [].concat(event.file);
|
||||||
|
this.fileList = lists
|
||||||
|
this.fileList1 = [];
|
||||||
|
uni.showToast({
|
||||||
|
title: '上传成功!'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 提交
|
||||||
|
submit() {
|
||||||
|
this.$refs.form1.validate().then((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const param = {
|
||||||
|
driverLicenseImg: this.driverLicenseImg,
|
||||||
|
...this.form,
|
||||||
|
schoolOrgCode: '340103000700',
|
||||||
|
operater: '1d08daf852cf4ee28f67cb583f538cbf'
|
||||||
|
}
|
||||||
|
storage.set('sfzNum', this.form.sfzmhm)
|
||||||
|
uni.request({
|
||||||
|
url: 'https://www.hfcgs.cn:20223/driver/addInfo',
|
||||||
|
method: 'POST',
|
||||||
|
data: param,
|
||||||
|
success: res => {
|
||||||
|
console.log(res);
|
||||||
|
uni.showToast({
|
||||||
|
title: "提交成功!",
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
fail: () => {},
|
||||||
|
|
||||||
|
});
|
||||||
|
// addInfo(param).then(resp=>{
|
||||||
|
// if(resp.code==='0000'){
|
||||||
|
// uni.showToast({
|
||||||
|
// title:"提交成功!",
|
||||||
|
// duration:2000,
|
||||||
|
// })
|
||||||
|
// setTimeout(()=>{
|
||||||
|
// uni.navigateBack()
|
||||||
|
// },1000)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
} else {
|
||||||
|
console.log('验证失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
urlTobase64(url) {
|
||||||
|
let base64 = ''
|
||||||
|
console.log(url);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.getFileSystemManager().readFile({
|
||||||
|
filePath: url, //选择图片返回的相对路径
|
||||||
|
encoding: 'base64', //编码格式
|
||||||
|
success: res => { //成功的回调
|
||||||
|
console.log(res);
|
||||||
|
base64 = 'data:image/jpeg;base64,' + res.data //不加上这串字符,在页面无法显示的哦
|
||||||
|
resolve(base64);
|
||||||
|
},
|
||||||
|
fail: (e) => {
|
||||||
|
console.log("图片转换失败");
|
||||||
|
reject(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.upload-img {
|
||||||
|
width: 165rpx;
|
||||||
|
height: 165rpx;
|
||||||
|
border: 1px dashed #c4c4c4;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontColor {
|
||||||
|
color: #383838;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-textarea__count {
|
||||||
|
background-color: #f9faf9 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-upload__button>.u-icon>.u-icon__icon {
|
||||||
|
font-size: 90rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-button--square {
|
||||||
|
border-radius: 40rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-button--primary {
|
||||||
|
background-color: #05C341 !important;
|
||||||
|
border-color: #05C341 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="flex fld-c p15">
|
<view>
|
||||||
|
<u-loading-page :loading="getLoading" loading-text="题库更新中..."></u-loading-page>
|
||||||
|
<view class="flex fld-c p15" v-if="!getLoading">
|
||||||
<u-sticky>
|
<u-sticky>
|
||||||
<view class="flex ai-c">
|
<view class="flex ai-c">
|
||||||
<view v-for="(item, index) in vipAllList" :key="index" class="km-item" :class="{ actived: index == current }"
|
<view v-for="(item, index) in vipAllList" :key="index" class="km-item" :class="{ actived: index == current }"
|
||||||
@@ -9,11 +11,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</u-sticky>
|
</u-sticky>
|
||||||
<view class="mt15">
|
<view class="mt15">
|
||||||
<swiper class="swiper" :current="current" style="height: 120px;" :autoplay="false" :display-multiple-items="1.45"
|
<swiper class="swiper" :current="current" style="height: 120px;" :autoplay="false"
|
||||||
:disable-programmatic-animation="true" @change="onChange">
|
:display-multiple-items="1.45" :disable-programmatic-animation="true" @change="onChange">
|
||||||
<swiper-item v-for="(item, index) in vipAllList" :key="index">
|
<swiper-item v-for="(item, index) in vipAllList" :key="index">
|
||||||
<view class="relative">
|
<view class="relative"
|
||||||
<image src="../../static/image/mine/vip_card.png" mode="widthFix" style="width:95%;"></image>
|
style="background-image: url(https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/vip%E8%83%8C%E6%99%AF_20230831010348.png);width: 95%;height: 204rpx;background-size: 100% 100%;">
|
||||||
|
<!-- <image src="" mode="widthFix" style="width:95%;"></image> -->
|
||||||
<view class="vip-info">
|
<view class="vip-info">
|
||||||
<u-avatar class="br-p50 overflow-h" style="border: 3px solid #873E1D;" :size="35" mp-avatar></u-avatar>
|
<u-avatar class="br-p50 overflow-h" style="border: 3px solid #873E1D;" :size="35" mp-avatar></u-avatar>
|
||||||
<view class="ml10">
|
<view class="ml10">
|
||||||
@@ -28,10 +31,10 @@
|
|||||||
<view v-if="vipHasOpened(item)" class="corner">
|
<view v-if="vipHasOpened(item)" class="corner">
|
||||||
VIP已开通
|
VIP已开通
|
||||||
</view>
|
</view>
|
||||||
<view v-if="vipHasOpened(item)" class="renew">
|
<view v-if="vipHasOpened(item)" @tap="chargeVip(item)" class="renew">
|
||||||
{{ item.price }}元立即续费
|
{{ item.price }}元立即续费
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="buy">
|
<view v-else class="buy" @tap="chargeVip(item)">
|
||||||
立即充值
|
立即充值
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -44,7 +47,7 @@
|
|||||||
<swiper class="swiper" :current="current" style="height: 300px;" :autoplay="false"
|
<swiper class="swiper" :current="current" style="height: 300px;" :autoplay="false"
|
||||||
:disable-programmatic-animation="true" @change="onChange">
|
:disable-programmatic-animation="true" @change="onChange">
|
||||||
<swiper-item v-for="(item, index) in vipAllList" :key="index">
|
<swiper-item v-for="(item, index) in vipAllList" :key="index">
|
||||||
<view v-if="index == 0 || index == 3" class="p15 br8 cor-fff">
|
<view v-if="index == 0 || index == 3" class="p15 br8 cor-fff bc-fff">
|
||||||
<view class="fs18 cor-000 fwb">
|
<view class="fs18 cor-000 fwb">
|
||||||
3步轻松学{{ getKmTitle(item.subjects) }}
|
3步轻松学{{ getKmTitle(item.subjects) }}
|
||||||
</view>
|
</view>
|
||||||
@@ -104,28 +107,45 @@
|
|||||||
<text class="cor-666 fs12">全部 ></text>
|
<text class="cor-666 fs12">全部 ></text>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c mt20">
|
<view class="flex ai-c mt20">
|
||||||
<image src="../../static/image/index/index_bg.png" mode="widthFix" style="flex: 1;border-radius: 33rpx;"></image>
|
<view class="contain-box relative">
|
||||||
<view class="ml18 text-center">
|
<image class="contain-box" src="../../../static/image/index/jpsp.png"></image>
|
||||||
|
<image class="play_btn_2" src="../../static/image/index/play.png" />
|
||||||
|
</view>
|
||||||
|
<view class="ml15 text-center">
|
||||||
<u-button :customStyle="{width:'200rpx',height:'66rpx',borderRadius: '33rpx'}" iconColor="#fff"
|
<u-button :customStyle="{width:'200rpx',height:'66rpx',borderRadius: '33rpx'}" iconColor="#fff"
|
||||||
text="去看视频" color="linear-gradient(90deg, #E66501 0%, #F8A42C 100%)" icon="play-circle" @click="toPlaceLive(item)">
|
text="去看视频" color="linear-gradient(90deg, #E66501 0%, #F8A42C 100%)" icon="play-circle"
|
||||||
|
@click="toPlaceLive(item)">
|
||||||
</u-button>
|
</u-button>
|
||||||
<view class="cor-333 fs15 mt17">真实考场模拟</view>
|
<view class="cor-333 fs15 fw600 mt10">真实考场模拟</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
<swiper-item>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
import useUserStore from '@/jtools/store/user'
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
import {
|
||||||
|
queryQuestionId,
|
||||||
|
getTestQuestionId
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1", "version"]), //映射函数,取出tagslist
|
||||||
|
getLoading() {
|
||||||
|
return this.loading_subject4 && this.loading_subject1
|
||||||
|
},
|
||||||
vipAllList() {
|
vipAllList() {
|
||||||
return useUserStore().vipAllList.filter(it => [1, 2, 3, 4].includes(Number(it.subjects)))
|
return useUserStore().vipAllList.filter(it => [1, 2, 3, 4].includes(Number(it.subjects)))
|
||||||
},
|
},
|
||||||
@@ -140,6 +160,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useQuestionStore, ['getOrderQuestion_sub1', 'getOrderQuestion_sub4', 'getAllQuestion']),
|
||||||
|
chargeVip(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/videoVip?subject=" + item.subjects
|
||||||
|
})
|
||||||
|
},
|
||||||
onChange(e) {
|
onChange(e) {
|
||||||
this.current = e.detail.current
|
this.current = e.detail.current
|
||||||
},
|
},
|
||||||
@@ -160,13 +186,42 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
vipHasOpened(item) {
|
vipHasOpened(item) {
|
||||||
return !!this.vipOnList.find(it => it.memberId == item.memberId)
|
;
|
||||||
|
return !!this.vipOnList.some(it => it.subjects.includes(item.subjects))
|
||||||
},
|
},
|
||||||
// 去精选500题 item=> 当前科目vip信息
|
// 去精选500题 item=> 当前科目vip信息
|
||||||
to500(item) {
|
to500(item) {
|
||||||
// 当前vip是否已开通
|
// 当前vip是否已开通
|
||||||
if (this.vipHasOpened(item)) {
|
if (this.vipHasOpened(item)) {
|
||||||
// 跳转
|
// 跳转
|
||||||
|
queryQuestionId({
|
||||||
|
versionId: this.version,
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: item.subjects,
|
||||||
|
isVip: '1'
|
||||||
|
}).then(async (resp) => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
const arr = resp.data
|
||||||
|
if (arr && arr.length) {
|
||||||
|
const listJson = JSON.stringify(arr)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/questionBank?navTitle=精简500题&subject=" + item.subjects +
|
||||||
|
"&questionIdList=" + listJson
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无题目',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (resp.code === '4001') {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前题库非最新版,请更新~',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.getAllQuestion()
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `请先充值${this.getKmTitle(item.subjects)}vip`,
|
title: `请先充值${this.getKmTitle(item.subjects)}vip`,
|
||||||
@@ -179,6 +234,9 @@
|
|||||||
// 当前vip是否已开通
|
// 当前vip是否已开通
|
||||||
if (this.vipHasOpened(item)) {
|
if (this.vipHasOpened(item)) {
|
||||||
// 跳转
|
// 跳转
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/trueTest?subject=" + item.subjects
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `请先充值${this.getKmTitle(item.subjects)}vip`,
|
title: `请先充值${this.getKmTitle(item.subjects)}vip`,
|
||||||
@@ -191,6 +249,9 @@
|
|||||||
// 当前vip是否已开通
|
// 当前vip是否已开通
|
||||||
if (this.vipHasOpened(item)) {
|
if (this.vipHasOpened(item)) {
|
||||||
// 跳转
|
// 跳转
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/secretPapers?subject=" + item.subjects
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `请先充值${this.getKmTitle(item.subjects)}vip`,
|
title: `请先充值${this.getKmTitle(item.subjects)}vip`,
|
||||||
@@ -203,6 +264,10 @@
|
|||||||
// 当前vip是否已开通
|
// 当前vip是否已开通
|
||||||
if (this.vipHasOpened(item)) {
|
if (this.vipHasOpened(item)) {
|
||||||
// 跳转
|
// 跳转
|
||||||
|
uni.showToast({
|
||||||
|
title: '敬请期待',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `请先充值${this.getKmTitle(item.subjects)}vip`,
|
title: `请先充值${this.getKmTitle(item.subjects)}vip`,
|
||||||
@@ -242,6 +307,7 @@
|
|||||||
left: 10px;
|
left: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.corner {
|
.corner {
|
||||||
@@ -258,6 +324,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.renew {
|
.renew {
|
||||||
@@ -273,7 +340,9 @@
|
|||||||
border-radius: 26rpx;
|
border-radius: 26rpx;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #F6E99F;
|
color: #F6E99F;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.buy {
|
.buy {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 45%;
|
left: 45%;
|
||||||
@@ -288,6 +357,7 @@
|
|||||||
border-radius: 30rpx;
|
border-radius: 30rpx;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #F6E99F;
|
color: #F6E99F;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.study {
|
.study {
|
||||||
@@ -301,6 +371,7 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #873E1D;
|
color: #873E1D;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-box {
|
.video-box {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
width: 694rpx;
|
width: 694rpx;
|
||||||
@@ -309,4 +380,19 @@
|
|||||||
border: 2rpx solid #CF8B6D;
|
border: 2rpx solid #CF8B6D;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.contain-box {
|
||||||
|
width: 406rpx;
|
||||||
|
height: 228rpx;
|
||||||
|
background: #00B74F;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play_btn_2 {
|
||||||
|
width: 65rpx;
|
||||||
|
height: 65rpx;
|
||||||
|
position: absolute;
|
||||||
|
left: 165.5rpx;
|
||||||
|
top: 78rpx
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,18 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<j-navbar>基本操作</j-navbar>
|
<j-navbar>基本操作</j-navbar>
|
||||||
<u-sticky bgColor="#fff">
|
<!-- <u-sticky bgColor="#fff">
|
||||||
<u-tabs :list="categoryList" :scrollable="false" @click="changeCategory"></u-tabs>
|
<u-tabs :list="categoryList" :scrollable="false" @click="changeCategory"></u-tabs>
|
||||||
</u-sticky>
|
</u-sticky> -->
|
||||||
<view class="p14">
|
<view class="p14">
|
||||||
<view class="flex ai-c">
|
<!-- <view class="flex ai-c">
|
||||||
<view class="car_item mr10" v-for="(item,index) of carTypeList" :key="index" @tap="chooseCar(item.value)" :class="item.value===tCar?'checked_car':'unchecked_car'">{{item.label}}</view>
|
<view class="car_item mr10" v-for="(item,index) of carTypeList" :key="index" @tap="chooseCar(item.value)" :class="item.value===tCar?'checked_car':'unchecked_car'">{{item.label}}</view>
|
||||||
|
</view> -->
|
||||||
|
<view class="flex p14lr p20tb bc-fff mb10" style="border-radius: 10rpx;"
|
||||||
|
v-for="(item,index) of videoList" :key="index" @tap="toOperateDetail(item.videoId)">
|
||||||
|
<view class="pic relative hide" style="overflow: hidden;">
|
||||||
|
<image class="pic" style="position: absolute;left: 0;top:0" mode="widthFix" :src="item.videoUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'"></image>
|
||||||
|
<image class="play_btn_2" src="../../static/image/index/play.png" />
|
||||||
</view>
|
</view>
|
||||||
<view class="flex p14 bc-fff mt10" style="border-radius: 16rpx;" v-for="(item,index) of videoList" :key="index" @tap="toDetail">
|
|
||||||
<image class="pic" src="../../static/image/index/index_bg.png"></image>
|
|
||||||
<view class="ml10">
|
<view class="ml10">
|
||||||
<text class="fs16 cor-000 fw600">上车、下车的方法</text>
|
<text class="fs16 cor-000 fw600">{{allVideoList[0]?.description}}</text>
|
||||||
<view class="fs14 mt5 cor-666">上车、下车的方法</view>
|
<view class="fs14 mt5 cor-666">{{item.description}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -20,42 +24,92 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
querySysConfigList,
|
||||||
|
queryProjectList
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
|
type:'2',
|
||||||
|
subject:'1',
|
||||||
tCar:0,
|
tCar:0,
|
||||||
categoryList:[{
|
categoryList:[{
|
||||||
name:'手动挡C1'
|
name:'手动挡C1'
|
||||||
},{
|
},{
|
||||||
name:'自动挡C2'
|
name:'自动挡C2'
|
||||||
}],
|
}],
|
||||||
carTypeList:[{
|
allVideoList:[],
|
||||||
label:'捷达',
|
videoList:[]
|
||||||
value:0
|
|
||||||
},{
|
|
||||||
label:'新桑塔纳',
|
|
||||||
value:1
|
|
||||||
},{
|
|
||||||
label:'爱丽舍',
|
|
||||||
value:2
|
|
||||||
}],
|
|
||||||
videoList:[{
|
|
||||||
label:"111"
|
|
||||||
},{
|
|
||||||
label:'222'
|
|
||||||
},{
|
|
||||||
label:'333'
|
|
||||||
},{
|
|
||||||
label:'444'
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onLoad(op){
|
||||||
|
if(op.subject){
|
||||||
|
this.subject=op.subject
|
||||||
|
}
|
||||||
|
if(op.type){
|
||||||
|
this.type=op.type
|
||||||
|
}
|
||||||
|
this.getDiverType()
|
||||||
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
formateTime(time) {
|
||||||
|
const h = parseInt(time / 3600)
|
||||||
|
const minute = parseInt(time / 60 % 60)
|
||||||
|
const second = Math.ceil(time % 60)
|
||||||
|
const hours = h < 10 ? '0' + h : h
|
||||||
|
const formatSecond = second > 59 ? 59 : second
|
||||||
|
return `${hours > 0 ? `${hours}:` : ''}${minute < 10 ? '0' + minute : minute}:${formatSecond < 10 ? '0' + formatSecond : formatSecond}`
|
||||||
|
},
|
||||||
|
toOperateDetail(val){
|
||||||
|
let arr = JSON.parse(JSON.stringify(this.allVideoList[0].videoList))
|
||||||
|
arr = arr.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
subDesc:this.allVideoList[0].description,
|
||||||
|
projectId:item.videoId,
|
||||||
|
videoTime:this.formateTime(item.videoTime)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let jsonString = JSON.stringify(arr)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/videoDetail?videoList=" + jsonString + "&subject=" + this.subject +
|
||||||
|
"&projectId=" + val + "&type=2"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getOperateList() {
|
||||||
|
queryProjectList({
|
||||||
|
"carTypeId": storage.get('carType') || '1001',
|
||||||
|
"subject": String(this.subject),
|
||||||
|
"type": this.type
|
||||||
|
}).then(resp => {
|
||||||
|
if(resp.code==='0000'){
|
||||||
|
this.videoList=resp.data[0]?resp.data[0].videoList:[]
|
||||||
|
this.allVideoList=resp.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getDiverType() {
|
||||||
|
const carTypeId = storage.get('carType') || '1001'
|
||||||
|
querySysConfigList(carTypeId, 'DriveType').then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
this.categoryList=resp.data.map(item=>{
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
name:item.configItemName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.getOperateList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
chooseCar(val){
|
chooseCar(val){
|
||||||
this.tCar=val
|
this.tCar=val
|
||||||
},
|
},
|
||||||
changeCategory(val){
|
changeCategory(val){
|
||||||
|
this.tCar=val.index
|
||||||
|
this.getOperateList()
|
||||||
},
|
},
|
||||||
toDetail(){
|
toDetail(){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -91,6 +145,19 @@
|
|||||||
width: 300rpx;
|
width: 300rpx;
|
||||||
height: 169rpx;
|
height: 169rpx;
|
||||||
background: #00B74F;
|
background: #00B74F;
|
||||||
border-radius: 8rpx;
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
.play_btn_2 {
|
||||||
|
width: 65rpx;
|
||||||
|
height: 65rpx;
|
||||||
|
position: absolute;
|
||||||
|
left: 117.5rpx;
|
||||||
|
top: 52rpx
|
||||||
|
}
|
||||||
|
.hide {
|
||||||
|
backface-visibility: hidden;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
-webkit-backface-visibility: hidden;
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,31 +1,86 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="chapter_item p14" v-for="(item,index) of chapterList" :key="index" @tap="toQuestion">
|
<u-loading-page :loading="getLoading" loading-text="题库更新中..."></u-loading-page>
|
||||||
{{item.label}}
|
<view v-if="!getLoading">
|
||||||
|
<view class="chapter_item p14" v-for="(item,index) of chapterList" :key="index" @tap="toQuestion(item.configItemCode)">
|
||||||
|
{{item.configItemName}}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
querySysConfigList,
|
||||||
|
queryQuestionId
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
chapterList:[
|
chapterList:[],
|
||||||
{label:'驾驶证申请相关'},
|
subject:'1'
|
||||||
{label:'驾驶证申请相关'},
|
}
|
||||||
{label:'驾驶证登记处罚'},
|
},
|
||||||
{label:'机动车强制报废'},
|
onLoad(op){
|
||||||
{label:'其他考点'},
|
if(op.subject){
|
||||||
{label:'驾驶证登记处罚'},
|
this.subject=op.subject
|
||||||
{label:'机动车强制报废'},
|
}
|
||||||
{label:'其他考点'}]
|
this.getChapterList()
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1", "version"]), //映射函数,取出tagslist
|
||||||
|
getLoading() {
|
||||||
|
return this.loading_subject4 && this.loading_subject1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
toQuestion(){
|
...mapActions(useQuestionStore, ['getAllQuestion']),
|
||||||
|
getQuestion(param,title) {
|
||||||
|
queryQuestionId({
|
||||||
|
versionId: this.version,
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject,
|
||||||
|
...param,
|
||||||
|
}).then(async (resp) => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
if(resp.data&&resp.data.length){
|
||||||
|
const arr = resp.data
|
||||||
|
const listJson = JSON.stringify(arr)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/questionBank?navTitle="+章节技巧
|
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无题目',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else if (resp.code === '4001') {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前题库非最新版,请更新~',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.getAllQuestion()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getChapterList(){
|
||||||
|
const carTypeId=storage.get('carType') || '1001'
|
||||||
|
const key=this.subject=='1'?'ChapterOfSubjectOne':'ChapterOfSubjectFour'
|
||||||
|
querySysConfigList(carTypeId,'ChapterOfSubjectOne').then(resp=>{
|
||||||
|
if(resp.code==='0000'){
|
||||||
|
this.chapterList=resp.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toQuestion(code){
|
||||||
|
this.getQuestion({chapter:code},'章节技巧')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +1,150 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view>
|
||||||
|
<view class="content" v-if="questionList&&questionList.length>0">
|
||||||
<view class="flex ai-c jc-c">
|
<view class="flex ai-c jc-c">
|
||||||
<view class="flex type_box jc-sb ai-c">
|
<view class="flex type_box jc-sb ai-c" v-if="navTitle!=='考前密卷'">
|
||||||
<view class="type_item" v-for="(item,index) of tabsList" :key="index" :class="tCurrent==item.value?'checked':'unchecked'" @tap="sectionChange(item.value)">{{item.label}}</view>
|
<view class="type_item" v-for="(item,index) of tabsList" :key="index"
|
||||||
|
:class="tCurrent==item.value?'checked':'unchecked'" @tap="sectionChange(item.value)">{{item.label}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false" :disable-programmatic-animation="true" @change="onChange" @animationfinish="onAnimationfinish" @touchend="touchEnd" >
|
<swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false" @change="onChange"
|
||||||
<swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesIndex">
|
@animationfinish="onAnimationfinish" @touchend="touchEnd">
|
||||||
|
<swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesIndex.questionId">
|
||||||
<scroll-view scroll-y="true" class="swiper-scroll">
|
<scroll-view scroll-y="true" class="swiper-scroll">
|
||||||
<view>
|
<view>
|
||||||
<view class="m14lr">
|
<view class="m14lr">
|
||||||
<text class="tag_box">{{getQuestType(quesItem.type)}}</text>
|
<text class="tag_box">{{getQuestType(quesItem.type)}}</text>
|
||||||
<text class="fs18">{{quesItem.question}}</text>
|
<text class="fs18" style="line-height: 42rpx;vertical-align: middle;">{{quesItem.question}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList"
|
<view class="p14 flex jc-c ai-c" v-if="quesItem.imageUrl">
|
||||||
:key="item.op" @tap="answerQues(item.opValue,index)">
|
<image v-show="quesItem.imageUrl" style="width: auto;max-height:40vh;" mode="heightFix"
|
||||||
<template
|
:lazy-load="true" @load="onoff='1'" :src="quesItem.imageUrl" @click="preview(quesItem.imageUrl)">
|
||||||
v-if="quesItem.clickAnswer&&quesItem.trueAnswer.includes(item.opValue)">
|
</image>
|
||||||
|
</view>
|
||||||
|
<template v-if="quesItem.type!='3'">
|
||||||
|
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList" :key="item.op"
|
||||||
|
@tap="answerQues(item.opValue,index)">
|
||||||
|
<template v-if="item.opDesc">
|
||||||
|
<template v-if="quesItem.clickAnswer&&quesItem.trueAnswer.includes(item.opValue)">
|
||||||
<u-icon class="mr15" name="checkmark-circle-fill" color="#05C341" size="32"></u-icon>
|
<u-icon class="mr15" name="checkmark-circle-fill" color="#05C341" size="32"></u-icon>
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template
|
||||||
v-else-if="quesItem.clickAnswer&&quesItem.clickAnswer.includes(item.opValue)&&!quesItem.trueAnswer.includes(item.opValue)">
|
v-else-if="quesItem.clickAnswer&&quesItem.clickAnswer?.includes(item.opValue)&&!quesItem.trueAnswer.includes(item.opValue)">
|
||||||
<u-icon class="mr15" name="close-circle-fill" color="red" size="32"></u-icon>
|
<u-icon class="mr15" name="close-circle-fill" color="red" size="32"></u-icon>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="!item.chooseOption">
|
<template v-else-if="!item.chooseOption">
|
||||||
<view class="option_item">{{item.op}}</view>
|
<view class="option_item">{{item.op}}</view>
|
||||||
</template>
|
</template>
|
||||||
<text class="fs18">{{item.opDesc}}</text>
|
<text style="width: calc(100% - 100rpx);display: inline-block;" class="fs18">{{item.opDesc}}</text>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view class="m14lr mt30"
|
<view class="m14lr mt30"
|
||||||
v-if="quesItem.clickAnswer&&!quesItem.trueAnswer.includes(quesItem.clickAnswer) || tCurrent===1">
|
v-if="quesItem.clickAnswer&&!quesItem.trueAnswer.includes(quesItem.clickAnswer) || showBestAnswer">
|
||||||
<view class="answer_box">
|
<view class="answer_box">
|
||||||
<text class="fs18 fw600 cor-000">答案:{{getRightOp(quesItem.trueAnswer)}}</text>
|
<text class="fs18 fw600 cor-000">答案:{{getRightOp(quesItem.trueAnswer)}}</text>
|
||||||
<view class="fs18 cor-000" style="text-indent:2em;"> {{quesItem.bestAnswer}}</view>
|
<view v-if="showSkillInfo==='show'&&quesItem.skillInfo" class="fs18 cor-000 mt5">
|
||||||
|
答题技巧:{{quesItem.skillInfo}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c jc-c mt10">
|
||||||
|
<view style="height: 6rpx;width: 120rpx;background-color: rgb(232, 232, 232);"></view>
|
||||||
|
<view class="fs18 fw600 cor-000 p15lr">试题详解</view>
|
||||||
|
<view style="height: 6rpx;width: 120rpx;background-color: rgb(232, 232, 232);"></view>
|
||||||
|
</view>
|
||||||
|
<view class="mt10">
|
||||||
|
<view class="fw600 cor-000 mb10 flex ai-c">
|
||||||
|
<view
|
||||||
|
style="background: linear-gradient(90deg, #11DF20 0%, #00B74F 100%);height: 36rpx;width: 8rpx;"
|
||||||
|
class="mr5"></view>题目解析
|
||||||
|
</view>
|
||||||
|
<view style="text-indent:2em;">{{quesItem.bestAnswer}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList" :key="item.op"
|
||||||
|
@tap="answerQues(item.opValue,index)">
|
||||||
|
<template v-if="item.opDesc">
|
||||||
|
<template
|
||||||
|
v-if="quesItem.isChoose&&quesItem.trueAnswer.includes(item.opValue)&&quesItem.clickAnswer&&quesItem.clickAnswer.includes(item.opValue)">
|
||||||
|
<u-icon class="mr15" name="checkmark-circle-fill" color="#05C341" size="32"></u-icon>
|
||||||
|
</template>
|
||||||
|
<template
|
||||||
|
v-else-if="quesItem.isChoose&&quesItem.clickAnswer&&quesItem.clickAnswer.includes(item.opValue)&&!quesItem.trueAnswer.includes(item.opValue)">
|
||||||
|
<u-icon class="mr15" name="close-circle-fill" color="red" size="32"></u-icon>
|
||||||
|
</template>
|
||||||
|
<template
|
||||||
|
v-else-if="!quesItem.isChoose||quesItem.clickAnswer&&!quesItem.clickAnswer.includes(item.opValue)&&quesItem.isChoose">
|
||||||
|
<template v-if="quesItem.isChoose">
|
||||||
|
<view class="option_item"
|
||||||
|
:class="quesItem.trueAnswer.includes(item.opValue)&&quesItem.clickAnswer&&!quesItem.clickAnswer.includes(item.opValue)?'right_option':''">
|
||||||
|
{{item.op}}
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="option_item"
|
||||||
|
:class="quesItem.clickAnswer&&quesItem.clickAnswer.includes(item.opValue)&&!quesItem.isChoose?'checked_option':''">
|
||||||
|
{{item.op}}
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<text style="width: calc(100% - 100rpx);display: inline-block;" class="fs18">{{item.opDesc}}</text>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view class="p14" v-if="tCurrent!=1">
|
||||||
|
<button :class="quesItem.clickAnswer&&quesItem.clickAnswer.length>1?'dx_checked':'dx_btn'"
|
||||||
|
@click="duoxuan(quesItem.clickAnswer)">确认</button>
|
||||||
|
</view>
|
||||||
|
<view class="m14lr mt30" v-if="isShowAnswer">
|
||||||
|
<view class="answer_box">
|
||||||
|
<text class="fs18 fw600 cor-000">答案:{{getRightOp(quesItem.trueAnswer)}}</text>
|
||||||
|
<view v-if="showSkillInfo==='show'&&quesItem.skillInfo" class="fs18 cor-000">
|
||||||
|
答题技巧:{{quesItem.skillInfo}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex ai-c jc-c mt10">
|
||||||
|
<view style="height: 6rpx;width: 120rpx;background-color: rgb(232, 232, 232);"></view>
|
||||||
|
<view class="fs18 fw600 cor-000 p15lr">试题详解</view>
|
||||||
|
<view style="height: 6rpx;width: 120rpx;background-color: rgb(232, 232, 232);"></view>
|
||||||
|
</view>
|
||||||
|
<view class="mt10">
|
||||||
|
<view class="fw600 cor-000 mb10 flex ai-c">
|
||||||
|
<view
|
||||||
|
style="background: linear-gradient(90deg, #11DF20 0%, #00B74F 100%);height: 36rpx;width: 8rpx;"
|
||||||
|
class="mr5"></view>题目解析
|
||||||
|
</view>
|
||||||
|
<view style="text-indent:2em;">{{quesItem.bestAnswer}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
|
<q-previewImage ref="previewRef" :urls="imgs" @open="open"></q-previewImage>
|
||||||
<view class="wp100 flex jc-sb ai-c p14 bc-fff" v-if="isShowAll" style="position: fixed;bottom: 0;left: 0;">
|
<view class="wp100 flex jc-sb ai-c p14 bc-fff" v-if="isShowAll" style="position: fixed;bottom: 0;left: 0;">
|
||||||
<view style="width: 220rpx;">
|
<view style="width: 220rpx;">
|
||||||
<button v-if="type==='practice'" class="btn">四步学科一</button>
|
<view v-if="type==='practice'" style="width: 220rpx;height: 80rpx;"></view>
|
||||||
<view v-else class="btn" style="text-align: center;" @tap="submitPaper">
|
<view v-else-if="type=='exam'" class="btn" style="text-align: center;" @tap="submitPaper">
|
||||||
<u-count-down ref="countDown_1" :time="1 * 60 * 60 * 1000" format="HH:mm:ss"></u-count-down>
|
<u-count-down ref="countDown_1" :time=" timeCount" format="HH:mm:ss" @change="timeChange"></u-count-down>
|
||||||
<text>交卷</text>
|
<text>交卷</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
|
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
|
||||||
<u-icon name="star-fill" v-if="questionList[topicIndex].isCollect" color="rgb(249,236,141)" size="24"></u-icon>
|
<u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
|
||||||
<u-icon name="star" v-else size="24"></u-icon>
|
color="rgb(249,236,141)" size="20"></u-icon>
|
||||||
<text class="cor-666">{{questionList[topicIndex].isCollect?'已收藏':'收藏'}}</text>
|
<u-icon name="star" v-else size="20"></u-icon>
|
||||||
|
<text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center">
|
<view class="text-center">
|
||||||
<view style="color: #00B74F;">{{rightList.length}}</view>
|
<view style="color: #00B74F;">{{navTitle !== '顺序答题'?rightList.length:storageRightList.length}}</view>
|
||||||
<text class="cor-666">答对</text>
|
<text class="cor-666">答对</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center">
|
<view class="text-center">
|
||||||
<view style="color: #FF6E02;">{{wrongList.length}}</view>
|
<view style="color: #FF6E02;">{{navTitle !== '顺序答题'?wrongList.length:storageWrongList.length}}</view>
|
||||||
<text class="cor-666">答错</text>
|
<text class="cor-666">答错</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center" @tap="popupShow=!popupShow">
|
<view class="text-center" @tap="popupShow=!popupShow">
|
||||||
<view><text class="cor-333">{{topicIndex+1}}</text><text style="color:#999;">/{{questionList.length}}</text></view>
|
<view><text class="cor-333">{{topicIndex+1}}</text><text style="color:#999;">/{{questionList.length}}</text>
|
||||||
|
</view>
|
||||||
<text class="cor-666">题板</text>
|
<text class="cor-666">题板</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -80,7 +163,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<template #confirmButton>
|
<template #confirmButton>
|
||||||
<view class="p10">
|
<view class="p10">
|
||||||
<u-button :customStyle="{width:'100%',height:'68rpx',borderRadius:'34rpx',color:'#fff',backgroundColor:'#05C341'}" @click="toResult">查看练题结果</u-button>
|
<u-button
|
||||||
|
:customStyle="{width:'100%',height:'68rpx',borderRadius:'34rpx',color:'#fff',backgroundColor:'#05C341'}"
|
||||||
|
@click="toResult">查看练题结果</u-button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</u-modal>
|
</u-modal>
|
||||||
@@ -90,15 +175,15 @@
|
|||||||
<text>确认交卷</text>
|
<text>确认交卷</text>
|
||||||
<view class="mt20 flex ai-c jc-sb">
|
<view class="mt20 flex ai-c jc-sb">
|
||||||
<view class="text-center">
|
<view class="text-center">
|
||||||
<text style="color:#FF6E02">99</text>
|
<text style="color:#FF6E02">{{questionList.length-rightList.length-wrongList.length}}</text>
|
||||||
<view class="cor-333">未答题数</view>
|
<view class="cor-333">未答题数</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center">
|
<view class="text-center">
|
||||||
<u-count-down ref="countDown_3" class="balckColor" :time="1 * 60 * 60 * 1000" format="HH:mm:ss"></u-count-down>
|
<u-count-down ref="countDown_3" class="balckColor" :time="timeCount" format="HH:mm:ss"></u-count-down>
|
||||||
<view>剩余时间</view>
|
<view>剩余时间</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center">
|
<view class="text-center">
|
||||||
<text style="color:#333">9</text>
|
<text style="color:#333">{{(rightList.length/questionList.length * 100).toFixed(0)}}</text>
|
||||||
<view class="cor-333">考试得分</view>
|
<view class="cor-333">考试得分</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -106,8 +191,22 @@
|
|||||||
</view>
|
</view>
|
||||||
<template #confirmButton>
|
<template #confirmButton>
|
||||||
<view class="p10">
|
<view class="p10">
|
||||||
<u-button :customStyle="{width:'45%',marginRight:'10px',height:'68rpx',lineHeight:'68rpx',borderRadius:'34rpx',color:'#666',border:'1px solid #666',display:'inline-block'}" @click="continueExam">继续考试</u-button>
|
<template v-if="isShowAll">
|
||||||
<u-button :customStyle="{width:'45%',marginLeft:'10px',height:'68rpx',lineHeight:'68rpx',borderRadius:'34rpx',color:'#fff',backgroundColor:'#05C341',display:'inline-block'}" @click="toSubmit">现在交卷</u-button>
|
<u-button
|
||||||
|
:customStyle="{width:'45%',marginRight:'10px',height:'68rpx',lineHeight:'68rpx',borderRadius:'34rpx',color:'#666',border:'1px solid #666',display:'inline-block'}"
|
||||||
|
@click="continueExam">继续考试</u-button>
|
||||||
|
<u-button
|
||||||
|
:customStyle="{width:'45%',marginLeft:'10px',height:'68rpx',lineHeight:'68rpx',borderRadius:'34rpx',color:'#fff',backgroundColor:'#05C341',display:'inline-block'}"
|
||||||
|
@click="toSubmit">现在交卷</u-button>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<u-button
|
||||||
|
:customStyle="{width:'45%',marginRight:'10px',height:'68rpx',lineHeight:'68rpx',borderRadius:'34rpx',color:'#666',border:'1px solid #666',display:'inline-block'}"
|
||||||
|
@click="toLeave">确定离开</u-button>
|
||||||
|
<u-button
|
||||||
|
:customStyle="{width:'45%',marginLeft:'10px',height:'68rpx',lineHeight:'68rpx',borderRadius:'34rpx',color:'#fff',backgroundColor:'#05C341',display:'inline-block'}"
|
||||||
|
@click="continueExam">继续考试</u-button>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</u-modal>
|
</u-modal>
|
||||||
@@ -115,44 +214,50 @@
|
|||||||
<view>
|
<view>
|
||||||
<view class="wp100 flex jc-sb p14 bc-fff">
|
<view class="wp100 flex jc-sb p14 bc-fff">
|
||||||
<view style="width: 220rpx;">
|
<view style="width: 220rpx;">
|
||||||
<button v-if="type==='practice'" class="btn">四步学科一</button>
|
<view v-if="type==='practice'" style="width: 220rpx;height: 80rpx;"></view>
|
||||||
<view v-else class="btn" style="text-align: center;" @tap="submitPaper">
|
<view v-else-if="type=='exam'" class="btn" style="text-align: center;" @tap="submitPaper">
|
||||||
<u-count-down ref="countDown_2" :time="1 * 60 * 60 * 1000" format="HH:mm:ss"></u-count-down>
|
<u-count-down ref="countDown_2" :time="timeCount" format="HH:mm:ss"></u-count-down>
|
||||||
<text>交卷</text>
|
<text>交卷</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
|
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
|
||||||
<u-icon name="star-fill" v-if="questionList[topicIndex].isCollect" color="rgb(249,236,141)" size="24"></u-icon>
|
<u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
|
||||||
<u-icon name="star" v-else size="24"></u-icon>
|
color="rgb(249,236,141)" size="20"></u-icon>
|
||||||
<text class="cor-666">{{questionList[topicIndex].isCollect?'已收藏':'收藏'}}</text>
|
<u-icon name="star" v-else size="20"></u-icon>
|
||||||
|
<text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center">
|
<view class="text-center">
|
||||||
<view style="color: #00B74F;">{{rightList.length}}</view>
|
<view style="color: #00B74F;">{{navTitle !== '顺序答题'?rightList.length:storageRightList.length}}</view>
|
||||||
<text class="cor-666">答对</text>
|
<text class="cor-666">答对</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center">
|
<view class="text-center">
|
||||||
<view style="color: #FF6E02;">{{wrongList.length}}</view>
|
<view style="color: #FF6E02;">{{navTitle !== '顺序答题'?wrongList.length:storageWrongList.length}}</view>
|
||||||
<text class="cor-666">答错</text>
|
<text class="cor-666">答错</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center" @tap="popupShow=!popupShow">
|
<view class="text-center" @tap="popupShow=!popupShow">
|
||||||
<view><text class="cor-333">{{topicIndex+1}}</text><text style="color:#999;">/{{questionList.length}}</text></view>
|
<view><text class="cor-333">{{topicIndex+1}}</text><text
|
||||||
|
style="color:#999;">/{{questionList.length}}</text>
|
||||||
|
</view>
|
||||||
<text class="cor-666">题板</text>
|
<text class="cor-666">题板</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c jc-sb p14" style="flex-wrap: wrap;max-height: 400px;overflow-y: scroll;">
|
<view class="flex ai-c jc-fs p14" style="flex-wrap: wrap;max-height: 400px;overflow-y: scroll;">
|
||||||
<view v-for="(item,index) of questionList" :key="index" style="width:20%;" class="flex ai-c jc-c" @tap="chooseQueston(index)">
|
<view v-for="(item,index) of questionList" :key="item.questionId" style="width:20%;position: relative;"
|
||||||
|
class="flex ai-c jc-c" @tap="chooseQueston(index)">
|
||||||
<view class="tCircle mb10" :class="{
|
<view class="tCircle mb10" :class="{
|
||||||
'active':index == topicIndex,
|
'active':index == topicIndex,
|
||||||
'success':rightList.includes(item.questionId),
|
'success':type=='exam'?rightList.includes(item.questionId):storageRightList.includes(item.questionId),
|
||||||
'error':wrongList.includes(item.questionId)
|
'error':type=='exam'?wrongList.includes(item.questionId):storageWrongList.includes(item.questionId)
|
||||||
}">
|
}">
|
||||||
{{index+1}}
|
{{index+1}}
|
||||||
</view>
|
</view>
|
||||||
|
<u-icon name="star-fill" v-if="collectList.includes(item.questionId)"
|
||||||
|
style="position: absolute;right: 5px;top:-3px" color="rgb(249,236,141)" size="24"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
<u-popup :show="showVip" mode="bottom" :closeOnClickOverlay="true" :round="16" @close="showVip=false">
|
<!-- <u-popup :show="showVip" mode="bottom" :closeOnClickOverlay="true" :round="16" @close="showVip=false">
|
||||||
<view class="p14" style="z-index: 9;">
|
<view class="p14" style="z-index: 9;">
|
||||||
<view class="wp100 flex ai-c jc-sb">
|
<view class="wp100 flex ai-c jc-sb">
|
||||||
<text class="fs30 fw600 cor-000">VIP题库</text>
|
<text class="fs30 fw600 cor-000">VIP题库</text>
|
||||||
@@ -172,8 +277,8 @@
|
|||||||
<image style="width: 65rpx;height: 65rpx; position: absolute;right: 20px;top: -5px;" src="../../static/image/practice/vip_include.png"></image>
|
<image style="width: 65rpx;height: 65rpx; position: absolute;right: 20px;top: -5px;" src="../../static/image/practice/vip_include.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="height: 528rpx;width: 100%;background-image: url(../../static/image/practice/vip_bg.png);background-size: 100% 100%;margin-top: -65px;position: relative;">
|
<view style="height: 528rpx;width: 100%;background-image: url(../../static/image/practice/vip_bg.jpg);background-size: 100% 100%;margin-top: -65px;position: relative;">
|
||||||
<text style="position: absolute;top: 138px;left:100px;rotate: 16deg;" class="fs25 cor-fff">VIP题库</text>
|
<text style="position: absolute;top: 151px;left:117px;rotate: 16deg;" class="fs25 cor-fff">VIP题库</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="wp100 p14" style="position: absolute;left: 0;bottom:20px">
|
<view class="wp100 p14" style="position: absolute;left: 0;bottom:20px">
|
||||||
<view class="sub_btn flex ai-c jc-sb">
|
<view class="sub_btn flex ai-c jc-sb">
|
||||||
@@ -181,12 +286,27 @@
|
|||||||
<image style="width: 276rpx;height: 88rpx;margin-top: -5px;" src="../../static/image/index/buy.png"></image>
|
<image style="width: 276rpx;height: 88rpx;margin-top: -5px;" src="../../static/image/index/buy.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup> -->
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<view class="mt20">
|
||||||
|
<u-loading-icon text="题目加载中..."></u-loading-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
import storage from '@/jtools/storage';
|
import storage from '@/jtools/storage';
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import {
|
||||||
|
querySysConfig,
|
||||||
|
submitTest
|
||||||
|
} from '@/jtools/api/question';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
tabsList: {
|
tabsList: {
|
||||||
@@ -207,6 +327,14 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
imgs: [],
|
||||||
|
subject: '1',
|
||||||
|
showSkillInfo: 'hidden',
|
||||||
|
currentType: storage.get('carType') || '1001',
|
||||||
|
onoff: '0',
|
||||||
|
navTitle: '',
|
||||||
|
originArray: '',
|
||||||
|
showBestAnswer: false,
|
||||||
nowPrice: 68,
|
nowPrice: 68,
|
||||||
showVip: false,
|
showVip: false,
|
||||||
popupShow: false,
|
popupShow: false,
|
||||||
@@ -216,21 +344,170 @@ export default {
|
|||||||
tCurrent: 0,
|
tCurrent: 0,
|
||||||
index: 0,
|
index: 0,
|
||||||
qIndex: 0,
|
qIndex: 0,
|
||||||
|
storageRightList: storage.get(`rightList_subject${this.subject}`) || [],
|
||||||
|
storageWrongList: storage.get(`wrongList_subject${this.subject}`) || [],
|
||||||
rightList: [],
|
rightList: [],
|
||||||
wrongList: [],
|
wrongList: [],
|
||||||
collectList:storage.get('collectList') || [],
|
collectList: storage.get(`collectList_subject${this.subject}`) || [],
|
||||||
questionList: [{isCollect:true}],//数据源
|
questionList: [], //数据源
|
||||||
swiperList: [], // 轮播图数据列表
|
swiperList: [], // 轮播图数据列表
|
||||||
swiperIndex: 0, // 轮播图当前位置
|
swiperIndex: 0, // 轮播图当前位置
|
||||||
isChange: false, // 是否切换
|
isChange: false, // 是否切换
|
||||||
topicIndex: 0, // 题目位置
|
topicIndex: 0, // 题目位置
|
||||||
duration: 200, // 动画过渡时长
|
duration: 200, // 动画过渡时长
|
||||||
|
time: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
created() {
|
||||||
this.renderSwiper(0)
|
const carType = storage.get('carType') || '1001'
|
||||||
|
querySysConfig(carType, 'NeedSkillInfo').then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
this.showSkillInfo = resp.data.configValue
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["currentIndex_subject1", "currentIndex_subject4"]), //映射函数,取出tagslist
|
||||||
|
isShowAnswer() {
|
||||||
|
// quesItem.isChoose&&quesItem.clickAnswer&&!quesItem.trueAnswer.includes(quesItem.clickAnswer)
|
||||||
|
if (this.tCurrent == 0) {
|
||||||
|
if (this.questionList[this.topicIndex].isChoose) {
|
||||||
|
const arr1 = this.questionList[this.topicIndex].clickAnswer.split('')
|
||||||
|
const arr2 = this.questionList[this.topicIndex].trueAnswer.split('')
|
||||||
|
if (!this.isArrEqual(arr1, arr2)) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
timeCount() {
|
||||||
|
const time = 45 * 60 * 1000
|
||||||
|
return time
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useQuestionStore, ['getCurrentIndex']),
|
||||||
|
open() {
|
||||||
|
|
||||||
|
},
|
||||||
|
preview(url) {
|
||||||
|
this.imgs = [url] //设置图片数组
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.imgs = [url]
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.$refs.previewRef.open(url);
|
||||||
|
},500)
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
},
|
||||||
|
getOriginArr(val) {
|
||||||
|
const arr = JSON.parse(val)
|
||||||
|
let arr1 = []
|
||||||
|
arr.forEach(item => {
|
||||||
|
arr1.push({
|
||||||
|
isChoose: false,
|
||||||
|
...item
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.originArray = JSON.stringify(arr1)
|
||||||
|
},
|
||||||
|
toLeave() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
isShowBest(val) {
|
||||||
|
this.showBestAnswer = val
|
||||||
|
},
|
||||||
|
duoxuan(val) {
|
||||||
|
if (val && val.length > 1) {
|
||||||
|
this.questionList[this.topicIndex].isChoose = true
|
||||||
|
if (this.tCurrent != 1) {
|
||||||
|
this.originArray = JSON.stringify(this.questionList)
|
||||||
|
}
|
||||||
|
// const falseList = storage.get(`wrongList_subject${this.subject}`) || []
|
||||||
|
// const trueList = storage.get(`rightList_subject${this.subject}`) || []
|
||||||
|
if (this.tCurrent !== 1) {
|
||||||
|
const arr1 = this.questionList[this.topicIndex].clickAnswer.split('')
|
||||||
|
const arr2 = this.questionList[this.topicIndex].trueAnswer.split('')
|
||||||
|
if (this.isArrEqual(arr1, arr2)) {
|
||||||
|
//判断选择的答案和实际的答案是否相同,如果相同,判断如果该题的ID在不在正确的数组中,不在则Push(存储的的同理)
|
||||||
|
//如果这道题在错误的数组中则把这道题在错误数组中删掉
|
||||||
|
if (!this.rightList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
|
this.rightList.push(this.questionList[this.topicIndex].questionId)
|
||||||
|
}
|
||||||
|
if (!this.storageRightList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
|
this.storageRightList.push(this.questionList[this.topicIndex].questionId)
|
||||||
|
storage.set(`rightList_subject${this.subject}`, this.storageRightList)
|
||||||
|
}
|
||||||
|
if (this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
|
const wIndex = this.wrongList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||||
|
this.wrongList.splice(wIndex, 1)
|
||||||
|
}
|
||||||
|
if (this.storageWrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
|
const wIndex = this.storageWrongList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||||
|
this.storageWrongList.splice(wIndex, 1)
|
||||||
|
storage.set(`wrongList_subject${this.subject}`, this.storageWrongList)
|
||||||
|
}
|
||||||
|
//答对题目 如果不是最后一题,跳下一题
|
||||||
|
if (this.topicIndex < this.questionList.length - 1) {
|
||||||
|
this.topicIndex++;
|
||||||
|
this.qIndex = this.topicIndex
|
||||||
|
if (this.navTitle === '顺序答题') {
|
||||||
|
this.getCurrentIndex(this.topicIndex, this.subject)
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.renderSwiper(this.topicIndex);
|
||||||
|
}, 1000)
|
||||||
|
} else {
|
||||||
|
this.qIndex = this.topicIndex + 1
|
||||||
|
}
|
||||||
|
if (this.qIndex > this.questionList.length - 1) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.tipShow = true
|
||||||
|
}, 1000)
|
||||||
|
} else {
|
||||||
|
this.tipShow = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
|
this.wrongList.push(this.questionList[this.topicIndex].questionId)
|
||||||
|
}
|
||||||
|
if (!this.storageWrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
|
this.storageWrongList.push(this.questionList[this.topicIndex].questionId)
|
||||||
|
storage.set(`wrongList_subject${this.subject}`, this.storageWrongList)
|
||||||
|
}
|
||||||
|
if (this.storageRightList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
|
const rIndex = this.storageRightList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||||
|
this.storageRightList.splice(rIndex, 1)
|
||||||
|
storage.set(`rightList_subject${this.subject}`, this.storageRightList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
timeChange(e) {
|
||||||
|
this.time = e
|
||||||
|
if (e.hours == 0 && e.minutes == 0 && e.seconds == 0 && e.milliseconds == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "考试结束,将为您自动交卷~",
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.toSubmit()
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
},
|
||||||
//获取正确选项
|
//获取正确选项
|
||||||
getRightOp(val) {
|
getRightOp(val) {
|
||||||
let rightOp = ''
|
let rightOp = ''
|
||||||
@@ -257,11 +534,16 @@ export default {
|
|||||||
},
|
},
|
||||||
//开通VIP
|
//开通VIP
|
||||||
toVip() {
|
toVip() {
|
||||||
this.showVip=true
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/videoVip?subject=" + this.subject
|
||||||
|
})
|
||||||
},
|
},
|
||||||
submitPaper() {
|
submitPaper() {
|
||||||
|
if (this.isShowAll) {
|
||||||
this.$refs.countDown_1.pause();
|
this.$refs.countDown_1.pause();
|
||||||
this.$refs.countDown_2.pause();
|
this.$refs.countDown_2.pause();
|
||||||
|
}
|
||||||
|
this.popupShow = false
|
||||||
this.$refs.countDown_3.pause();
|
this.$refs.countDown_3.pause();
|
||||||
this.$emit('update:isSubmit', true)
|
this.$emit('update:isSubmit', true)
|
||||||
},
|
},
|
||||||
@@ -278,23 +560,43 @@ export default {
|
|||||||
},
|
},
|
||||||
//交卷
|
//交卷
|
||||||
toSubmit() {
|
toSubmit() {
|
||||||
uni.navigateTo({
|
const restTime = this.time.hours * 60 * 60 + this.time.minutes * 60 + this.time.seconds
|
||||||
url:"/pages/questionBank/examResult"
|
const score = (this.rightList.length / this.questionList.length * 100).toFixed(0)
|
||||||
|
if (this.rightList.length + this.wrongList.length == 0) {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
submitTest({
|
||||||
|
"carTypeId": storage.get('carType') || '1001',
|
||||||
|
"score": score,
|
||||||
|
"testTime": 45 * 60 - restTime,
|
||||||
|
subject: this.subject
|
||||||
|
}).then(resp => {
|
||||||
|
const doNotNum = this.questionList.length - this.rightList.length - this.wrongList.length
|
||||||
|
const list = JSON.stringify(this.wrongList)
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/examResult?doNotNum=" + doNotNum + "&wrongList=" + list + "&score=" +
|
||||||
|
score + "&subject=" + this.subject + "&navTitle=" + this.navTitle
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//查看考试结果
|
//查看考试结果
|
||||||
toResult() {
|
toResult() {
|
||||||
|
const allDoNum = this.wrongList.length + this.rightList.length
|
||||||
|
const list = JSON.stringify(this.wrongList)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/practiceResult"
|
url: "/pages/questionBank/practiceResult?allDoNum=" + allDoNum + "&wrongList=" + list + "&subject=" + this
|
||||||
|
.subject + "&navTitle=" + this.navTitle
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toCollect() {
|
toCollect() {
|
||||||
if(this.questionList[this.topicIndex].isCollect){
|
|
||||||
if (this.collectList.includes(this.questionList[this.topicIndex].questionId)) {
|
if (this.collectList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
const idx = this.collectList.indexOf(this.questionList[this.topicIndex].questionId)
|
const idx = this.collectList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||||
this.collectList.splice(idx, 1)
|
this.collectList.splice(idx, 1)
|
||||||
}
|
|
||||||
this.questionList[this.topicIndex].isCollect=false
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "取消收藏",
|
title: "取消收藏",
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@@ -307,7 +609,7 @@ export default {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
storage.set('collectList',this.collectList)
|
storage.set(`collectList_subject${this.subject}`, this.collectList)
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
this.tipShow = false
|
this.tipShow = false
|
||||||
@@ -348,6 +650,7 @@ export default {
|
|||||||
|
|
||||||
// 轮播图切换
|
// 轮播图切换
|
||||||
onChange(e) {
|
onChange(e) {
|
||||||
|
// this.onoff='0'
|
||||||
// 非触摸事件不做轮播图状态更新
|
// 非触摸事件不做轮播图状态更新
|
||||||
if (e.detail.source != "touch") return;
|
if (e.detail.source != "touch") return;
|
||||||
|
|
||||||
@@ -360,6 +663,9 @@ export default {
|
|||||||
// 轮播图当前位置小于原来时则表示为上一题
|
// 轮播图当前位置小于原来时则表示为上一题
|
||||||
this.topicIndex--;
|
this.topicIndex--;
|
||||||
}
|
}
|
||||||
|
if (this.navTitle === '顺序答题') {
|
||||||
|
this.getCurrentIndex(this.topicIndex, this.subject)
|
||||||
|
}
|
||||||
// 更新轮播图位置数值,为更新时让 Vue 能监听到数据有改变
|
// 更新轮播图位置数值,为更新时让 Vue 能监听到数据有改变
|
||||||
this.swiperIndex = e.detail.current;
|
this.swiperIndex = e.detail.current;
|
||||||
},
|
},
|
||||||
@@ -385,6 +691,10 @@ export default {
|
|||||||
// 选择题目
|
// 选择题目
|
||||||
pickerTopic(index) {
|
pickerTopic(index) {
|
||||||
this.topicIndex = index;
|
this.topicIndex = index;
|
||||||
|
this.index = this.topicIndex
|
||||||
|
if (this.navTitle === '顺序答题') {
|
||||||
|
this.getCurrentIndex(this.topicIndex, this.subject)
|
||||||
|
}
|
||||||
this.renderSwiper(index);
|
this.renderSwiper(index);
|
||||||
},
|
},
|
||||||
isArrEqual(arr1, arr2) {
|
isArrEqual(arr1, arr2) {
|
||||||
@@ -392,45 +702,67 @@ export default {
|
|||||||
},
|
},
|
||||||
//答题
|
//答题
|
||||||
answerQues(op, index) {
|
answerQues(op, index) {
|
||||||
const falseList =storage.get('wrongList') || []
|
// const falseList = storage.get(`wrongList_subject${this.subject}`) || []
|
||||||
const trueList =storage.get('rightList') || []
|
// const trueList = storage.get(`rightList_subject${this.subject}`) || []
|
||||||
if (!this.questionList[this.topicIndex].clickAnswer) {
|
if (!this.questionList[this.topicIndex].clickAnswer) {
|
||||||
this.questionList[this.topicIndex].optionList[index].chooseOption =`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}`
|
this.questionList[this.topicIndex].optionList[index].chooseOption =
|
||||||
this.questionList[this.topicIndex].clickAnswer = `${this.questionList[this.topicIndex].optionList[index].clickAnswer?this.questionList[this.topicIndex].optionList[index].clickAnswer:''}${op}`
|
`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}`
|
||||||
|
this.questionList[this.topicIndex].clickAnswer =
|
||||||
|
`${this.questionList[this.topicIndex].optionList[index].clickAnswer?this.questionList[this.topicIndex].optionList[index].clickAnswer:''}${op}`
|
||||||
|
} else {
|
||||||
|
//如果是多选 点击的选项中不包含该选项则拼接进去,如果包含则能删除
|
||||||
|
if (this.questionList[this.topicIndex].type == '3' && !this.questionList[this.topicIndex].clickAnswer.includes(
|
||||||
|
op) && !this.questionList[this.topicIndex].isChoose) {
|
||||||
|
this.questionList[this.topicIndex].optionList[index].chooseOption =
|
||||||
|
`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}`
|
||||||
|
this.questionList[this.topicIndex].clickAnswer = `${this.questionList[this.topicIndex].clickAnswer}${op}`
|
||||||
|
} else if (this.questionList[this.topicIndex].type == '3' && this.questionList[this.topicIndex].clickAnswer
|
||||||
|
.includes(op) && !this.questionList[this.topicIndex].isChoose) {
|
||||||
|
this.questionList[this.topicIndex].optionList[index].chooseOption = ''
|
||||||
|
let reg2 = new RegExp(op); // 不加'g',仅删除字符串里第一个"a"
|
||||||
|
this.questionList[this.topicIndex].clickAnswer = this.questionList[this.topicIndex].clickAnswer.replace(reg2,
|
||||||
|
"");
|
||||||
}
|
}
|
||||||
if(this.tCurrent!==1){
|
}
|
||||||
|
if (this.tCurrent != 1) {
|
||||||
|
this.originArray = JSON.stringify(this.questionList)
|
||||||
|
}
|
||||||
|
if (this.tCurrent !== 1 && this.questionList[this.topicIndex].type != '3') {
|
||||||
const arr1 = this.questionList[this.topicIndex].clickAnswer.split('')
|
const arr1 = this.questionList[this.topicIndex].clickAnswer.split('')
|
||||||
const arr2 = this.questionList[this.topicIndex].trueAnswer.split('')
|
const arr2 = this.questionList[this.topicIndex].trueAnswer.split('')
|
||||||
if (this.isArrEqual(arr1, arr2)) {
|
if (this.isArrEqual(arr1, arr2)) {
|
||||||
|
//判断选择的答案和实际的答案是否相同,如果相同,判断如果该题的ID在不在正确的数组中,不在则Push(存储的的同理)
|
||||||
|
//如果这道题在错误的数组中则把这道题在错误数组中删掉
|
||||||
if (!this.rightList.includes(this.questionList[this.topicIndex].questionId)) {
|
if (!this.rightList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
this.rightList.push(this.questionList[this.topicIndex].questionId)
|
this.rightList.push(this.questionList[this.topicIndex].questionId)
|
||||||
}
|
}
|
||||||
if(!trueList.includes(this.questionList[this.topicIndex].questionId)){
|
if (!this.storageRightList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
trueList.push(this.questionList[this.topicIndex].questionId)
|
this.storageRightList.push(this.questionList[this.topicIndex].questionId)
|
||||||
storage.set('rightList',trueList)
|
storage.set(`rightList_subject${this.subject}`, this.storageRightList)
|
||||||
}
|
}
|
||||||
if (this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
if (this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
const wIndex = this.wrongList.indexOf(this.questionList[this.topicIndex].questionId)
|
const wIndex = this.wrongList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||||
this.wrongList.splice(wIndex, 1)
|
this.wrongList.splice(wIndex, 1)
|
||||||
}
|
}
|
||||||
if(falseList.includes(this.questionList[this.topicIndex].questionId)){
|
if (this.storageWrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
const wIndex=falseList.indexOf(this.questionList[this.topicIndex].questionId)
|
const wIndex = this.storageWrongList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||||
falseList.splice(wIndex,1)
|
this.storageWrongList.splice(wIndex, 1)
|
||||||
storage.set('wrongList',falseList)
|
storage.set(`wrongList_subject${this.subject}`, this.storageWrongList)
|
||||||
}
|
}
|
||||||
|
//答对题目 如果不是最后一题,跳下一题
|
||||||
if (this.topicIndex < this.questionList.length - 1) {
|
if (this.topicIndex < this.questionList.length - 1) {
|
||||||
this.topicIndex++;
|
this.topicIndex++;
|
||||||
this.qIndex = this.topicIndex
|
this.qIndex = this.topicIndex
|
||||||
|
if (this.navTitle === '顺序答题') {
|
||||||
|
this.getCurrentIndex(this.topicIndex, this.subject)
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.renderSwiper(this.topicIndex);
|
this.renderSwiper(this.topicIndex);
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
|
||||||
if(this.topicIndex<=this.questionList.length-1){
|
|
||||||
this.qIndex=this.topicIndex
|
|
||||||
} else {
|
} else {
|
||||||
this.qIndex++
|
this.qIndex = this.topicIndex + 1
|
||||||
}
|
}
|
||||||
if(this.qIndex>=this.questionList.length-1){
|
if (this.qIndex > this.questionList.length - 1) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.tipShow = true
|
this.tipShow = true
|
||||||
}, 1000)
|
}, 1000)
|
||||||
@@ -441,41 +773,63 @@ export default {
|
|||||||
if (!this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
if (!this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
this.wrongList.push(this.questionList[this.topicIndex].questionId)
|
this.wrongList.push(this.questionList[this.topicIndex].questionId)
|
||||||
}
|
}
|
||||||
if(!falseList.includes(this.questionList[this.topicIndex].questionId)){
|
if (!this.storageWrongList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
falseList.push(this.questionList[this.topicIndex].questionId)
|
this.storageWrongList.push(this.questionList[this.topicIndex].questionId)
|
||||||
storage.set('wrongList',falseList)
|
storage.set(`wrongList_subject${this.subject}`, this.storageWrongList)
|
||||||
}
|
}
|
||||||
if(trueList.includes(this.questionList[this.topicIndex].questionId)){
|
if (this.storageRightList.includes(this.questionList[this.topicIndex].questionId)) {
|
||||||
const rIndex=trueList.indexOf(this.questionList[this.topicIndex].questionId)
|
const rIndex = this.storageRightList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||||
trueList.splice(rIndex,1)
|
this.storageRightList.splice(rIndex, 1)
|
||||||
storage.set('wrongList',trueList)
|
storage.set(`rightList_subject${this.subject}`, this.storageRightList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sectionChange(index) {
|
sectionChange(index) {
|
||||||
this.tCurrent = index
|
this.tCurrent = index
|
||||||
this.getQuestionList()
|
// this.getQuestionList()
|
||||||
this.renderSwiper(0)
|
// this.renderSwiper(0)
|
||||||
|
this.$emit('changeTab', index)
|
||||||
},
|
},
|
||||||
getQuestionList(val) {
|
getQuestionList(val, title, subject) {
|
||||||
console.log(val);
|
if (title) {
|
||||||
this.questionList=val.map(item=>{
|
this.navTitle = title
|
||||||
let isCollect=false
|
|
||||||
if(this.collectList.includes(item.questionId)){
|
|
||||||
isCollect=true
|
|
||||||
}
|
}
|
||||||
return {
|
if (subject) {
|
||||||
isCollect:isCollect,
|
this.subject = subject
|
||||||
...item
|
console.log(this.subject);
|
||||||
|
this.storageRightList = storage.get(`rightList_subject${subject}`) || []
|
||||||
|
this.storageWrongList = storage.get(`wrongList_subject${subject}`) || []
|
||||||
|
this.collectList = storage.get(`collectList_subject${subject}`) || []
|
||||||
|
}
|
||||||
|
if (val && val.length) {
|
||||||
|
this.questionList = JSON.parse(val)
|
||||||
|
} else {
|
||||||
|
this.questionList = JSON.parse(this.originArray)
|
||||||
|
}
|
||||||
|
console.log(this.questionList);
|
||||||
|
if (this.navTitle === '顺序答题') {
|
||||||
|
if (subject) {
|
||||||
|
this.pickerTopic(this[`currentIndex_subject${subject}`])
|
||||||
|
} else {
|
||||||
|
this.pickerTopic(this[`currentIndex_subject${this.subject}`])
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.pickerTopic(this.topicIndex)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.checked_option {
|
||||||
|
background-color: #000;
|
||||||
|
border: 1px solid #000;
|
||||||
|
color: #fff
|
||||||
|
}
|
||||||
|
|
||||||
.type_box {
|
.type_box {
|
||||||
width: 350rpx;
|
width: 350rpx;
|
||||||
height: 72rpx;
|
height: 72rpx;
|
||||||
@@ -501,6 +855,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tag_box {
|
.tag_box {
|
||||||
|
vertical-align: middle;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 78rpx;
|
width: 78rpx;
|
||||||
height: 42rpx;
|
height: 42rpx;
|
||||||
@@ -533,6 +888,7 @@ export default {
|
|||||||
background: #EEEEEE;
|
background: #EEEEEE;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
width: 220rpx;
|
width: 220rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
@@ -542,6 +898,7 @@ export default {
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tCircle {
|
.tCircle {
|
||||||
width: 80rpx;
|
width: 80rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
@@ -575,9 +932,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
padding-top: calc(var(--window-top) + 10px);
|
padding-top: calc(var(--window-top) + 10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.vip_btn {
|
.vip_btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
@@ -588,6 +947,7 @@ export default {
|
|||||||
background: linear-gradient(90deg, #FF9804 0%, #E95B0E 100%);
|
background: linear-gradient(90deg, #FF9804 0%, #E95B0E 100%);
|
||||||
border-radius: 50rpx;
|
border-radius: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub_btn {
|
.sub_btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 110rpx;
|
height: 110rpx;
|
||||||
@@ -597,4 +957,30 @@ export default {
|
|||||||
border-radius: 55rpx;
|
border-radius: 55rpx;
|
||||||
padding: 14rpx;
|
padding: 14rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dx_btn {
|
||||||
|
width: 100%;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #fff;
|
||||||
|
background: rgb(204, 204, 204);
|
||||||
|
border-radius: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dx_checked {
|
||||||
|
width: 100%;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #fff;
|
||||||
|
background: #05C341;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right_option {
|
||||||
|
border-color: #05C341;
|
||||||
|
background-color: #fff;
|
||||||
|
color: #05C341
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,23 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<!-- <u-navbar title="本次成绩" @rightClick="rightClick" :autoBack="true"></u-navbar> -->
|
<!-- <u-navbar title="本次成绩" @rightClick="rightClick" :autoBack="true"></u-navbar> -->
|
||||||
<j-navbar>本次成绩</j-navbar>
|
<j-navbar backPath="/pages/index/index">本次成绩</j-navbar>
|
||||||
<view class="p14 wp100">
|
<view class="p14 wp100">
|
||||||
<GradesChart color="#FF6E02" titleName="32分" :actualValue="0.32" />
|
<GradesChart color="#FF6E02" :titleName="score+'分'" :actualValue="Number(scorePrecent)" />
|
||||||
<view class="top_box flex jc-c" style="flex-direction: column;">
|
<view class="top_box flex jc-c" style="flex-direction: column;">
|
||||||
<view class="wp100 text-center" style="margin-top: -153rpx;">
|
<view class="wp100 text-center" style="margin-top: -153rpx;">
|
||||||
<text>太棒了!正确率很高了!</text>
|
<text v-if="score>=90">太棒了!正确率很高了!</text>
|
||||||
<button class="centerBtn">马上提分</button>
|
<text v-else>很遗憾!考试不及格</text>
|
||||||
<view class="flex ai-c jc-c">
|
<button class="centerBtn" @click="toVip">马上提分</button>
|
||||||
|
<view class="flex ai-c jc-c mt10">
|
||||||
<view class="text-center wp33">
|
<view class="text-center wp33">
|
||||||
<view>99</view>
|
<view>{{doNotNum}}</view>
|
||||||
<text>未做题</text>
|
<text>未做题</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center wp33">
|
<view class="text-center wp33" @tap="toQuestionBank">
|
||||||
<view>12</view>
|
<view>{{wrongList?.length}}</view>
|
||||||
<text>看错题</text>
|
<text>看错题</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center wp33 flex jc-c ai-c" style="flex-direction: column;">
|
<view class="text-center wp33 flex jc-c ai-c" style="flex-direction: column;" @tap="toExams">
|
||||||
<u-icon name="edit-pen" size="28"></u-icon>
|
<u-icon name="edit-pen" size="28"></u-icon>
|
||||||
<text>重新考试</text>
|
<text>重新考试</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -39,18 +40,36 @@
|
|||||||
<text style="color: #00B74F;position: absolute;right:33px;top:-13px">及格线</text>
|
<text style="color: #00B74F;position: absolute;right:33px;top:-13px">及格线</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="wp100 text-center bc-fff pb10">
|
||||||
|
<text>近五次模考成绩</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
import GradesChart from "./components/GradesChart.vue"
|
import GradesChart from "./components/GradesChart.vue"
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import {
|
||||||
|
testTotal
|
||||||
|
} from '@/jtools/api/question';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
GradesChart
|
GradesChart
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
navTitle:"模拟考试",
|
||||||
|
subject:1,
|
||||||
|
doNotNum:0,
|
||||||
|
wrongList:undefined,
|
||||||
|
score:0,
|
||||||
|
scorePrecent:0,
|
||||||
chartData: {},
|
chartData: {},
|
||||||
//您可以通过修改 config-ucharts.js 文件中下标为 ['line'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
|
//您可以通过修改 config-ucharts.js 文件中下标为 ['line'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
|
||||||
opts: {
|
opts: {
|
||||||
@@ -84,27 +103,97 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
onLoad(op){
|
||||||
|
if(op.doNotNum){
|
||||||
|
this.doNotNum=op.doNotNum
|
||||||
|
}
|
||||||
|
if(op.wrongList){
|
||||||
|
console.log(op.wrongList);
|
||||||
|
this.wrongList=JSON.parse(op.wrongList) || []
|
||||||
|
}
|
||||||
|
if(op.score){
|
||||||
|
this.score=op.score
|
||||||
|
this.scorePrecent=(this.score/100).toFixed(2)
|
||||||
|
}
|
||||||
|
if(op.subject){
|
||||||
|
this.subject=op.subject
|
||||||
|
}
|
||||||
|
if(op.navTitle){
|
||||||
|
this.navTitle=op.navTitle
|
||||||
|
}
|
||||||
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
this.getServerData();
|
this.getServerData();
|
||||||
},
|
},
|
||||||
|
onUnload() {
|
||||||
|
//#ifdef MP-WEIXIN
|
||||||
|
uni.reLaunch({
|
||||||
|
url:"/pages/index/index"
|
||||||
|
})
|
||||||
|
//#endif
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useUserStore, ["vipOnList"])
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useUserStore, ['searchUserVip']),
|
||||||
|
async toVip(){
|
||||||
|
await this.searchUserVip()
|
||||||
|
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||||
|
if(res){
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/me/vip'
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.navigateTo({
|
||||||
|
url:"/pages/index/videoVip?subject="+this.subject
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
getServerData() {
|
getServerData() {
|
||||||
//模拟从服务器获取数据时的延时
|
testTotal({
|
||||||
setTimeout(() => {
|
"carTypeId": storage.get('carType') || '1001',
|
||||||
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
|
"subject": this.subject
|
||||||
|
}).then(resp=>{
|
||||||
|
if(resp.code==='0000'){
|
||||||
|
if(resp.data&&resp.data.recentTestList&&resp.data.recentTestList.length){
|
||||||
|
const scoreList =resp.data.recentTestList.map(item=>{
|
||||||
|
return item.score
|
||||||
|
})
|
||||||
let res = {
|
let res = {
|
||||||
categories: ["2018","2019","2020","2021","2022","2023"],
|
categories: ["第一次","第二次","第三次","第四次","第五次"],
|
||||||
series: [{
|
series: [{
|
||||||
name: "",
|
name: "",
|
||||||
data: [90]
|
data: scoreList
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
this.chartData = JSON.parse(JSON.stringify(res));
|
this.chartData = JSON.parse(JSON.stringify(res));
|
||||||
}, 500);
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toQuestionBank(){
|
||||||
|
if(this.wrongList.length==0){
|
||||||
|
uni.showToast({
|
||||||
|
title:'当前无错题~',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
const list =JSON.stringify(this.wrongList)
|
||||||
|
uni.navigateTo({
|
||||||
|
url:"/pages/questionBank/questionBank?navTitle=错题&subject="+this.subject+"&questionList="+list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//重新考试
|
||||||
|
toExams(){
|
||||||
|
uni.navigateTo({
|
||||||
|
url:"/pages/questionBank/practiceExams?subject="+this.subject
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -118,6 +207,7 @@
|
|||||||
width: 349rpx;
|
width: 349rpx;
|
||||||
height: 76rpx;
|
height: 76rpx;
|
||||||
background: #DEEFE5;
|
background: #DEEFE5;
|
||||||
|
border:none;
|
||||||
border-radius: 38rpx;
|
border-radius: 38rpx;
|
||||||
line-height: 76rpx;
|
line-height: 76rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="p14">
|
<view>
|
||||||
|
<u-loading-page :loading="getLoading" loading-text="题库更新中..."></u-loading-page>
|
||||||
|
<view class="p14" v-if="!getLoading">
|
||||||
<view class="flex jc-sb">
|
<view class="flex jc-sb">
|
||||||
<view class="relative mr5" @tap="toIconSkill">
|
<view class="relative mr5" @tap="toIconSkill">
|
||||||
<image style="width: 336rpx;height: 152rpx;" src="../../static/image/practice/errorprone_bg.png">
|
<image style="width: 336rpx;height: 152rpx;" src="../../static/image/practice/errorprone_bg.png">
|
||||||
@@ -13,15 +15,16 @@
|
|||||||
<image style="width: 363rpx;height: 170rpx;" src="../../static/image/practice/chapter_bg.png"></image>
|
<image style="width: 363rpx;height: 170rpx;" src="../../static/image/practice/chapter_bg.png"></image>
|
||||||
<view style="position: absolute;left: 0;top: 0;" class="p10">
|
<view style="position: absolute;left: 0;top: 0;" class="p10">
|
||||||
<view style="color: #FF6E02;font-size: 18px;">章节练习</view>
|
<view style="color: #FF6E02;font-size: 18px;">章节练习</view>
|
||||||
<text style="color: #FF6E02;font-size: 14px;">共5章</text>
|
<text style="color: #FF6E02;font-size: 14px;">共{{chapterNum}}章</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bc-fff pt14" style="border-radius: 20rpx;">
|
<view class="bc-fff pt14" style="border-radius: 20rpx;">
|
||||||
<u-grid :border="false" col="4">
|
<u-grid :border="false" col="4">
|
||||||
<u-grid-item v-for="(listItem,listIndex) in list" :key="listIndex" @click="toAnswer(listItem.title)">
|
<u-grid-item v-for="(listItem,listIndex) in list" :key="listIndex"
|
||||||
<view style="width: 84rpx;height: 84rpx;">
|
@click="toAnswer(listItem.title,listItem.isError,listItem.isNew)">
|
||||||
<image style="width: 84rpx;" mode="widthFix" :src="listItem.image"></image>
|
<view class="mb5" style="width: 84rpx;height: 84rpx;">
|
||||||
|
<image style="width: 84rpx;height:84rpx;" mode="heightFix" :src="listItem.image"></image>
|
||||||
</view>
|
</view>
|
||||||
<text class="grid-text fs14 cor-000">{{listItem.title}}</text>
|
<text class="grid-text fs14 cor-000">{{listItem.title}}</text>
|
||||||
<text class="grid-text mb10 fs12 cor-999">{{listItem.subTitle}}</text>
|
<text class="grid-text mb10 fs12 cor-999">{{listItem.subTitle}}</text>
|
||||||
@@ -31,67 +34,238 @@
|
|||||||
<view class="mt14 p14 bc-fff" style="border-radius: 20rpx;">
|
<view class="mt14 p14 bc-fff" style="border-radius: 20rpx;">
|
||||||
<text class="fs18 cor-000 fw600">常见考点</text>
|
<text class="fs18 cor-000 fw600">常见考点</text>
|
||||||
<view class="flex ai-c wp100 mt10" style="flex-wrap: wrap;">
|
<view class="flex ai-c wp100 mt10" style="flex-wrap: wrap;">
|
||||||
<view class="wp50 flex ai-c mb10" v-for="(item,index) of testCenterList" :key="index">
|
<view class="wp50 flex ai-c p15tb" style="border-bottom: 1rpx solid #DDDCDC;"
|
||||||
|
v-for="(item,index) of testCenterList" :key="index" @tap="toQuestionBank(item)">
|
||||||
<view class="dot_item">{{index+1}}</view>
|
<view class="dot_item">{{index+1}}</view>
|
||||||
<text class="ml5">{{item.label}}</text>
|
<text class="ml5 topic_cont_text" style="width: calc(100% - 65rpx);">{{item.configItemName}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import errorIcon from "../../static/image/practice/error_icon.png"
|
import errorIcon from "../../static/image/practice/error_icon.png"
|
||||||
import newRulesIcon from "../../static/image/practice/newRules_icon.png"
|
import newRulesIcon from "../../static/image/practice/newRules_icon.png"
|
||||||
import neverWriteIcon from "../../static/image/practice/neverWrite_icon.png"
|
import neverWriteIcon from "../../static/image/practice/neverWrite_icon.png"
|
||||||
|
import danxuanIcon from "../../static/image/index/danxuan.png"
|
||||||
|
import panduanIcon from "../../static/image/index/panduan.png"
|
||||||
|
import tupianIcon from "../../static/image/index/tupian.png"
|
||||||
|
import {
|
||||||
|
querySysConfigList,
|
||||||
|
querySpecialNum,
|
||||||
|
queryQuestionId
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
chapterNum:0,
|
||||||
errorIcon,
|
errorIcon,
|
||||||
newRulesIcon,
|
newRulesIcon,
|
||||||
neverWriteIcon,
|
neverWriteIcon,
|
||||||
list: [{
|
list: [{
|
||||||
title: '新规题',
|
title: '新规题',
|
||||||
subTitle: '392题',
|
subTitle: '392题',
|
||||||
|
isNew: 1,
|
||||||
|
isError: 0,
|
||||||
image: newRulesIcon
|
image: newRulesIcon
|
||||||
}, {
|
}, {
|
||||||
title: '易错题',
|
title: '易错题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 1,
|
||||||
subTitle: '392题',
|
subTitle: '392题',
|
||||||
image: errorIcon
|
image: errorIcon
|
||||||
},{
|
|
||||||
title:'未做题',
|
|
||||||
subTitle:'392题',
|
|
||||||
image:neverWriteIcon
|
|
||||||
}, {
|
}, {
|
||||||
title: '单选题',
|
title: '单选题',
|
||||||
subTitle: '392题',
|
subTitle: '392题',
|
||||||
image:newRulesIcon
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: danxuanIcon
|
||||||
}, {
|
}, {
|
||||||
title: '判断题',
|
title: '判断题',
|
||||||
subTitle: '392题',
|
subTitle: '392题',
|
||||||
image:errorIcon
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: panduanIcon
|
||||||
}, {
|
}, {
|
||||||
title: '图片题',
|
title: '图片题',
|
||||||
subTitle: '392题',
|
subTitle: '392题',
|
||||||
image:neverWriteIcon
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: tupianIcon
|
||||||
}],
|
}],
|
||||||
testCenterList:[
|
testCenterList: [],
|
||||||
{label:'驾驶证申请相关'},
|
subject: '1'
|
||||||
{label:'驾驶证申请相关'},
|
}
|
||||||
{label:'驾驶证登记处罚'},
|
},
|
||||||
{label:'机动车强制报废'},
|
onLoad(op) {
|
||||||
{label:'其他考点'},
|
if (op.subject) {
|
||||||
{label:'驾驶证登记处罚'},
|
this.subject = op.subject
|
||||||
{label:'机动车强制报废'},
|
}
|
||||||
{label:'其他考点'}]
|
this.getExamPoint()
|
||||||
|
this.getQuestionNum()
|
||||||
|
this.getChapterList()
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["loading_subject4", "loading_subject1", "version"]), //映射函数,取出tagslist
|
||||||
|
getLoading() {
|
||||||
|
return this.loading_subject4 && this.loading_subject1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toAnswer(title) {
|
...mapActions(useQuestionStore, ['getAllQuestion']),
|
||||||
uni.navigateTo({
|
getChapterList(){
|
||||||
url:"/pages/questionBank/questionBank?navTitle="+title
|
const carTypeId=storage.get('carType') || '1001'
|
||||||
|
const key=this.subject=='1'?'ChapterOfSubjectOne':'ChapterOfSubjectFour'
|
||||||
|
querySysConfigList(carTypeId,'ChapterOfSubjectOne').then(resp=>{
|
||||||
|
if(resp.code==='0000'&&resp.data){
|
||||||
|
this.chapterNum=resp.data.length
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getQuestionNum() {
|
||||||
|
querySpecialNum({
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject
|
||||||
|
}).then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
if (this.subject == '1') {
|
||||||
|
this.list = [{
|
||||||
|
title: '新规题',
|
||||||
|
subTitle: resp.data.newQuestionNum + '题',
|
||||||
|
isNew: 1,
|
||||||
|
isError: 0,
|
||||||
|
image: newRulesIcon,
|
||||||
|
}, {
|
||||||
|
title: '易错题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 1,
|
||||||
|
subTitle: resp.data.errorQuestionNum + '题',
|
||||||
|
image: errorIcon,
|
||||||
|
}, {
|
||||||
|
title: '单选题',
|
||||||
|
subTitle: resp.data.radioQuestionNum + '题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: danxuanIcon,
|
||||||
|
}, {
|
||||||
|
title: '判断题',
|
||||||
|
subTitle: resp.data.judgeQuestionNum + '题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: panduanIcon,
|
||||||
|
}, {
|
||||||
|
title: '图片题',
|
||||||
|
subTitle: resp.data.imageQuestionNum + '题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: tupianIcon,
|
||||||
|
}]
|
||||||
|
} else {
|
||||||
|
this.list = [{
|
||||||
|
title: '新规题',
|
||||||
|
subTitle: resp.data.newQuestionNum + '题',
|
||||||
|
isNew: 1,
|
||||||
|
isError: 0,
|
||||||
|
image: newRulesIcon
|
||||||
|
}, {
|
||||||
|
title: '易错题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 1,
|
||||||
|
subTitle: resp.data.errorQuestionNum + '题',
|
||||||
|
image: errorIcon,
|
||||||
|
}, {
|
||||||
|
title: '单选题',
|
||||||
|
subTitle: resp.data.radioQuestionNum + '题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: danxuanIcon,
|
||||||
|
}, {
|
||||||
|
title: '多选题',
|
||||||
|
subTitle: resp.data.multipleChoiceQuestionNum + '题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: neverWriteIcon
|
||||||
|
}, {
|
||||||
|
title: '判断题',
|
||||||
|
subTitle: resp.data.judgeQuestionNum + '题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: panduanIcon,
|
||||||
|
}, {
|
||||||
|
title: '图片题',
|
||||||
|
subTitle: resp.data.imageQuestionNum + '题',
|
||||||
|
isNew: 0,
|
||||||
|
isError: 0,
|
||||||
|
image: tupianIcon,
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getExamPoint() {
|
||||||
|
const carTypeId = storage.get('carType') || '1001'
|
||||||
|
const examKey = this.subject == '1' ? 'ExamKeysOfSubjectOne' : 'ExamKeysOfSubjectFour'
|
||||||
|
querySysConfigList(carTypeId, examKey).then(resp => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
this.testCenterList = resp.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getQuestion(param,title) {
|
||||||
|
queryQuestionId({
|
||||||
|
versionId: this.version,
|
||||||
|
carTypeId: storage.get('carType') || '1001',
|
||||||
|
subject: this.subject,
|
||||||
|
...param,
|
||||||
|
}).then(async (resp) => {
|
||||||
|
if (resp.code === '0000') {
|
||||||
|
if(resp.data&&resp.data.length){
|
||||||
|
const arr = resp.data
|
||||||
|
const listJson = JSON.stringify(arr)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无题目',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else if (resp.code === '4001') {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前题库非最新版,请更新~',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.getAllQuestion()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toAnswer(title, isError, isNew) {
|
||||||
|
if (title == '单选题') {
|
||||||
|
this.getQuestion({type:'2'},title)
|
||||||
|
} else if (title == '多选题') {
|
||||||
|
this.getQuestion({type:'3'},title)
|
||||||
|
} else if (title == '判断题') {
|
||||||
|
this.getQuestion({type:'1'},title)
|
||||||
|
} else if (title == '图片题') {
|
||||||
|
this.getQuestion({isImage:'1'},title)
|
||||||
|
} else {
|
||||||
|
this.getQuestion({isNew:isNew,isError:isError},title)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
toQuestionBank(val) {
|
||||||
|
this.getQuestion({examKey:val.configItemCode},val.configItemName)
|
||||||
|
},
|
||||||
toIconSkill() {
|
toIconSkill() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/index/iconSkill"
|
url: "/pages/index/iconSkill"
|
||||||
@@ -99,7 +273,7 @@
|
|||||||
},
|
},
|
||||||
toChapterSkill() {
|
toChapterSkill() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/chapterExercise"
|
url: "/pages/questionBank/chapterExercise?subject="+this.subject
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,10 +284,26 @@
|
|||||||
.dot_item {
|
.dot_item {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
line-height: 40rpx;
|
line-height: 41rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: #0BD032;
|
background: #0BD032;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.topic_cont_text {
|
||||||
|
height: 45rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-all;
|
||||||
|
/* break-all(允许在单词内换行。) */
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* 超出部分省略号 */
|
||||||
|
display: -webkit-box;
|
||||||
|
/** 对象作为伸缩盒子模型显示 **/
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
/** 设置或检索伸缩盒对象的子元素的排列方式 **/
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
/** 显示的行数 **/
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
<view>
|
<view>
|
||||||
<!-- <u-navbar title="模拟考试" @rightClick="rightClick" :autoBack="true">
|
<!-- <u-navbar title="模拟考试" @rightClick="rightClick" :autoBack="true">
|
||||||
</u-navbar> -->
|
</u-navbar> -->
|
||||||
<j-navbar>模拟考试</j-navbar>
|
<j-navbar :isDefineBack="true" @toBack="toBack">{{title}}</j-navbar>
|
||||||
<Question :tabsList="tabsList" v-model:isSubmit="isSubmit" type="exam" />
|
<Question ref="question" :tabsList="tabsList" v-model:isSubmit="isSubmit" :type="type" :isShowAll="isShowAll" @changeTab="changeTab" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -13,6 +13,12 @@
|
|||||||
mapActions
|
mapActions
|
||||||
} from 'pinia' //引入映射函数
|
} from 'pinia' //引入映射函数
|
||||||
import useQuestionStore from '@/jtools/store/question' //引入store
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
|
import {
|
||||||
|
getTestQuestion,
|
||||||
|
queryQuestionId
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
import Question from './components/Question.vue';
|
import Question from './components/Question.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -20,25 +26,77 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
type: '',
|
||||||
|
collectList: storage.get(`collectList_subject${this.subject}`) || [],
|
||||||
|
questionArr: [],
|
||||||
|
isShowAll: true,
|
||||||
|
title: "模拟考试",
|
||||||
|
subject: 1,
|
||||||
isSubmit: false,
|
isSubmit: false,
|
||||||
tabsList: [{
|
tabsList: [{
|
||||||
label: "模拟考试",
|
label: "模拟考试",
|
||||||
value: 0
|
value: 0
|
||||||
}, {
|
}, {
|
||||||
label:"考前密卷",
|
label: "考前秘卷",
|
||||||
value: 1
|
value: 1
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(op) {
|
||||||
console.log(this.orderQuestionList);
|
if (op.title) {
|
||||||
|
this.title = op.title
|
||||||
|
}
|
||||||
|
if (op.subject) {
|
||||||
|
this.subject = op.subject
|
||||||
|
const param = {}
|
||||||
|
if (op.isExam1) {
|
||||||
|
param.isExam1 = op.isExam1
|
||||||
|
}
|
||||||
|
if (op.needVip) {
|
||||||
|
this.isShowAll = op.needVip
|
||||||
|
}
|
||||||
|
let arr = []
|
||||||
|
arr = [...this[`orderQuestion_subject${this.subject}`]]
|
||||||
|
let questionObj = {}
|
||||||
|
arr.forEach(item => {
|
||||||
|
item.isChoose = false
|
||||||
|
questionObj[item.questionId] = item
|
||||||
|
})
|
||||||
|
if (op.questionIdList) {
|
||||||
|
const idList = JSON.parse(op.questionIdList)
|
||||||
|
if (idList && idList.length > 0) {
|
||||||
|
idList.forEach(item => {
|
||||||
|
this.questionArr.push(questionObj[item])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.type = 'exam'
|
||||||
|
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr), this.title,this.subject)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQuestionStore, ["orderQuestionList"]) //映射函数,取出tagslist
|
...mapState(useUserStore, ["vipOnList", "token"]),
|
||||||
|
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数,取出tagslist
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
rightClick() {
|
...mapActions(useUserStore, ['searchUserVip']),
|
||||||
console.log('返回');
|
toBack() {
|
||||||
|
this.$refs.question.submitPaper()
|
||||||
|
},
|
||||||
|
async changeTab(val) {
|
||||||
|
if (val == 1) {
|
||||||
|
await this.searchUserVip()
|
||||||
|
const result = this.vipOnList.some(item => item.subjects.includes(this.subject))
|
||||||
|
if (result) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/secretPapers?subject=" + this.subject
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/index/videoVip?subject=" + this.subject
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,10 +108,12 @@
|
|||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
display: inline-block !important;
|
display: inline-block !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .u-count-down__text {
|
::v-deep .u-count-down__text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .balckColor .u-count-down__text {
|
::v-deep .balckColor .u-count-down__text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333 !important;
|
color: #333 !important;
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<!-- <u-navbar title="本次练题结果" @rightClick="rightClick" :autoBack="true"></u-navbar>-->
|
<!-- <u-navbar title="本次练题结果" @rightClick="rightClick" :autoBack="true"></u-navbar>-->
|
||||||
<j-navbar>本次练题结果</j-navbar>
|
<j-navbar backPath="/pages/index/index">本次练题结果</j-navbar>
|
||||||
<view class="p14 wp100">
|
<view class="p14 wp100">
|
||||||
<GradesChart />
|
<GradesChart :titleName="rightPencentDesc" :actualValue="Number(rightPencent)" />
|
||||||
<view class="top_box flex jc-c" style="flex-direction: column;">
|
<view class="top_box flex jc-c" style="flex-direction: column;">
|
||||||
<view class="wp100 text-center" >
|
<view class="wp100 text-center" style="margin-top: -80px;">
|
||||||
<text>太棒了!正确率很高了!</text>
|
<text v-if="Number(rightPencent * 100)>=90">太棒了!正确率很高了!</text>
|
||||||
|
<text v-else>继续努力吧,正确率有点低~</text>
|
||||||
<view class="flex ai-c jc-c mt10">
|
<view class="flex ai-c jc-c mt10">
|
||||||
<view class="text-center wp50">
|
<view class="text-center wp50" @tap="toQuestionBank">
|
||||||
<view>1/3</view>
|
<view>{{wrongList.length}}/{{allDoNum}}</view>
|
||||||
<text>本次错题</text>
|
<text>本次错题</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-center wp50 flex jc-c ai-c" style="flex-direction: column;">
|
<view class="text-center wp50 flex jc-c ai-c" style="flex-direction: column;" @tap="toContiune">
|
||||||
<u-icon name="file-text" size="28"></u-icon>
|
<u-icon name="file-text" size="28"></u-icon>
|
||||||
<text>继续做题</text>
|
<text>继续做题</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -25,12 +26,12 @@
|
|||||||
<view class="flex ai-c jc-sb">
|
<view class="flex ai-c jc-sb">
|
||||||
<view>
|
<view>
|
||||||
<text class="fs18 cor-000 fw600">累计练题</text>
|
<text class="fs18 cor-000 fw600">累计练题</text>
|
||||||
<text class="fs14 cor-666 ml10">33题</text>
|
<text class="fs14 cor-666 ml10">{{allRightList.length+allWrongList.length}}题</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="fs14 cor-666">未做题2311题</text>
|
<text class="fs14 cor-666">未做题{{getNotDoNum}}题</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt10">
|
<view class="mt10">
|
||||||
<u-line-progress :percentage="20" activeColor="#05C341" height="16"></u-line-progress>
|
<u-line-progress :percentage="percent" activeColor="#05C341" height="16"></u-line-progress>
|
||||||
</view>
|
</view>
|
||||||
<view class="p14 mt10 flex ai-c jc-sb" style="border-radius: 20rpx;background-color: rgb(253,249,238);">
|
<view class="p14 mt10 flex ai-c jc-sb" style="border-radius: 20rpx;background-color: rgb(253,249,238);">
|
||||||
<view>
|
<view>
|
||||||
@@ -47,6 +48,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
import GradesChart from "./components/GradesChart.vue"
|
import GradesChart from "./components/GradesChart.vue"
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -54,11 +61,61 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
rightPencent:0,
|
||||||
|
rightPencentDesc:'',
|
||||||
|
allDoNum:0,
|
||||||
|
wrongList:[],
|
||||||
|
subject:1,
|
||||||
|
allRightList:[],
|
||||||
|
allWrongList:[],
|
||||||
|
percent:undefined,
|
||||||
|
navTitle:'顺序练习',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(op){
|
||||||
|
if(op.allDoNum){
|
||||||
|
this.allDoNum=op.allDoNum
|
||||||
|
}
|
||||||
|
if(op.navTitle){
|
||||||
|
this.navTitle=op.navTitle
|
||||||
|
}
|
||||||
|
if(op.wrongList){
|
||||||
|
this.wrongList=JSON.parse(op.wrongList)
|
||||||
|
this.rightPencent=this.allDoNum>0?((this.allDoNum-this.wrongList.length)/this.allDoNum).toFixed(2):0
|
||||||
|
this.rightPencentDesc=(this.rightPencent*100).toFixed(0)+'%'
|
||||||
|
}
|
||||||
|
if(op.subject){
|
||||||
|
this.subject=op.subject
|
||||||
|
this.allRightList=storage.get(`rightList_subject${this.subject}`) || []
|
||||||
|
this.allWrongList=storage.get(`wrongList_subject${this.subject}`) || []
|
||||||
|
this.percent=(((this.allRightList.length+this.wrongList.length) / this[`orderQuestion_subject${this.subject}`].length)*100).toFixed(0)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
//#ifdef MP-WEIXIN
|
||||||
|
uni.reLaunch({
|
||||||
|
url:"/pages/index/index"
|
||||||
|
})
|
||||||
|
//#endif
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["orderQuestion_subject1","orderQuestion_subject4"]), //映射函数,取出tagslist
|
||||||
|
getNotDoNum(){
|
||||||
|
return this[`orderQuestion_subject${this.subject}`].length-(this.allRightList.length+this.allWrongList.length)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
toQuestionBank(){
|
||||||
|
const list =JSON.stringify(this.wrongList)
|
||||||
|
uni.navigateTo({
|
||||||
|
url:"/pages/questionBank/questionBank?navTitle=错题&subject="+this.subject+"&questionList="+list
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toContiune(){
|
||||||
|
uni.navigateTo({
|
||||||
|
url:"/pages/questionBank/questionBank?navTitle="+this.navTitle+"&subject="+this.subject
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<!-- <u-navbar :title="navTitle" @rightClick="rightClick" :autoBack="true">
|
<u-loading-page :loading="loading" :loading-text="loadTxt"></u-loading-page>
|
||||||
</u-navbar> -->
|
<view v-if="!loading">
|
||||||
<j-navbar>{{navTitle}}</j-navbar>
|
<j-navbar>{{navTitle}}</j-navbar>
|
||||||
<Question ref="question" :tabsList="tabsList" :isShowAll="true"></Question>
|
<Question ref="question" :tabsList="tabsList" :isShowAll="isShowAll" :subject="subject" :navTitle="navTitle"
|
||||||
|
@changeTab="changeTab"></Question>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -13,13 +15,25 @@
|
|||||||
mapActions
|
mapActions
|
||||||
} from 'pinia' //引入映射函数
|
} from 'pinia' //引入映射函数
|
||||||
import useQuestionStore from '@/jtools/store/question' //引入store
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import useUserStore from '@/jtools/store/user'
|
||||||
import Question from './components/Question.vue';
|
import Question from './components/Question.vue';
|
||||||
|
import {
|
||||||
|
queryQuestion,
|
||||||
|
queryQuestionId
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Question
|
Question
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
loadTxt: '加载中...',
|
||||||
|
collectList: storage.get(`collectList_subject${this.subject}`) || [],
|
||||||
|
loading: false,
|
||||||
|
isShowAll: true,
|
||||||
|
needVip: false,
|
||||||
|
subject: 1,
|
||||||
navTitle: '',
|
navTitle: '',
|
||||||
tabsList: [{
|
tabsList: [{
|
||||||
label: "答题",
|
label: "答题",
|
||||||
@@ -31,19 +45,66 @@
|
|||||||
questionArr: []
|
questionArr: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(op) {
|
async onLoad(op) {
|
||||||
|
this.loading = true
|
||||||
|
if (op.needVip) {
|
||||||
|
this.needVip = op.needVip
|
||||||
|
}
|
||||||
|
if (op.subject) {
|
||||||
|
this.subject = op.subject
|
||||||
|
}
|
||||||
if (op && op.navTitle) {
|
if (op && op.navTitle) {
|
||||||
this.navTitle = op.navTitle
|
this.navTitle = op.navTitle
|
||||||
if(this.navTitle==='顺序答题'){
|
let arr = []
|
||||||
this.questionArr=[...this.orderQuestion]
|
let param = {}
|
||||||
this.$refs.question.getQuestionList(this.questionArr)
|
if (op.needVip) {
|
||||||
|
this.isShowAll = !Boolean(op.needVip == 'true')
|
||||||
}
|
}
|
||||||
|
arr = [...this[`orderQuestion_subject${this.subject}`]]
|
||||||
|
let questionObj={}
|
||||||
|
arr.forEach(item => {
|
||||||
|
item.isChoose=false
|
||||||
|
questionObj[item.questionId]=item
|
||||||
|
})
|
||||||
|
if(op.navTitle==='顺序答题'){
|
||||||
|
this.questionArr=arr
|
||||||
|
}else if (op.questionIdList) {
|
||||||
|
const idList = JSON.parse(op.questionIdList)
|
||||||
|
if(idList&&idList.length>0){
|
||||||
|
idList.forEach(item=>{
|
||||||
|
this.questionArr.push(questionObj[item])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr), this.navTitle , this.subject)
|
||||||
|
this.$refs.question.getOriginArr(JSON.stringify(this.questionArr))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQuestionStore, ["orderQuestion"]) //映射函数,取出tagslist
|
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数,取出tagslist
|
||||||
|
...mapState(useUserStore, ["vipOnList", "token"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(useUserStore, ['searchUserVip']),
|
||||||
|
...mapActions(useQuestionStore, ['getAllQuestion']),
|
||||||
|
changeTab(val) {
|
||||||
|
if (val == 1) {
|
||||||
|
let list = JSON.parse(JSON.stringify(this.questionArr))
|
||||||
|
list = list.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
clickAnswer: item.trueAnswer,
|
||||||
|
isChoose: true,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$refs.question.isShowBest(true)
|
||||||
|
this.$refs.question.getQuestionList(JSON.stringify(list), this.navTitle)
|
||||||
|
} else {
|
||||||
|
this.$refs.question.isShowBest(false)
|
||||||
|
this.$refs.question.getQuestionList()
|
||||||
|
}
|
||||||
|
},
|
||||||
rightClick() {
|
rightClick() {
|
||||||
console.log('返回');
|
console.log('返回');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<sunny-video style="width: 100%" videoHeight="422rpx" ref="sunny-video" title="测试视频" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" @timeupdate="timeupdate" />
|
<sunny-video style="width: 100%" videoHeight="422rpx" ref="sunny-video" :src="videoList[currentIndex].videoUrl" />
|
||||||
<view class="p14 bc-fff">
|
<view class="p14tb bc-fff">
|
||||||
<u-scroll-list :indicator="false" v-if="videoType=='test'">
|
<view class="skill-sequence-panel-content-wrapper pr14" v-if="videoType=='test'">
|
||||||
<view class="flex ai-c jc-sb mt15">
|
<scroll-view class="skill-sequence-panel-content" scroll-x>
|
||||||
<view class="tab_iem mr15" :class="videoIndex===item.value?'checked_tab':''" v-for="(item,index) of testList" :key="index" @tap="checkTest(item.value)">{{item.label}}</view>
|
<view class="skill-sequence-skill-wrapper tab_iem" :class="videoIndex===item.value?'checked_tab':''"
|
||||||
|
v-for="(item,index) of testList" :key="index" @tap="checkTest(item.value)">{{item.label}}</view>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</u-scroll-list>
|
<view class="flex ai-c jc-sb mt10 wp100 p14">
|
||||||
<view class="flex ai-c jc-sb mt10 wp100">
|
<text class="fs18 fw600 cor-000">{{title}}</text>
|
||||||
<text class="fs18 fw600 cor-000">C1捷达-基础操作视频讲解</text>
|
|
||||||
<view class="flex" @tap="popupShow=true" v-if="videoType!='test'">
|
<view class="flex" @tap="popupShow=true" v-if="videoType!='test'">
|
||||||
<text class="fs14 cor-666">更多</text>
|
<text class="fs14 cor-666">更多</text>
|
||||||
<u-icon color="#666" name="arrow-right" size="18"></u-icon>
|
<u-icon color="#666" name="arrow-right" size="18"></u-icon>
|
||||||
@@ -18,20 +19,26 @@
|
|||||||
<view>
|
<view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="pl14 bc-fff">
|
<view class="bc-fff pl14 pb10">
|
||||||
<u-scroll-list :indicator="false" class="mr15">
|
<view class="skill-sequence-panel-content-wrapper">
|
||||||
<view v-for="(item, index) in videoList" :key="index" class="mr15" @click="checkVideo(item.id)">
|
<scroll-view class="skill-sequence-panel-content" scroll-x :scroll-left="getScrollLeft">
|
||||||
|
<view class="skill-sequence-skill-wrapper" v-for="(item, index) in videoList" :key="index"
|
||||||
|
@tap="checkVideo(item.projectId)">
|
||||||
<view>
|
<view>
|
||||||
<view class="mb10 relative">
|
<view class="mb10 relative contain-box hide" style="overflow: hidden;">
|
||||||
<image class="contain-box" src="../../static/image/index/index_bg.png"></image>
|
<image class="contain-box" style="position: absolute;left: 0;top: 0;" mode="widthFix"
|
||||||
<view v-if="nowVideo===item.id" class="playLogo">播放中</view>
|
:src="item.videoUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'"></image>
|
||||||
|
<view v-if="projectId==item.projectId" class="playLogo">播放中</view>
|
||||||
<image class="play_btn" src="../../static/image/index/play.png" />
|
<image class="play_btn" src="../../static/image/index/play.png" />
|
||||||
<text style="position: absolute;right: 8rpx;bottom: 8rpx;color:#fff">13:14</text>
|
<text style="position: absolute;right: 8rpx;bottom: 8rpx;color:#fff">{{item.videoTime}}</text>
|
||||||
</view>
|
</view>
|
||||||
<text :style="{color:nowVideo===item.id?'#FF6E02':'#333'}">正确的驾驶姿势</text>
|
<view class="topic_cont_text" :style="{color:projectId==item.projectId?'#FF6E02':'#333'}">
|
||||||
|
{{item.description}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-scroll-list>
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-popup :show="popupShow" mode="bottom" :closeOnClickOverlay="true" @close="popupShow=false">
|
<u-popup :show="popupShow" mode="bottom" :closeOnClickOverlay="true" @close="popupShow=false">
|
||||||
<view class="p14 flex ai-c jc-sb">
|
<view class="p14 flex ai-c jc-sb">
|
||||||
@@ -39,15 +46,16 @@
|
|||||||
<text class="fs16 cor-666" @tap="popupShow=false">收起</text>
|
<text class="fs16 cor-666" @tap="popupShow=false">收起</text>
|
||||||
</view>
|
</view>
|
||||||
<view style="max-height: 800rpx;overflow-y: scroll;" class="p14lr">
|
<view style="max-height: 800rpx;overflow-y: scroll;" class="p14lr">
|
||||||
<view class="flex bc-fff mt10" style="border-radius: 16rpx;" v-for="(item,index) of videoList" :key="index" @tap="toDetail">
|
<view class="flex bc-fff mb15" style="border-radius: 16rpx;" v-for="(item,index) of videoList" :key="index"
|
||||||
<view class="pic relative">
|
@tap="checkVideo(item.projectId)">
|
||||||
<image class="pic" src="../../static/image/index/index_bg.png"></image>
|
<view class="pic relative hide" style="overflow: hidden;">
|
||||||
|
<image class="pic" style="position: absolute;left: 0;top: 0;" mode="widthFix" :src="item.videoUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'"></image>
|
||||||
<image class="play_btn_2" src="../../static/image/index/play.png" />
|
<image class="play_btn_2" src="../../static/image/index/play.png" />
|
||||||
<text style="position: absolute;right: 8rpx;bottom: 8rpx;color:#fff">13:14</text>
|
<text style="position: absolute;right: 8rpx;bottom: 8rpx;color:#fff">{{item.videoTime}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="ml10">
|
<view class="ml10">
|
||||||
<text class="fs16 cor-000 fw600">上车、下车的方法</text>
|
<text class="fs16 cor-000 fw600">{{item.description}}</text>
|
||||||
<view class="fs14 mt5 cor-666">上车、下车的方法</view>
|
<view class="fs14 mt5 cor-666">{{item.subDesc}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -56,9 +64,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
queryProjectList
|
||||||
|
} from '@/jtools/api/question';
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
title: '',
|
||||||
|
currentIndex: 0,
|
||||||
videoIndex: 0,
|
videoIndex: 0,
|
||||||
testList: [{
|
testList: [{
|
||||||
label: "八一考场",
|
label: "八一考场",
|
||||||
@@ -82,9 +96,9 @@
|
|||||||
label: "庐江考场",
|
label: "庐江考场",
|
||||||
value: 6
|
value: 6
|
||||||
}],
|
}],
|
||||||
|
driveType:'',
|
||||||
videoType: '',
|
videoType: '',
|
||||||
popupShow: false,
|
popupShow: false,
|
||||||
nowVideo:0,
|
|
||||||
videoList: [{
|
videoList: [{
|
||||||
title: '正确的驾驶姿势',
|
title: '正确的驾驶姿势',
|
||||||
time: '13:14',
|
time: '13:14',
|
||||||
@@ -109,20 +123,94 @@
|
|||||||
title: '正确的驾驶姿势',
|
title: '正确的驾驶姿势',
|
||||||
time: '13:14',
|
time: '13:14',
|
||||||
id: 5
|
id: 5
|
||||||
}]
|
}],
|
||||||
|
projectId: undefined,
|
||||||
|
param: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(op) {
|
onLoad(op) {
|
||||||
|
if(op.driveType){
|
||||||
|
this.driveType=op.driveType
|
||||||
|
this.param.driveType=op.driveType
|
||||||
|
}
|
||||||
if (op.type) {
|
if (op.type) {
|
||||||
this.videoType = op.type
|
this.videoType = op.type
|
||||||
}
|
}
|
||||||
|
if (op.projectId) {
|
||||||
|
this.projectId = op.projectId
|
||||||
|
}
|
||||||
|
if (op.subject) {
|
||||||
|
this.param.subject = op.subject
|
||||||
|
}
|
||||||
|
if (op.type) {
|
||||||
|
this.param.type = op.type
|
||||||
|
this.getVideoList()
|
||||||
|
}
|
||||||
|
if (op.type == '1') {
|
||||||
|
if (this.param.subject == '2') {
|
||||||
|
this.title = '科二基础项目讲解'
|
||||||
|
} else {
|
||||||
|
this.title = '科三基础项目讲解'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.title = '基础操作讲解'
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
getScrollLeft() {
|
||||||
|
const index = this.currentIndex - 1 < 0 ? 0 : this.currentIndex - 1
|
||||||
|
return 164 * index
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
formateTime(time) {
|
||||||
|
const h = parseInt(time / 3600)
|
||||||
|
const minute = parseInt(time / 60 % 60)
|
||||||
|
const second = Math.ceil(time % 60)
|
||||||
|
const hours = h < 10 ? '0' + h : h
|
||||||
|
const formatSecond = second > 59 ? 59 : second
|
||||||
|
return `${hours > 0 ? `${hours}:` : ''}${minute < 10 ? '0' + minute : minute}:${formatSecond < 10 ? '0' + formatSecond : formatSecond}`
|
||||||
|
},
|
||||||
|
getVideoList() {
|
||||||
|
queryProjectList({
|
||||||
|
"carTypeId": storage.get('carType') || '1001',
|
||||||
|
...this.param,
|
||||||
|
}).then(resp => {
|
||||||
|
if(resp.code==='0000'){
|
||||||
|
let arr=[]
|
||||||
|
if(this.param.type=='1'){
|
||||||
|
arr = JSON.parse(JSON.stringify(resp.data))
|
||||||
|
arr = arr.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
videoUrl: item.videoList[0]?.videoUrl,
|
||||||
|
videoTime: this.formateTime(item.videoList[0]?.videoTime)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
arr = JSON.parse(JSON.stringify(resp.data[0].videoList))
|
||||||
|
arr = arr.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
projectId: item.videoId,
|
||||||
|
subDesc: resp.data[0].description,
|
||||||
|
videoTime: this.formateTime(item.videoTime)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.videoList = arr
|
||||||
|
this.currentIndex = this.videoList.findIndex(item => item.projectId == this.projectId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
checkTest(val) {
|
checkTest(val) {
|
||||||
this.videoIndex = val
|
this.videoIndex = val
|
||||||
},
|
},
|
||||||
checkVideo(val) {
|
checkVideo(val) {
|
||||||
this.nowVideo=val
|
this.popupShow = false
|
||||||
|
this.projectId = val
|
||||||
|
this.currentIndex = this.videoList.findIndex(item => item.projectId == this.projectId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,6 +223,22 @@
|
|||||||
background: #00B74F;
|
background: #00B74F;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.topic_cont_text {
|
||||||
|
width: 260rpx;
|
||||||
|
height:45rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-all;
|
||||||
|
/* break-all(允许在单词内换行。) */
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* 超出部分省略号 */
|
||||||
|
/* display: -webkit-box; */
|
||||||
|
white-space: nowrap;
|
||||||
|
-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
|
||||||
|
-webkit-line-clamp:1; /** 显示的行数 **/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.playLogo {
|
.playLogo {
|
||||||
width: 90rpx;
|
width: 90rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
@@ -148,6 +252,7 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
top: 0
|
top: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
.play_btn {
|
.play_btn {
|
||||||
width: 65rpx;
|
width: 65rpx;
|
||||||
height: 65rpx;
|
height: 65rpx;
|
||||||
@@ -155,6 +260,7 @@
|
|||||||
left: 97.5rpx;
|
left: 97.5rpx;
|
||||||
top: 39.5rpx
|
top: 39.5rpx
|
||||||
}
|
}
|
||||||
|
|
||||||
.play_btn_2 {
|
.play_btn_2 {
|
||||||
width: 65rpx;
|
width: 65rpx;
|
||||||
height: 65rpx;
|
height: 65rpx;
|
||||||
@@ -162,12 +268,14 @@
|
|||||||
left: 117.5rpx;
|
left: 117.5rpx;
|
||||||
top: 52rpx
|
top: 52rpx
|
||||||
}
|
}
|
||||||
|
|
||||||
.pic {
|
.pic {
|
||||||
width: 300rpx;
|
width: 300rpx;
|
||||||
height: 169rpx;
|
height: 169rpx;
|
||||||
background: #00B74F;
|
background: #00B74F;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab_iem {
|
.tab_iem {
|
||||||
width: 145rpx;
|
width: 145rpx;
|
||||||
height: 56rpx;
|
height: 56rpx;
|
||||||
@@ -177,8 +285,32 @@
|
|||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
color: #333
|
color: #333
|
||||||
}
|
}
|
||||||
|
|
||||||
.checked_tab {
|
.checked_tab {
|
||||||
background: linear-gradient(90deg, #11DF20 0%, #01B74F 100%);
|
background: linear-gradient(90deg, #11DF20 0%, #01B74F 100%);
|
||||||
color: #fff
|
color: #fff
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*scroll-view外层*/
|
||||||
|
.skill-sequence-panel-content-wrapper {
|
||||||
|
position: relative;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*scroll-view本身*/
|
||||||
|
.skill-sequence-panel-content {
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*scroll-view内层*/
|
||||||
|
.skill-sequence-skill-wrapper {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
.hide {
|
||||||
|
backface-visibility: hidden;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
-webkit-backface-visibility: hidden;
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -5,21 +5,22 @@
|
|||||||
</u-sticky>
|
</u-sticky>
|
||||||
<view class="p14">
|
<view class="p14">
|
||||||
<view class="top_box">
|
<view class="top_box">
|
||||||
<view class="tip_box flex ai-c jc-sb" v-if="tIndex==0">
|
<view class="tip_box flex ai-c jc-sb" v-if="tIndex==0&&showTip">
|
||||||
<view class="flex ai-c">
|
<view class="flex ai-c">
|
||||||
<u-icon name="error-circle-fill" color="#FF6E02" size="18"></u-icon>
|
<u-icon name="error-circle-fill" color="#FF6E02" size="18"></u-icon>
|
||||||
<text class="ml10 fs12" style="color: #FF6E02;">{{title}}</text>
|
<text class="ml10 fs12" style="color: #FF6E02;">{{title}}</text>
|
||||||
</view>
|
</view>
|
||||||
<u-icon name="close" color="#FF6E02" size="18"></u-icon>
|
<u-icon name="close" color="#FF6E02" size="18" @tap="showTip=false"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="p14">
|
<view class="p14">
|
||||||
<text class="fs18 cor-000 fw600">{{tIndex==0?'错题':'收藏'}}情况</text>
|
<text class="fs18 cor-000 fw600">{{tIndex==0?'错题':'收藏'}}情况</text>
|
||||||
<view class="total_box mt10">
|
<view class="total_box mt10" @tap="toPractice">
|
||||||
<view class="flex ai-c jc-sb">
|
<view class="flex ai-c jc-sb">
|
||||||
<view class="text-center">
|
<view class="text-center">
|
||||||
<view style="width: 111rpx;" class="fs30 cor-000">4</view>
|
<view style="width: 111rpx;" class="fs30 cor-000">{{tIndex==0?wrongList.length:collectList.length}}
|
||||||
</view>
|
</view>
|
||||||
<view style="text-align: right;flex-direction: column;justify-content: right" class="flex ai-c" @tap="toPractice">
|
</view>
|
||||||
|
<view style="text-align: right;flex-direction: column;justify-content: right" class="flex ai-c">
|
||||||
<u-icon name="arrow-right" size="18"></u-icon>
|
<u-icon name="arrow-right" size="18"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -28,55 +29,49 @@
|
|||||||
<text class="fs14 cor-666">全部{{tIndex==0?'错题':'收藏'}}</text>
|
<text class="fs14 cor-666">全部{{tIndex==0?'错题':'收藏'}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view style="text-align: right;flex-direction: column;justify-content: right" class="flex ai-c">
|
<view style="text-align: right;flex-direction: column;justify-content: right" class="flex ai-c">
|
||||||
<text v-if="tIndex==0" class="fs14 cor-666">错4/已做100</text>
|
<text v-if="tIndex==0"
|
||||||
|
class="fs14 cor-666">错{{wrongList.length}}/已做{{wrongList.length+rightList.length}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="yellow_box" v-if="tIndex==0">
|
<view class="yellow_box" v-if="tIndex==0&&getPercent>10">
|
||||||
<view class="flex jc-sb ai-c">
|
<view class="flex jc-sb ai-c">
|
||||||
<view>
|
<view>
|
||||||
<text class="fs24 fw600" style="color: #FF6E02;">32%</text><text class="fs18 cor-000 fw600">错题率</text>
|
<text class="fs24 fw600" style="color: #FF6E02;">{{getPercent}}%</text><text
|
||||||
|
class="fs18 cor-000 fw600">错题率</text>
|
||||||
<view class="fs14 cor-000">错题率有点高,快去提升吧</view>
|
<view class="fs14 cor-000">错题率有点高,快去提升吧</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="width: 156rpx;">
|
<!-- <view style="width: 156rpx;">
|
||||||
<button class="riseBtn">马上提升</button>
|
<button class="riseBtn">马上提升</button>
|
||||||
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<!-- <view class="flex jc-sb ai-c mt10" v-if="tIndex==0">
|
||||||
<view class="flex jc-sb ai-c mt10" v-if="tIndex==0">
|
|
||||||
<text>答对后自动移除错题</text>
|
<text>答对后自动移除错题</text>
|
||||||
<u-switch v-model="isMoveWrong" activeColor="#0BD032"></u-switch>
|
<u-switch v-model="isMoveWrong" activeColor="#0BD032"></u-switch>
|
||||||
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<!-- <view class="ml15 text-center">
|
||||||
<view style="margin-top: 30rpx;" v-if="tIndex==0">
|
|
||||||
<view class="video-box">
|
|
||||||
<view class="flex jc-sb ai-c wp100">
|
|
||||||
<text style="color: #05C341;font-size: 36rpx;">科一精品视频课</text>
|
|
||||||
<text class="cor-666 fs12">全部10节课 ></text>
|
|
||||||
</view>
|
|
||||||
<view class="flex ai-c mt20">
|
|
||||||
<image class="contain-box" src="../../static/image/index/index_bg.png"></image>
|
|
||||||
<view class="ml15 text-center">
|
|
||||||
<u-button :customStyle="{width:'200rpx',height:'66rpx',borderRadius: '33rpx'}" iconColor="#fff"
|
<u-button :customStyle="{width:'200rpx',height:'66rpx',borderRadius: '33rpx'}" iconColor="#fff"
|
||||||
text="去看视频" color="linear-gradient(90deg, #11DF20 0%, #00B74F 100%)" icon="play-circle">
|
text="去看视频" color="linear-gradient(90deg, #11DF20 0%, #00B74F 100%)" icon="play-circle">
|
||||||
</u-button>
|
</u-button>
|
||||||
<view class="cor-333 fs15 fw600 mt10">科一易错试题</view>
|
<view class="cor-333 fs15 fw600 mt10">科{{subject==1?'一':'四'}}易错试题</view>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="top_box mt15 p14" v-if="typeList&&typeList.length">
|
||||||
|
|
||||||
</view>
|
|
||||||
<view class="top_box mt15 p14">
|
|
||||||
<view class="flex jc-sb aic">
|
<view class="flex jc-sb aic">
|
||||||
<text class="fs18 cor-000 fw600">{{tIndex==0?'错题':'收藏题'}}分类</text>
|
<text class="fs18 cor-000 fw600">{{tIndex==0?'错题':'收藏题'}}分类</text>
|
||||||
<u-icon name="arrow-right" size="18"></u-icon>
|
<!-- <u-icon name="arrow-right" size="18"></u-icon> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c jc-sb" style="flex-wrap: wrap;">
|
<view class="flex ai-c jc-sb mt10" style="flex-wrap: wrap;">
|
||||||
<view v-for="(item,index) of typeList" :key="index" class="category_item p14 flex jc-sb ai-c mb10">
|
<!-- 这个点击效果没加 -->
|
||||||
<text class="cor-000">{{item.typeName}}</text>
|
<view v-for="(item,index) of typeList" :key="index" class="category_item p14 flex jc-sb ai-c mb10" @tap="toCategoryQuestion(item)">
|
||||||
<text class="cor-666">{{item.typeNum}}</text>
|
<view class="topic_cont_text" style="max-width: 75%;">
|
||||||
|
<text class="cor-000">{{item.categoryName}}</text>
|
||||||
|
</view>
|
||||||
|
<text class="cor-666">{{item.num}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -85,44 +80,109 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
mapState,
|
||||||
|
mapActions
|
||||||
|
} from 'pinia' //引入映射函数
|
||||||
|
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||||
|
import storage from '@/jtools/storage';
|
||||||
|
import {
|
||||||
|
questionCategory
|
||||||
|
} from '@/jtools/api/question';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
showTip: true,
|
||||||
|
collectList: [],
|
||||||
|
rightList: storage.get(`rightList_subject${this.subject}`) || [],
|
||||||
|
wrongList: storage.get(`wrongList_subject${this.subject}`) || [],
|
||||||
|
subject: 0,
|
||||||
tIndex: 0,
|
tIndex: 0,
|
||||||
isMoveWrong: true,
|
isMoveWrong: true,
|
||||||
title: '重要提示:所有错题做对,再去考试!',
|
title: '重要提示:所有错题做对,再去考试!',
|
||||||
categoryList: [{
|
categoryList: [{
|
||||||
name: '错题本'
|
name: '错题本'
|
||||||
},{name:'收藏夹'}],
|
|
||||||
typeList:[{
|
|
||||||
typeName:'驾驶证审验注销',
|
|
||||||
typeNum:1
|
|
||||||
}, {
|
}, {
|
||||||
typeName:'机动车强制报废',
|
name: '收藏夹'
|
||||||
typeNum:2
|
}],
|
||||||
},{
|
typeList: []
|
||||||
typeName:'驾驶证审验注销',
|
}
|
||||||
typeNum:1
|
},
|
||||||
},{
|
onLoad(op) {
|
||||||
typeName:'机动车强制报废',
|
if (op.subject) {
|
||||||
typeNum:2
|
this.subject = op.subject
|
||||||
},{
|
this.rightList = storage.get(`rightList_subject${this.subject}`) || []
|
||||||
typeName:'驾驶证审验注销',
|
this.wrongList = storage.get(`wrongList_subject${this.subject}`) || []
|
||||||
typeNum:1
|
this.collectList = storage.get(`collectList_subject${this.subject}`) || []
|
||||||
},{
|
this.getQuestionCategory()
|
||||||
typeName:'机动车强制报废',
|
}
|
||||||
typeNum:2
|
},
|
||||||
}]
|
computed: {
|
||||||
|
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4"]), //映射函数,取出tagslist
|
||||||
|
getPercent() {
|
||||||
|
return ((this.wrongList.length / (this.wrongList.length + this.rightList.length)) * 100).toFixed(0)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getQuestionCategory() {
|
||||||
|
const param = {}
|
||||||
|
if (this.tIndex == 0) {
|
||||||
|
param.questionIdList = this.wrongList
|
||||||
|
} else {
|
||||||
|
param.questionIdList = this.collectList
|
||||||
|
}
|
||||||
|
questionCategory(param).then(resp => {
|
||||||
|
this.typeList = resp.data
|
||||||
|
})
|
||||||
|
},
|
||||||
tabChange(val) {
|
tabChange(val) {
|
||||||
this.tIndex = val.index
|
this.tIndex = val.index
|
||||||
|
this.getQuestionCategory()
|
||||||
|
},
|
||||||
|
toCategoryQuestion(item){
|
||||||
|
const jsonString = JSON.stringify(item.errorQuestionIdList)
|
||||||
|
console.log(item);
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/questionBank/questionBank?navTitle=" + item.categoryName + "&questionIdList=" + jsonString+"&subject="+this.subject
|
||||||
|
})
|
||||||
},
|
},
|
||||||
toPractice() {
|
toPractice() {
|
||||||
const navTitle = this.tIndex == 0 ? '错题本' : '收藏夹'
|
const navTitle = this.tIndex == 0 ? '错题本' : '收藏夹'
|
||||||
|
let arr=[]
|
||||||
|
if (navTitle == '错题本') {
|
||||||
|
arr = this.wrongList
|
||||||
|
if (!this.wrongList.length) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '当前无错题,继续保持吧~',
|
||||||
|
showCancel: false,
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log('用户点击确定');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else if (navTitle == '收藏夹') {
|
||||||
|
arr=this.collectList
|
||||||
|
if (!this.collectList.length) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '当前无收藏题~',
|
||||||
|
showCancel: false,
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log('用户点击确定');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const listJson=JSON.stringify(arr)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/questionBank/questionBank?navTitle="+navTitle
|
url: "/pages/questionBank/questionBank?navTitle=" + navTitle + "&subject=" + this.subject+"&questionIdList="+listJson
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,23 +194,27 @@
|
|||||||
background: linear-gradient(90deg, #11DF20 0%, #00B74F 100%) !important;
|
background: linear-gradient(90deg, #11DF20 0%, #00B74F 100%) !important;
|
||||||
bottom: 14rpx !important;
|
bottom: 14rpx !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top_box {
|
.top_box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #FDFDFD;
|
background: #FDFDFD;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tip_box {
|
.tip_box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #FFE6D4;
|
background: #FFE6D4;
|
||||||
border-radius: 20rpx 20rpx 0rpx 0rpx;
|
border-radius: 20rpx 20rpx 0rpx 0rpx;
|
||||||
padding: 10px 14px;
|
padding: 10px 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.total_box {
|
.total_box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #F5F5F5;
|
background: #F5F5F5;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.yellow_box {
|
.yellow_box {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
@@ -158,6 +222,7 @@
|
|||||||
background: linear-gradient(90deg, #FBF2D4 0%, #F7E4B5 100%);
|
background: linear-gradient(90deg, #FBF2D4 0%, #F7E4B5 100%);
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.riseBtn {
|
.riseBtn {
|
||||||
width: 156rpx;
|
width: 156rpx;
|
||||||
height: 56rpx;
|
height: 56rpx;
|
||||||
@@ -169,6 +234,7 @@
|
|||||||
color: #FF6E02;
|
color: #FF6E02;
|
||||||
border-radius: 28rpx;
|
border-radius: 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-box {
|
.video-box {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
width: 694rpx;
|
width: 694rpx;
|
||||||
@@ -184,12 +250,35 @@
|
|||||||
background: #00B74F;
|
background: #00B74F;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category_item {
|
.category_item {
|
||||||
width: 312rpx;
|
width: 310rpx;
|
||||||
height: 90rpx;
|
height: 90rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 90rpx;
|
line-height: 90rpx;
|
||||||
background: #F5F5F5;
|
background: #F5F5F5;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.play_btn_2 {
|
||||||
|
width: 65rpx;
|
||||||
|
height: 65rpx;
|
||||||
|
position: absolute;
|
||||||
|
left: 165.5rpx;
|
||||||
|
top: 78rpx
|
||||||
|
}
|
||||||
|
.topic_cont_text {
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-all;
|
||||||
|
/* break-all(允许在单词内换行。) */
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* 超出部分省略号 */
|
||||||
|
display: -webkit-box;
|
||||||
|
/** 对象作为伸缩盒子模型显示 **/
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
/** 设置或检索伸缩盒对象的子元素的排列方式 **/
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
/** 显示的行数 **/
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
BIN
src/static/image/index/danxuan.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
BIN
src/static/image/index/jpsp.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
src/static/image/index/panduan.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
src/static/image/index/paysucess.jpg
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
src/static/image/index/tupian.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 46 KiB |
BIN
src/static/image/index/vip_ksxj.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
src/static/image/index/vip_trueRoom.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
src/static/image/mine/callme.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 5.9 KiB |
11
src/uni_modules/g-preview-img/changelog.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
## 1.0.4(2022-12-07)
|
||||||
|
修改:判断在APP端不监听document的滚动
|
||||||
|
## 1.0.3(2022-12-05)
|
||||||
|
新增:支持视频预览,视频图片混用
|
||||||
|
新增:支持预览单张,handlePreviewImg方法直接传入图片或视频地址即可单张预览
|
||||||
|
## 1.0.2(2022-12-05)
|
||||||
|
|
||||||
|
## 1.0.1(2022-12-05)
|
||||||
|
文档错误修改
|
||||||
|
## 1.0.0(2022-11-29)
|
||||||
|
初始化插件
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
<template>
|
||||||
|
<view class="pos">
|
||||||
|
<uni-transition :mode-class="modeClass" :show="show">
|
||||||
|
<!-- 多张图片预览 -->
|
||||||
|
<view class="content" @tap="closedPreview">
|
||||||
|
<swiper
|
||||||
|
class="swiper"
|
||||||
|
circular
|
||||||
|
:current="curDot"
|
||||||
|
@change="swiperChange"
|
||||||
|
:indicator-dots="false"
|
||||||
|
>
|
||||||
|
<swiper-item v-for="(item, idx) in selfImgList" :key="idx">
|
||||||
|
<movable-area scale-area>
|
||||||
|
<movable-view
|
||||||
|
:scale="!disabledScale"
|
||||||
|
direction="all"
|
||||||
|
scale="true"
|
||||||
|
scale-min="0.5"
|
||||||
|
scale-max="5"
|
||||||
|
:scale-value="1"
|
||||||
|
damping="150"
|
||||||
|
friction="15"
|
||||||
|
>
|
||||||
|
<image v-if="isImg(item)" :src="item" mode="widthFix"></image>
|
||||||
|
<view class="video-preview" v-else>
|
||||||
|
<video
|
||||||
|
:autoplay="true"
|
||||||
|
:src="item"
|
||||||
|
:enable-progress-gesture="false"
|
||||||
|
:show-fullscreen-btn="false"
|
||||||
|
></video>
|
||||||
|
</view>
|
||||||
|
</movable-view>
|
||||||
|
</movable-area>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
<!-- 指示器 -->
|
||||||
|
<slot name="indicator" v-if="imgList.length > 1 && !indicatorDotsType">
|
||||||
|
<view class="current-dot">
|
||||||
|
<view class="change-buttom" @tap.stop="previousImg">
|
||||||
|
<uni-icons class="font-white" type="back" size="30"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="font-white cur">
|
||||||
|
{{ curDot + 1 }}/{{ imgList.length }}
|
||||||
|
</view>
|
||||||
|
<view class="change-buttom" @tap.stop="nextImg">
|
||||||
|
<uni-icons class="font-white" type="forward" size="30"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</slot>
|
||||||
|
</uni-transition>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
// 过渡效果
|
||||||
|
modeClass: {
|
||||||
|
type: Array,
|
||||||
|
default: ['fade', 'zoom-out'],
|
||||||
|
},
|
||||||
|
// 指示器类型 true 圆点 false 数字
|
||||||
|
indicatorDotsType: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
// 图片列表
|
||||||
|
imgList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
// 是否禁止放大缩小 禁止后swiper可以滑动切换
|
||||||
|
disabledScale: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
curDot: 0,
|
||||||
|
selfImgList: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
isImg() {
|
||||||
|
return (src) => {
|
||||||
|
return src.indexOf('.mp4') === -1 ? true : false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
//监听打开时阻止下面元素的滚动事件
|
||||||
|
/* #ifdef APP-PLUS*/
|
||||||
|
show(val) {
|
||||||
|
if (val) {
|
||||||
|
document
|
||||||
|
.getElementsByClassName('pos')[0]
|
||||||
|
.addEventListener('touchmove', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* #endif */
|
||||||
|
imgList: {
|
||||||
|
handler(val) {
|
||||||
|
if (val.length) {
|
||||||
|
this.selfImgList = val.concat();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handlePreviewImg(param) {
|
||||||
|
this.show = !this.show;
|
||||||
|
if (typeof param === 'string') {
|
||||||
|
this.selfImgList = [param];
|
||||||
|
} else {
|
||||||
|
if (param) {
|
||||||
|
this.curDot = param;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$emit('preview', this.show);
|
||||||
|
},
|
||||||
|
closedPreview() {
|
||||||
|
this.show = !this.show;
|
||||||
|
this.curDot = 0;
|
||||||
|
this.$emit('preview', this.show);
|
||||||
|
},
|
||||||
|
swiperChange(e) {
|
||||||
|
this.curDot = e.detail.current;
|
||||||
|
this.$emit('changeImg', e.detail.current);
|
||||||
|
},
|
||||||
|
previousImg() {
|
||||||
|
let num = this.imgList.length - 1;
|
||||||
|
if (this.curDot <= 0) {
|
||||||
|
this.curDot = num;
|
||||||
|
} else {
|
||||||
|
this.curDot--;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nextImg() {
|
||||||
|
let num = this.imgList.length - 1;
|
||||||
|
if (this.curDot >= num) {
|
||||||
|
this.curDot = 0;
|
||||||
|
} else {
|
||||||
|
this.curDot++;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
movable-view {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
movable-area {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
movable-view image {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: #00000076;
|
||||||
|
}
|
||||||
|
.pos {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
.swiper {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.current-dot {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10%;
|
||||||
|
left: 25%;
|
||||||
|
width: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
.change-buttom {
|
||||||
|
padding: 10rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #3f3f3f;
|
||||||
|
}
|
||||||
|
.cur {
|
||||||
|
font-size: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-white {
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
::v-deep {
|
||||||
|
.uni-swiper-dots-horizontal {
|
||||||
|
bottom: 12%;
|
||||||
|
}
|
||||||
|
.uni-swiper-dot {
|
||||||
|
width: 10rpx;
|
||||||
|
height: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni-video {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.video-preview {
|
||||||
|
position: relative;
|
||||||
|
.video-close {
|
||||||
|
position: absolute;
|
||||||
|
right: 50rpx;
|
||||||
|
top: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
84
src/uni_modules/g-preview-img/package.json
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
{
|
||||||
|
"id": "g-preview-img",
|
||||||
|
"displayName": "g-preview-img一款兼容vue2,vue3的图片预览插件,视频预览,支持单张多张,左右滑动,放大缩小",
|
||||||
|
"version": "1.0.4",
|
||||||
|
"description": "g-preview-img一款兼容vue2,vue3的图片预览插件,视频预览,支持单张多张,左右滑动,放大缩小",
|
||||||
|
"keywords": [
|
||||||
|
"vue2",
|
||||||
|
"vue3",
|
||||||
|
"图片预览",
|
||||||
|
"视频预览"
|
||||||
|
],
|
||||||
|
"repository": "",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.1.0"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"type": "component-vue",
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": ""
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "y"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "y"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "y",
|
||||||
|
"微信浏览器(Android)": "y",
|
||||||
|
"QQ浏览器(Android)": "y"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "y",
|
||||||
|
"IE": "y",
|
||||||
|
"Edge": "y",
|
||||||
|
"Firefox": "y",
|
||||||
|
"Safari": "y"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "u",
|
||||||
|
"阿里": "u",
|
||||||
|
"百度": "u",
|
||||||
|
"字节跳动": "u",
|
||||||
|
"QQ": "u",
|
||||||
|
"钉钉": "u",
|
||||||
|
"快手": "u",
|
||||||
|
"飞书": "u",
|
||||||
|
"京东": "u"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
64
src/uni_modules/g-preview-img/readme.md
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|

|
||||||
|
### 一款兼容vue2,vue3的图片预览插件,视频预览,支持图片视频混用,支持单张多张,左右滑动,放大缩小
|
||||||
|
|
||||||
|
### 基础使用方法
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
<template>
|
||||||
|
|
||||||
|
<image v-for="(item,idx) in imgList" :src="item" :key="idx" @tap="handleClick(idx)"></image>
|
||||||
|
<g-preview-img :imgList="imgList" ref="preview"><g-preview-img>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
const preview = ref(null)
|
||||||
|
const imgList = ['图片路径1','图片路径2']
|
||||||
|
const handleClick = (idx)=>{
|
||||||
|
// idx为要打开的图片的索引,也可以不传,默认打开第一张
|
||||||
|
// handlePreviewImg的参数支持传入单张图片地址或单个视频地址
|
||||||
|
preview.value.handlePreviewImg(idx)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
| 属性名/事件 | 类型 | 默认值 | 说明 |
|
||||||
|
| ----------------- | ------------ | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| modeClass | Array/String | \['fade', 'zoom-out'] | uni-transition组件过渡效果,可选值见 <https://uniapp.dcloud.net.cn/component/uniui/uni-transition.html#mode-class-%E5%86%85%E7%BD%AE%E8%BF%87%E6%B8%A1%E5%8A%A8%E7%94%BB%E7%B1%BB%E5%9E%8B%E8%AF%B4%E6%98%8E> |
|
||||||
|
| indicatorDotsType | Boolean | false | 多张图片的指示器,ture为圆点,false数字,当图片列表只有一张图片时,默认不展示指示器 |
|
||||||
|
| imgList | Array | | 图片列表 |
|
||||||
|
| disabledScale | Boolean | false | 是否禁止双指放大缩小 |
|
||||||
|
| @preview | 打开关闭事件 | | 接受一个参数,ture为开启,false为关闭 |
|
||||||
|
| @changeImg | 图片切换的事件 | | 参数为当前的图片索引 |
|
||||||
|
|
||||||
|
#### 插槽,自定义翻页按钮
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
<g-preview-img :imgList="imgList" ref="preview">
|
||||||
|
<template>
|
||||||
|
<!--你的翻页按钮-->
|
||||||
|
<view @tap.stop="previousImg">上一页</view>
|
||||||
|
<view @tap.stop="nextImg">下一页</view>
|
||||||
|
</template>
|
||||||
|
</g-preview-img>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const preview = ref(null)
|
||||||
|
//上一页的方法
|
||||||
|
const previousImg = ()=>{
|
||||||
|
preview.value.previousImg()
|
||||||
|
}
|
||||||
|
//下一页的方法
|
||||||
|
const previousImg = ()=>{
|
||||||
|
preview.value.nextImg()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 支持uniapp原生swiper的属性
|
||||||
|
|
||||||
|
插件内部swiper标签上绑定了$attrs,所以在使用时可以传入一些swiper的属性
|
||||||
|
注意:不要传disable-touch这个属性,会有意想不到的错误
|
||||||
|
|
||||||
|
**插件bug会及时修复!!**
|
||||||
24
src/uni_modules/q-previewImage/changelog.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
## 1.1.1(2023-08-01)
|
||||||
|
优化文档
|
||||||
|
## 1.1.0(2023-08-01)
|
||||||
|
优化文档
|
||||||
|
## 1.0.9(2023-07-10)
|
||||||
|
优化文档
|
||||||
|
## 1.0.8(2023-06-25)
|
||||||
|
优化文档
|
||||||
|
## 1.0.7(2023-06-25)
|
||||||
|
优化文档
|
||||||
|
## 1.0.6(2023-05-26)
|
||||||
|
优化文档
|
||||||
|
## 1.0.5(2023-05-22)
|
||||||
|
优化文档
|
||||||
|
## 1.0.4(2023-04-30)
|
||||||
|
新增图片放大功能,解决原生组件和tabbar导航栏等无法覆盖的问题
|
||||||
|
## 1.0.3(2023-04-28)
|
||||||
|
优化文档
|
||||||
|
## 1.0.2(2023-04-28)
|
||||||
|
优化文档
|
||||||
|
## 1.0.1(2023-04-28)
|
||||||
|
新增长按事件
|
||||||
|
## 1.0.0(2023-04-28)
|
||||||
|
插件上线
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<template>
|
||||||
|
<view class="previewImage" v-if="show" @tap="close">
|
||||||
|
<view class="page" v-if="urls.length > 0">
|
||||||
|
<text class="text">{{ current + 1 }} / {{ urls.length }}</text>
|
||||||
|
</view>
|
||||||
|
<swiper class="swiper" :current="current" @change="swiperChange" @touchstart="handleTouchStart" @touchend="handleTouchEnd">
|
||||||
|
<swiper-item v-for="(item, index) in urls" :key="index">
|
||||||
|
<movable-area class="movable-area" scale-area>
|
||||||
|
<movable-view class="movable-view" direction="all" :inertia="true" damping="100" scale="true" scale-min="1" scale-max="4" :scale-value="scale">
|
||||||
|
<scroll-view scroll-y="true" class="uni-scroll-view">
|
||||||
|
<view class="scroll-view"><image :key="index" class="image" :src="item" mode="widthFix" @longpress="onLongpress(item)" /></view>
|
||||||
|
</scroll-view>
|
||||||
|
</movable-view>
|
||||||
|
</movable-area>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
urls: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
default: () => {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
current: 0, //当前页
|
||||||
|
scale: 1,
|
||||||
|
isZooming: false // 是否处于缩放状态
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//打开
|
||||||
|
open(current) {
|
||||||
|
this.current = this.urls.findIndex(item => item === current);
|
||||||
|
this.show = true;
|
||||||
|
this.$emit('open');
|
||||||
|
},
|
||||||
|
//关闭
|
||||||
|
close() {
|
||||||
|
if (!this.isZooming) {
|
||||||
|
this.show = false;
|
||||||
|
this.current = 0;
|
||||||
|
this.$emit('close');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//图片改变
|
||||||
|
swiperChange(e) {
|
||||||
|
this.current = e.detail.current;
|
||||||
|
},
|
||||||
|
//监听长按
|
||||||
|
onLongpress(e) {
|
||||||
|
this.$emit('onLongpress', e);
|
||||||
|
},
|
||||||
|
handleTouchStart() {
|
||||||
|
this.isZooming = true;
|
||||||
|
},
|
||||||
|
handleTouchEnd() {
|
||||||
|
this.isZooming = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.previewImage {
|
||||||
|
z-index: 9999;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #000000;
|
||||||
|
.swiper {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
swiper-item {
|
||||||
|
.movable-area {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
.movable-view {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
.scroll-view {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100vh;
|
||||||
|
.image {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.page {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 9999;
|
||||||
|
width: 100%;
|
||||||
|
top: 60rpx;
|
||||||
|
text-align: center;
|
||||||
|
.text {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
padding: 3rpx 16rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
81
src/uni_modules/q-previewImage/package.json
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
"id": "q-previewImage",
|
||||||
|
"displayName": "图片预览、多图左右滑动、图片放大、支持覆盖原生组件、原生导航栏、tabbar",
|
||||||
|
"version": "1.1.1",
|
||||||
|
"description": "最简洁的模拟图片预览,支持长按事件,多图左右滑动,大图上下滑动查看,支持图片放大,支持覆盖原生组件/原生导航栏/tabbar 支持vue2/vue3/app/小程序/h5",
|
||||||
|
"keywords": [
|
||||||
|
"图片预览"
|
||||||
|
],
|
||||||
|
"repository": "",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.4.14"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"type": "component-vue",
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": ""
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "y"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "n"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "u",
|
||||||
|
"微信浏览器(Android)": "u",
|
||||||
|
"QQ浏览器(Android)": "u"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "u",
|
||||||
|
"IE": "u",
|
||||||
|
"Edge": "u",
|
||||||
|
"Firefox": "u",
|
||||||
|
"Safari": "u"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "u",
|
||||||
|
"百度": "u",
|
||||||
|
"字节跳动": "u",
|
||||||
|
"QQ": "u",
|
||||||
|
"钉钉": "u",
|
||||||
|
"快手": "u",
|
||||||
|
"飞书": "u",
|
||||||
|
"京东": "u"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
244
src/uni_modules/q-previewImage/readme.md
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
# 最简洁的模拟图片预览,支持长按事件,多图左右滑动,大图上下滑动查看,支持图片放大,支持覆盖原生组件/原生导航栏/tabbar 支持vue2/vue3/app/小程序/h5
|
||||||
|
|
||||||
|
- 为了解决项目中因一些特殊原因无法使用uni.previewImage,例如App.onShow或者页面的oShow中写了方法。
|
||||||
|
- 如果用uni.previewImage,每次预览图片都会进到onShow的方法里
|
||||||
|
- 可以基本实现官方的预览图片功能,但是体验不如uni.previewImage()
|
||||||
|
- 如没有特殊原因,还是推荐官方的uni.previewImage()
|
||||||
|
|
||||||
|
## 安装指引
|
||||||
|
|
||||||
|
##1. 在插件市场打开本插件页面,在右侧点击`使用 HBuilderX 导入插件`,选择要导入的项目点击确定
|
||||||
|
|
||||||
|
##2. 使用方法 vue2写法
|
||||||
|
|
||||||
|
```
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<video v-if="videoShow" id="myVideo" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" controls></video>
|
||||||
|
<image v-for="(item, index) in imgs" :key="index" :src="item" @click="preview(item)"></image>
|
||||||
|
<q-previewImage ref="previewImage" :urls="imgs" @onLongpress="onLongpress" @open="open" @close="close"></q-previewImage>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
videoShow:true,//video组件是否显示
|
||||||
|
imgs: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
preview(url) {
|
||||||
|
this.imgs = ['https://web-assets.dcloud.net.cn/unidoc/zh/multiport-20210812.png', 'https://web-assets.dcloud.net.cn/unidoc/zh/uni-function-diagram.png'] //设置图片数组
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.previewImage.open(url); // 传入当前选中的图片地址(小程序必须添加$nextTick,解决组件首次加载无图)
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
this.$refs.previewImage.open(url); // 传入当前选中的图片地址
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
onLongpress(e){ //长按事件
|
||||||
|
console.log('当前长按的图片是' + e);
|
||||||
|
uni.showActionSheet({
|
||||||
|
itemList: ['转发给朋友', '保存到手机'],
|
||||||
|
success: function (res) {
|
||||||
|
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
console.log(res.errMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/* open和close方法一般用不到,但是在一些特殊场景会用到,
|
||||||
|
* 比如预览图片时你需要覆盖 NavigationBar和 TabBar,
|
||||||
|
* 或者在app中需要预览图片时覆盖住原生组件,比如video或者map等,
|
||||||
|
* 你可以根据open和close去做一些操作,例如隐藏导航栏或者隐藏一些原生组件等
|
||||||
|
*/
|
||||||
|
open(){ //监听组件显示 (隐藏TabBar和NavigationBar,隐藏video原生组件)
|
||||||
|
// uni.hideTabBar()
|
||||||
|
// uni.setNavigationBarColor({
|
||||||
|
// frontColor: '#000000', // 设置前景色为黑色
|
||||||
|
// backgroundColor: '#000000', // 设置背景色为黑色
|
||||||
|
// })
|
||||||
|
// this.videoShow = false
|
||||||
|
},
|
||||||
|
close(){ //监听组件隐藏 (显示TabBar和NavigationBar,显示video原生组件)
|
||||||
|
// uni.showTabBar()
|
||||||
|
// uni.setNavigationBarColor({
|
||||||
|
// frontColor: '#ffffff', // 设置前景色为白色
|
||||||
|
// backgroundColor: '#000000', // 设置背景色为黑色
|
||||||
|
// })
|
||||||
|
// this.videoShow = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
##3. vue3 setup写法
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<video v-if="videoShow" id="myVideo" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" controls></video>
|
||||||
|
<image v-for="(item, index) in imgs" :key="index" :src="item" @click="preview(item)"></image>
|
||||||
|
<q-previewImage ref="previewImage" :urls="imgs" @onLongpress="onLongpress" @open="open" @close="close"></q-previewImage>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref, toRefs,nextTick } from 'vue';
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
videoShow:true,//video组件是否显示
|
||||||
|
imgs: [],
|
||||||
|
});
|
||||||
|
const previewImage = ref(null);
|
||||||
|
|
||||||
|
const { imgs,videoShow } = toRefs(data)// 解构
|
||||||
|
|
||||||
|
const preview = url => {
|
||||||
|
data.imgs = ['https://web-assets.dcloud.net.cn/unidoc/zh/multiport-20210812.png', 'https://web-assets.dcloud.net.cn/unidoc/zh/uni-function-diagram.png'] //设置图片数组
|
||||||
|
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
nextTick(()=>{
|
||||||
|
previewImage.value.open(url); // 传入当前选中的图片地址(小程序必须添加nextTick,解决组件首次加载无图)
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
previewImage.value.open(url); // 传入当前选中的图片地址
|
||||||
|
// #endif
|
||||||
|
};
|
||||||
|
|
||||||
|
const onLongpress = e =>{
|
||||||
|
console.log('当前长按的图片是' + e);
|
||||||
|
uni.showActionSheet({
|
||||||
|
itemList: ['转发给朋友', '保存到手机'],
|
||||||
|
success: function (res) {
|
||||||
|
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
console.log(res.errMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open和close方法一般用不到,但是在一些特殊场景会用到,
|
||||||
|
* 比如预览图片时你需要覆盖 NavigationBar和 TabBar,
|
||||||
|
* 或者在app中需要预览图片时覆盖住原生组件,比如video或者map等,
|
||||||
|
* 你可以根据open和close去做一些操作,例如隐藏导航栏或者隐藏一些原生组件等
|
||||||
|
*/
|
||||||
|
const open = () => { //监听组件显示 (隐藏TabBar和NavigationBar,隐藏video原生组件)
|
||||||
|
// uni.hideTabBar()
|
||||||
|
// uni.setNavigationBarColor({
|
||||||
|
// frontColor: '#000000', // 设置前景色为黑色
|
||||||
|
// backgroundColor: '#000000', // 设置背景色为黑色
|
||||||
|
// })
|
||||||
|
// data.videoShow = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const close = () => { //监听组件隐藏 (显示TabBar和NavigationBar,显示video原生组件)
|
||||||
|
// uni.showTabBar()
|
||||||
|
// uni.setNavigationBarColor({
|
||||||
|
// frontColor: '#ffffff', // 设置前景色为白色
|
||||||
|
// backgroundColor: '#000000', // 设置背景色为黑色
|
||||||
|
// })
|
||||||
|
// data.videoShow = true
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
##4. 项目示例 (一般返回的数据图片是以逗号或特殊字符分割的字符串,点击时就需要传两个参数,一个是图片数组,一个是当前图片的index)
|
||||||
|
## 注意q-previewImage不要写在循环体中,imgs其实就是用来存放当前图片的数组,每次点击每次赋值就行
|
||||||
|
|
||||||
|
```
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<video v-if="videoShow" id="myVideo" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" controls></video>
|
||||||
|
<view v-for="(item, index) in list" :key="index" class="list">
|
||||||
|
<image :src="i" mode="aspectFill" v-for="(i,imgindex) in item.urls.split(',')" @click.stop="preimg(item.urls.split(','),imgindex)"></image>
|
||||||
|
<view>
|
||||||
|
<q-previewImage ref="previewImage" :urls="imgs" @onLongpress="onLongpress" @open="open" @close="close"></q-previewImage>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
videoShow:true,//是否显示video组件
|
||||||
|
imgs: [],//imgs其实就是用来存放当前图片的数组,每次点击每次赋值就行
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
preimg(urls,index){
|
||||||
|
this.imgs = urls //imgs其实就是用来存放当前图片的数组,每次点击每次赋值就行
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.previewImage.open(this.imgs[index]); // 传入当前选中的图片地址(小程序必须添加$nextTick,解决组件首次加载无图)
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
this.$refs.previewImage.open(this.imgs[index]); // 传入当前选中的图片地址
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
onLongpress(e){ //长按事件
|
||||||
|
console.log('当前长按的图片是' + e);
|
||||||
|
uni.showActionSheet({
|
||||||
|
itemList: ['转发给朋友', '保存到手机'],
|
||||||
|
success: function (res) {
|
||||||
|
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
console.log(res.errMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/* open和close方法一般用不到,但是在一些特殊场景会用到,
|
||||||
|
* 比如预览图片时你需要覆盖 NavigationBar和 TabBar,
|
||||||
|
* 或者在app中需要预览图片时覆盖住原生组件,比如video或者map等,
|
||||||
|
* 你可以根据open和close去做一些操作,例如隐藏导航栏或者隐藏一些原生组件等
|
||||||
|
*/
|
||||||
|
open(){ //监听组件显示 (隐藏TabBar和NavigationBar,隐藏video原生组件)
|
||||||
|
// uni.hideTabBar()
|
||||||
|
// uni.setNavigationBarColor({
|
||||||
|
// frontColor: '#000000', // 设置前景色为黑色
|
||||||
|
// backgroundColor: '#000000', // 设置背景色为黑色
|
||||||
|
// })
|
||||||
|
// this.videoShow = false
|
||||||
|
},
|
||||||
|
close(){ //监听组件隐藏 (显示TabBar和NavigationBar,显示video原生组件)
|
||||||
|
// uni.showTabBar()
|
||||||
|
// uni.setNavigationBarColor({
|
||||||
|
// frontColor: '#ffffff', // 设置前景色为白色
|
||||||
|
// backgroundColor: '#000000', // 设置背景色为黑色
|
||||||
|
// })
|
||||||
|
// this.videoShow = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 如果插件对您有一点帮助,请给个五星好评,感谢支持
|
||||||
|
|
||||||
|
|
||||||
|
## 如有问题,请加qq 965969604
|
||||||