123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678 |
- <template>
- <view class="">
- <view class="bg">
- </view>
- <view class="active position">
- <!-- 立即报名弹框 -->
- <u-popup v-model="show" mode="center" border-radius="19" :closeable="true" @close="close">
- <view class="pop_wrap">
- <view class="pop_top">
- <text class="title">请填写报名信息</text>
- </view>
- <view class="pop_center">
- <u-form label-width='120'>
- <u-form-item label="姓名" class="position">
- <view class="star">
- *
- </view>
- <u-input v-model="name" placeholder="请填写姓名" />
- </u-form-item>
- <u-form-item label="手机号" class="position">
- <view class="star">
- *
- </view>
- <u-input v-model="mobile" placeholder="请填写手机号" />
- </u-form-item>
- </u-form>
- </view>
- <view class="pop_bootom">
- <button type="default" @click="sure_sign">确认</button>
- </view>
- </view>
- </u-popup>
- <!-- <view :class="[this.is_weixin()?'':'wrap1','wrap']"> -->
- <view class="wrap">
- <view class="top_wrap">
- <!-- <view :class="[this.is_weixin()?'':'top1','top']"> -->
- <view class="top">
- <view class="search">
- <image src="../../static/images/search.png" mode=""></image>
- <input type="text" value="" v-model="query.title" placeholder="请输入活动名称"
- placeholder-style="font-size:14px;color:#D9D0C8;" @confirm="search" @input="get_text" />
- </view>
- <view class="search_right" @click="to_create">
- <image src="../../static/images/user-plus.png" mode=""></image>
- <text>发起活动</text>
- </view>
- </view>
- <view :class="[is_click?'':'close','menu']">
- <u-dropdown active-color="#674023" inactive-color="#6F6F6F" title-size="30" @open="menuClick"
- @close="close_menu">
- <u-dropdown-item v-model="active_type" title="活动类型" :options="type" @change="type_select">
- </u-dropdown-item>
- <u-dropdown-item v-model="sctive_shape" title="活动形式" :options="shape"
- @change="shape_select">
- </u-dropdown-item>
- </u-dropdown>
- </view>
- </view>
- </view>
- <!-- </view> -->
- <view class="active_list">
- <view class="empty" v-if="my_list.length == 0">
- <image src="../../static/images/empty_active.png" mode=""></image>
- <text>暂无内容</text>
- </view>
- <view class="item" v-for="(item,index) in my_list" :key="index" @click="to_detail(item)">
- <view class="img">
- <image :src="item.cover_resource.url" mode="aspectFill"></image>
- </view>
- <view class="right">
- <view class="title">{{item.title}}</view>
- <view class="logo">
- <image :src="item.organization?item.organization.logo:logo" mode=""></image>
- <text>{{item.organization?item.organization.name:'--'}}</text>
- </view>
- <view class="time">
- <!-- <text>{{item.start_time}}--{{item.end_time}}</text>|<text>{{item.shape_text}}活动</text> -->
- <text>{{getTime(item.start_time)}}-{{getTime(item.end_time)}}</text>|<text>{{item.shape_text}}活动</text>
- </view>
- <view class="bottom">
- <view class="free">
- <!-- {{item.money}} -->
- {{item.sign_up_nums}}/{{item.total_nums}}
- </view>
- <view class="btn" @click.stop="signUp(item)" v-if="item.state.status == 1">
- 马上报名
- </view>
- <view v-else :class="item.state.status == 3 ? 'btn_over' :'btn_check'">
- {{item.state.status_text}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- show: false,
- prop: '',
- type: [
- {
- label: '全部',
- value: 0
- },
- ],
- shape: [
- {
- label: '全部',
- value: 0
- }
- ],
- active_type: '',
- sctive_shape: '',
- my_list: [],
- query: {},
- logo: '../../static/images/logo.png',
- page: 1,
- last: false,
- mobile: '',
- name: '',
- // 解决吸顶遮挡问题
- is_click: false
- }
- },
- onShow() {
-
- },
- async onLoad() {
- this.page = 1
- this.my_list = []
- this.last = false
- await this.getList()
- this.get_shape()
- this.get_setting()
- },
- onReachBottom() {
- if (!this.last) {
- this.page++
- }
- this.getList()
- },
- methods: {
- menuClick(e) {
- this.is_click = true
- },
- close_menu() {
- this.is_click = false
-
- },
- to_detail(item) {
- uni.navigateTo({
- url: '/pages/activity/active_detail?id=' + item.id,
- success: res => {
- },
- fail: (e) => {
- },
- complete: () => {}
- })
- },
- getTime(time) {
- let time1 = time.split(' ')
- let time2 = time1[0]
- return time2.replace(/\-/g, '.')
- },
- close() {
- this.name = ''
- this.mobile = ''
- },
- //立即报名
- signUp(item) {
- if (this.vuex_token) {
- this.prop = item
- let time = item.start_time
- let time1 = time.split(' ')
- let time2 = time1[0]
- this.prop.start_time = time2
- this.show = true
- } else {
- uni.reLaunch({
- url: '../login/index'
- })
- }
- },
- sure_sign(id) {
- if (!this.name) {
- uni.showToast({
- title: '请输入姓名!',
- icon: 'none'
- })
- return
- }
- if (!this.mobile) {
- uni.showToast({
- title: '请输入手机号!',
- icon: 'none'
- })
- return
- }
- let data = {
- activity_id: this.prop.id,
- name: this.name,
- mobile: this.mobile
- }
- this.$u.post('/page/sign-up-activity', data).then(res => {
- console.log(res, '报名提交成功')
- this.show = false
- uni.reLaunch({
- url: '../organization/success'
- })
- })
- },
- get_text(e) {
- console.log(e, '0000')
- this.query.title = e.detail.value
- },
- search() {
- this.page = 1
- this.my_list = []
- console.log(this.query, 'query')
- this.getList()
- },
- //获取活动
- getList() {
- this.query.page = this.page
- this.$u.get('/page/activities', this.query).then(res => {
- console.log(res, 'ppp')
- if (this.page > 1 && res.data.data.length == 0) {
- uni.showToast({
- title: '暂无更多',
- icon: 'none'
- })
- this.last = true
- } else {
- this.my_list = this.my_list.concat(res.data.data)
- // this.my_list = this.my_list.map(item => {
- // item.start_time = item.start_time.slice(0, 10)
- // item.end_time = item.end_time.slice(0, 10)
- // return item
- // })
- }
- })
- },
- //点击下拉菜单
- search_type(e) {
- console.log(e, 'searchj')
- },
- //选择活动类型
- type_select(e) {
- console.log(e, 'tuyp')
- this.query.type_id = e
- this.page = 1
- this.last = false
- this.my_list = []
- this.getList()
- console.log(this.type, 'type')
- },
- //选择活动形式
- shape_select(e) {
- this.query.shape = e
- console.log(this.query.shape, 'this.query.shape')
- this.page = 1
- this.last = false
- this.my_list = []
- this.getList()
- console.log(this.shape, 'shape')
- },
- //获取类型配置
- get_setting() {
- this.$u.get('/setting/get-lists?key=ACTIVITY_TYPE').then(res => {
- console.log(res.data, 'leix')
- this.type = this.type.concat(res.data.data.map((item, index) => {
- return {
- label: item.value,
- value: item.id
- }
- }))
- console.log(this.type, '11111111')
- uni.setStorageSync('type', this.type)
- })
- },
- //获取活动形式
- get_shape() {
- this.$u.get('/common/enums').then(res => {
- console.log(res,'0000000000000')
- for(var key in res.data.ActivityShapeEnum){
- console.log(key,'key')
- this.shape.push({label: res.data.ActivityShapeEnum[key],
- value: key})
- }
-
- console.log(this.shape,'shapoe')
- uni.setStorageSync('shape', this.shape)
- })
- },
- to_create() {
- if (this.vuex_token) {
- uni.navigateTo({
- url: './create_active',
- success: res => {
- console.log(111)
- },
- fail: (e) => {
- console.log(e)
- },
- complete: () => {}
- })
- } else {
- uni.reLaunch({
- url: '../login/index'
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- // padding-top: 10px;
- background-color: #F9F9FB;
- }
- .active {
- padding: 0 0 20px;
- // background-color: #F9F9FB;
- //添加弹框
- .pop_wrap {
- width: 290px;
- height: 280px;
- display: flex;
- flex-direction: column;
- align-items: center;
- .pop_top {
- margin-top: 20px;
- text {
- display: block;
- font-size: 13px;
- color: rgba(40, 40, 40, 0.5);
- text-align: center;
- line-height: 22px;
- padding: 0 20px;
- }
- .title {
- font-size: 18px;
- font-weight: bold;
- color: #282828;
- line-height: 25px;
- margin-bottom: 2px;
- }
- }
- .pop_center {
- margin-top: 15px;
- text {
- font-size: 14px;
- font-family: PingFang SC;
- font-weight: 400;
- line-height: 20px;
- color: #353535;
- opacity: 0.79;
- display: block;
- margin-bottom: 6px;
- }
- .position{
- position: relative;
- .star{
- position: absolute;
- left: -10px;
- color: red;
- }
- }
- }
- .pop_bootom {
- margin-top: 25px;
- button {
- border: 1px solid #FF5A26;
- width: 98px;
- // height: 36px;
- padding: 0 5px;
- line-height: 36px;
- background-color: #fff;
- color: #FF5A26;
- }
- }
- }
- .wrap {
- position: fixed;
- width: 100%;
- background-color: #F9F9FB;
- top: 0;
- z-index: 12;
- height: 140px;
- }
- .wrap1{
- height: 160px;
- }
- .top_wrap {
- position: fixed;
- // top: 40px;
- top: 0;
- left: 16px;
- right: 16px;
- z-index: 12;
- // background-color: #F9F9FB;
- }
- // .top_wrap1 {
- // position: fixed;
- // // top: 10px;
- // left: 16px;
- // right: 16px;
- // z-index: 12;
- // background-color: #F9F9FB;
- // }
- .top {
- display: flex;
- align-items: center;
- justify-content: space-between;
- // padding: 0 16px;
- // padding-top: 10px;
- margin-top: 10px;
- height: 52px;
- .search {
- display: flex;
- align-items: center;
- height: 52px;
- box-shadow: 0px 8px 16px rgba(12, 20, 61, 0.06);
- border-radius: 10px;
- flex-shrink: 0;
- margin-right: 14px;
- flex: 1;
- image {
- width: 16px;
- height: 16px;
- margin-left: 20px;
- margin-right: 20px;
- }
- }
- .search_right {
- font-size: 12px;
- font-family: PingFang SC;
- font-weight: bold;
- line-height: 20px;
- color: #84705E;
- // width: 48px;
- height: 39px;
- text-align: center;
- image {
- width: 25px;
- height: 20px;
- }
- text {
- display: block;
- }
- }
- }
- .top1 {
- margin-top: 50px
- }
- .menu {
- height: 40px;
- // margin-top: 100px;
- margin-top: 20px;
- // overflow: hidden;
- }
- .close {
- overflow: hidden;
- }
- .active_list {
- padding: 120px 16px 0;
- // padding: 0 16px;
- // margin-top: 120px;
- .empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- font-size: 14px;
- font-family: PingFang HK;
- font-weight: 400;
- line-height: 20px;
- color: #696969;
- opacity: 0.47;
- image {
- width: 94px;
- height: 51px;
- margin-bottom: 25px;
- }
- }
- .item {
- // height: 113px;
- background: #FFFFFF;
- box-shadow: 0px 8px 12px rgba(12, 20, 61, 0.06);
- border-radius: 10px;
- display: flex;
- align-items: center;
- margin-top: 14px;
- padding: 16px 10px;
- &:first-child{
- // margin-top: 45px;
- }
- .img {
- width: 100px;
- height: 92px;
- overflow: hidden;
- border-radius: 6px;
- flex-shrink: 0;
- margin-right: 8px;
- image {
- width: 100px;
- height: 92px;
- }
- }
- .right {
- width: 100%;
- .title {
- font-size: 15px;
- font-family: Graphit;
- font-weight: 500;
- color: #282828;
- overflow: hidden;
- -webkit-line-clamp: 1;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- }
- .logo {
- display: flex;
- align-items: center;
- font-size: 13px;
- font-family: Graphit;
- font-weight: 500;
- color: #696969;
- margin-top: 2px;
- image {
- width: 24px;
- height: 24px;
- border-radius: 50%;
- margin-right: 6px;
- }
- }
- .time {
- font-size: 12px;
- font-family: PingFang HK;
- font-weight: 400;
- color: #B2B2B2;
- margin-top: 2px;
- overflow: hidden;
- -webkit-line-clamp: 1;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- text:first-child {
- margin-right: 2px;
- }
- text:last-child {
- margin-left: 2px;
- }
- }
- .bottom {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-top: 6px;
- .free {
- font-size: 14px;
- font-family: PingFang HK;
- font-weight: 500;
- color: #79573D;
- }
- .btn {
- width: 80px;
- height: 22px;
- background: #79573D;
- border-radius: 6px;
- font-size: 12px;
- font-family: PingFang HK;
- font-weight: 400;
- line-height: 22px;
- color: #FFFFFF;
- text-align: center;
- margin-right: 10px;
- }
- .btn_over {
- background: #A0A0A0;
- width: 80px;
- height: 22px;
- border-radius: 6px;
- font-size: 12px;
- font-family: PingFang HK;
- font-weight: 400;
- line-height: 22px;
- color: #FFFFFF;
- text-align: center;
- margin-right: 10px;
- }
- .btn_check {
- background: #fff;
- width: 80px;
- height: 22px;
- border-radius: 6px;
- font-size: 12px;
- font-family: PingFang HK;
- font-weight: 400;
- line-height: 20px;
- color: #79573D;
- text-align: center;
- margin-right: 10px;
- border: 1px solid #79573D;
- }
- }
- }
- }
- }
- }
- </style>
|