活动管理完成列表页面简单联调

main
26947 2024-06-06 21:14:03 +08:00
parent 285165da02
commit a4ccdc6ad7
6 changed files with 319 additions and 173 deletions

View File

@ -49,3 +49,26 @@ export function delActivityTakeInfo(id) {
method: 'delete'
})
}
// 报名
export function gotoSing1(id) {
return request({
url: '/activityInfo/activityTakeInfo/goSing1/' + id,
method: 'get'
})
}
// 取消报名
export function gotoSing2(id) {
return request({
url: '/activityInfo/activityTakeInfo/goSing2/' + id,
method: 'get'
})
}
// 签到
export function gotoQrcode(data) {
return request({
url: '/activityInfo/activityTakeInfo/goQrcode',
method: 'put',
data: data
})
}

View File

@ -37,14 +37,6 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/index",
"style": {
"navigationBarTitleText": "若依移动端框架",
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/signln/signid",
"style": {

View File

@ -2,7 +2,6 @@
<view class="fixed-header">
<!-- 顶部导航栏 -->
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" @leftClick="leftClick">
<template #center>
<div class="navbarcenter"><span>活动详情</span></div>
</template>
@ -17,7 +16,10 @@
<view class="addrs">活动地点{{ actiInfoList.addres }}</view>
</view>
<view class="cardz">
<up-parse :content="actiInfoList.acContent" :tagStyle="style"></up-parse>
<!-- <up-parse :content="processContent(actiInfoList.acContent)" :tagStyle="style"></up-parse> -->
<view v-if="textopen" v-html="actiInfoList.acContent" class="acContentstyle"></view>
<up-text size="15" color="#000000" lineHeight="23" v-else :text="actiInfoList.acContent"></up-text>
</view>
<view class="cardx" v-for="(item, index) in toimage(actiInfoList.file)" :key="index">
<image :src="item" class="image"></image>
@ -26,30 +28,35 @@
</view>
<view class="dictAuto">
<view v-if="actiInfoList.state === '0'">
<view class="state3" v-if="activityAttendInfo.attendState === '0' | activityAttendInfo.attendState === '1' " >
<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' " >
<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>
<up-button color="#C0F0EC" size="large" shape="circle" @click="goSing(1)"><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>
<up-button color="#FDE2E2" size="large" shape="circle" @click="goQrcode(1)"><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 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>
<up-button color="#C0F0EC" size="large" shape="circle" @click="goSing(1)"><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>
<up-button color="#C0F0EC" size="large" shape="circle" @click="goSing(0)"><span
class="btnText">取消报名</span></up-button>
</view>
</view>
</view>
@ -62,122 +69,148 @@
<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 { getTakePartsInfoByacId, gotoQrcode, gotoSing1, gotoSing2 } 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 { 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 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 store = useStore();
const QNDomain = store.state.user.QNDomain;
const actiInfoList = ref({});
const activityAttendInfo = ref({});
const qrcodeInfo = ref();
function getAvatar() {
return QNDomain + actiInfoList.value.avatarInfo
return QNDomain + actiInfoList.value.avatarInfo;
}
function isHTML(str) {
const htmlRegex = /<[^>]*>/;
return htmlRegex.test(str);
}
const textopen = ref(false)
onLoad((options) => {
const _id = options.id
const _id = options.id;
getInfo(_id).then(response => {
actiInfoList.value = response.data;
textopen.value = isHTML(actiInfoList.value.acContent);
console.log("actiInfoList:", actiInfoList.value);
});
getDicts('activity_state').then(e => {
activityState.value = e.data
})
activityState.value = e.data;
});
getDicts('take_part_state').then(e => {
takePartState.value = e.data
})
takePartState.value = e.data;
});
checkStatus(options.id);
});
})
const activityAttendInfo = ref({})
const checkStatus = (id) => {
getTakePartsInfoByacId(id).then(e => {
console.log("数据:", e);
activityAttendInfo.value = e.data;
})
}
console.log("个人信息:", activityAttendInfo.value)
});
};
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('扫描二维码出现错误')
}
})
}
proxy.$tab.navigateBack(1);
};
const toimage = (url) => {
if (typeof url === 'string') {
let info = url.split(",");
// 使mapdomainName
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
}
//
return null;
};
function cancel() {
open.value = !open.value
open.value = !open.value;
}
const getDictLabelByValue = (state) => {
const dict = activityState.value.find((dict) => dict.dictValue === state);
return dict ? dict : '未知状态';
};
const goSing = (e) => {
if (e === 0) {
//
gotoSing2(activityAttendInfo.value.id).then(e => {
proxy.$modal.msgSuccess("取消报名成功!");
actiInfoList.value.elroll -= 1
})
}
if (e === 1) {
//
gotoSing1(activityAttendInfo.value.id).then(e => {
proxy.$modal.msgSuccess("报名成功!");
actiInfoList.value.elroll += 1
})
}
//
checkStatus(actiInfoList.value.id);
}
const goQrcode = () => {
uni.scanCode({
onlyFromCamera: true,
success: (res) => {
console.log('扫描二维码成功,结果:', res);
toqrcode(res);
},
error: (res) => {
console.log('扫描二维码出现错误');
}
});
}
function confirm() {
open.value = !open.value;
activityAttendInfo.value.qrcodeInfo = JSON.stringify(qrcodeInfo.value)
gotoQrcode(activityAttendInfo.value).then(e => {
proxy.$modal.msgSuccess("签到成功!");
//
checkStatus(actiInfoList.value.id);
})
}
const toqrcode = (e) => {
qrcodeInfo.value = JSON.parse(e.result);
if (actiInfoList.value.id !== qrcodeInfo.value.id) {
proxy.$modal.msgError('二维码不匹配!')
return;
} else {
open.value = !open.value;
console.log("信息:", qrcodeInfo.value);
}
};
</script>
<style lang="scss">
.navbarcenter {
@ -324,4 +357,12 @@ const getDictLabelByValue = (state) => {
z-index: 10002;
/* 确保在最上层 */
}
.acContentstyle {
color: #000000 !important;
font-weight: 400;
font-size: 24rpx;
text-align: left;
line-height: 46rpx;
}
</style>

View File

@ -1,82 +1,94 @@
<template>
<view>
<!-- 顶部导航栏 -->
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" @leftClick="leftClick"
:bgColor="bgColor">
<template #center>
<div class="navbarcenter"><span>发布活动</span></div>
</template>
</up-navbar>
</view>
<view class="bgc"></view>
<view class="cardz">
<view class="titleInfo">
<up-input placeholder="输入活动标题~5~20个字" v-model="title" border="none" maxlength="20" fontSize="34rpx"
color="#C0C0C0" clearable></up-input>
<view class="xian"></view>
</view>
<view class="contentInfo">
<up-textarea v-model="content" placeholder="
<up-form :model="form" :rules="rules" ref="uFormRef">
<view class="cardz">
<view class="titleInfo">
<up-form-item label="" prop="acTitle" borderBottom>
<up-input placeholder="输入活动标题~5~20个字" v-model="form.acTitle" border="none" maxlength="20"
fontSize="34rpx" color="#C0C0C0" clearable></up-input>
</up-form-item>
<view class="xian"></view>
</view>
<view class="contentInfo">
<up-form-item label="" prop="acContent" borderBottom>
<up-textarea v-model="form.acContent" placeholder="
活动图片最多可发布两张
输入准确定位可以更好提供活动信息奥安全指南请勿发布带有个人信息住址" count border="none" height="270" maxlength="500"
placeholderStyle="color: #c0c0c0;font-size: 30rpx; background:none;"></up-textarea>
</view>
<view class="cardzfile">
<fileUpload v-model="fileList1" :fileTypeInfo="fileTypeInfo1" :limit="2"></fileUpload>
</view>
</view>
<view class="cardx">
<up-cell-group :border="false">
<up-cell :isLink="true" :center="true" @click="startTime">
<template #title style="margin-top: 2rpx;width: 100%;height: 30rpx;display: flex;align-items: center;">
<image v-if="showtext1" :src="tu52" style="width: 30rpx; height: 32rpx;"></image>
<image v-else :src="tu522" style="width: 30rpx; height: 32rpx;"></image>
<span v-if="showtext1" >请选择活动开始时间</span>
<span v-else class="text2">{{parseTime(StartTime, '{y}-{m}-{d} {h}:{i}:{s}')}}</span>
<up-datetime-picker :show="showStartTime" v-model="newData"
:modelValue="newData"
@confirm="confirm1"
@cancel="cancel"
mode="datetime"></up-datetime-picker>
</template>
</up-cell>
<up-cell :isLink="true" :center="true" @click="showEndTime =!showEndTime ">
<template #title style="margin-top: 2rpx;width: 100%;height: 30rpx;display: flex;align-items: center;">
<image v-if="showtext2" :src="tu53" style="width: 30rpx; height: 32rpx;"></image>
<image v-else :src="tu532" style="width: 30rpx; height: 32rpx;"></image>
<span v-if="showtext2"></span>
<span v-else class="text2"> {{parseTime(EndTime, '{y}-{m}-{d} {h}:{i}:{s}')}}</span>
<up-datetime-picker :show="showEndTime" v-model="newData" @confirm="confirm2"
:modelValue="newData"
@cancel="cancel"
mode="datetime"></up-datetime-picker>
</template>
</up-cell>
<up-cell :border="false" :isLink="true" :center="true">
<template #title style="margin-top: 2rpx;width: 100%;height: 30rpx;display: flex;align-items: center;">
<image v-if="showtext3" :src="tu51" style="width: 30rpx; height: 32rpx;"></image>
<image v-else :src="tu512" style="width: 30rpx; height: 32rpx;"></image>
<span>添加活动具体位置</span>
</template>
</up-cell>
</up-cell-group>
</view>
placeholderStyle="color: #c0c0c0;font-size: 30rpx; background:none;"></up-textarea>
</up-form-item>
</view>
<up-form-item label="" prop="file" borderBottom>
<view class="cardzfile">
<fileUpload v-model="form.file" :fileTypeInfo="fileTypeInfo1" :limit="2"></fileUpload>
</view>
</up-form-item>
<view class="cardxx">
<up-button color="#C9F6F5" size="large" shape="circle" @click="publish"><span
class="fbText">发布</span></up-button>
<view style="width: 26rpx;height: 80rpx;"></view>
<up-button color="#F8F8E3" size="large" shape="circle" @click="draft" style="margin-left: 26rpx;"><span
class="cgText">存草稿</span></up-button>
</view>
</view>
<view class="cardx">
<up-cell-group :border="false">
<up-form-item label="" prop="startTime" borderBottom @click="showStartTime =! showStartTime">
<view style="margin-top: 2rpx;width: 100%;height: 30rpx;display: flex;align-items: center;">
<image v-if="showtext1" :src="tu52" style="width: 30rpx; height: 32rpx; margin-right: 12rpx;"></image>
<image v-else :src="tu522" style="width: 30rpx; height: 32rpx; margin-right: 12rpx;"></image>
<up-input v-model="form.startTime" disabled disabledColor="#ffffff" color="#C9F6F5"
placeholder="请选择活动开始时间" placeholderStyle="color: #333333 !important;font-size: 30rpx;"
border="none">
<span v-if="showtext2"></span>
</up-input>
<up-icon slot="right" name="arrow-right"></up-icon>
</view>
</up-form-item>
<up-form-item label="" prop="endTime" borderBottom @click="showEndTime = !showEndTime">
<view style="margin-top: 2rpx;width: 100%;height: 30rpx;display: flex;align-items: center;">
<image v-if="showtext2" :src="tu53" style="width: 30rpx; height: 32rpx;margin-right: 12rpx;"></image>
<image v-else :src="tu532" style="width: 30rpx; height: 32rpx; margin-right: 12rpx;"></image>
<up-input v-model="form.endTime" disabled disabledColor="#ffffff" color="#C9F6F5"
placeholder="请选择活动结束时间" placeholderStyle="color: #333333 !important;font-size: 30rpx;"
border="none">
<span v-if="showtext2"></span>
</up-input>
<up-icon slot="right" name="arrow-right"></up-icon>
</view>
</up-form-item>
<up-cell :border="false" :isLink="true" :center="true">
<template #title
style="margin-top: 2rpx;width: 100%;height: 30rpx;display: flex;align-items: center;">
<image v-if="showtext3" :src="tu51" style="width: 30rpx; height: 32rpx;"></image>
<image v-else :src="tu512" style="width: 30rpx; height: 32rpx;"></image>
<span>添加活动具体位置</span>
</template>
</up-cell>
</up-cell-group>
</view>
<up-datetime-picker :show="showStartTime" v-model="newData" :modelValue="newData" @confirm="confirm1" format="YYYY-MM-DD HH:mm:ss"
@cancel="cancel" mode="datetime"></up-datetime-picker>
<up-datetime-picker :show="showEndTime" v-model="newData" @confirm="confirm2" :modelValue="newData" format="YYYY-MM-DD HH:mm:ss"
@cancel="cancel" mode="datetime"></up-datetime-picker>
<view class="cardxx">
<up-button color="#C9F6F5" size="large" shape="circle" @click="publish" throttleTime="500"><span
class="fbText">发布</span></up-button>
<view style="width: 26rpx;height: 80rpx;"></view>
<up-button color="#F8F8E3" size="large" shape="circle" @click="draft" style="margin-left: 26rpx;"><span
class="cgText">存草稿</span></up-button>
</view>
</up-form>
</template>
<script setup>
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/activityInfo/info";
import fileUpload from '../common/file/fileUpload'
import { onShow, onLoad } from '@dcloudio/uni-app'
import { ref, reactive, getCurrentInstance,computed } from 'vue'
import { ref, reactive, getCurrentInstance, computed, toRefs } from 'vue'
import { useStore } from 'vuex';
const { proxy } = getCurrentInstance();
const iconConfig = proxy.iconConfig;
@ -88,56 +100,137 @@ const tu53 = iconConfig.tu53;
const tu532 = iconConfig.tu532;
const title = ref('')
const content = ref('');
const data = reactive({
form: {
acTitle: '',
acContent: '',
startTime: null,
endTime: null,
file: null,
state: null,
},
rules: {
acTitle: [
{ required: true, message: '请输入活动标题', trigger: 'blur' },
{ min: 5, max: 20, message: '标题长度在 5 到 20 个字符', trigger: 'blur' }
],
acContent: [
{ required: true, message: '请输入活动内容', trigger: 'blur' },
{ max: 500, message: '内容不能超过 500 字', trigger: 'blur' }
],
startTime: [
{ required: true, message: '请选择活动开始时间', trigger: 'change' }
],
endTime: [
{ required: true, message: '请选择活动结束时间', trigger: 'change' },
{ validator: (rule, value, callback) => {
console.log(form.value.startTime," ",value," ",value <= form.value.startTime)
if (value <= form.value.startTime) {
callback( proxy.$modal.msgError('时间选择错误') );
} else {
callback();
}
}, trigger: 'change' }
]
}
});
const { form, rules } = toRefs(data);
const fileList1 = ref([])
const fileTypeInfo1 = ref('image')
const bgColor = ref('');
bgColor.value = 'rgba(170, 0, 0, 0)'
const showStartTime = ref(false);
const showEndTime = ref(false);
const StartTime = ref('请选择活动开始时间')
const showtext1 = ref(true)
const showtext2 = ref(true)
const showtext3 = ref(true)
const EndTime = ref('请选择活动结束时间')
const newData = ref(new Date().getTime())
const StartTime = ref('请选择活动开始时间');
const showtext1 = ref(true);
const showtext2 = ref(true);
const showtext3 = ref(true);
const EndTime = ref('请选择活动结束时间');
const newData = ref(new Date().getTime());
const timeFormat = uni.$u.timeFormat;
//
const uFormRef = ref(null);
onLoad((options) => {
console.log("页面参数:", options.id);
})
const leftClick = () => {
proxy.$tab.navigateBack(1)
}
const draft = () => {
form.value.auditStatus = "5"
submitForm('draft');
console.log("存草稿");
}
const publish = () => {
form.value.auditStatus = "1"
submitForm('publish');
console.log("发布");
}
const submitForm = (type) => {
if (uFormRef.value) {
uFormRef.value.validate().then(valid => {
if (valid) {
console.log('表单验证通过:', form.value);
proxy.$modal.loading('正在提交数据,请稍候...');
//
if (type === 'publish') {
console.log("调用发布接口", form.value);
//
addInfo(form.value).then(response => {
proxy.$modal.closeLoading();
proxy.$modal.msgSuccess("发布成功");
proxy.$tab.navigateTo('/pages/common/talkState/publish')
});
} else {
// 稿
addInfo(form.value).then(response => {
proxy.$modal.closeLoading();
proxy.$modal.msgSuccess("存草稿成功");
});
}
} else {
console.log('表单验证失败');
}
}).catch(error => {
console.log('表单验证错误:', error);
});
} else {
console.log('表单引用未定义');
}
}
const startTime = (e) => {
showStartTime.value = !showStartTime.value
}
const confirm1 = (e) => {
console.log(e);
showtext1.value = false;
StartTime.value = e.value
showStartTime.value = false
form.value.startTime = timeFormat(e.value,'yyyy-mm-dd hh:MM:ss');
showStartTime.value = !showStartTime.value
}
const confirm2 = (e) => {
console.log(e);
showtext2.value = false;
EndTime.value = e.value
showEndTime.value = false
form.value.endTime = timeFormat(e.value,'yyyy-mm-dd hh:MM:ss');
showEndTime.value = !showEndTime.value
}
const cancel = (e) => {
showStartTime.value = false
showEndTime.value = false
showStartTime.value = false;
showEndTime.value = false;
}
</script>
<style lang="scss">
.navbarcenter {
font-weight: 400;
font-size: 36rpx;
text-align: left;
color: #000000;
@ -190,9 +283,6 @@ const cancel = (e) => {
display: flex;
align-items: center;
}
}
.cardxx {
@ -207,21 +297,18 @@ const cancel = (e) => {
color: #FBFBFB !important;
}
.cgText {
font-weight: 400;
font-size: 30rpx;
color: #999999 !important;
}
}
.text2{
.text2 {
margin-left: 12rpx;
font-weight: 400;
font-size: 30rpx;
text-align: left;
color: #C9F6F5 !important;
font-size: 30rpx;
text-align: left;
color: #C9F6F5 !important;
}
</style>
</style>

View File

@ -104,7 +104,7 @@ const afterRead = async (event) => {
url: store.state.user.QNDomain + result,
furl: result
});
emit("update:modelValue", fileList1.value);
emit("update:modelValue", listToString(fileList1.value));
fileListLen++;
} catch (error) {
console.error("上传失败:", error);
@ -219,7 +219,7 @@ const typeInfo = () => {
separator = separator || ",";
for (let i in list) {
if (list[i].url) {
strs += list[i].url + separator;
strs += list[i].furl + separator;
}
}
return strs != '' ? strs.substr(0, strs.length - 1) : '';

View File

@ -39,7 +39,10 @@ const bgColor = ref('');
bgColor.value = 'rgba(170, 0, 0, 0)'
const leftClick = () => {
proxy.$tab.navigateBack(1)
proxy.$tab.switchTab("/pages/index")
}
const publish = () => {
proxy.$tab.switchTab("/pages/index")
}
</script>
<style lang="scss" scoped>