【fix】 完成活动邀请模块相关功能,并自测;存在问题:图片回显

This commit is contained in:
tian.guangyuan
2020-05-11 17:43:11 +08:00
parent 0444e1d158
commit d00db5e1be
10 changed files with 531 additions and 74 deletions

View File

@@ -40,6 +40,15 @@ export function getEnrollInfo(
})
}
// 客户参赛详情查询(客户)
export function getEnrollDetail(data = {}) {
return request({
url: getUrl(`/customer/active/getEnrollDetail`, 1),
method: 'post',
data
})
}
// 代理人邀约标识获取
export function getShareCode(data = {}) {
return request({
@@ -66,3 +75,21 @@ export function saveOpen(data = {}) {
data
})
}
// 客户报名
export function enroll(data = {}) {
return request({
url: getUrl(`/customer/active/enroll`, 1),
method: 'post',
data
})
}
// 客户参赛
export function enter(data = {}) {
return request({
url: getUrl(`/customer/active/enter`, 1),
method: 'post',
data
})
}

View File

@@ -3,6 +3,7 @@ const ExercisingDetails = () => import('@/views/ebiz/exercising/ExercisingDetail
const SignUp = () => import('@/views/ebiz/exercising/SignUp')
const SignUpDetails = () => import('@/views/ebiz/exercising/SignUpDetails')
const PlayerDetails = () => import('@/views/ebiz/exercising/PlayerDetails')
const SignUpResult = () => import('@/views/ebiz/exercising/SignUpResult')
export default [
{
@@ -40,5 +41,14 @@ export default [
title: '参赛信息',
index: 4
}
},
{
path: '/exercising/SignUpResult',
name: 'SignUpResult',
component: SignUpResult,
meta: {
title: '提交成功',
index: 5
}
}
]

View File

@@ -19,7 +19,6 @@ export default {
filters: {},
data() {
let isWeixin = this.$utils.device().isWeixin //判断环境
isWeixin = true
return {
Images: [],
isWeixin

View File

@@ -21,7 +21,7 @@
<p class="fs15 fwb pl10 pv12 title text-left">作品信息</p>
<template v-for="child in playerInfo.childrenList">
<van-cell-group :key="child.subBusinessNo">
<van-cell :title="child.name+'的作品'" title-class="text-left" value="" />
<van-cell :title="child.name + '的作品'" title-class="text-left" value="" />
<img v-lazy="child.imgPath" class="mt5 mb10 img" alt="作品图片" max-width="100%" />
</van-cell-group>
</template>
@@ -32,7 +32,7 @@
<script>
import { Cell, CellGroup, Divider } from 'vant'
import { getEnrollInfo } from '@/api/ebiz/exercising/exercising'
import config from '@/config'
export default {
name: '',
filters: {},
@@ -54,6 +54,10 @@ export default {
getEnrollInfo({ businessNo: this.businessNo })
.then(res => {
if (res.result == '0') {
for (let child of res.content.childrenList) {
child.imgPath = config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=` + child.imgPath
console.log(child.imgPath)
}
this.playerInfo = res.content
} else {
this.$toast(res.resultMessage)
@@ -92,7 +96,7 @@ export default {
border-radius: 10px;
overflow: hidden;
}
.img{
.img {
max-width: 100%;
border-radius: 10px;
}

View File

@@ -3,57 +3,66 @@
<!-- 子女信息 -->
<!-- 上传作品 -->
<template>
<div>
<van-cell-group class="m10 border-r5">
<p class="fs15 fwb pl10 pv12 title">基本信息</p>
<van-field v-model="value" label="姓名" placeholder="姓名" />
<van-field v-model="value" label="联系电话" placeholder="联系电话" />
</van-cell-group>
<div class="sign-up-container pb50">
<ParentInformation v-if="step == 1" @next="toChild"></ParentInformation>
<ChildInformation v-if="step == 2" :childInfo="feachData" @next="toChild" @nextJump="step++"></ChildInformation>
<UploadImg v-if="step == 3" :childInfo="feachData" @next="toSuccess"></UploadImg>
</div>
</template>
<script>
import { Cell, CellGroup, Field } from 'vant'
// import { } from '@/api/ebiz/manpower/manpower'
import ParentInformation from './SignUpCompinents/ParentInformation.vue'
import ChildInformation from './SignUpCompinents/ChildInformation.vue'
import UploadImg from './SignUpCompinents/UploadImg.vue'
export default {
name: '',
name: 'SignUp',
filters: {},
data() {
return {}
return {
step: 1,
feachData: null
}
},
watch: {},
created() {},
mounted() {},
mounted() {
document.body.className = document.body.className + ' bg-white'
},
beforeRouteLeave(to, from, next) {
document.body.className = document.body.className.replace(/bg-white/g, '')
next()
},
methods: {
init() {}
toChild(info) {
this.feachData = info
if (this.feachData.enterStatus == '02') {
this.$toast('您已上传过参赛作品,请勿重复提交!')
} else {
this.step++
}
},
toSuccess() {
this.$jump({
flag: 'h5',
extra: {
title: '提交成功',
forbidSwipeBack: 1, //当前页面禁止右滑返回
url: location.origin + `/#/exercising/SignUpResult`
},
routerInfo: {
path: `/exercising/SignUpResult`,
type: '1'
}
})
}
},
components: {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Field.name]: Field,
ParentInformation,
ChildInformation,
UploadImg
}
}
</script>
<style scoped="scoped" lang="scss">
.title {
border-bottom: 1px solid #ebedf0;
position: relative;
text-indent: 10px;
&:before {
content: ' ';
display: block;
position: absolute;
width: 5px;
top: 15px;
height: 4vw;
border-left: 3px solid red;
}
}
.border-r5 {
border-radius: 10px;
overflow: hidden;
}
</style>
<style scoped="scoped" lang="scss"></style>

View File

@@ -0,0 +1,160 @@
<!-- 页面名称 -->
<template>
<div>
<div class="m10">
<p class="fs15 fwb pl10 pv12 title">子女信息</p>
<template v-if="childInfo.enterStatus == '01'">
<van-cell-group :key="child.subBusinessNo" v-for="(child, index) in childInfo.childrenList">
<van-cell title="子女姓名" :value="child.name" value-class="text-left" />
<van-cell title="出生日期" :value="child.birthday" value-class="text-left" />
<van-cell title="年龄" :value="child.age + '岁'" value-class="text-left" />
<van-divider :style="drviderStyle" v-if="index != childInfo.childrenList.length - 1" />
</van-cell-group>
</template>
<template v-else>
<van-panel :key="index" v-for="(child, index) in childrenList">
<van-cell-group :key="child.subBusinessNo">
<van-field v-model="child.name" v-validate="'required|salename'" required name="子女姓名" label="子女姓名" placeholder="子女姓名" />
<van-field v-model="child.birthday" v-show="false" name="出生日期" v-validate="'required'" required label="出生日期" placeholder="出生日期" />
<FieldDatePicter
required
:v-validate="{ required: true }"
label="出生日期"
name="出生日期"
:value.sync="child.birthday"
type="date"
@confirm="getAge($event, child)"
:maxDate="maxDate"
:minDate="minDate"
:flag="true"
></FieldDatePicter>
<van-field readonly :value="child.age ? child.age + '岁' : ''" label="年龄" placeholder="年龄" />
</van-cell-group>
<template #header> </template>
<template #footer>
<div class="text-right" v-if="childrenList.length > 1">
<van-button size="small" icon="delete" type="danger" @click="delChild(index)"></van-button>
</div>
</template>
</van-panel>
<van-button plain hairline type="primary" block @click="addChild">+ 添加子女</van-button>
</template>
</div>
<div class="bottom-area bottom-btn">
<van-button type="danger" size="large" v-if="childInfo.enterStatus == '01'" @click="nextJump">下一步</van-button>
<van-button type="danger" size="large" v-else @click="next">确认报名</van-button>
</div>
</div>
</template>
<script>
import { Cell, CellGroup, Field, Panel, Divider } from 'vant'
import { enroll } from '@/api/ebiz/exercising/exercising'
import FieldDatePicter from '@/components/ebiz/FieldDatePicter'
import beforeDate from '@/assets/js/utils/getBeforeDate.js'
import utilsAge from '@/assets/js/utils/age'
export default {
name: 'ChildInformation',
filters: {},
data() {
return {
maxDate: new Date(beforeDate.getBeforeYear(3)),
minDate: new Date(beforeDate.getBeforeYear(18)),
childrenList: [
{
name: '',
birthday: '',
age: ''
}
],
drviderStyle: { color: '#f5f5f5', borderColor: '#f5f5f5', padding: '0 16px', margin: '0', height: '1vw', background: '#f5f5f5' }
}
},
props: {
childInfo: Object
},
watch: {},
created() {},
mounted() {},
methods: {
async next() {
let valid = await this.$validator.validate()
console.log(valid)
if (valid) {
let arr = this.childrenList.map(item => {
return item.name
})
if (arr.length != Array.from(new Set(arr)).length) {
return this.$toast('子女姓名不能重复')
}
let feachData = {
childrenList: this.childrenList
}
Object.assign(feachData, this.childInfo)
enroll(feachData)
.then(res => {
console.log(res)
if (res.result == '0') {
this.$emit('next', res.content)
} else {
this.$toast(res.resultMessage)
}
})
.catch(err => {
console.error(err)
})
} else {
return this.$toast(this.$validator.errors.all()[0])
}
},
nextJump() {
this.$emit('nextJump')
},
getAge(val, child) {
child.birthday = val
child.age = utilsAge.getAge(val, new Date())
},
addChild() {
this.childrenList.push({
name: '',
birthday: '',
age: ''
})
},
delChild(val) {
this.childrenList.splice(val, 1)
}
},
components: {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Field.name]: Field,
[Panel.name]: Panel,
[Divider.name]: Divider,
[FieldDatePicter.name]: FieldDatePicter
}
}
</script>
<style scoped="scoped" lang="scss">
.title {
border-bottom: 1px solid #ebedf0;
position: relative;
text-indent: 10px;
&:before {
content: ' ';
display: block;
position: absolute;
width: 5px;
top: 15px;
height: 4vw;
border-left: 3px solid red;
}
}
.border-r5 {
border-radius: 10px;
overflow: hidden;
}
</style>

View File

@@ -0,0 +1,95 @@
<!-- 页面名称 -->
<template>
<div>
<van-cell-group class="m10 border-r5">
<p class="fs15 fwb pl10 pv12 title">基本信息</p>
<van-field v-model="feachData.name" name="姓名" v-validate="'required|salename'" required label="姓名" placeholder="姓名" />
<van-field
v-model="feachData.phone"
name="联系电话"
v-validate="'required|mobileLength11|mobileStartWith1|mobile'"
required
label="联系电话"
placeholder="联系电话"
/>
</van-cell-group>
<div class="bottom-area bottom-btn">
<van-button type="danger" size="large" @click="next">下一步</van-button>
</div>
</div>
</template>
<script>
import { Cell, CellGroup, Field } from 'vant'
import { getEnrollDetail } from '@/api/ebiz/exercising/exercising'
export default {
name: 'ParentInformation',
filters: {},
data() {
let feachData = {
shareCode: this.$route.query.shareCode,
phone: '',
name: ''
}
return {
feachData
}
},
watch: {},
created() {},
mounted() {},
methods: {
async next() {
let valid = await this.$validator.validate()
if (!valid) {
return this.$toast(this.$validator.errors.all()[0])
}
getEnrollDetail(this.feachData)
.then(res => {
console.log(res)
if (res.result == '0') {
if (res.content == null) {
this.$emit('next', this.feachData)
} else {
this.$emit('next', res.content)
}
} else {
this.$toast(res.resultMessage)
}
})
.catch(err => {
console.error(err)
})
}
},
components: {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Field.name]: Field
}
}
</script>
<style scoped="scoped" lang="scss">
.title {
border-bottom: 1px solid #ebedf0;
position: relative;
text-indent: 10px;
&:before {
content: ' ';
display: block;
position: absolute;
width: 5px;
top: 15px;
height: 4vw;
border-left: 3px solid red;
}
}
.border-r5 {
border-radius: 10px;
overflow: hidden;
}
</style>

View File

@@ -0,0 +1,145 @@
<!-- 页面名称 -->
<template>
<div>
<van-cell-group class="m10 border-r5">
<p class="fs15 fwb pl10 pv12 title text-left">作品信息</p>
<van-cell-group :key="child.subBusinessNo" v-for="(child, index) in childrenList" @click="beforeRead(index)">
<van-cell :title="child.name + '的作品'" title-class="text-left" value="" />
<van-uploader v-model="img[index]" :max-size="maxSize" :max-count="1" class="mt10 ml20" :after-read="afterRead" @delete="deleteImg" />
</van-cell-group>
</van-cell-group>
<div class="bottom-area bottom-btn"><van-button type="danger" size="large" @click="next">提交</van-button></div>
</div>
</template>
<script>
import { Cell, CellGroup, Uploader } from 'vant'
import { uploadImg } from '@/api/ebiz/sale/sale'
import { enter } from '@/api/ebiz/exercising/exercising'
export default {
name: '',
filters: {},
data() {
return {
index: null,
img: {},
maxSize: 10485760, //1024*1024*10
childrenList: []
}
},
props: {
childInfo: Object
},
watch: {},
created() {},
mounted() {
this.childrenList = this.childInfo.childrenList
for (let i = this.childrenList.length; i--; ) {
this.img[i] = []
}
},
methods: {
next() {
for (let child of this.childrenList) {
if (child.imgPath == '') {
return this.$toast('请上传' + child.name + '的作品')
}
}
let feachData = {}
Object.assign(feachData, this.childInfo)
feachData.childrenList = this.childrenList
enter(feachData)
.then(res => {
console.log(res)
if (res.result == '0') {
this.$emit('next', res.content)
} else {
this.$toast(res.resultMessage)
}
})
.catch(err => {
console.error(err)
})
},
dataURLtoFile(dataurl, filename) {
//将base64转换为文件
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], filename, { type: mime })
},
beforeRead(index) {
this.index = index
},
afterRead(file) {
this.file = file.content
this.imgName = Math.floor(Math.random() * 100).toString() + new Date().getTime() + file.file.name //为图片名加随机数 与时间戳
file.name = this.imgName
this.uploadImg()
},
uploadImg() {
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
let formdata = new FormData()
formdata.append('imgPath', this.dataURLtoFile(this.file, this.imgName))
uploadImg(formdata)
.then(res => {
if (res.result == '0') {
this.$toast.clear()
this.childrenList[this.index].imgPath = encodeURI(res.path).replace(/\+/g, '%2B')
this.$forceUpdate()
} else {
this.$toast('网络环境不佳,图片上传失败,请切换移动网络或稍后重试')
}
})
.catch(err => {
console.error(err)
this.$toast('网络环境不佳,图片上传失败,请切换移动网络或稍后重试')
})
},
deleteImg() {
this.childrenList[this.index].imgPath = ''
this.img[this.index] = []
this.$forceUpdate()
}
},
components: {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Uploader.name]: Uploader
}
}
</script>
<style scoped="scoped" lang="scss">
.title {
border-bottom: 1px solid #ebedf0;
position: relative;
text-indent: 10px;
&:before {
content: ' ';
display: block;
position: absolute;
width: 5px;
top: 15px;
height: 4vw;
border-left: 3px solid red;
}
}
.border-r5 {
border-radius: 10px;
overflow: hidden;
}
</style>

