活动联调

master
yujialong 12 months ago
parent a51e096915
commit 36566437fc
  1. 15
      apis/modules/activity.js
  2. 2
      components/filter-popup/filter-popup.vue
  3. 42
      components/sideSelect/sideSelect.vue
  4. 8
      libs/util.js
  5. 187
      order/activityDetail/activityDetail.vue
  6. 321
      other/activityDetail/activityDetail.vue
  7. 208
      other/registeredActivity/registeredActivity.vue
  8. 0
      other/supplierDetail/supplierDetail.vue
  9. 4
      pages.json
  10. 129
      pages/index/index.vue
  11. 2
      pages/person/person.vue
  12. 4
      pages/supplier/supplier.vue
  13. 11
      styles/common.scss

@ -6,4 +6,19 @@ export const postLoginActivity = (data) => {
} }
export const getCompetition = (id) => { export const getCompetition = (id) => {
return post(`competition/competition/management/getCompetition?competitionId=${id}`) return post(`competition/competition/management/getCompetition?competitionId=${id}`)
}
export const individualEventRegistration = (data) => {
return post(`competition/competition/registration/individualEventRegistration`, data)
}
export const getCurrentTime = () => {
return get(`competition/competition/management/getCurrentTime`)
}
export const queryRegistrationByCondition = (data) => {
return post(`competition/competition/registration/queryRegistrationByCondition`, data)
}
export const competitionUserDel = (data) => {
return post(`competition/competitionUserDel/save`, data)
}
export const cancelRegistration = (id) => {
return post(`competition/competition/registration/cancelRegistration?competitionId=${id}`)
} }

