提交 33bce5df 编写于 作者: R Renic1

新增教师发布活动页面

上级 3abab024
......@@ -53,7 +53,12 @@
"navigationStyle": "custom"
}
}, {
"path": "pages/discover/detail",
"path": "pages/discover/discover-detail",
"style": {
"navigationStyle": "custom"
}
}, {
"path": "pages/discover/add-school-activity",
"style": {
"navigationStyle": "custom"
}
......
<template>
<view class="add-school-activity">
<view class="nav-bar-back">
<image class="nav-bar-back-icon" src="/static/discover/back.png" @click="goBack"></image>
<view class="nav-bar-title">发起赛事</view>
<image class="nav-bar-add" src="../../static/post/发送.png" @click="submit"></image>
</view>
<view class="school-activity-icon-wrapper">
<image class="school-activity-icon" src="/static/discover/activity-icon.png"></image>
</view>
<view class="school-activity-item-wrapper">
<view class="form-group">
<image class="form-icon" src="/static/discover/name.png"></image>
<input class="form-input" type="text" placeholder="请输入活动名称" v-model="name">
</view>
<view class="form-group">
<image class="form-icon" src="/static/discover/content.png"></image>
<textarea class="form-input1" placeholder="请输入活动内容" v-model="content" ></textarea>
</view>
<view class="form-group">
<image class="form-icon" src="/static/discover/activity-time.png"></image>
<view class="input-wrapper">
<view class="form-input2">
<picker mode="date" start="1970-01-01" end="2100-12-31" @change="handleDateChange1">
<view class="picker">{{ start_date }}</view>
</picker>
</view>
<view class="form-input2">
<picker mode="date" start="1970-01-01" end="2100-12-31" @change="handleDateChange2">
<view class="picker">{{ end_date }}</view>
</picker>
</view>
</view>
</view>
<view class="form-group">
<image class="form-icon" src="/static/discover/activity-object.png"></image>
<input class="form-input" type="text" placeholder="请输入活动对象" v-model="object">
</view>
<view class="form-group">
<image class="form-icon" src="/static/discover/activity-place.png"></image>
<input class="form-input" type="text" placeholder="请输入活动地点" v-model="place">
</view>
<view class="form-group">
<image class="form-icon" src="/static/discover/activity-contact.png"></image>
<input class="form-input" type="text" placeholder="请输入活动联系方式" v-model="contact">
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
name:'',
content:'',
object:'',
place:'',
contact:'',
start_date: '2023-05-04',
end_date: '2023-05-04',
}
},
methods: {
goBack() {
uni.navigateBack({
delta: 1
})
},
async submit() {
if (!/^[\u4e00-\u9fa5]+$/.test(this.name)) {
uni.showToast({
title: '请输入正确的中文姓名',
icon: 'none'
});
return;
}else {
uni.showToast({
title: '提交成功',
icon: 'success'
});
}
// try {
// const res = await uniCloud.callFunction({
// name: 'addActivity',
// data: {
// name: this.name
// }
// });
// uni.showToast({
// title: '提交成功',
// icon: 'success'
// });
// this.name = '';
// } catch (err) {
// console.error(err);
// uni.showToast({
// title: '提交失败,请稍后再试',
// icon: 'none'
// });
},
handleDateChange1(event) {
this.start_date = event.detail.value
},
handleDateChange2(event) {
this.end_date = event.detail.value
},
}
}
</script>
<style>
.add-school-activity {
position: absolute;
width: 100%;
height: 100%;
background-color: #EDEEF0;
}
.nav-bar-back {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 60px;
background-color: #EDEEF0;
}
.nav-bar-back-icon {
width: 40px;
height: 30px;
}
.nav-bar-title {
flex: 1;
text-align: center;
font-size: 24px;
font-weight: bold;
color: #F1992D;
}
.nav-bar-add {
width: 30px;
height: 30px;
margin-top: 10px;
float: right;
margin-right: 10px;
}
.school-activity-icon-wrapper{
margin-top: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.school-activity-icon {
width: 50%;
height: 80px;
margin: 0px;
padding: 0px;
}
.school-activity-item-wrapper{
margin-top: 20px;
}
.form-group {
display: flex;
align-items: center;
margin-top: 15px;
}
.form-icon {
width: 40px;
height: 30px;
margin-left: 30px;
}
.form-input {
margin-left: 5px;
width: 70%;
height: 35px;
border: none;
outline: none;
font-size: 14px;
color: #333;
background-color: #fff;
padding: 0 10px;
}
.form-input1 {
margin-left: 5px;
width: 70%;
height: 70px;
border: none;
outline: none;
font-size: 14px;
color: #333;
background-color: #fff;
padding: 0 10px;
}
.input-wrapper {
flex-direction: column;
display: flex;
width: 100%;
}
.form-input2 {
margin-top: 5px;
margin-left: 10px;
width: 80%;
height: 35px;
border: none;
outline: none;
font-size: 14px;
color: #333;
background-color: #fff;
padding: 0 10px;
}
</style>
\ No newline at end of file
......@@ -4,7 +4,7 @@
<image class="nav-bar-back-icon" src="/static/discover/back.png" @click="goBack"></image>
<view class="nav-bar-title">{{title}}</view>
</view>
<view class="school-activity-icon-wrapper"><image class="school-activity-icon" src="/static/my/main/modify-icon.png"></image></view>
<view class="school-activity-icon-wrapper"><image class="school-activity-icon" src="/static/discover/activity.svg"></image></view>
<view class="activity-production">
<image class="activity-production-icon" src="/static/discover/production.png"></image>
<text>活动介绍:</text>
......@@ -76,9 +76,10 @@
color: #F1992D;
}
.school-activity-icon-wrapper{
display: flex;
justify-content: center;
align-items: center;
margin-top: 10px;
display: flex;
justify-content: center;
align-items: center;
}
.school-activity-icon {
......
......@@ -14,8 +14,20 @@
<!-- 校内活动 -->
<view class="one-school-activity" @click="goToDetail" >
<text class="school-activity-title">{{title}}</text>
<image class="school-activity-icon" src="/static/my/main/modify-icon.png"></image>
<image class="school-activity-icon" src="/static/discover/activity.svg"></image>
</view>
<view class="one-school-activity" @click="goToDetail" >
<text class="school-activity-title">{{title}}</text>
<image class="school-activity-icon" src="/static/discover/activity.svg"></image>
</view>
<view class="one-school-activity" @click="goToDetail" >
<text class="school-activity-title">{{title}}</text>
<image class="school-activity-icon" src="/static/discover/activity.svg"></image>
</view>
<view @click="goActivityAdd" class="add-activity" v-if="showButton">
<u-icon name="edit-pen" color="#F1992D" size="40"></u-icon>
</view>
</view>
</template>
......@@ -23,19 +35,32 @@
export default {
data() {
return {
showButton: false, // 初始值为隐藏
id: '1' ,// 根据id控制显示和隐藏
list: [{
name: '发现'
}],
title:'趣味篮球赛'
}
},
methods: {
goToDetail() {
uni.navigateTo({
url: '/pages/discover/detail'
})
}
}
mounted() {
// 根据id值进行判断
if (this.id == 1) {
this.showButton = true;
}
},
methods: {
goToDetail() {
uni.navigateTo({
url: '/pages/discover/discover-detail'
})
},
goActivityAdd() {
uni.navigateTo({
url: '/pages/discover/add-school-activity'
})
},
}
}
</script>
......@@ -54,7 +79,7 @@
width: 90%;
height: 200px;
margin-top: 2px;
margin-bottom: 4px;
margin-bottom: 10px;
}
.school-activity-name {
......@@ -63,4 +88,17 @@
font-size: 24px;
font-weight: bold;
}
.add-activity {
position: fixed;
right: 20rpx;
bottom: 100rpx;
width: 100rpx;
height: 100rpx;
border-radius: 50%;
background-color: white;
box-shadow: 0 0 20rpx #999;
display: flex;
justify-content: center;
align-items: center;
}
</style>
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册