活动管理完成列表页面简单联调
parent
285165da02
commit
a4ccdc6ad7
|
@ -49,3 +49,26 @@ export function delActivityTakeInfo(id) {
|
||||||
method: 'delete'
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -37,14 +37,6 @@
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "若依移动端框架",
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
"navigationBarTextStyle": "white"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/signln/signid",
|
"path": "pages/signln/signid",
|
||||||
"style": {
|
"style": {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<view class="fixed-header">
|
<view class="fixed-header">
|
||||||
<!-- 顶部导航栏 -->
|
<!-- 顶部导航栏 -->
|
||||||
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" @leftClick="leftClick">
|
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" @leftClick="leftClick">
|
||||||
|
|
||||||
<template #center>
|
<template #center>
|
||||||
<div class="navbarcenter"><span>活动详情</span></div>
|
<div class="navbarcenter"><span>活动详情</span></div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -17,7 +16,10 @@
|
||||||
<view class="addrs">活动地点:{{ actiInfoList.addres }}</view>
|
<view class="addrs">活动地点:{{ actiInfoList.addres }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cardz">
|
<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>
|
||||||
<view class="cardx" v-for="(item, index) in toimage(actiInfoList.file)" :key="index">
|
<view class="cardx" v-for="(item, index) in toimage(actiInfoList.file)" :key="index">
|
||||||
<image :src="item" class="image"></image>
|
<image :src="item" class="image"></image>
|
||||||
|
@ -26,30 +28,35 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="dictAuto">
|
<view class="dictAuto">
|
||||||
<view v-if="actiInfoList.state === '0'">
|
<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>
|
<up-button color="#F1F1F1" size="large" shape="circle"><span class="btnText">未参加</span></up-button>
|
||||||
</view>
|
</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>
|
<up-button color="#F1F1F1" size="large" shape="circle"><span class="btnText">已参加</span></up-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="actiInfoList.state === '2'">
|
<view v-else-if="actiInfoList.state === '2'">
|
||||||
<view class="state1" v-if="activityAttendInfo.attendState === '0'">
|
<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>
|
||||||
<view class="state2" v-else-if="activityAttendInfo.attendState === '1'">
|
<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>
|
||||||
<view class="state2" v-else-if="activityAttendInfo.attendState === '2'">
|
<view class="state2" v-else-if="activityAttendInfo.attendState === '2'">
|
||||||
<up-button color="#FDE2E2" size="large" shape="circle"><span class="btnText">已签到</span></up-button>
|
<up-button color="#FDE2E2" size="large" shape="circle"><span class="btnText">已签到</span></up-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="actiInfoList.state === '1'">
|
<view v-else-if="actiInfoList.state === '1'">
|
||||||
<view class="state1" v-if="activityAttendInfo.attendState === '0'">
|
<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>
|
||||||
<view class="state1" v-else-if="activityAttendInfo.attendState === '1'">
|
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -62,122 +69,148 @@
|
||||||
<view class="launchAddres">{{ actiInfoList.infoSchool }}</view>
|
<view class="launchAddres">{{ actiInfoList.infoSchool }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="elroll">已报名:{{ actiInfoList.elroll }}人</view>
|
<view class="elroll">已报名:{{ actiInfoList.elroll }}人</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infox2">
|
<view class="infox2">
|
||||||
<up-modal :show="open" :title="title" width="600rpx" :content='content' confirmText="签到" cancelText="取消"
|
<up-modal :show="open" :title="title" width="600rpx" :content='content' confirmText="签到" cancelText="取消"
|
||||||
confirmColor="#3477FC" showCancelButton closeOnClickOverlay @confirm="confirm" @cancel="cancel"></up-modal>
|
confirmColor="#3477FC" showCancelButton closeOnClickOverlay @confirm="confirm" @cancel="cancel"></up-modal>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<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 { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/activityInfo/info";
|
||||||
import { getDicts } from "@/api/system/dict/data"
|
import { getDicts } from "@/api/system/dict/data";
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import { ref, reactive, getCurrentInstance, toRefs, computed } from 'vue'
|
import { ref, reactive, getCurrentInstance, toRefs, computed } from 'vue';
|
||||||
import { useStore } from 'vuex';
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const iconConfig = proxy.iconConfig;
|
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({
|
const style = ref({
|
||||||
p: 'font-weight: 400;font-size: 24rpx;color: #000000 !important;',
|
p: 'font-weight: 400;font-size: 24rpx;color: #000000 !important;',
|
||||||
|
});
|
||||||
|
const activityState = ref([]); // 字典 activity_state 活动状态
|
||||||
})
|
const takePartState = ref([]); // 字典 take_part_state 活动参与状态
|
||||||
const activityState = ref([])//字典 activity_state 活动状态
|
const open = ref(false);
|
||||||
const takePartState = ref([])//字典 take_part_state 活动参与状态
|
|
||||||
const open = ref(false)
|
|
||||||
const title = ref('确认签到');
|
const title = ref('确认签到');
|
||||||
const content = ref('请您确认活动签到,祝您玩的愉快!');
|
const content = ref('请您确认活动签到,祝您玩的愉快!');
|
||||||
// 创建响应式数据 ref('#001f3f')
|
|
||||||
const bgColor = ref('');
|
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 actiInfoList = ref({});
|
||||||
|
const activityAttendInfo = ref({});
|
||||||
|
const qrcodeInfo = ref();
|
||||||
|
|
||||||
function getAvatar() {
|
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) => {
|
onLoad((options) => {
|
||||||
const _id = options.id
|
const _id = options.id;
|
||||||
getInfo(_id).then(response => {
|
getInfo(_id).then(response => {
|
||||||
actiInfoList.value = response.data;
|
actiInfoList.value = response.data;
|
||||||
|
textopen.value = isHTML(actiInfoList.value.acContent);
|
||||||
console.log("actiInfoList:", actiInfoList.value);
|
console.log("actiInfoList:", actiInfoList.value);
|
||||||
});
|
});
|
||||||
getDicts('activity_state').then(e => {
|
getDicts('activity_state').then(e => {
|
||||||
activityState.value = e.data
|
activityState.value = e.data;
|
||||||
})
|
});
|
||||||
getDicts('take_part_state').then(e => {
|
getDicts('take_part_state').then(e => {
|
||||||
takePartState.value = e.data
|
takePartState.value = e.data;
|
||||||
})
|
});
|
||||||
checkStatus(options.id);
|
checkStatus(options.id);
|
||||||
|
});
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
const activityAttendInfo = ref({})
|
|
||||||
const checkStatus = (id) => {
|
const checkStatus = (id) => {
|
||||||
getTakePartsInfoByacId(id).then(e => {
|
getTakePartsInfoByacId(id).then(e => {
|
||||||
console.log("数据:", e);
|
|
||||||
activityAttendInfo.value = e.data;
|
activityAttendInfo.value = e.data;
|
||||||
})
|
console.log("个人信息:", activityAttendInfo.value)
|
||||||
}
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const leftClick = () => {
|
const leftClick = () => {
|
||||||
proxy.$tab.navigateBack(1)
|
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) => {
|
const toimage = (url) => {
|
||||||
if (typeof url === 'string') {
|
if (typeof url === 'string') {
|
||||||
let info = url.split(",");
|
let info = url.split(",");
|
||||||
// 使用map方法处理每个元素,给每个元素增加domainName前缀
|
|
||||||
let processedInfo = info.map(item => QNDomain + item);
|
let processedInfo = info.map(item => QNDomain + item);
|
||||||
console.log("processedInfo", processedInfo);
|
console.log("processedInfo", processedInfo);
|
||||||
// 使用join方法将数组转换成字符串,这里使用逗号作为分隔符
|
|
||||||
return processedInfo;
|
return processedInfo;
|
||||||
}
|
}
|
||||||
return null; // 或者其他默认值
|
return null;
|
||||||
}
|
};
|
||||||
const toqrcode = (e) => {
|
|
||||||
qrcodeInfo.value = JSON.parse(e.result)
|
|
||||||
console.log("信息:", qrcodeInfo.value);
|
|
||||||
}
|
|
||||||
//模态框确认按钮
|
|
||||||
function confirm() {
|
|
||||||
open.value = !open.value
|
|
||||||
}
|
|
||||||
//模态框取消按钮
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = !open.value
|
open.value = !open.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDictLabelByValue = (state) => {
|
const getDictLabelByValue = (state) => {
|
||||||
const dict = activityState.value.find((dict) => dict.dictValue === state);
|
const dict = activityState.value.find((dict) => dict.dictValue === state);
|
||||||
return dict ? dict : '未知状态';
|
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>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.navbarcenter {
|
.navbarcenter {
|
||||||
|
@ -324,4 +357,12 @@ const getDictLabelByValue = (state) => {
|
||||||
z-index: 10002;
|
z-index: 10002;
|
||||||
/* 确保在最上层 */
|
/* 确保在最上层 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.acContentstyle {
|
||||||
|
color: #000000 !important;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
text-align: left;
|
||||||
|
line-height: 46rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -1,82 +1,94 @@
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
<!-- 顶部导航栏 -->
|
<!-- 顶部导航栏 -->
|
||||||
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" @leftClick="leftClick"
|
<up-navbar leftText="" title="" :placeholder="true" :safeAreaInsetTop="true" @leftClick="leftClick"
|
||||||
:bgColor="bgColor">
|
:bgColor="bgColor">
|
||||||
|
|
||||||
<template #center>
|
<template #center>
|
||||||
<div class="navbarcenter"><span>发布活动</span></div>
|
<div class="navbarcenter"><span>发布活动</span></div>
|
||||||
</template>
|
</template>
|
||||||
</up-navbar>
|
</up-navbar>
|
||||||
</view>
|
</view>
|
||||||
<view class="bgc"></view>
|
<view class="bgc"></view>
|
||||||
<view class="cardz">
|
<up-form :model="form" :rules="rules" ref="uFormRef">
|
||||||
<view class="titleInfo">
|
<view class="cardz">
|
||||||
<up-input placeholder="输入活动标题~(5~20个字)" v-model="title" border="none" maxlength="20" fontSize="34rpx"
|
<view class="titleInfo">
|
||||||
color="#C0C0C0" clearable></up-input>
|
<up-form-item label="" prop="acTitle" borderBottom>
|
||||||
<view class="xian"></view>
|
<up-input placeholder="输入活动标题~(5~20个字)" v-model="form.acTitle" border="none" maxlength="20"
|
||||||
</view>
|
fontSize="34rpx" color="#C0C0C0" clearable></up-input>
|
||||||
<view class="contentInfo">
|
</up-form-item>
|
||||||
<up-textarea v-model="content" placeholder="输入活动内容
|
<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"
|
输入准确定位可以更好提供活动信息奥!安全指南:请勿发布带有个人信息(如:住址)" count border="none" height="270" maxlength="500"
|
||||||
placeholderStyle="color: #c0c0c0;font-size: 30rpx; background:none;"></up-textarea>
|
placeholderStyle="color: #c0c0c0;font-size: 30rpx; background:none;"></up-textarea>
|
||||||
</view>
|
</up-form-item>
|
||||||
<view class="cardzfile">
|
</view>
|
||||||
<fileUpload v-model="fileList1" :fileTypeInfo="fileTypeInfo1" :limit="2"></fileUpload>
|
<up-form-item label="" prop="file" borderBottom>
|
||||||
</view>
|
<view class="cardzfile">
|
||||||
</view>
|
<fileUpload v-model="form.file" :fileTypeInfo="fileTypeInfo1" :limit="2"></fileUpload>
|
||||||
<view class="cardx">
|
</view>
|
||||||
<up-cell-group :border="false">
|
</up-form-item>
|
||||||
<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>
|
|
||||||
|
|
||||||
<view class="cardxx">
|
</view>
|
||||||
<up-button color="#C9F6F5" size="large" shape="circle" @click="publish"><span
|
<view class="cardx">
|
||||||
class="fbText">发布</span></up-button>
|
<up-cell-group :border="false">
|
||||||
<view style="width: 26rpx;height: 80rpx;"></view>
|
<up-form-item label="" prop="startTime" borderBottom @click="showStartTime =! showStartTime">
|
||||||
<up-button color="#F8F8E3" size="large" shape="circle" @click="draft" style="margin-left: 26rpx;"><span
|
<view style="margin-top: 2rpx;width: 100%;height: 30rpx;display: flex;align-items: center;">
|
||||||
class="cgText">存草稿</span></up-button>
|
<image v-if="showtext1" :src="tu52" style="width: 30rpx; height: 32rpx; margin-right: 12rpx;"></image>
|
||||||
</view>
|
<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>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/activityInfo/info";
|
||||||
import fileUpload from '../common/file/fileUpload'
|
import fileUpload from '../common/file/fileUpload'
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
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';
|
import { useStore } from 'vuex';
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const iconConfig = proxy.iconConfig;
|
const iconConfig = proxy.iconConfig;
|
||||||
|
@ -88,56 +100,137 @@ const tu53 = iconConfig.tu53;
|
||||||
const tu532 = iconConfig.tu532;
|
const tu532 = iconConfig.tu532;
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
const content = 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 fileList1 = ref([])
|
||||||
const fileTypeInfo1 = ref('image')
|
const fileTypeInfo1 = ref('image')
|
||||||
const bgColor = ref('');
|
const bgColor = ref('');
|
||||||
bgColor.value = 'rgba(170, 0, 0, 0)'
|
bgColor.value = 'rgba(170, 0, 0, 0)'
|
||||||
const showStartTime = ref(false);
|
const showStartTime = ref(false);
|
||||||
const showEndTime = ref(false);
|
const showEndTime = ref(false);
|
||||||
const StartTime = ref('请选择活动开始时间')
|
const StartTime = ref('请选择活动开始时间');
|
||||||
const showtext1 = ref(true)
|
const showtext1 = ref(true);
|
||||||
const showtext2 = ref(true)
|
const showtext2 = ref(true);
|
||||||
const showtext3 = ref(true)
|
const showtext3 = ref(true);
|
||||||
const EndTime = ref('请选择活动结束时间')
|
const EndTime = ref('请选择活动结束时间');
|
||||||
const newData = ref(new Date().getTime())
|
const newData = ref(new Date().getTime());
|
||||||
|
const timeFormat = uni.$u.timeFormat;
|
||||||
|
// 表单引用
|
||||||
|
const uFormRef = ref(null);
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
console.log("页面参数:", options.id);
|
console.log("页面参数:", options.id);
|
||||||
})
|
})
|
||||||
|
|
||||||
const leftClick = () => {
|
const leftClick = () => {
|
||||||
proxy.$tab.navigateBack(1)
|
proxy.$tab.navigateBack(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const draft = () => {
|
const draft = () => {
|
||||||
|
form.value.auditStatus = "5"
|
||||||
|
submitForm('draft');
|
||||||
console.log("存草稿");
|
console.log("存草稿");
|
||||||
}
|
}
|
||||||
|
|
||||||
const publish = () => {
|
const publish = () => {
|
||||||
|
form.value.auditStatus = "1"
|
||||||
|
submitForm('publish');
|
||||||
console.log("发布");
|
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) => {
|
const startTime = (e) => {
|
||||||
showStartTime.value = !showStartTime.value
|
showStartTime.value = !showStartTime.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirm1 = (e) => {
|
const confirm1 = (e) => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
showtext1.value = false;
|
showtext1.value = false;
|
||||||
StartTime.value = e.value
|
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) => {
|
const confirm2 = (e) => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
showtext2.value = false;
|
showtext2.value = false;
|
||||||
EndTime.value = e.value
|
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) => {
|
const cancel = (e) => {
|
||||||
showStartTime.value = false
|
showStartTime.value = false;
|
||||||
showEndTime.value = false
|
showEndTime.value = false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.navbarcenter {
|
.navbarcenter {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
|
@ -190,9 +283,6 @@ const cancel = (e) => {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cardxx {
|
.cardxx {
|
||||||
|
@ -207,21 +297,18 @@ const cancel = (e) => {
|
||||||
color: #FBFBFB !important;
|
color: #FBFBFB !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.cgText {
|
.cgText {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #999999 !important;
|
color: #999999 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.text2{
|
|
||||||
|
.text2 {
|
||||||
margin-left: 12rpx;
|
margin-left: 12rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: #C9F6F5 !important;
|
color: #C9F6F5 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -104,7 +104,7 @@ const afterRead = async (event) => {
|
||||||
url: store.state.user.QNDomain + result,
|
url: store.state.user.QNDomain + result,
|
||||||
furl: result
|
furl: result
|
||||||
});
|
});
|
||||||
emit("update:modelValue", fileList1.value);
|
emit("update:modelValue", listToString(fileList1.value));
|
||||||
fileListLen++;
|
fileListLen++;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("上传失败:", error);
|
console.error("上传失败:", error);
|
||||||
|
@ -219,7 +219,7 @@ const typeInfo = () => {
|
||||||
separator = separator || ",";
|
separator = separator || ",";
|
||||||
for (let i in list) {
|
for (let i in list) {
|
||||||
if (list[i].url) {
|
if (list[i].url) {
|
||||||
strs += list[i].url + separator;
|
strs += list[i].furl + separator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
||||||
|
|
|
@ -39,7 +39,10 @@ const bgColor = ref('');
|
||||||
bgColor.value = 'rgba(170, 0, 0, 0)'
|
bgColor.value = 'rgba(170, 0, 0, 0)'
|
||||||
|
|
||||||
const leftClick = () => {
|
const leftClick = () => {
|
||||||
proxy.$tab.navigateBack(1)
|
proxy.$tab.switchTab("/pages/index")
|
||||||
|
}
|
||||||
|
const publish = () => {
|
||||||
|
proxy.$tab.switchTab("/pages/index")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in New Issue