@ -162,7 +162,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.getDis()
}, },
methods: { methods: {
//value id //value id

@ -0,0 +1,42 @@
<template>
<view class="sideSelect">
<view v-for="(item, i) in menus" :key="i" :class="['item', {active: cur === item.id }]" @click="menuChange(item)">{{ item.name }}</view>
</view>
</template>
<script>
export default {
name:"sideSelect",
props: {
menus: {
type: Array,
default: () => []
},
},
data() {
return {
cur: ''
};
},
methods: {
menuChange(item) {
this.cur = item.id
}
}
}
</script>
<style scoped lang="scss">
.sideSelect {
min-width: 200rpx;
font-size: 28rpx;
text-align: center;
.item {
padding: 20rpx 0;
}
.active {
color: #fff;
background-color: $uni-primary;
}
}
</style>

@ -1,4 +1,5 @@
import Product from '@/config/product' import Product from '@/config/product'
import { getCurrentTime } from '@/apis/modules/activity.js'
const files = [ const files = [
'https://huorantech.cn/%E7%94%A8%E6%88%B7%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE.docx', // 用户服务协议 'https://huorantech.cn/%E7%94%A8%E6%88%B7%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE.docx', // 用户服务协议
@ -125,4 +126,11 @@ export default {
getFileExt(fileName) { getFileExt(fileName) {
return fileName.substring(fileName.lastIndexOf(".") + 1); return fileName.substring(fileName.lastIndexOf(".") + 1);
}, },
// 获取当前时间
getNow () {
return new Promise(async (resolve, reject) => {
const res = await getCurrentTime()
resolve(new Date(res.currentTime))
})
},
} }

@ -1,187 +0,0 @@
<template>
<view class="wrap">
<view class="banner">
<image class="pic" :src="form.coverUrl" mode="widthFix"></image>
</view>
<view class="info">
<view class="line">
<view class="label">状态</view>
<view class="val">进行中</view>
</view>
<view class="line">
<view class="label">人数限制</view>
<view class="val">{{ form.quantityLimit }}</view>
</view>
<view class="line">
<view class="label">举办时间</view>
<view class="val">{{ form.playStartTime + ' ~ ' + form.playEndTime }}</view>
</view>
<view class="line">
<view class="label">活动地点</view>
<view class="val">{{ form.reportingPlace }}</view>
</view>
<view class="line">
<view class="label">主办方</view>
<view class="val">{{ form.sponsor }}</view>
</view>
<view v-if="form.whetherToShowApplicants === '1'" class="line">
<view class="label">已报名人员</view>
<view class="val">(0/{{ form.quantityLimit }})</view>
</view>
</view>
<ul class="tab">
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li>
</ul>
<view v-if="!curTab" class="detail">
<mp-html :content="form.description"/>
</view>
<view v-else class="list">
</view>
<view class="btns">
<view class="btn share">分享</view>
<view class="btn sign">立刻报名</view>
</view>
</view>
</template>
<script>
import { getCompetition } from '@/apis/modules/activity.js'
export default {
data() {
return {
id: '',
curTab: 0,
tabs: [
{
name: '活动详情',
id: 0
},
{
name: '活动通知',
id: 1
},
],
form: {
quantityLimit: '',
playStartTime: '',
playEndTime: '',
reportingPlace: '',
sponsor: '',
},
shopCartTotal: 0,
types: [],
mpStyle: {
p: 'font-size: 25rpx !important;font-family: Microsoft Yahei !important;font-weight: 400 !important;color: #333 !important;',
span: 'font-size: 25rpx !important;font-family: Microsoft Yahei !important;font-weight: 400 !important;color: #333 !important;'
}
}
},
onShow() {
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
this.id = options.id
this.getInfo()
},
methods: {
//
getInfo() {
uni.showLoading({
title: '加载中'
})
getCompetition(this.id).then(res => {
const data = res.competition
data.whetherToShowApplicants === '1' && this.tabs.push({
name: '已报名人员',
id: 2
})
this.form = data
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
},
// tab
tabChange(tab) {
this.curTab = tab.id
},
//
download(item) {
uni.setStorageSync('files', {
copyWriting: this.form.mall.productName,
fileName: [item.fileName],
urls: [item.filePath]
})
this.$util.to(`/team/send/send`)
},
}
}
</script>
<style scoped lang="scss">
.wrap {
padding-bottom: 140rpx;
}
.banner {
.pic {
width: 100%;
}
}
.info {
position: relative;
padding: 20rpx;
margin: -150rpx 30rpx 30rpx;
background-color: #fff;
border-radius: 8px;
.line {
display: flex;
align-items: center;
margin: 20rpx 0;
}
.label {
min-width: 180rpx;
font-size: 28rpx;
}
.val {
font-size: 28rpx;
font-weight: 600;
color: #333;
}
}
.detail {
padding: 34rpx 32rpx;
margin: 20rpx;
border-radius: 20px;
background-color: #fff;
}
.btns {
position: fixed;
bottom: 0;
display: flex;
justify-content: center;
width: 100%;
padding: 20rpx 0;
background-color: #fff;
.btn {
width: 200rpx;
padding: 16rpx 0;
font-size: 28rpx;
color: #fff;
text-align: center;
}
.share {
background-color: #75b4ff;
border-top-left-radius: 40rpx;
border-bottom-left-radius: 40rpx;
}
.sign {
background-color: $uni-primary;
border-top-right-radius: 40rpx;
border-bottom-right-radius: 40rpx;
}
}
</style>

@ -0,0 +1,321 @@
<template>
<view class="wrap">
<view class="banner">
<image class="pic" :src="form.coverUrl" mode="widthFix"></image>
</view>
<view class="info">
<view class="line">
<view class="label">活动名称</view>
<view class="val">{{ form.name }}</view>
</view>
<view class="line">
<view class="label">状态</view>
<view class="val">进行中</view>
</view>
<view class="line">
<view class="label">人数限制</view>
<view class="val">{{ form.quantityLimit }}</view>
</view>
<view class="line items-start">
<view class="label">举办时间</view>
<view class="val">{{ form.playStartTime + ' ~ ' + form.playEndTime }}</view>
</view>
<view class="line">
<view class="label">活动地点</view>
<view class="val">{{ form.reportingPlace }}</view>
</view>
<view class="line">
<view class="label">主办方</view>
<view class="val">{{ form.sponsor }}</view>
</view>
<view v-if="form.whetherToShowApplicants === '1'" class="line">
<view class="label">已报名人员</view>
<view class="val">({{ form.applicantNum }}/{{ form.quantityLimit }})</view>
</view>
</view>
<ul class="tab">
<li :class="{active: curTab === 0}" @click="tabChange(0)">活动详情</li>
<li :class="{active: curTab === 1}" @click="tabChange(1)">活动通知</li>
<li v-if="form.whetherToShowApplicants === '1'" :class="{active: curTab === 2}" @click="tabChange(2)">已报名人员({{ form.applicantNum }}/{{ form.quantityLimit }})</li>
</ul>
<view v-if="!curTab" class="detail">
<mp-html :content="form.description"/>
</view>
<view v-else class="list">
<view v-for="(item, i) in list" :key="i" class="item" @click="toDetail(item)">
<view class="top">
<image class="avatar" :src="item.userAvatars"></image>
<view class="name">{{ item.username }}</view>
</view>
<view class="meta">组织名称</view>
<view class="meta">手机号</view>
</view>
</view>
<view class="btns">
<view class="btn share">分享</view>
<view :class="['btn sign', {disabled: !form.signing}]" @click="presign">立刻报名</view>
</view>
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog mode="input" placeholder="请输入4位数邀请码" :duration="2000" :before-close="true" @close="closePopup" @confirm="codeSubmit"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
import { getCompetition, individualEventRegistration, queryRegistrationByCondition } from '@/apis/modules/activity.js'
import Util from '@/libs/util'
export default {
data() {
return {
id: '',
curTab: 0,
reachBottom: 0, // 0->,1->,-1->
status: 'more', // more|loading|noMore
list: [],
page: 1,
pageSize: 5,
total: 0,
form: {
quantityLimit: '',
playStartTime: '',
playEndTime: '',
reportingPlace: '',
sponsor: '',
},
shopCartTotal: 0,
types: [],
mpStyle: {
p: 'font-size: 25rpx !important;font-family: Microsoft Yahei !important;font-weight: 400 !important;color: #333 !important;',
span: 'font-size: 25rpx !important;font-family: Microsoft Yahei !important;font-weight: 400 !important;color: #333 !important;'
},
timer: null,
now: '',
invitationCode: '',
}
},
//
onPullDownRefresh() {
this.initList()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1500)
},
//
onReachBottom() {
if (this.reachBottom >= 0) {
this.reachBottom = 1
this.status = 'loading'
this.getList()
}
},
onShow() {
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
this.id = options.id
this.getInfo()
},
methods: {
//
getInfo() {
uni.showLoading({
title: '加载中'
})
getCompetition(this.id).then(async (res) => {
const data = res.competition
this.form = data
this.now = await Util.getNow()
this.statusInterval()
this.timer = setInterval(() => {
this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1))
this.statusInterval()
}, 1000)
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
},
async statusInterval () {
const data = this.form
if (data.signUpStartTime && data.signUpEndTime) {
this.handleStatus()
}
},
//
handleStatus () {
const data = this.form
let signing = 0
const signUpStartTime = new Date(data.signUpStartTime) //
const signUpEndTime = new Date(data.signUpEndTime) //
const { now } = this
// (whetherToSignUp 10)
if (!data.competitionRegistration && now > signUpStartTime && now < signUpEndTime) {
signing = 1
}
this.$set(this.form, 'signing', signing)
},
//
getRegList() {
uni.showLoading({
title: '加载中'
})
queryRegistrationByCondition({
competitionId: this.id,
pageNum: this.page,
pageSize: this.pageSize,
}).then(async ({ data }) => {
this.list = this.reachBottom > 0 ? [...this.list, ...data.records] : data.records
this.page++ // page+1
const noMore = this.list.length === data.total //
this.status = noMore ? 'noMore' : 'more' // noMore
this.reachBottom = noMore ? -1 : 0 // -1
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
},
initList() {
this.page = 1
this.reachBottom = 0
this.getRegList()
},
// tab
tabChange(id) {
id === 2 && this.initList()
this.curTab = id
},
//
async presign() {
if (this.form.competitionRegistration) return this.$util.errMsg('你已经报名过该活动!')
if (!this.form.signing) return this.$util.errMsg('现在不在报名时间!')
this.invitationCode = ''
//
this.form.isNeedCode ? this.$refs.popup.open() : this.sign()
},
//
async sign() {
const res = await individualEventRegistration({
competitionId: this.form.id,
registrationInvitationCode: this.invitationCode
})
this.getInfo()
this.$util.sucMsg('报名成功!')
this.closePopup()
},
//
closePopup() {
this.$refs.popup.close()
},
//
codeSubmit(value) {
if (!value || value.length !== 4) return this.$util.errMsg('请输入4位数邀请码!')
this.invitationCode = value
this.sign()
},
}
}
</script>
<style scoped lang="scss">
.wrap {
padding-bottom: 140rpx;
}
.banner {
.pic {
width: 100%;
}
}
.info {
position: relative;
padding: 20rpx;
margin: -150rpx 30rpx 0;
background-color: #fff;
border-radius: 8px;
.line {
display: flex;
align-items: center;
margin: 20rpx 0;
}
.items-start {
align-items: flex-start;
}
.label {
min-width: 180rpx;
font-size: 28rpx;
}
.val {
font-size: 28rpx;
font-weight: 600;
color: #333;
}
}
.detail {
padding: 34rpx 32rpx;
margin: 20rpx;
border-radius: 20px;
background-color: #fff;
}
.list {
margin: 0 30rpx;
.item {
padding: 30rpx;
margin: 10rpx 0;
background-color: #fff;
border-radius: 8px;
}
.top {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.avatar {
width: 60rpx;
height: 60rpx;
margin-right: 20rpx;
border-radius: 50%;
}
.name {
font-size: 30rpx;
font-weight: 600;
}
.meta {
margin: 10rpx 0;
font-size: 26rpx;
}
}
.btns {
position: fixed;
bottom: 0;
display: flex;
justify-content: center;
width: 100%;
padding: 20rpx 0;
background-color: #fff;
.btn {
width: 200rpx;
padding: 16rpx 0;
font-size: 28rpx;
color: #fff;
text-align: center;
}
.share {
background-color: #75b4ff;
border-top-left-radius: 40rpx;
border-bottom-left-radius: 40rpx;
}
.sign {
background-color: $uni-primary;
border-top-right-radius: 40rpx;
border-bottom-right-radius: 40rpx;
&.disabled {
background-color: #d7d7d7;
}
}
}
</style>

@ -1,41 +1,67 @@
<template> <template>
<view> <view class="page">
<view class="filter"> <view class="filter">
<uni-search-bar class="search" radius="30" placeholder="请输入活动名称" v-model="keyword" clearButton="auto" cancelButton="none" /> <uni-search-bar class="search" radius="30" placeholder="请输入活动名称" v-model="keyword" clearButton="auto" cancelButton="none" />
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons> <uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons>
</view> </view>
<ul class="tab-wrap"> <view class="wrap">
<view class="tab"> <sideSelect :menus="menus" />
<li :class="{active: curTab === ''}" @click="tabChange('')">全部</li> <view class="list">
<uni-swipe-action>
<uni-swipe-action-item
v-for="item in list"
:key="i"
:threshold="0"
:right-options="ops"
@click="e => handle(e, item)"
>
<view class="item" @click="toDetail(item)">
<view class="top">
<image class="pic" :src="item.coverUrl"></image>
<view class="">
<view class="name ell">{{ item.competitionName }}</view>
<view v-if="item.whetherToShowApplicants === '1'" class="meta ell">{{ item.applicantNum }}/{{ item.quantityLimit }}人已报名</view>
</view>
</view>
<view class="texts">
<view class="meta">举办时间{{ item.playStartTime + ' ~ ' + item.playEndTime }}</view>
<view class="meta ell">主办方{{ item.sponsor }}</view>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</view> </view>
</view>
<scroll-view scroll-x :scroll-left="scrollLeft" class="tab tab-scroll">
<li v-for="(tab, i) in tabs" :key="i" :class="{active: curTab === tab.value}" @click="tabChange(tab.value)">{{ tab.title }}</li>
</scroll-view>
</ul>
<ul class="list">
<li v-for="(item, i) in list" :key="i" @click="toDetail(item)">
<image class="pic" src="@/static/image/info-bg.jpg"></image>
<view class="right">
<view class="name">测试名称</view>
<view class="meta">时间23323</view>
<view class="meta">主办方23323</view>
<view class="meta">12/343人已报名</view>
</view>
</li>
</ul>
<filter-popup ref="filter" showCategory :data="filters" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup> <filter-popup ref="filter" showCategory :data="filters" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
</view> </view>
</template> </template>
<script> <script>
import { tagsList, listOfGoods, productTypeList, shoppingCartList } from '@/apis/modules/product.js' import { postLoginActivity, competitionUserDel, cancelRegistration } from '@/apis/modules/activity.js'
export default { export default {
data() { data() {
return { return {
menus: [
{
id: '',
name: '全部'
},
{
id: 1,
name: '活动'
},
{
id: 2,
name: '需求'
},
{
id: 3,
name: '招募'
},
],
popup: false, popup: false,
// //
filters: [ filters: [
@ -98,6 +124,20 @@
productTypeName: '', productTypeName: '',
tagName: '', tagName: '',
categoryName: '', categoryName: '',
ops: [
{
text: '删除',
style: {
backgroundColor: '#F56C6C'
}
},
{
text: '取消报名',
style: {
backgroundColor: '#f79c69'
}
}
],
} }
}, },
watch: { watch: {
@ -124,41 +164,21 @@
} }
}, },
onShow() { onShow() {
const pages = getCurrentPages() this.initList()
const { options } = pages[pages.length - 1] // this.getFilter()
const { tagId, tagsName } = options
this.form.tagId = +tagId || ''
if (tagId) {
this.filterForm.tagId = [+tagId]
// this.tagName = tagsName
}
this.keyword = options.keyword || ''
this.page = 1
this.getList()
this.getFilter()
this.getShopCart()
}, },
methods: { methods: {
getList() { getList() {
listOfGoods({ postLoginActivity({
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
sort: 0, listType: 1,
isShelves: 0, keyWord: this.keyword,
hotTag: this.form.tagId ? 2 : 1, platformSource: ''
...this.form, }).then(async ({ data }) => {
productName: this.keyword, this.list = this.reachBottom > 0 ? [...this.list, ...data.records] : data.records
productType: this.curTab
}).then(({ page }) => {
// list
const list = page.records
list.map(e => {
e.productIntroduction = this.$util.removeTag(e.productIntroduction)
})
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list
this.page++ // page+1 this.page++ // page+1
const noMore = this.list.length === page.total // const noMore = this.list.length === data.total //
this.status = noMore ? 'noMore' : 'more' // noMore this.status = noMore ? 'noMore' : 'more' // noMore
this.reachBottom = noMore ? -1 : 0 // -1 this.reachBottom = noMore ? -1 : 0 // -1
}).catch(e => {}) }).catch(e => {})
@ -168,15 +188,6 @@
this.reachBottom = 0 this.reachBottom = 0
this.getList() this.getList()
}, },
//
getShopCart() {
shoppingCartList({
pageNum: 1,
pageSize: 1000,
}).then(({ data }) => {
this.total = data.total
}).catch(e => {})
},
// //
getFilter() { getFilter() {
// //
@ -254,39 +265,79 @@
}, },
// //
toDetail(item) { toDetail(item) {
this.$util.to(`../activityDetail/activityDetail?id=${item.mallId}`) this.$util.to(`../activityDetail/activityDetail?id=${item.id}`)
},
//
handle(e, row) {
const that = this
if (!e.index) {
uni.showModal({
title: '提示',
content: '确定要删除吗?',
success(res) {
if (res.confirm) {
competitionUserDel({
competitionId: row.id
}).then(res => {
that.$util.sucMsg('删除成功')
that.initList()
}).catch(res => {})
}
}
})
} else {
uni.showModal({
title: '提示',
content: '确定要取消报名吗?',
success(res) {
if (res.confirm) {
cancelRegistration(row.id).then(res => {
that.$util.sucMsg('取消报名成功')
that.initList()
}).catch(res => {})
}
}
})
}
}, },
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.tab-wrap { .page {
// background-color: #fff;
}
.wrap {
display: flex; display: flex;
.tab-scroll { align-items: flex-start;
width: calc(100% - 100rpx); margin: 0 0;
white-space: nowrap;
li {
display: inline-block;
}
}
} }
.list { .list {
li { flex: 1;
padding: 20rpx;
margin: 20rpx;
border-radius: 8px;
background-color: #fff;
.item {
padding: 28rpx 0;
overflow: hidden;
border-bottom: 1px solid rgba(225, 225, 225, .4);
}
.top {
display: flex; display: flex;
padding: 20rpx;
margin: 16rpx 20rpx;
background-color: #fff;
border-radius: 16rpx;
} }
.pic { .pic {
width: 240rpx; width: 160rpx;
height: 180rpx; height: 100rpx;
margin-right: 20rpx; margin-right: 20rpx;
border-radius: 8px; border-radius: 8px;
} }
.texts {
// width: calc(100% - 240rpx);
}
.name { .name {
font-size: 30rpx; font-size: 28rpx;
font-weight: 600; font-weight: 600;
color: #333; color: #333;
} }
@ -294,6 +345,9 @@
margin: 10rpx 0; margin: 10rpx 0;
font-size: 26rpx; font-size: 26rpx;
color: #999; color: #999;
&:last-child {
margin-bottom: 0;
}
} }
} }
</style> </style>

@ -52,7 +52,7 @@
], ],
"subPackages": [ "subPackages": [
{ {
"root": "order", "root": "other",
"pages": [ "pages": [
{ {
"path" : "supplierDetail/supplierDetail", "path" : "supplierDetail/supplierDetail",
@ -67,7 +67,7 @@
"style" : "style" :
{ {
"navigationBarTitleText" : "活动详情", "navigationBarTitleText" : "活动详情",
"enablePullDownRefresh" : false "enablePullDownRefresh" : true
} }
}, },
{ {

@ -31,32 +31,43 @@
<image class="pic" :src="item.coverUrl"></image> <image class="pic" :src="item.coverUrl"></image>
<view class="texts"> <view class="texts">
<view class="name ell">{{ item.competitionName }}</view> <view class="name ell">{{ item.competitionName }}</view>
<view class="meta">时间{{ item.playStartTime + ' ~ ' + item.playEndTime }}</view> <view class="meta">举办时间{{ item.playStartTime + ' ~ ' + item.playEndTime }}</view>
<view class="meta ell">主办方{{ item.sponsor }}</view> <view class="meta ell">主办方{{ item.sponsor }}</view>
<view v-if="item.whetherToShowApplicants === '1'" class="meta ell">(0/{{ item.quantityLimit }})人已报名</view> <view v-if="item.whetherToShowApplicants === '1'" class="meta ell">{{ item.applicantNum }}/{{ item.quantityLimit }}人已报名</view>
<view class="sign" @click.stop="sign(item)">报名</view> <view v-if="item.signing" class="sign" @click.stop="presign(item)">报名</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="!per" class="per-mask">功能升级中敬请期待...</view> <view v-if="!per" class="per-mask">功能升级中敬请期待...</view>
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog mode="input" placeholder="请输入4位数邀请码" :duration="2000" :before-close="true" @close="closePopup" @confirm="codeSubmit"></uni-popup-dialog>
</uni-popup>
</view> </view>
</template> </template>
<script> <script>
import { postLoginActivity } from '@/apis/modules/activity.js' import { postLoginActivity, individualEventRegistration } from '@/apis/modules/activity.js'
import Util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
per: true, // per: true, //
teamId: uni.getStorageSync('teamId') || '', teamId: uni.getStorageSync('teamId') || '',
reachBottom: 0, // 0->,1->,-1->
status: 'more', // more|loading|noMore
keyword: '', keyword: '',
list: [], list: [],
page: 1, page: 1,
pageSize: 10, pageSize: 5,
total: 0, total: 0,
curTab: 0, curTab: 0,
curItem: null,
timer: null,
now: '',
invitationCode: '',
tabs: [ tabs: [
{ {
name: '全部', name: '全部',
@ -85,11 +96,26 @@
], ],
} }
}, },
//
onPullDownRefresh() {
this.initList()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1500)
},
//
onReachBottom() {
if (this.reachBottom >= 0) {
this.reachBottom = 1
this.status = 'loading'
this.getList()
}
},
onShow() { onShow() {
uni.setStorageSync('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNzAyMjg4MDEzLCJleHAiOjE3MDMxNTIwMTMsImFjY291bnRJZCI6IjEifQ.3dZSZAG7w8tSPU9DBL0VdULgkQmiZpYVzjf1qfxx5HY') uni.setStorageSync('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNzAyMjg4MDEzLCJleHAiOjE3MDMxNTIwMTMsImFjY291bnRJZCI6IjEifQ.3dZSZAG7w8tSPU9DBL0VdULgkQmiZpYVzjf1qfxx5HY')
this.keyword = '' this.keyword = ''
this.per = true this.per = true
this.getProducts() this.initList()
}, },
methods: { methods: {
// //
@ -99,34 +125,94 @@
} }
this.getProducts() this.getProducts()
}, },
initList() {
this.page = 1
this.reachBottom = 0
this.getList()
},
// //
getProducts() { getList() {
postLoginActivity({ postLoginActivity({
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
listType: 0, listType: 0,
keyWord: this.keyword,
platformSource: '' platformSource: ''
}).then(({ data }) => { }).then(async ({ data }) => {
this.list = data.records this.list = this.reachBottom > 0 ? [...this.list, ...data.records] : data.records
this.page++ // page+1
const noMore = this.list.length === data.total //
this.status = noMore ? 'noMore' : 'more' // noMore
this.reachBottom = noMore ? -1 : 0 // -1
this.now = await Util.getNow()
this.statusInterval()
this.timer = setInterval(() => {
this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1))
this.statusInterval()
}, 1000)
}).catch(e => {}) }).catch(e => {})
}, },
async statusInterval () {
this.list.map(item => {
if (item.signUpStartTime && item.signUpEndTime) {
this.handleStatus(item)
}
})
},
//
handleStatus (item) {
let signing = 0
const signUpStartTime = new Date(item.signUpStartTime) //
const signUpEndTime = new Date(item.signUpEndTime) //
const { now } = this
// (whetherToSignUp 10)
if (item.whetherToSignUp && now > signUpStartTime && now < signUpEndTime) {
signing = 1
}
this.$set(item, 'signing', signing)
},
// //
searchConfirm(e) { searchConfirm() {
e.value && this.$util.to(`/order/products/products?keyword=${e.value}`) this.initList()
}, },
// //
toDetail(item) { toDetail(item) {
this.$util.to('/order/activityDetail/activityDetail?id=' + item.id) this.$util.to('/other/activityDetail/activityDetail?id=' + item.id)
}, },
// tab // tab
tabChange(tab) { tabChange(tab) {
this.curTab = tab.id this.curTab = tab.id
// this.initList() // this.initList()
}, },
//
async presign(item) {
this.invitationCode = ''
this.curItem = item
//
item.isNeedCode ? this.$refs.popup.open() : this.sign()
},
// //
sign(item) { async sign() {
const res = await individualEventRegistration({
} competitionId: this.curItem.id,
registrationInvitationCode: this.invitationCode
})
this.initList()
this.$util.sucMsg('报名成功!')
this.closePopup()
},
//
closePopup() {
this.$refs.popup.close()
},
//
codeSubmit(value) {
if (!value || value.length !== 4) return this.$util.errMsg('请输入4位数邀请码!')
this.invitationCode = value
this.sign()
},
} }
} }
</script> </script>
@ -146,16 +232,6 @@
.hot { .hot {
width: 100%; width: 100%;
} }
.search-wrap {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10rpx;
background-color: #fff;
.search {
flex: 1;
}
}
.module { .module {
margin: 20rpx; margin: 20rpx;
padding: 20rpx; padding: 20rpx;
@ -180,17 +256,16 @@
display: flex; display: flex;
margin-bottom: 28rpx; margin-bottom: 28rpx;
background-color: #fff; background-color: #fff;
border-radius: 8px;
overflow: hidden; overflow: hidden;
} }
.pic { .pic {
width: 320rpx; width: 320rpx;
height: 240rpx; height: 240rpx;
margin-right: 20rpx; margin-right: 20rpx;
border-radius: 8px;
} }
.texts { .texts {
width: calc(100% - 240rpx); width: calc(100% - 240rpx);
padding: 10rpx;
} }
.name { .name {
font-size: 28rpx; font-size: 28rpx;

@ -26,7 +26,7 @@
<image src="https://occupationlab.com/images/preschoolEdu/icon2.png" /> <image src="https://occupationlab.com/images/preschoolEdu/icon2.png" />
<view class="text ell">我的关注</view> <view class="text ell">我的关注</view>
</li> </li>
<li @click="toPage('/order/registeredActivity/registeredActivity')"> <li @click="toPage('/other/registeredActivity/registeredActivity')">
<image src="https://occupationlab.com/images/preschoolEdu/icon3.png" /> <image src="https://occupationlab.com/images/preschoolEdu/icon3.png" />
<view class="text ell">已报名活动</view> <view class="text ell">已报名活动</view>
</li> </li>

@ -6,7 +6,7 @@
</view> </view>
<view class="banner"> <view class="banner">
<!-- <image class="pic" src="@/static/image/index/banner.png" mode="widthFix"></image> --> <image class="pic" src="@/static/image/info-bg.jpg" mode="widthFix"></image>
</view> </view>
<ul class="tab"> <ul class="tab">
@ -203,7 +203,7 @@
}, },
// //
toDetail(item) { toDetail(item) {
this.$util.to('/order/supplierDetail/supplierDetail?id=') this.$util.to('/other/supplierDetail/supplierDetail?id=')
}, },
// tab // tab
tabChange(tab) { tabChange(tab) {

@ -77,6 +77,16 @@ ul {
@include sort; @include sort;
} }
} }
.search-wrap {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10rpx;
background-color: #fff;
.search {
flex: 1;
}
}
.form-list { .form-list {
.line { .line {
display: flex; display: flex;
@ -151,7 +161,6 @@ ul {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
margin-bottom: 20rpx; margin-bottom: 20rpx;
background-color: #fff;
li { li {
padding: 0 20rpx; padding: 0 20rpx;
font-size: 28rpx; font-size: 28rpx;

Loading…
Cancel
Save