View File

@@ -32,11 +32,11 @@ export default {
filters: {},
data() {
let searchData = {
"belongAgent":"0",
"enterStatus":"",
"pageSize":10,
"pageNum":1,
"activeCode":"DRAW"
belongAgent: '0',
enterStatus: '',
pageSize: 10,
pageNum: 1,
activeCode: 'DRAW'
}
return {
searchData,
@@ -46,7 +46,7 @@ export default {
}
},
watch: {
'searchData.enterStatus': function(newVal, oldVal){
'searchData.enterStatus': function() {
this.list = []
this.searchData.pageSize = 10
this.searchData.pageNum = 1
@@ -62,26 +62,28 @@ export default {
this.loading = true
this.getEnrollList()
},
getEnrollList(){
getEnrollList(this.searchData).then(res=>{
console.log(res);
if(res.result == '0'){
let resC = res.content;
if(resC.nextPage == 0){
getEnrollList() {
getEnrollList(this.searchData)
.then(res => {
console.log(res)
if (res.result == '0') {
let resC = res.content
if (resC.nextPage == 0) {
this.finished = true
}
this.loading = false
this.list = this.list.concat(resC.list)
this.searchData.pageNum++
}else{
} else {
this.$toast(res.resultMessage)
}
}).catch(err=>{
console.error(err);
})
.catch(err => {
console.error(err)
})
},
// 跳转到 报名信息详情页面
toPlayerDetail(player){
toPlayerDetail(player) {
// player.businessNo
this.$jump({
flag: 'h5',

View File

@@ -3,13 +3,12 @@
<div class="SignUpResult-container">
<div class="SignUpResult-header flex justify-content-c align-items-c m15 bg-white flex-direction-colunm">
<img :src="srcSuccess" class="SignUpResult-img mb15 pt15" />
<img :src="srcFail" class="SignUpResult-img mb15 pt15" />
<!-- <img :src="srcFail" class="SignUpResult-img mb15 pt15" /> -->
<h3 class="mb10">参赛成功</h3>
<h3 class="mb10">参赛失败</h3>
<!-- <h3 class="mb10">参赛失败</h3> -->
</div>
<div class="bottom-area bottom-btn">
<van-button class="m-btn w250" type="danger" size="normal" @click="next">返回</van-button>
<van-button type="danger" size="large" @click="next">返回</van-button>
</div>
</div>
</template>
@@ -17,22 +16,29 @@
<script>
// import { } from 'vant'
// import { } from '@/api/ebiz/manpower/manpower'
import { closeWindow } from '@/assets/js/utils/wxShare.js'
export default {
name: '',
filters: {},
data() {
return {
srcSuccess: this.$assetsUrl + 'images/success.png',
srcFail: this.$assetsUrl + 'images/fail.png'
srcSuccess: this.$assetsUrl + 'images/success.png'
// srcFail: this.$assetsUrl + 'images/fail.png'
}
},
watch: {},
created() {},
mounted() {},
mounted() {
document.body.className = document.body.className + ' bg-white'
},
beforeRouteLeave(to, from, next) {
document.body.className = document.body.className.replace(/bg-white/g, '')
next()
},
methods: {
init() {},
next() {}
next() {
closeWindow()
}
},
components: {
// [Field.name]: Field,