优化代码
This commit is contained in:
parent
af094e55b0
commit
de61f9db80
@ -117,7 +117,10 @@ module.exports = {
|
||||
}
|
||||
return arr
|
||||
},
|
||||
|
||||
//过滤html
|
||||
filterHtml(html) {
|
||||
return html.replace(/<[^>]+>/g, "")
|
||||
},
|
||||
// 秒数转时分秒格式
|
||||
sec_to_time(s) {
|
||||
var t;
|
||||
|
@ -54,6 +54,18 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tn-padding-sm tn-margin-xs" @click="goPage('/pages/wrong/index')">
|
||||
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
|
||||
<view
|
||||
class="icon15__item--image tn-flex tn-flex-row-center tn-flex-col-center tn-shadow-blur tn-color-white">
|
||||
<image src="/static/img/3.png" style="width: 100%;height: 100%"></image>
|
||||
</view>
|
||||
|
||||
<view class="tn-text-center">
|
||||
<text class="tn-text-ellipsis" style="font-size: 28rpx">错题本</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tn-padding-sm tn-margin-xs" @click="goPage('/pages/index/news-detail?id=1')">
|
||||
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
|
||||
<view
|
||||
@ -90,18 +102,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="tn-padding-sm tn-margin-xs" @click="goPage('/pages/wrong/index')">
|
||||
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
|
||||
<view
|
||||
class="icon15__item--image tn-flex tn-flex-row-center tn-flex-col-center tn-shadow-blur tn-color-white">
|
||||
<image src="/static/img/3.png" style="width: 100%;height: 100%"></image>
|
||||
</view>
|
||||
|
||||
<view class="tn-text-center">
|
||||
<text class="tn-text-ellipsis" style="font-size: 28rpx">错题本</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@ -124,9 +125,7 @@
|
||||
<image class="question-bank-image" :src="imgUrl + item.image"
|
||||
mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="question-bank-title">
|
||||
{{ item.text }}
|
||||
</view>
|
||||
<view v-html="item.text" class="question-bank-title"></view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
@ -1146,9 +1145,9 @@ export default {
|
||||
|
||||
.question-bank-title {
|
||||
padding: 15rpx;
|
||||
font-size: 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
display: flex;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 题库卡片样式 end */
|
||||
|
@ -117,7 +117,6 @@ export default {
|
||||
newsApi.getNewsDetail(this, {
|
||||
id: id
|
||||
}).then(res => {
|
||||
s
|
||||
if (res && res.data) {
|
||||
this.newsData = res.data
|
||||
}
|
||||
|
@ -1,136 +1,155 @@
|
||||
<template>
|
||||
<view style="padding: 30rpx; background-color: #FAFAFA; min-height: 100vh;">
|
||||
<view style="display: flex;align-items: center;">
|
||||
<view @click="show = true"
|
||||
style="display: flex;align-items: center; border: 2rpx solid #1A73E8; border-radius: 32rpx; padding: 8rpx 24rpx; color: #1A73E8; background: #fff; font-weight: 500; box-shadow: 0 2rpx 8rpx rgba(26,115,232,0.08); cursor: pointer; transition: background 0.2s;">
|
||||
<view style="margin-right: 8rpx;">更多题库</view>
|
||||
<view>
|
||||
<text class="tn-icon-down-triangle"
|
||||
style="font-size: 24rpx; color: #1A73E8; position: relative;"></text>
|
||||
<view>
|
||||
<view style="padding: 30rpx; background-color: #FAFAFA; min-height: 100vh;">
|
||||
<view style="display: flex;align-items: center;">
|
||||
<view @click="show = true"
|
||||
style="display: flex;align-items: center; border: 2rpx solid #1A73E8; border-radius: 32rpx; padding: 8rpx 24rpx; color: #1A73E8; background: #fff; font-weight: 500; box-shadow: 0 2rpx 8rpx rgba(26,115,232,0.08); cursor: pointer; transition: background 0.2s;">
|
||||
<view style="margin-right: 8rpx;">更多题库</view>
|
||||
<view>
|
||||
<text class="tn-icon-down-triangle"
|
||||
style="font-size: 24rpx; color: #1A73E8; position: relative;"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
style="display: inline-block; position: relative;padding-left: 30rpx;font-size: 32rpx;font-weight: bold;">
|
||||
<text>{{ info.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: inline-block; position: relative;padding-left: 30rpx;font-size: 32rpx;font-weight: bold;">
|
||||
<text>{{ info.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view style="padding: 20rpx 0px;margin-top: 30rpx;">
|
||||
<view v-for="item in info.children" style="margin-bottom: 40rpx;">
|
||||
<view @click="goTrain(item.value, item.text, item.type)"
|
||||
style="display: flex;justify-content: space-between;align-items: center; background: #fff; border-radius: 16rpx; box-shadow: 0 4rpx 16rpx rgba(26,115,232,0.06); padding: 30rpx;">
|
||||
<view style="display: flex;align-items: center;">
|
||||
<view
|
||||
style="height: 40rpx;width: 40rpx;background-color: #1A73E8;border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24rpx; font-weight: bold;">
|
||||
题
|
||||
</view>
|
||||
<view style="padding-left: 32rpx;">
|
||||
<view style="font-size: 32rpx; font-weight: bold; color: #222;">{{ item.text }}</view>
|
||||
<view style="color: #999999;font-size: 24rpx;padding-top: 8rpx;">题目数量:{{ item.count }}道
|
||||
<view style="padding: 20rpx 0px;margin-top: 30rpx;">
|
||||
<view v-for="item in info.children" style="margin-bottom: 40rpx;">
|
||||
<view @click="goTrain(item.value, item.text, item.type)"
|
||||
style="display: flex;justify-content: space-between;align-items: center; background: #fff; border-radius: 16rpx; box-shadow: 0 4rpx 16rpx rgba(26,115,232,0.06); padding: 30rpx;">
|
||||
<view style="display: flex;align-items: center;">
|
||||
<view
|
||||
style="height: 40rpx;width: 40rpx;background-color: #1A73E8;border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24rpx; font-weight: bold;">
|
||||
题
|
||||
</view>
|
||||
<view style="padding-left: 32rpx;">
|
||||
<view style="font-size: 32rpx; font-weight: bold; color: #222;">{{ item.text }}</view>
|
||||
<view style="color: #999999;font-size: 24rpx;padding-top: 8rpx;">题目数量:{{ item.count }}道
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 1会员 2不是会员 -->
|
||||
<view v-if="item.type == 2"
|
||||
style="width: 110rpx;background: #1A73E8; color: #fff; border-radius: 24rpx; padding: 4rpx 28rpx; font-size: 26rpx; font-weight: 500; letter-spacing: 2rpx;">
|
||||
免费</view>
|
||||
<view v-else
|
||||
style="width: 110rpx;background: #f39c12; color: #fff; border-radius: 24rpx; padding: 4rpx 28rpx; font-size: 26rpx; font-weight: 500; letter-spacing: 2rpx;">
|
||||
会员</view>
|
||||
</view>
|
||||
<!-- 1会员 2不是会员 -->
|
||||
<view v-if="item.type == 2"
|
||||
style="background: #1A73E8; color: #fff; border-radius: 24rpx; padding: 4rpx 28rpx; font-size: 26rpx; font-weight: 500; letter-spacing: 2rpx;">
|
||||
免费</view>
|
||||
<view v-else
|
||||
style="background: #f39c12; color: #fff; border-radius: 24rpx; padding: 4rpx 28rpx; font-size: 26rpx; font-weight: 500; letter-spacing: 2rpx;">
|
||||
会员</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<tn-popup v-model="show" mode="left" width="550rpx"
|
||||
:style="'border-radius:32rpx 0 0 32rpx; box-shadow: 0 8rpx 32rpx rgba(26,115,232,0.12); overflow: hidden;'">
|
||||
<view style="padding: 30rpx;">
|
||||
<view v-for="item in cateList" @click="getTree(item)"
|
||||
style="margin-bottom: 40rpx;padding:25rpx 20rpx;text-align: center;background-color: #F3F5F7;border-radius: 60rpx; font-size: 28rpx; color: #1A73E8;">
|
||||
{{ item.text }}
|
||||
</view>
|
||||
</view>
|
||||
</tn-popup>
|
||||
</view>
|
||||
<tn-popup v-model="show" mode="left" width="550rpx"
|
||||
:style="'border-radius:32rpx 0 0 32rpx; box-shadow: 0 8rpx 32rpx rgba(26,115,232,0.12); overflow: hidden;'">
|
||||
<view style="padding: 30rpx;">
|
||||
<view v-for="item in cateList" @click="getTree(item)"
|
||||
style="margin-bottom: 40rpx;padding:25rpx 20rpx;text-align: center;background-color: #F3F5F7;border-radius: 60rpx; font-size: 28rpx; color: #1A73E8;">
|
||||
{{ item.text }}</view>
|
||||
</view>
|
||||
</tn-popup>
|
||||
<view @click="openCtj()"
|
||||
style="position: fixed;left:0;right: 0;bottom: 5%;;background-color: #1A73E8;text-align: center;width: 90%;margin: 0 auto;height: 90rpx;line-height: 90rpx;color: #FFFFFF">
|
||||
本章错题集</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import newsApi from "@/common/api/news.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
id: 0,
|
||||
cateList: [],
|
||||
info: {},
|
||||
vip: 0,
|
||||
}
|
||||
},
|
||||
onLoad(op) {
|
||||
console.log(op);
|
||||
this.id = op.id;
|
||||
this.getCate();
|
||||
this.getIsUser();
|
||||
},
|
||||
methods: {
|
||||
getTree(item) {
|
||||
this.info = item;
|
||||
this.show = false;
|
||||
},
|
||||
getIsUser() {
|
||||
newsApi.ifUserMember(this, {}).then(res => {
|
||||
//0 不是会员
|
||||
console.log(res);
|
||||
this.vip = res.code;
|
||||
})
|
||||
},
|
||||
getCate() {
|
||||
this.http('cate/getThree', {
|
||||
kind: 'QUESTION',
|
||||
}).then(res => {
|
||||
this.cateList = res.data;
|
||||
this.info = res.data.find(item => item.value == this.id);
|
||||
})
|
||||
},
|
||||
goTrain(id, name, type) {
|
||||
if (type == 1 && this.vip == 0) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '该题库仅限会员可用,请联系客服开通会员!',
|
||||
confirmText: '联系客服',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: '18903795988' //仅为示例
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
import newsApi from "@/common/api/news.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
id: 0,
|
||||
cateList: [],
|
||||
info: {},
|
||||
vip: 0,
|
||||
}
|
||||
},
|
||||
onLoad(op) {
|
||||
console.log(op);
|
||||
this.id = op.id;
|
||||
this.getCate();
|
||||
this.getIsUser();
|
||||
},
|
||||
methods: {
|
||||
openCtj(){
|
||||
const values = this.info.children?.map(item => item.value).join(',') || '';
|
||||
console.log(values);
|
||||
uni.navigateTo({
|
||||
url:"/pages/wrong/index?cate_ids="+values
|
||||
})
|
||||
},
|
||||
getTree(item) {
|
||||
this.info = item;
|
||||
this.show = false;
|
||||
},
|
||||
getIsUser() {
|
||||
newsApi.ifUserMember(this, {}).then(res => {
|
||||
//0 不是会员
|
||||
console.log(res);
|
||||
this.vip = res.code;
|
||||
})
|
||||
},
|
||||
getCate() {
|
||||
this.http('cate/getThree', {
|
||||
kind: 'QUESTION',
|
||||
}).then(res => {
|
||||
//过滤里面的text
|
||||
res.data.forEach(item => {
|
||||
item.text = item.text.replace(/<[^>]+>/g, "")
|
||||
})
|
||||
this.cateList = res.data;
|
||||
this.info = res.data.find(item => item.value == this.id);
|
||||
})
|
||||
},
|
||||
goTrain(id, name, type) {
|
||||
if (type == 1 && this.vip == 0) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '该题库仅限会员可用,请联系客服开通会员!',
|
||||
confirmText: '联系客服',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: '18903795988' //仅为示例
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.utils.goto('train?cateId=' + id + '&cateName=' + name + '&mode=normal')
|
||||
}
|
||||
this.utils.goto('train?cateId=' + id + '&cateName=' + name + '&mode=normal')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #FAFAFA;
|
||||
}
|
||||
page {
|
||||
background-color: #FAFAFA;
|
||||
}
|
||||
|
||||
/* 统一字体和颜色 */
|
||||
body,
|
||||
view,
|
||||
text {
|
||||
font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
|
||||
color: #222;
|
||||
}
|
||||
/* 统一字体和颜色 */
|
||||
body,
|
||||
view,
|
||||
text {
|
||||
font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
/* 主题色变量可用于后续扩展 */
|
||||
:root {
|
||||
--theme-color: #1A73E8;
|
||||
}
|
||||
/* 主题色变量可用于后续扩展 */
|
||||
:root {
|
||||
--theme-color: #1A73E8;
|
||||
}
|
||||
|
||||
/* 适当增加全局间距 */
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* 适当增加全局间距 */
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 注释:如需进一步美化可在此扩展 */
|
||||
/* 注释:如需进一步美化可在此扩展 */
|
||||
</style>
|
@ -29,19 +29,16 @@
|
||||
@click="checkPay">{{btnText}}</tui-button>
|
||||
</view> -->
|
||||
|
||||
<view class="tn-margin-top-sm">
|
||||
<view class="tn-margin-top-sm" style="padding-bottom: 230rpx;">
|
||||
<view class="tn-flex tn-flex-wrap tn-margin-sm">
|
||||
<block v-for="(item, index) in cateList" :key="index">
|
||||
<view style="width: 50%">
|
||||
<view class="question-bank-card tn-margin-xs"
|
||||
@click="checkPay(item.value)">
|
||||
<view class="question-bank-card tn-margin-xs" @click="checkPay(item.value)">
|
||||
<view class="question-bank-image-wrapper">
|
||||
<image class="question-bank-image" :src="imgUrl + item.image" mode="aspectFill">
|
||||
</image>
|
||||
</view>
|
||||
<view class="question-bank-title">
|
||||
{{ item.text }}
|
||||
</view>
|
||||
<view v-html="item.text" class="question-bank-title"></view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
@ -299,41 +296,43 @@ export default {
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tn-radio__label {
|
||||
color: #333 !important;
|
||||
font-size: 15px !important;
|
||||
}
|
||||
|
||||
/* 题库卡片样式 start */
|
||||
.question-bank-card {
|
||||
background-color: #ffffff;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
background-color: #ffffff;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
.question-bank-card:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
.question-bank-card:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.question-bank-image-wrapper {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
.question-bank-image-wrapper {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
.question-bank-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.question-bank-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.question-bank-title {
|
||||
padding: 15rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
display: flex;
|
||||
}
|
||||
/* 题库卡片样式 end */
|
||||
.question-bank-title {
|
||||
padding: 15rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 题库卡片样式 end */
|
||||
</style>
|
@ -20,15 +20,17 @@
|
||||
over: 0,
|
||||
questionIds: [],
|
||||
showNodata: false,
|
||||
cate_ids:'',
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.cate_ids=e.cate_ids;
|
||||
this.questionIds = e.question_ids
|
||||
this.ajax()
|
||||
},
|
||||
methods: {
|
||||
ajax() {
|
||||
this.http('question/wrongList', {page:this.page, question_ids: this.questionIds}, 'post').then(res => {
|
||||
this.http('question/wrongList', {page:this.page, question_ids: this.questionIds,cate_ids:this.cate_ids}, 'post').then(res => {
|
||||
if (res.code == 0) {
|
||||
this.utils.toast(res.msg)
|
||||
setTimeout(() => {
|
||||
|
@ -36,7 +36,7 @@
|
||||
<!-- 联系电话 -->
|
||||
<tn-form-item label="手机号码" prop="phone" class="form-item-vertical" required>
|
||||
<tn-input v-model="form.phone" type="number" placeholder="请输入手机号码" :border="false"
|
||||
:placeholderStyle="placeholderStyle" maxlength="11" @blur="validatePhone" />
|
||||
:placeholderStyle="placeholderStyle" maxlength="11"/>
|
||||
</tn-form-item>
|
||||
|
||||
<!-- 上传蓝底电子版照片 -->
|
||||
@ -671,18 +671,10 @@ export default {
|
||||
leijishijian: '', // 累计从事本职业时间
|
||||
pxjd: '' // 培训基地
|
||||
}
|
||||
|
||||
// 清空用户协议选择
|
||||
this.agreementChecked = []
|
||||
|
||||
// 清空日期选择器状态
|
||||
this.datePickerShow = false
|
||||
|
||||
uni.showToast({
|
||||
title: '表单已重置',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user