Commit 8e4481b3 authored by Facius's avatar Facius

feat: 广告改为动态返回

parent 1949c9e6
;(function() {
let NODE_ENV = 'prod' // dev:开发环境 | test:测试环境 | prod:生产环境
let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null
let VERSION = 'v1.3.1'
if (process.env.NODE_ENV === 'development') {
......
......@@ -128,9 +128,12 @@ let learnApiFun = function(vm) {
await vm.$u.post('/rest/reward/receive/award', params)
// 获取问卷回答状态
let answerStatus = async (params = {}) =>
await vm.$u.get('/rest/survey/answer/status', params)
// let answerStatus = async (params = {}) =>
// await vm.$u.get('/rest/survey/answer/status', params)
//
let getAdvertisementList = async (params = {}) =>
await vm.$u.get('/rest/ad/config/1', params)
const learnApi = {
getQuestion,
getQuestionTotal,
......@@ -160,7 +163,8 @@ let learnApiFun = function(vm) {
examCancel,
submitSurvey,
receiveAward,
answerStatus
// answerStatus
getAdvertisementList
}
return learnApi
}
......
<template>
<view class="wrap">
<u-swiper :list="list" @click="handleClick" height="180" border-radius="16" :mode="mode"></u-swiper>
<u-swiper :list="list" name="subjectUrl" @click="handleClick" height="180" border-radius="16" :mode="mode"></u-swiper>
</view>
</template>
<script>
export default {
props: {
list: {
type: Array,
default() {
return []
},
},
},
data() {
return {
list: [{
image: process.uniEnv.qn_base_url + 'wenjuandatiguagngao.jpg',
id: 1
}
],
}
},
created() {
......@@ -36,7 +39,7 @@
},
handleClick(index) {
console.log(index)
this.$emit('click', this.list[index].id)
this.$emit('click', this.list[index])
}
}
}
......
......@@ -87,7 +87,7 @@ export default {
computed: {
wenjuandatiImage() {
return process.uniEnv.qn_base_url + 'wenjuandati.jpg'
return process.uniEnv.qn_base_url + 'wenjuanzhutu.jpg'
},
checked() {
var count = 0
......@@ -136,6 +136,7 @@ export default {
}
},
methods: {
/*
queryQuestionWarehouseById(id) {
// 埋点-调查问卷信息信息
// let trackParams = {
......@@ -153,7 +154,7 @@ export default {
.catch((err) => {
console.log(err)
})
},
},*/
handleChange(event, index, i) {
for (var question of this.list[index].answerList) {
question.checked = false
......
......@@ -61,7 +61,7 @@ export default {
},
computed: {
lingqujiangliImage() {
return process.uniEnv.qn_base_url + 'lingqujiangli.jpg'
return process.uniEnv.qn_base_url + 'lignqufuli.jpg'
},
buttonStyle() {
return this.selected
......
......@@ -87,7 +87,7 @@
<view>{{ item.title }}</view>
</view>
</view>
<AdvertisementSwiper v-if="showAdvertisement" @click="handleClickAdvertisement"/>
<AdvertisementSwiper v-if="showAdvertisement" :list="advertisementList" @click="handleClickAdvertisement"/>
<view :class="['bottom-view', {'showAdvertisement': showAdvertisement}]">
<image
class="bottom-image"
......@@ -148,7 +148,7 @@ export default {
tipTop: 410,
tipTop0: 128,
havingExamination: false, // 有进行中的考试
questionnaireStatus: 10,
advertisementList: [], // 广告位
}
},
computed: {
......@@ -279,18 +279,8 @@ export default {
return `width:570rpx;margin-top:${this.tipTop0}rpx`
},
showAdvertisement() {
return this.selected.id > 0 && (this.filledQuestionnaire || this.notQuestionnaire)
},
// 0-未参与问卷, 1-已参与未领取奖品, 2-已参与已领取奖品, 10-已参与无奖品问卷
// 已参与调查未领取奖励
filledQuestionnaire() {
return this.questionnaireStatus == 1
},
// 未参与调查
notQuestionnaire() {
return this.questionnaireStatus == 0
}
},
return this.selected.id > 0 && this.advertisementList.length > 0
}, },
watch: {
'detail.totalCount'(val) {
// 上次答题总数为0,这次答题总数大于0,弹出提示
......@@ -366,7 +356,7 @@ export default {
this.getInProgress()
// 是否显示广告:调查问卷
this.answerStatus()
this.getAdvertisementList()
})
.catch((err) => {
this.loading = false
......@@ -666,17 +656,18 @@ export default {
},
})
},
handleClickAdvertisement(id) {
handleClickAdvertisement(item) {
var path = 'questionnaire'
if (this.notQuestionnaire) {
// 0-未参与问卷, 1-已参与未领取奖品, 2-已参与已领取奖品, 10-已参与无奖品问卷
if (item.status== 0){
path = 'questionnaire'
} else if (this.filledQuestionnaire) {
} else if (item.status== 1) {
path = 'results'
}
this.$u.route({
url: 'pages/advertisement/' + path,
params: {
surveyId: id,
surveyId: item.businessId,
},
})
},
......@@ -692,12 +683,14 @@ export default {
console.log(err)
})
},
answerStatus() {
getAdvertisementList() {
// surveyId 问卷id,暂时写死
this.$u.api
.answerStatus({surveyId: 1})
.getAdvertisementList()
.then((res) => {
this.questionnaireStatus = res
this.advertisementList = res.filter((item) => {
return item.status == 0 || item.status == 1
}) || []
})
.catch((err) => {
console.log(err)
......
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