talk_appAmin/pages/activity/info.vue

327 lines
9.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template class="content">
<view class="fixed-header">
<!-- 顶部导航栏 -->
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" @leftClick="leftClick">
<template #center>
<div class="navbarcenter"><span>活动详情</span></div>
</template>
</up-navbar>
</view>
<view style="height: 100vh; overflow: auto;">
<view class="avtivityInfo">
<view>
<view class="cards">
<view class="title"> {{ actiInfoList.acTitle }}</view>
<view class="time">活动时间{{ actiInfoList.startTime }} - {{ actiInfoList.endTime }}</view>
<view class="addrs">活动地点{{ actiInfoList.addres }}</view>
</view>
<view class="cardz">
<up-parse :content="actiInfoList.acContent" :tagStyle="style"></up-parse>
</view>
<view class="cardx" v-for="(item, index) in toimage(actiInfoList.file)" :key="index">
<image :src="item" class="image"></image>
</view>
</view>
</view>
<view class="dictAuto">
<view v-if="actiInfoList.state === '0'">
<view class="state3" v-if="activityAttendInfo.attendState === '0' | activityAttendInfo.attendState === '1' " >
<up-button color="#F1F1F1" size="large" shape="circle"><span class="btnText">未参加</span></up-button>
</view>
<view class="state3" v-else-if="activityAttendInfo.attendState === '2' " >
<up-button color="#F1F1F1" size="large" shape="circle"><span class="btnText">已参加</span></up-button>
</view>
</view>
<view v-else-if="actiInfoList.state === '2'">
<view class="state1" v-if="activityAttendInfo.attendState === '0'">
<up-button color="#C0F0EC" size="large" shape="circle"><span class="btnText">立即报名</span></up-button>
</view>
<view class="state2" v-else-if="activityAttendInfo.attendState === '1'">
<up-button color="#FDE2E2" size="large" shape="circle"><span class="btnText">扫码签到</span></up-button>
</view>
<view class="state2" v-else-if="activityAttendInfo.attendState === '2'">
<up-button color="#FDE2E2" size="large" shape="circle"><span class="btnText">已签到</span></up-button>
</view>
</view>
<view v-else-if="actiInfoList.state === '1'">
<view class="state1" v-if="activityAttendInfo.attendState === '0'">
<up-button color="#C0F0EC" size="large" shape="circle"><span class="btnText">立即报名</span></up-button>
</view>
<view class="state1" v-else-if="activityAttendInfo.attendState === '1'">
<up-button color="#C0F0EC" size="large" shape="circle"><span class="btnText">取消报名</span></up-button>
</view>
</view>
</view>
</view>
<view class="infox">
<view class="infoavatar">
<up-avatar size="60rpx" :src="QNDomain + actiInfoList.avatarInfo" />
<view style="margin-left: 24rpx;">
<view class="launchName">{{ actiInfoList.nickName }}</view>
<view class="launchAddres">{{ actiInfoList.infoSchool }}</view>
</view>
</view>
<view class="elroll">已报名:{{ actiInfoList.elroll }}人</view>
</view>
<view class="infox2">
<up-modal :show="open" :title="title" width="600rpx" :content='content' confirmText="签到" cancelText="取消"
confirmColor="#3477FC" showCancelButton closeOnClickOverlay @confirm="confirm" @cancel="cancel"></up-modal>
</view>
</template>
<script setup>
import { getTakePartsInfoByacId, getActivityTakeInfo, delActivityTakeInfo, addActivityTakeInfo, updateActivityTakeInfo } from "@/api/activityInfo/activityTakeInfo";
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/activityInfo/info";
import { getDicts } from "@/api/system/dict/data"
import { onShow, onLoad } from '@dcloudio/uni-app'
import { ref, reactive, getCurrentInstance, toRefs, computed } from 'vue'
import { useStore } from 'vuex';
const { proxy } = getCurrentInstance();
const iconConfig = proxy.iconConfig;
const tu21 = iconConfig.tu21;
const tu22 = iconConfig.tu22;
const tu51 = iconConfig.tu51;
const tu52 = iconConfig.tu52;
const tu53 = iconConfig.tu53;
const style = ref({
p: 'font-weight: 400;font-size: 24rpx;color: #000000 !important;',
})
const activityState = ref([])//字典 activity_state 活动状态
const takePartState = ref([])//字典 take_part_state 活动参与状态
const open = ref(false)
const title = ref('确认签到');
const content = ref('请您确认活动签到,祝您玩的愉快!');
// 创建响应式数据 ref('#001f3f')
const bgColor = ref('');
const store = useStore()
const QNDomain = store.state.user.QNDomain
const actiInfoList = ref({});
function getAvatar() {
return QNDomain + actiInfoList.value.avatarInfo
}
onLoad((options) => {
const _id = options.id
getInfo(_id).then(response => {
actiInfoList.value = response.data;
console.log("actiInfoList:", actiInfoList.value);
});
getDicts('activity_state').then(e => {
activityState.value = e.data
})
getDicts('take_part_state').then(e => {
takePartState.value = e.data
})
checkStatus(options.id);
})
const activityAttendInfo = ref({})
const checkStatus = (id) => {
getTakePartsInfoByacId(id).then(e => {
console.log("数据:", e);
activityAttendInfo.value = e.data;
})
}
const leftClick = () => {
proxy.$tab.navigateBack(1)
}
const qrcodeInfo = ref()
const btnClick = () => {
uni.scanCode({
onlyFromCamera: true,
success: (res) => {
console.log('扫描二维码成功,结果:', res);
toqrcode(res);
open.value = !open.value
},
error: (res) => {
console.log('扫描二维码出现错误')
}
})
}
const toimage = (url) => {
if (typeof url === 'string') {
let info = url.split(",");
// 使用map方法处理每个元素给每个元素增加domainName前缀
let processedInfo = info.map(item => QNDomain + item);
console.log("processedInfo", processedInfo);
// 使用join方法将数组转换成字符串这里使用逗号作为分隔符
return processedInfo;
}
return null; // 或者其他默认值
}
const toqrcode = (e) => {
qrcodeInfo.value = JSON.parse(e.result)
console.log("信息:", qrcodeInfo.value);
}
//模态框确认按钮
function confirm() {
open.value = !open.value
}
//模态框取消按钮
function cancel() {
open.value = !open.value
}
const getDictLabelByValue = (state) => {
const dict = activityState.value.find((dict) => dict.dictValue === state);
return dict ? dict : '未知状态';
};
</script>
<style lang="scss">
.navbarcenter {
font-weight: 400;
width: 148rpx;
height: 37rpx;
font-size: 36rpx;
text-align: left;
color: #000000;
}
.avtivityInfo {
width: 686rpx;
margin: 44rpx auto;
.cards {
.title {
font-weight: 400 !important;
font-size: 32rpx;
text-align: left;
color: #000000 !important;
}
.time {
margin-top: 28rpx;
font-weight: 400;
font-size: 24rpx;
text-align: left;
color: #999999 !important;
}
.addrs {
margin-top: 12rpx;
font-weight: 400;
font-size: 24rpx;
text-align: left;
color: #999999 !important;
}
}
.cardz {
margin-top: 48rpx;
font-weight: 400;
width: 674rpx;
font-size: 24rpx;
text-align: left;
color: #000000 !important;
}
.cardx {
.image {
width: 686rpx;
height: 720rpx;
}
}
}
.dictAuto {
margin: 4rpx auto;
margin-bottom: 400rpx;
.state1 {
width: 686rpx;
height: 80rpx;
margin: 0 auto;
.btnText {
font-weight: 400;
width: 120rpx;
font-size: 30rpx;
color: #00CCBE !important;
}
}
.state2 {
width: 686rpx;
height: 80rpx;
margin: 0 auto;
.btnText {
font-weight: 400;
width: 120rpx;
font-size: 30rpx;
color: #FFABAB !important;
}
}
.state3 {
width: 686rpx;
height: 80rpx;
margin: 0 auto;
.btnText {
font-weight: 400;
width: 120rpx;
font-size: 30rpx;
color: #7E7E7E !important;
}
}
}
.infox {
display: flex;
justify-content: space-between;
align-items: center;
height: 88rpx;
padding-left: 32rpx;
padding-right: 32rpx;
position: fixed;
/* */
left: 0;
/* */
right: 0;
/* */
bottom: 68rpx;
/* */
border-top: 1px solid #ccc;
/* */
background-color: white;
/* */
z-index: 10;
.infoavatar {
display: flex;
}
}
.infox2 {
position: fixed;
/* */
left: 0;
/* */
right: 0;
/* */
bottom: 0;
/* */
height: 68rpx;
width: 100%;
background-color: #f6f6f6;
z-index: 10002;
/* */
}
</style>