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 @@ ...@@ -17,6 +17,7 @@
} }
} }
ENV_VAR['bmapAK'] = 'lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI' ENV_VAR['bmapAK'] = 'lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI'
ENV_VAR['qn_base_url'] = 'https://qn-static.banshouhui.com/study/'
if (ENV_VAR) { if (ENV_VAR) {
process.uniEnv = {} process.uniEnv = {}
process.uniEnv['node_env'] = NODE_ENV 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 { ...@@ -107,7 +107,6 @@ export default {
font-size: 28rpx; font-size: 28rpx;
text-align: center; text-align: center;
color: #5a6073; color: #5a6073;
text-align: center;
} }
.pop-content { .pop-content {
......
...@@ -132,6 +132,7 @@ export default { ...@@ -132,6 +132,7 @@ export default {
border-radius: 24rpx; border-radius: 24rpx;
.top { .top {
width: 100%; width: 100%;
margin-left: 6rpx;
.avatar { .avatar {
padding-right: 16rpx; padding-right: 16rpx;
.avatar-list { .avatar-list {
...@@ -174,7 +175,6 @@ export default { ...@@ -174,7 +175,6 @@ export default {
.topics { .topics {
flex-flow: column; flex-flow: column;
flex: 1; flex: 1;
padding-left: 40rpx;
border-right: 2rpx solid #e8ebf3; border-right: 2rpx solid #e8ebf3;
.topics-lists { .topics-lists {
width: 100%; width: 100%;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
:is-back="false" :is-back="false"
></u-navbar> ></u-navbar>
<view class="content"> <view class="content">
<view class="exam-title-view"> <view class="exam-title-view" @click="$u.throttle(handleSelect, 500)">
<image class="titleImage" :src="imageUrl"></image> <image class="titleImage" :src="imageUrl"></image>
<text>{{ title }}</text> <text>{{ title }}</text>
<u-icon class="icon-view" name="arrow-up-fill"></u-icon> <u-icon class="icon-view" name="arrow-up-fill"></u-icon>
...@@ -72,7 +72,10 @@ ...@@ -72,7 +72,10 @@
<u-icon class="arrow-right" name="arrow-right"></u-icon> <u-icon class="arrow-right" name="arrow-right"></u-icon>
</view> </view>
</view> </view>
<SubjectStatistics :info="info"></SubjectStatistics> <SubjectStatistics
:info="info"
@answer="handleAnswer"
></SubjectStatistics>
</view> </view>
</view> </view>
</template> </template>
...@@ -131,35 +134,35 @@ export default { ...@@ -131,35 +134,35 @@ export default {
subItems() { subItems() {
return [ return [
{ {
pathName: 'warehouse/index', pathName: 'pages/xxx/xxx',
title: '专项练习', title: '专项练习',
value: '', value: '',
icon: this.imageUrl, icon: this.imageUrl,
imageStyle: 'width:60rpx;height:60rpx', imageStyle: 'width:60rpx;height:60rpx',
}, },
{ {
pathName: 'warehouse/spare', pathName: 'pages/xxx/xxx',
title: '我的错题', title: '我的错题',
value: '', value: '',
icon: this.imageUrl, icon: this.imageUrl,
imageStyle: 'width:60rpx;height:60rpx', imageStyle: 'width:60rpx;height:60rpx',
}, },
{ {
pathName: 'warehouse/return', pathName: 'pages/xxx/xxx',
title: '收藏的题', title: '收藏的题',
value: '', value: '',
icon: this.imageUrl, icon: this.imageUrl,
imageStyle: 'width:60rpx;height:60rpx', imageStyle: 'width:60rpx;height:60rpx',
}, },
{ {
pathName: 'warehouse/records', pathName: 'pages/xxx/xxx',
title: '我的成绩', title: '我的成绩',
value: '', value: '',
icon: this.imageUrl, icon: this.imageUrl,
imageStyle: 'width:60rpx;height:60rpx', imageStyle: 'width:60rpx;height:60rpx',
}, },
{ {
pathName: 'warehouse/records', pathName: 'pages/xxx/xxx',
title: '搜索试题', title: '搜索试题',
value: '', value: '',
icon: this.imageUrl, icon: this.imageUrl,
...@@ -169,7 +172,37 @@ export default { ...@@ -169,7 +172,37 @@ export default {
}, },
}, },
onLoad() {}, 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> </script>
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
></u-navbar> ></u-navbar>
<view> <view>
<view class="category-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> </view>
<view class="label-title"> <view class="label-title">
...@@ -41,8 +42,8 @@ ...@@ -41,8 +42,8 @@
<script> <script>
import QuestionBankCell from '@/components/question-bank-cell' import QuestionBankCell from '@/components/question-bank-cell'
const key2 = '2' const key2 = 'sub-category'
const key3 = '3' const key3 = 'sub-sub-category'
export default { export default {
components: { components: {
QuestionBankCell, QuestionBankCell,
...@@ -68,6 +69,9 @@ export default { ...@@ -68,6 +69,9 @@ export default {
borderRadius: '12rpx', borderRadius: '12rpx',
} }
}, },
shangyijiImage() {
return process.uniEnv.qn_base_url + 'shangyiji-w.png'
},
}, },
onLoad(e) { onLoad(e) {
this.getPageInfo() this.getPageInfo()
...@@ -145,12 +149,24 @@ export default { ...@@ -145,12 +149,24 @@ export default {
align-items: center; align-items: center;
text-align: center; text-align: center;
border-radius: 12rpx; border-radius: 12rpx;
font-size: 36rpx;
font-weight: bold;
background-color: #ffffff; background-color: #ffffff;
height: 112rpx;
position: relative;
color: #2953ff; color: #2953ff;
height: 160rpx; .category-text {
padding: 0 60rpx; 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 { .label-title {
font-size: 32rpx; font-size: 32rpx;
......
...@@ -86,9 +86,9 @@ let r = require('../../libs/bmap-wx.min.js') ...@@ -86,9 +86,9 @@ let r = require('../../libs/bmap-wx.min.js')
let h = new r.BMapWX({ let h = new r.BMapWX({
ak: process.uniEnv.bmapAK, ak: process.uniEnv.bmapAK,
}) })
const key1 = '1' const key1 = 'category'
const key2 = '2' const key2 = 'sub-category'
const key3 = '3' const key3 = 'sub-sub-category'
export default { export default {
components: { components: {
PopView, PopView,
......
...@@ -9,26 +9,34 @@ ...@@ -9,26 +9,34 @@
title-bold title-bold
></u-navbar> ></u-navbar>
<!-- 标签列表 --> <!-- 标签列表 -->
<view class="select-category-content"> <scroll-view
<view v-for="(item, key) in labels" :key="key" class="label-list"> class="select-category-content"
<view class="label-title" v-if="key == secondKey"> scroll-y
<!-- 品类title --> :scroll-into-view="scrollId"
<view>{{ titles[key] }}</view> >
</view> <view v-for="(items, key) in labels" :key="key" class="label-list">
<view class="label-content"> <view v-for="(list, index) in items" :key="index" class="label-list">
<view v-for="(label, ind) in item" :key="ind" class="label-item"> <view class="label-title" :id="key + index">
<!-- 选中为蓝底,非选中状态为白底 --> <!-- 品类title -->
<view <view>{{
:class="[ key == secondKey ? labels[firstKey][0][index].name : '非煤矿类'
'label-normal', }}</view>
{ </view>
selected: label.id == selected[key].id, <view class="label-content">
wide: key == secondKey, <view v-for="(label, ind) in list" :key="ind" class="label-item">
}, <!-- 选中为蓝底,非选中状态为白底 -->
]" <view
@click="handleClick(key, label)" :class="[
> 'label-normal',
<text class="label-text">{{ label.name }}</text> {
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> </view>
</view> </view>
...@@ -37,27 +45,20 @@ ...@@ -37,27 +45,20 @@
<view class="tag-loading-view" v-if="tapLoading"> <view class="tag-loading-view" v-if="tapLoading">
<u-loading mode="flower"></u-loading> <u-loading mode="flower"></u-loading>
</view> </view>
<!-- 无数据 --> </scroll-view>
<view
class="tag-loading-view"
v-else-if="item.length <= 0 && titles[key]"
>{{ '暂无' + selected[key1].name }}</view
>
</view>
</view> </view>
</template> </template>
<script> <script>
const key1 = '1' const key1 = 'category'
const key2 = '2' const key2 = 'sub-category'
export default { export default {
data() { data() {
return { return {
firstLoad: true, // 初次加载
labels: { labels: {
// 标签列表 // 标签列表
[key1]: [], // 一级品类列表 [key1]: [[]], // 一级品类列表
[key2]: [], // 二级品类列表 [key2]: [[], [], []], // 二级品类列表
}, },
selected: { selected: {
// 选中的标签 // 选中的标签
...@@ -65,31 +66,27 @@ export default { ...@@ -65,31 +66,27 @@ export default {
[key2]: {}, // 选中的二级品类 [key2]: {}, // 选中的二级品类
}, },
tapLoading: true, tapLoading: true,
scrollId: '',
} }
}, },
computed: { computed: {
// 品类title firstKey() {
titles() { return key1
return {
[key1]: '', // 一级品类title
[key2]: this.selected[key1].name, // 二级品类title
}
}, },
secondKey() { secondKey() {
return key2 return key2
}, },
}, },
onLoad(e) { onLoad(e) {
this.loadLabel(key1) // 获取一级标签 this.loadLabel() // 获取标签
}, },
methods: { methods: {
// 选中标签 // 选中标签
handleClick(key, label) { handleClick(key, ind, label) {
this.selected[key] = label this.selected[key] = label
if (key == key1) { if (key == key1) {
// 选中一级标签 // 选中一级标签
this.selected[key2] = {} // 清空选二级标签 this.scrollId = key2 + ind
this.loadLabel(key2, label.id) // 获取二级标签
} else { } else {
// 选中二级标签 // 选中二级标签
this.setPageInfo(this.selected) this.setPageInfo(this.selected)
...@@ -98,12 +95,9 @@ export default { ...@@ -98,12 +95,9 @@ export default {
}) })
} }
}, },
/**
* @description 获取合作商或品牌列表 // 获取品类
* @property {String} key 哪一级品类 loadLabel() {
* @property {String} selectedId 需要获取二级品类列表时,选中的一级品类的id
*/
loadLabel(key, selectedId) {
// async loadLabel(key, selectedId) { // async loadLabel(key, selectedId) {
// this.tapLoading = true; // this.tapLoading = true;
// let param = {}; // let param = {};
...@@ -115,23 +109,73 @@ export default { ...@@ -115,23 +109,73 @@ export default {
// this.tapLoading = false // this.tapLoading = false
// if (res && res.code == 200) { // if (res && res.code == 200) {
// this.labels[key] = res.data || []; // this.labels[key] = res.data || [];
this.tapLoading = false
for (var i = 0; i < 10; i++) { this.labels = {
// 测试模拟多条数据 [key1]: [
this.labels[key].push({ [
name: '特种作业人员', {
id: i, 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 this.selected[key1] = this.labels[key1][0][0]
if (this.labels[key].length > 0) {
this.selected[key] = this.labels[key][0]
this.loadLabel(key2, this.selected[key].id)
}
}
// } // }
}, },
// 本页数据设置,用于其他页面访问本页数据 // 本页数据设置,用于其他页面访问本页数据
...@@ -159,6 +203,8 @@ export default { ...@@ -159,6 +203,8 @@ export default {
padding: 0 0 30rpx 24rpx; padding: 0 0 30rpx 24rpx;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
position: relative;
.label-list { .label-list {
margin-bottom: 20rpx; margin-bottom: 20rpx;
.label-title { .label-title {
...@@ -211,12 +257,12 @@ export default { ...@@ -211,12 +257,12 @@ export default {
} }
.tag-loading-view { .tag-loading-view {
display: flex; display: flex;
position: absolute;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-top: 400rpx; top: 400rpx;
color: #999999; color: #999999;
text-align: center; text-align: center;
position: absolute;
width: 100%; width: 100%;
padding-right: 11rpx; 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