Commit 61dad72b authored by Damon's avatar Damon

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

parents 2845c03e 974eb1f5
......@@ -17,6 +17,7 @@
}
}
ENV_VAR['bmapAK'] = 'lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI'
ENV_VAR['qn_base_url'] = 'https://qn-static.banshouhui.com/study/'
if (ENV_VAR) {
process.uniEnv = {}
process.uniEnv['node_env'] = NODE_ENV
......
<template>
<u-mask :show="show" :mask-close-able="false" :customStyle="customStyle">
<view class="tip-view">
<view class="tip-content">
<image class="tip-image" :src="imageUrl"></image>
<view class="tip-message">
<text>{{ message }}</text>
</view>
<view class="tip-btn-view">
<u-button
:custom-style="buttonStyle"
shape="circle"
type="primary"
@click="handleClick"
>
{{ buttonText }}
</u-button>
</view>
</view>
</view>
</u-mask>
</template>
<script>
/**
* @description 创建一个遮罩层,提示文字和图片
* @property {Boolean} visible 是否显示遮罩(默认false)
* @property {Object} custom-style 自定义样式对象,见上方说明
* @example <answer-operation-tips :show.sync="show"></answer-operation-tips>
*/
export default {
props: {
show: {
type: Boolean,
default: false,
},
message: {
type: String,
default: '左右滑动可切换上下题',
},
buttonText: {
type: String,
default: '我知道了',
},
customStyle: {
type: Object,
default() {
return {}
},
},
},
data() {
return {}
},
computed: {
imageUrl() {
return '/static/logo.png'
},
buttonStyle() {
return {
backgroundColor: '#FFFFFF',
width: '304rpx',
height: '104rpx',
color: '#2953FF',
fontWeight: 'bold',
fontSize: '32rpx',
}
},
},
methods: {
handleClick() {
this.$emit('update:show', false)
this.$emit('click')
},
},
}
</script>
<style lang="scss" scoped>
.tip-view {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
.tip-content {
margin-top: 200rpx;
text-align: center;
.tip-image {
width: 670rpx;
height: 136rpx;
margin-bottom: 60rpx;
}
.tip-message {
font-size: 44rpx;
text-align: center;
color: #ffffff;
font-weight: bold;
}
.tip-btn-view {
padding-top: 288rpx;
}
}
}
</style>
......@@ -107,7 +107,6 @@ export default {
font-size: 28rpx;
text-align: center;
color: #5a6073;
text-align: center;
}
.pop-content {
......
......@@ -132,6 +132,7 @@ export default {
border-radius: 24rpx;
.top {
width: 100%;
margin-left: 6rpx;
.avatar {
padding-right: 16rpx;
.avatar-list {
......@@ -174,7 +175,6 @@ export default {
.topics {
flex-flow: column;
flex: 1;
padding-left: 40rpx;
border-right: 2rpx solid #e8ebf3;
.topics-lists {
width: 100%;
......
......@@ -10,7 +10,7 @@
:is-back="false"
></u-navbar>
<view class="content">
<view class="exam-title-view">
<view class="exam-title-view" @click="$u.throttle(handleSelect, 500)">
<image class="titleImage" :src="imageUrl"></image>
<text>{{ title }}</text>
<u-icon class="icon-view" name="arrow-up-fill"></u-icon>
......@@ -72,7 +72,10 @@
<u-icon class="arrow-right" name="arrow-right"></u-icon>
</view>
</view>
<SubjectStatistics :info="info"></SubjectStatistics>
<SubjectStatistics
:info="info"
@answer="handleAnswer"
></SubjectStatistics>
</view>
</view>
</template>
......@@ -131,35 +134,35 @@ export default {
subItems() {
return [
{
pathName: 'warehouse/index',
pathName: 'pages/xxx/xxx',
title: '专项练习',
value: '',
icon: this.imageUrl,
imageStyle: 'width:60rpx;height:60rpx',
},
{
pathName: 'warehouse/spare',
pathName: 'pages/xxx/xxx',
title: '我的错题',
value: '',
icon: this.imageUrl,
imageStyle: 'width:60rpx;height:60rpx',
},
{
pathName: 'warehouse/return',
pathName: 'pages/xxx/xxx',
title: '收藏的题',
value: '',
icon: this.imageUrl,
imageStyle: 'width:60rpx;height:60rpx',
},
{
pathName: 'warehouse/records',
pathName: 'pages/xxx/xxx',
title: '我的成绩',
value: '',
icon: this.imageUrl,
imageStyle: 'width:60rpx;height:60rpx',
},
{
pathName: 'warehouse/records',
pathName: 'pages/xxx/xxx',
title: '搜索试题',
value: '',
icon: this.imageUrl,
......@@ -169,7 +172,37 @@ export default {
},
},
onLoad() {},
methods: {},
onShow() {
let pages = getCurrentPages()
let page = pages[pages.length - 1]
let info = page.info
if (info) {
this.selected = info
page.info = null
}
},
methods: {
handleSelect() {
// if (this.vuex_token) {
var str = this.selected ? 'selectedList' : 'addExam'
this.$u.route({
url: 'pages/learn/' + str,
})
// } else {
// this.$u.route({ url: 'pages/login/index' })
// }
},
handleAnswer() {},
handleClick(path) {
// if (this.vuex_token) {
this.$u.route({
url: path,
})
// } else {
// this.$u.route({ url: 'pages/login/index' })
// }
},
},
}
</script>
......
......@@ -10,7 +10,8 @@
></u-navbar>
<view>
<view class="category-view">
<text>{{ category.name }}</text>
<image class="image-view" :src="shangyijiImage"></image>
<text class="category-text">{{ category.name }}</text>
</view>
</view>
<view class="label-title">
......@@ -41,8 +42,8 @@
<script>
import QuestionBankCell from '@/components/question-bank-cell'
const key2 = '2'
const key3 = '3'
const key2 = 'sub-category'
const key3 = 'sub-sub-category'
export default {
components: {
QuestionBankCell,
......@@ -68,6 +69,9 @@ export default {
borderRadius: '12rpx',
}
},
shangyijiImage() {
return process.uniEnv.qn_base_url + 'shangyiji-w.png'
},
},
onLoad(e) {
this.getPageInfo()
......@@ -145,12 +149,24 @@ export default {
align-items: center;
text-align: center;
border-radius: 12rpx;
font-size: 36rpx;
font-weight: bold;
background-color: #ffffff;
height: 112rpx;
position: relative;
color: #2953ff;
height: 160rpx;
padding: 0 60rpx;
.category-text {
padding: 0 60rpx;
font-size: 28rpx;
font-weight: bold;
word-break: break-all;
z-index: 1;
}
.image-view {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
}
.label-title {
font-size: 32rpx;
......
......@@ -86,9 +86,9 @@ let r = require('../../libs/bmap-wx.min.js')
let h = new r.BMapWX({
ak: process.uniEnv.bmapAK,
})
const key1 = '1'
const key2 = '2'
const key3 = '3'
const key1 = 'category'
const key2 = 'sub-category'
const key3 = 'sub-sub-category'
export default {
components: {
PopView,
......
......@@ -9,26 +9,34 @@
title-bold
></u-navbar>
<!-- 标签列表 -->
<view class="select-category-content">
<view v-for="(item, key) in labels" :key="key" class="label-list">
<view class="label-title" v-if="key == secondKey">
<!-- 品类title -->
<view>{{ titles[key] }}</view>
</view>
<view class="label-content">
<view v-for="(label, ind) in item" :key="ind" class="label-item">
<!-- 选中为蓝底,非选中状态为白底 -->
<view
:class="[
'label-normal',
{
selected: label.id == selected[key].id,
wide: key == secondKey,
},
]"
@click="handleClick(key, label)"
>
<text class="label-text">{{ label.name }}</text>
<scroll-view
class="select-category-content"
scroll-y
:scroll-into-view="scrollId"
>
<view v-for="(items, key) in labels" :key="key" class="label-list">
<view v-for="(list, index) in items" :key="index" class="label-list">
<view class="label-title" :id="key + index">
<!-- 品类title -->
<view>{{
key == secondKey ? labels[firstKey][0][index].name : '非煤矿类'
}}</view>
</view>
<view class="label-content">
<view v-for="(label, ind) in list" :key="ind" class="label-item">
<!-- 选中为蓝底,非选中状态为白底 -->
<view
:class="[
'label-normal',
{
selected: label.id == selected[key].id,
wide: key == secondKey,
},
]"
@click="handleClick(key, ind, label)"
>
<text class="label-text">{{ label.name }}</text>
</view>
</view>
</view>
</view>
......@@ -37,27 +45,20 @@
<view class="tag-loading-view" v-if="tapLoading">
<u-loading mode="flower"></u-loading>
</view>
<!-- 无数据 -->
<view
class="tag-loading-view"
v-else-if="item.length <= 0 && titles[key]"
>{{ '暂无' + selected[key1].name }}</view
>
</view>
</scroll-view>
</view>
</template>
<script>
const key1 = '1'
const key2 = '2'
const key1 = 'category'
const key2 = 'sub-category'
export default {
data() {
return {
firstLoad: true, // 初次加载
labels: {
// 标签列表
[key1]: [], // 一级品类列表
[key2]: [], // 二级品类列表
[key1]: [[]], // 一级品类列表
[key2]: [[], [], []], // 二级品类列表
},
selected: {
// 选中的标签
......@@ -65,31 +66,27 @@ export default {
[key2]: {}, // 选中的二级品类
},
tapLoading: true,
scrollId: '',
}
},
computed: {
// 品类title
titles() {
return {
[key1]: '', // 一级品类title
[key2]: this.selected[key1].name, // 二级品类title
}
firstKey() {
return key1
},
secondKey() {
return key2
},
},
onLoad(e) {
this.loadLabel(key1) // 获取一级标签
this.loadLabel() // 获取标签
},
methods: {
// 选中标签
handleClick(key, label) {
handleClick(key, ind, label) {
this.selected[key] = label
if (key == key1) {
// 选中一级标签
this.selected[key2] = {} // 清空选二级标签
this.loadLabel(key2, label.id) // 获取二级标签
this.scrollId = key2 + ind
} else {
// 选中二级标签
this.setPageInfo(this.selected)
......@@ -98,12 +95,9 @@ export default {
})
}
},
/**
* @description 获取合作商或品牌列表
* @property {String} key 哪一级品类
* @property {String} selectedId 需要获取二级品类列表时,选中的一级品类的id
*/
loadLabel(key, selectedId) {
// 获取品类
loadLabel() {
// async loadLabel(key, selectedId) {
// this.tapLoading = true;
// let param = {};
......@@ -115,23 +109,73 @@ export default {
// this.tapLoading = false
// if (res && res.code == 200) {
// this.labels[key] = res.data || [];
for (var i = 0; i < 10; i++) {
// 测试模拟多条数据
this.labels[key].push({
name: '特种作业人员',
id: i,
})
this.tapLoading = false
this.labels = {
[key1]: [
[
{
name: '特种作业人员',
id: 'c-0',
},
{
name: '特种作业人员1',
id: 'c-1',
},
{
name: '特种作业人员2',
id: 'c-2',
},
],
],
[key2]: [
[
{
name: '0-登高架设作业-0',
id: 'c-00',
},
{
name: '0-登高架设作业-1',
id: 'c-01',
},
{
name: '0-登高架设作业-2',
id: 'c-02',
},
],
[
{
name: '1-登高架设作业-0',
id: 'c-10',
},
{
name: '1-登高架设作业-1',
id: 'c-11',
},
{
name: '1-登高架设作业-2',
id: 'c-12',
},
],
[
{
name: '2-登高架设作业-0',
id: 'c-20',
},
{
name: '2-登高架设作业-1',
id: 'c-21',
},
{
name: '2-登高架设作业-3',
id: 'c-22',
},
],
],
}
// 初次进入页面,需要获取二级品类列表
if (this.firstLoad && key == key1) {
this.firstLoad = false
if (this.labels[key].length > 0) {
this.selected[key] = this.labels[key][0]
this.loadLabel(key2, this.selected[key].id)
}
}
this.selected[key1] = this.labels[key1][0][0]
// }
},
// 本页数据设置,用于其他页面访问本页数据
......@@ -159,6 +203,8 @@ export default {
padding: 0 0 30rpx 24rpx;
height: 100%;
overflow: auto;
position: relative;
.label-list {
margin-bottom: 20rpx;
.label-title {
......@@ -211,12 +257,12 @@ export default {
}
.tag-loading-view {
display: flex;
position: absolute;
align-items: center;
justify-content: center;
margin-top: 400rpx;
top: 400rpx;
color: #999999;
text-align: center;
position: absolute;
width: 100%;
padding-right: 11rpx;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment