Commit bd13d3c8 by 李伟康

commit 提交

1 parent f8a73771
......@@ -10,10 +10,10 @@ const configModule = 'app-tape'
const configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`;
/**获取mock数据 */
const getMockData = async () => {
const getMockData = async (immediate = false) => {
const MOCKDATA = uni.$storage.get('mock_data')
try {
if (MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) {
if (!immediate && MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) {
return Promise.resolve(MOCKDATA);
} else {
if (!serverConfig.mockRequestCount) {
......
......@@ -15,7 +15,7 @@
>文件夹</view>
<template v-for="(i,index) in data">
<view
:class="['item', {active: i.id == id} ]"
:class="['item', {active: i[idKey] == id} ]"
:key="index"
@click="jump(i)"
>
......@@ -60,7 +60,11 @@ export default {
type: String,
data: Array,
id: [String, Number],
showPayBtn: Boolean
showPayBtn: Boolean,
idKey: {
type: String,
default: 'id'
}
},
data () {
return {
......
......@@ -45,7 +45,7 @@
<template v-if="type != 'preview'">
<tool-box
ref="toolRef"
:data="media"
:data="toolList"
:type="type"
@choose="choose"
@finish="open"
......@@ -60,9 +60,7 @@
<view :class="['sprite-icon', `${!drawStatus ? 'icon-pen' : 'icon-pen-active'}`]"> </view>
</view>
</template>
<pay-pop
ref="pay"
></pay-pop>
<pay-pop ref="pay"></pay-pop>
<finish-step
ref="stepRef"
@submit="done"
......@@ -92,7 +90,8 @@ export default {
type: {
type: String,
default: 'preview'
}
},
toolList: Array
},
data () {
return {
......
......@@ -19,11 +19,17 @@
:style="i.style"
@click="toDetail(i)"
>
<image
class="item-img"
:src="i.thumbnail"
mode="scaleToFill"
/>
<template v-if="i.showTitle">
<view class="item-text flex">{{i.title}}</view>
</template>
<template v-else>
<image
class="item-img"
:src="i.thumbnail"
mode="scaleToFill"
@error="errorImg(index)"
/>
</template>
</view>
</template>
</view>
......@@ -32,6 +38,7 @@
:id.sync="id"
:media="moduleList"
:type.sync="type"
:toolList="toolList"
@back="back"
@done="done"
ref="detail"
......@@ -55,6 +62,7 @@ export default {
data () {
return {
moduleList: [],
toolList: [],
id: "",
type: "",
chooseItem: {},
......@@ -111,8 +119,7 @@ export default {
},
// 查询素材
async getSoure () {
let moduleList = await uni.$api.commonApi.findSoureList();
//
let { moduleList, toolList } = await uni.$api.systemApi.getMockData(true);
moduleList.map((e, index) => {
if (index == 3) e.class = 'vertical'
else if (index == 2) e.class = 'square'
......@@ -126,9 +133,14 @@ export default {
6: 'display:none;'
}[index]
}
e.showTitle = false
});
console.log(moduleList)
this.moduleList = moduleList;
this.moduleList = moduleList
this.toolList = toolList
},
errorImg (index) {
this.moduleList[index].showTitle = true
},
async start () {
const result = await this.$permision.requestAndroidPermission(
......@@ -234,8 +246,8 @@ export default {
<style scoped lang="scss">
.module-box {
padding-top: 44rpx;
&::after{
content: '';
&::after {
content: "";
display: block;
clear: both;
}
......@@ -243,12 +255,19 @@ export default {
float: left;
border-radius: 48rpx;
overflow: hidden;
margin:0 48rpx 48rpx 0;
margin: 0 48rpx 48rpx 0;
&-img {
width: 100%;
height: 100%;
vertical-align: top;
}
&-text {
width: 100%;
height: 100%;
background: #999;
justify-content: center;
color: #fff;
}
}
.landscape {
height: 312rpx;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!