# Conflicts:
#	backend/application.yaml
#	backend/src/main/resources/application.yaml
This commit is contained in:
Paidax
2025-05-06 17:59:13 +08:00
30 changed files with 1274 additions and 339 deletions
@@ -85,7 +85,7 @@ public class ClientAuthController {
@ApiOperation(value = "短信登录", nickname = "/sms-login", httpMethod = "POST")
public Object doSmsLogin(ClientLoginBody loginBody, HttpServletRequest req) {
try {
String token = clientAuthService.doSmsLogin(loginBody);
String token = clientAuthService.doLogin(loginBody);
return Result.success().addData(token);
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -48,6 +48,16 @@ public class Client_user extends BaseModel implements Serializable {
@Comment("单位ID")
private String unitId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("密码")
private String password;
@Column
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("盐")
private String salt;
@Column
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("openId")
@@ -10,7 +10,7 @@ public interface ClientAuthService {
* @param loginBody 登录信息
* @return token
*/
String doSmsLogin(ClientLoginBody loginBody);
String doLogin(ClientLoginBody loginBody);
/**
* 注册
@@ -1,7 +1,9 @@
package com.budwk.app.client.auth.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.exception.BaseException;
import com.budwk.app.base.utils.PwdUtil;
import com.budwk.app.client.auth.vo.ClientLoginBody;
import com.budwk.app.client.auth.models.Client_user;
import com.budwk.app.client.auth.vo.ClientRegisterBody;
@@ -11,6 +13,9 @@ import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import java.util.List;
@IocBean
public class ClientAuthServiceImpl implements ClientAuthService {
@@ -21,23 +26,34 @@ public class ClientAuthServiceImpl implements ClientAuthService {
private ValidateService validateService;
@Override
public String doSmsLogin(ClientLoginBody loginBody) {
public String doLogin(ClientLoginBody loginBody) {
Client_user user = null;
int count = dao.count(Client_user.class, Cnd.where(Client_user::getPhone, "=", loginBody.getPhone()));
if (count == 0) {
// // 自动注册
// user = new Client_user();
// user.setPhone(loginBody.getPhone());
// user.setUserName("用户" + loginBody.getPhone());
// dao.insert(user);
throw new BaseException("手机号码不存在");
}
validateService.checkSMSCode(loginBody.getPhone(), loginBody.getSmsCode());
user = dao.fetch(Client_user.class, Cnd.where(Client_user::getPhone, "=", loginBody.getPhone()));
if (user == null) {
throw new BaseException("用户登录失败");
throw new BaseException("用户不存在");
}
if (StrUtil.isBlank(loginBody.getLoginMethod()) || !List.of("sms", "password").contains(loginBody.getLoginMethod())) {
throw new BaseException("登录方式不正确");
}
if (loginBody.getLoginMethod().equals("sms")) {
validateService.checkSMSCode(loginBody.getPhone(), loginBody.getSmsCode());
}
if (loginBody.getLoginMethod().equals("password")) {
String hashedPassword = PwdUtil.getPassword(loginBody.getPassword(), user.getSalt());
if (!Strings.sNull(hashedPassword).equalsIgnoreCase(user.getPassword())) {
throw new BaseException("密码不正确");
}
}
StpClientUtil.STP.login(user.getId());
StpClientUtil.STP.checkLogin();
return StpClientUtil.STP.getTokenValue();
@@ -9,4 +9,8 @@ public class ClientLoginBody {
private String smsCode;
private String password;
private String loginMethod;
}
@@ -81,6 +81,7 @@ public class ClientActivityController {
return Result.success();
}
/**
* 查询报名人员
* 报名人不见得参加活动
@@ -117,4 +117,18 @@ public class ClientItemController {
}
/**
* 取消项目报名
* @param signVO
* @return
*/
@At("/cancel-team-sign-up")
@AdaptBy(type = JsonAdaptor.class)
@SaCheckLogin(type = StpClientUtil.TYPE)
public synchronized Result cancelTeamSignUp(ClientActivitySignVO signVO) {
clientItemService.cancelTeamSignUp(signVO);
return Result.success();
}
}
@@ -1,9 +1,12 @@
package com.budwk.app.client.module.activity.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.client.module.activity.vo.ClientActivitySignVO;
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
import com.budwk.app.module.activity.models.ActivityItemUser;
public interface ClientItemService extends BaseService<ActivityItemUser> {
void signUp(ClientItemSignUpVO signVO);
void cancelTeamSignUp(ClientActivitySignVO signVO);
}
@@ -2,6 +2,7 @@ package com.budwk.app.client.module.activity.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.client.module.activity.service.ClientItemService;
import com.budwk.app.client.module.activity.vo.ClientActivitySignVO;
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
import com.budwk.app.module.activity.models.ActGroupUser;
import com.budwk.app.module.activity.models.Activity;
@@ -59,4 +60,10 @@ public class ClientItemServiceImpl extends BaseServiceImpl<ActivityItemUser> imp
}
insert(userList);
}
@Override
public void cancelTeamSignUp(ClientActivitySignVO signVO) {
clear(Cnd.where(ActivityItemUser::getActivityId, "=", signVO.getActivityId())
.and(ActivityItemUser::getItemId, "=", signVO.getItemId()));
}
}
@@ -12,6 +12,7 @@ import java.util.List;
public class ClientActivitySignVO {
private Long activityId;
private Long itemId;
private String unitId;
@@ -185,7 +185,7 @@ public class ActUserController {
@At
@SaCheckPermission("activity.user")
public Result getActivityList(String year){
List<Activity> activityList = dao.query(Activity.class, Cnd.where("YEAR(startTime)", "=", year).and(Activity::getDelFlag, "=", false));
List<Activity> activityList = dao.query(Activity.class, Cnd.NEW().andEX("YEAR(startTime)", "=", year).and(Activity::getDelFlag, "=", false));
return Result.success(activityList);
}
@@ -0,0 +1,123 @@
package com.budwk.app.module.activity.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.PageForm;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.module.activity.models.ActWonderfulMoment;
import com.budwk.app.module.activity.models.Activity;
import com.budwk.app.module.activity.service.ActWonderfulMomentService;
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName ActWonderfulMomentController
* @Author JyuHsin
* @Date 2025/5/6 15:30
* @Version 1.0
* @Description TODO
*/
@Slf4j
@IocBean
@Ok("json:full")
@At("/platform/activity/wonderfulMoment")
public class ActWonderfulMomentController {
@Inject
private ActWonderfulMomentService wonderfulMomentService;
@At("")
@SaCheckPermission("activity.wonderfulMoment")
@Ok("beetl:/platform/activity/wonderfulMoment/index.html")
public void index() {
}
@At
@SaCheckPermission("activity.wonderfulMoment")
public Result pageData(PageForm pageForm, String startTime, String endTime){
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
cnd.and("title", "like", "%" + pageForm.getSearchKeyword() + "%");
}
cnd.andEX("publishTime", ">=", startTime);
cnd.andEX("publishTime", "<=", endTime);
cnd.desc("publishTime");
Pagination pagination = wonderfulMomentService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
return Result.success(pagination);
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("activity.wonderfulMoment")
public Result onHandle(@Param("wonderfulMoment") ActWonderfulMoment wonderfulMoment) {
if(wonderfulMoment.getId() == null) {
wonderfulMoment.setPublishTime(DateUtil.now());
}
wonderfulMomentService.insertOrUpdate(wonderfulMoment);
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission("activity.wonderfulMoment")
public Result onDelete(Long id) {
wonderfulMomentService.delete(id);
return Result.success();
}
@At
@SaCheckLogin(type = StpClientUtil.TYPE)
public Result getWonderfulMoment(@Param("id") Long id) {
Cnd cnd = Cnd.where("published", "=", true).andEX("id", "=", id);
cnd.desc("publishTime");
List<ActWonderfulMoment> momentList = wonderfulMomentService.query(cnd);
List<NutMap> result = new ArrayList<>();
for (ActWonderfulMoment wonderfulMoment : momentList) {
NutMap nutMap = Lang.obj2map(wonderfulMoment, NutMap.class);
DateTime dateTime = DateUtil.parse(wonderfulMoment.getPublishTime());
//如果是今天
if(DateUtil.isSameDay(dateTime, new Date())) {
nutMap.put("time", "今天" + DateUtil.format(dateTime, "HH:mm"));
} else {
nutMap.put("time", DateUtil.betweenDay(dateTime, new Date(), false) + "天前");
}
result.add(nutMap);
}
return Result.success(result);
}
@At("/getWonderfulMomentById/?")
@SaCheckLogin(type = StpClientUtil.TYPE)
public Result getWonderfulMomentById(Long id) {
ActWonderfulMoment moment = wonderfulMomentService.fetch(id);
return Result.success(moment);
}
@At("/handleWonderfulMoment/?")
@SaCheckLogin(type = StpClientUtil.TYPE)
public Result handleWonderfulMoment(Long id) {
ActWonderfulMoment moment = wonderfulMomentService.fetch(id);
moment.setReadCount(moment.getReadCount() + 1);
wonderfulMomentService.update(moment);
return Result.success();
}
}
@@ -1,5 +1,6 @@
package com.budwk.app.module.activity.controller;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import com.budwk.app.base.page.PageForm;
@@ -8,6 +9,7 @@ import com.budwk.app.base.result.Result;
import com.budwk.app.module.activity.models.Activity;
import com.budwk.app.module.activity.models.ActivityItem;
import com.budwk.app.module.activity.service.ActivityManageService;
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
@@ -163,4 +165,11 @@ public class ActivityManageController {
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@SaCheckLogin(type = StpClientUtil.TYPE)
public Result getActivity() {
List<Activity> activityList = activityService.query(Cnd.NEW());
return Result.success(activityList);
}
}
@@ -0,0 +1,56 @@
package com.budwk.app.module.activity.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
/**
* @ClassName ActWonderfulMoment
* @Author JyuHsin
* @Date 2025/5/6 15:28
* @Version 1.0
* @Description TODO
*/
@Data
@Comment("活动项目队伍得分表")
@Table("act_wonderful_moment")
@EqualsAndHashCode(callSuper = true)
@TableMeta("{'mysql-charset':'utf8mb4'}")
public class ActWonderfulMoment extends BaseModel {
@Id
@Comment("ID")
private Long id;
@Column
@Comment("标题")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String title;
@Column
@Comment("发布内容")
@ColDefine(type = ColType.TEXT)
private String content;
@Column
@Comment("发布时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String publishTime;
@Column
@Comment("封面图")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String cover;
@Column
@Comment("是否发布")
@ColDefine(type = ColType.BOOLEAN)
private Boolean published;
@Column
@Comment("阅读次数")
@Default(value = "0")
@ColDefine(type = ColType.INT)
private Integer readCount;
}
@@ -0,0 +1,14 @@
package com.budwk.app.module.activity.service;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.module.activity.models.ActWonderfulMoment;
/**
* @ClassName ActWonderfulMomentService
* @Author JyuHsin
* @Date 2025/5/6 15:30
* @Version 1.0
* @Description TODO
*/
public interface ActWonderfulMomentService extends BaseService<ActWonderfulMoment> {
}
@@ -0,0 +1,21 @@
package com.budwk.app.module.activity.service.impl;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.module.activity.models.ActWonderfulMoment;
import com.budwk.app.module.activity.service.ActWonderfulMomentService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @ClassName ActWonderfulMomentServiceImpl
* @Author JyuHsin
* @Date 2025/5/6 15:31
* @Version 1.0
* @Description TODO
*/
@IocBean(args = {"refer:dao"})
public class ActWonderfulMomentServiceImpl extends BaseServiceImpl<ActWonderfulMoment> implements ActWonderfulMomentService {
public ActWonderfulMomentServiceImpl(Dao dao) {
super(dao);
}
}
@@ -12,10 +12,22 @@
:on-exceed="handleExceed"
:file-list="fileList"
>
<i class="el-icon-plus"></i>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{file}">
<img class="el-upload-list__item-thumbnail" :src="'/open/file/upload/download?filepath=' + file.url" alt=""
style="var(--box-width, '100px') !important;height: var(--box-height, '100px') !important">
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
<i class="el-icon-zoom-in"></i>
</span>
<span class="el-upload-list__item-delete" @click="handleRemove(file)">
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
<el-dialog :visible.sync="dialogVisible" append-to-body>
<img width="100%" :src="dialogImageUrl" alt="">
<img width="100%" :src="'/open/file/upload/download?filepath=' + dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
@@ -124,4 +136,4 @@ module.exports = {
<style scoped>
</style>
</style>
@@ -78,6 +78,9 @@ const addOrUpdate = {
{{form.files}}
<file-upload v-model="form.files" accept=".pdf"></file-upload>
</el-form-item>
<el-form-item label="封面图" prop="cover">
<image-upload v-model="form.cover" :max-count="1"></image-upload>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">取消</el-button>
@@ -31,15 +31,15 @@ const itemForm = {
<el-table-column label="报名人数">
<template #default="{row}">
<el-input-number v-model="row.num" :disabled="row.isTeamApply"
placeholder="请输入报名人数"></el-input-number>
placeholder="请输入报名人数" style="width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="图片">
<template #default="{row}">
{{row.img}}
<image-upload v-model="row.img" :maxCount="1"></image-upload>
</template>
</el-table-column>
<!-- <el-table-column label="图片">
<template #default="{row}">
{{row.img}}
<image-upload v-model="row.img" :max-count="1"></image-upload>
</template>
</el-table-column>-->
<el-table-column label="操作" fixed="right" width="100px">
<template #default="{$index}">
<el-button type="text" class="text-danger" @click="removeRow($index)">删除</el-button>
@@ -0,0 +1,78 @@
const addOrUpdate = {
template: /*language=HTML*/ `
<el-dialog :title="form.id ? '修改' : '新增'" :visible.sync="visible" width="70%">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
</el-form-item>
<el-form-item label="内容" prop="content">
<text-editor v-model="form.content" :height="300"></text-editor>
</el-form-item>
<el-form-item label="是否发布" prop="published">
<el-switch
v-model="form.published"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
<el-form-item label="封面图" prop="cover">
<image-upload v-model="form.cover" :max-count="1"></image-upload>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="onSubmit">确定</el-button>
</template>
</el-dialog>
`,
data() {
return {
title: '',
visible: false,
form: {
published: true,
},
rules: {
title: [{required: true, message: '请输入标题', trigger: ['blur', 'change']}],
content: [{required: true, message: '请输入内容', trigger: ['blur', 'change']}],
cover: [{required: true, message: '请上传封面图', trigger: ['blur', 'change']}],
},
}
},
methods: {
onOpen(row) {
this.visible = true
if (row?.id) {
this.$nextTick(() => {
this.form = JSON.parse(JSON.stringify(row))
})
} else {
this.form = {published: true}
}
},
onSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.$confirm('您确定要提交吗?', '提示', {
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
$.post('/platform/activity/wonderfulMoment/onHandle', {"wonderfulMoment": JSON.stringify(this.form)}).then(res => {
if (res.code === 0) {
this.$message.success(this.form.id ? '修改成功' : '新增成功')
this.$emit('refresh')
this.visible = false
} else {
this.$message.error(res.msg)
}
})
}).catch(() => {
})
}
})
}
}
}
@@ -0,0 +1,139 @@
<!--#
layout("/layouts/platform_1.html"){
#-->
<style>
</style>
<div id="app">
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">标题</div>
<div class="search-item-option">
<el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入标题"></el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">开始时间</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.startTime"
type="date"
placeholder="请选择发布开始时间"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">结束时间</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.endTime"
type="date"
placeholder="请选择发布结束时间"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt-3">
<el-row type="flex" style="justify-content: flex-end" class="mb-3">
<el-button icon="el-icon-plus" type="primary" size="small" @click="$refs.addOrUpdateRef.onOpen()">新增精彩瞬间</el-button>
</el-row>
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
<el-table-column label="序号" type="index" header-align="center" align="center" width="50"></el-table-column>
<el-table-column label="标题" prop="title"></el-table-column>
<el-table-column label="发布时间" prop="publishTime"></el-table-column>
<el-table-column label="阅读次数" prop="readCount"></el-table-column>
<el-table-column label="发布状态" prop="published">
<template #default="{ row }">
<el-switch
@change="(val) => {publishedChange(val, row)}"
v-model="row.published"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="250">
<template #default="{ row }">
<el-button type="text" @click="$refs.addOrUpdateRef.onOpen(row)">修改</el-button>
<el-button type="text" class="text-danger" @click="onTableRowDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<add-or-update ref="addOrUpdateRef" @refresh="doSearch"></add-or-update>
</div>
<script>
<!--#include('addOrUpdate.js'){}#-->
new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
"add-or-update": addOrUpdate,
},
data() {
return {
pageForm: {
activityId: '',
},
activityList: [],
tableDeleteUrl: "/platform/activity/wonderfulMoment/onDelete"
}
},
methods: {
onTableRowDelete(id) {
if (!id) {
return
}
this.$confirm('确定删除该数据吗?', '提示', {
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
$.post(this.tableDeleteUrl, {id}).then((res) => {
if (res.code === 0) {
this.$message.success("删除成功")
this.pageData()
} else {
this.$message.error(res.msg)
}
})
}).catch(() => {})
},
publishedChange(val, row) {
const params = JSON.parse(JSON.stringify(row))
this.$set(params, 'published', val)
$.post('/platform/activity/wonderfulMoment/onHandle', {"wonderfulMoment": JSON.stringify(params)}).then((res) => {
if (res.code === 0) {
this.$message.success("修改成功")
} else {
this.$message.error(res.msg)
}
})
},
async getActivityList(){
const resp = await $.post('/platform/activity/user/getActivityList')
this.activityList = resp.data
},
},
async created() {
this.getActivityList()
await this.pageData()
}
})
</script>
<!--#
}
#-->
+6
View File
@@ -91,6 +91,12 @@
"style": {
"navigationBarTitleText": "精彩瞬间"
}
},
{
"path": "pages/activity/wonderfulMoment/index",
"style": {
"navigationBarTitleText": "精彩瞬间"
}
}
],
"globalStyle": {
+197 -54
View File
@@ -5,38 +5,40 @@
<t-dropdown-item :options="actOptions" :value="selectActId"/>
</t-dropdown-menu>
<view class="content-container">
<view class="page-header">
<text class="page-title">团队报名</text>
<text class="page-subtitle">点击项目报名</text>
</view>
<!-- <view class="page-header">-->
<!-- <text class="page-title">团队报名</text>-->
<!-- <text class="page-subtitle">点击项目报名</text>-->
<!-- </view>-->
<!-- 项目列表 -->
<view class="project-cards">
<view
v-for="project in itemOptions"
:key="project.id"
class="project-card"
:class="{'project-card--registered': registrationStatus.get(project.id)?.length}"
@click="selectProject(project)"
>
<view class="project-card__content">
<view class="project-card__title">{{ project.name }}</view>
<view class="project-card__desc">{{ project.description }}</view>
</view>
<view class="project-card__status">
<t-tag v-if="registrationStatus.get(project.id)?.length" theme="success" variant="light-outline">
已报名 {{ registrationStatus.get(project.id)?.length }}人
</t-tag>
<view v-else class="project-card__action">
<t-icon name="chevron-right" color="#999"/>
<!-- 项目列表 -->
<view class="project-cards">
<view
v-for="project in itemOptions"
:key="project.id"
class="project-card"
:class="{'project-card--registered': registrationStatus.get(project.id)?.length}"
>
<view class="project-card__content">
<t-image :src=config.fileDomain+project.img shape="round"
class="project-card__image" fit="fill"/>
<view class="project-card__title">{{ project.name }}</view>
<div style="display: flex;justify-content: flex-end;margin-top: 10px;">
<t-button size="small" class="project-card__button" @click="openDesc(project)">项目介绍</t-button>
<t-button size="small" @click="selectProject(project)" class="project-card__button"> 活动报名 {{
registrationStatus.get(project.id)?.length ? registrationStatus.get(project.id)?.length : 0
}}人
</t-button>
</div>
<!-- <t-tag v-if="registrationStatus.get(project.id)?.length" theme="success" variant="light-outline">
已报名 {{ registrationStatus.get(project.id)?.length }}人
</t-tag>-->
</view>
</view>
<!-- <view v-if="registrationStatus.get(project.id)?.length" class="project-card__checkmark">
<t-icon name="check" color="#52c41a"/>
</view>-->
</view>
</view>
</view>
</template>
<view v-else style="flex: 1;display: flex;justify-content: center;align-items: center">
<t-empty v-if="actOptions && actOptions.length === 0"
@@ -46,6 +48,45 @@
</t-empty>
</view>
<t-popup v-model:visible="showDescPicker" placement="bottom" destroy-on-close>
<view class="member-picker">
<view class="picker-header">
<text class="picker-title">项目介绍</text>
<t-icon name="close" @click="showDescPicker = false"/>
</view>
<view>
<view class="event-item-header">
<text class="event-item-name">{{ team.name }}</text>
</view>
<view class="event-item-content">
<t-image :src=config.fileDomain+team.img shape="round"
class="event-item-image" fit="fill"/>
<!-- 项目信息区域 -->
<view class="event-item-info">
<view class="event-item-section">
<view class="event-item-section-title">
<t-icon name="flag" size="16px" color="var(--td-brand-color-5)"/>
<text>活动形式</text>
</view>
<view class="event-item-section-content">{{ team.form }}</view>
</view>
<view class="event-item-section">
<view class="event-item-section-title">
<t-icon name="chart-bar" size="16px" color="var(--td-brand-color-5)"/>
<text>评分规则</text>
</view>
<view class="event-item-section-content">{{ team.rule }}</view>
</view>
</view>
</view>
</view>
</view>
</t-popup>
<t-popup v-model:visible="showMemberPicker" placement="bottom" destroy-on-close>
<view class="member-picker">
<view class="picker-header">
@@ -60,7 +101,7 @@
此项目是团队协作需要全体成员参与
</view>
<view v-else>
此项目需【{{itemOptions.find(p => p.id === selectedItemId)?.num}}】名成员参与
此项目需【{{ itemOptions.find(p => p.id === selectedItemId)?.num }}】名成员参与
</view>
</view>
@@ -81,10 +122,22 @@
</view>
</t-checkbox-group>
</view>
<view class="picker-footer"v-if="isSelfLeader">
<t-button block theme="primary" @click="submitRegistration">
确认报名 ({{ selectedMemberIds.length }}人)
</t-button>
<view class="picker-footer" v-if="isSelfLeader">
<t-row gutter="20">
<t-col span="12">
<t-button block theme="primary" @click="cancelRegistration"
:disabled="!selectedMemberList.filter(v => v.itemId === team.id).map(v => v.userId).length">
取消报名
</t-button>
</t-col>
<t-col span="12">
<t-button block theme="primary" style="margin-left: 5px;" @click="submitRegistration">
确认报名 ({{ selectedMemberIds.length }}人)
</t-button>
</t-col>
</t-row>
</view>
</view>
</t-popup>
@@ -97,6 +150,7 @@ import {useRequest} from '@/utils/request';
import {Dialog, Toast} from 'tdesign-mobile-vue';
import {onLoad} from '@dcloudio/uni-app';
import {useUserStore} from "@/store";
import {config} from "@/utils/config";
const request = useRequest();
const userStore = useUserStore();
@@ -106,23 +160,7 @@ const actOptions = ref([])
// 选中的活动ID
const selectActId = ref(null);
// 项目列表数据
const itemOptions = ref([
{
id: 1,
name: '篮球比赛',
description: '3v3篮球友谊赛'
},
{
id: 2,
name: '足球比赛',
description: '5人制足球赛'
},
{
id: 3,
name: '羽毛球比赛',
description: '双打友谊赛'
}
]);
const itemOptions = ref([]);
// 选中的项目ID
const selectedItemId = ref(null);
// 团队成员列表
@@ -147,6 +185,14 @@ const selectedMemberIds = ref([]);
// 成员选择弹窗显示状态
const showMemberPicker = ref(false);
// 描述选择弹窗显示状态
const showDescPicker = ref(false);
const openDesc = (project) => {
team.value = project
showDescPicker.value = true
}
// 获取活动列表
async function listActs() {
@@ -192,7 +238,7 @@ async function listTeamUser() {
const {code, data, msg} = await request.get('/client/item/list-team-user/' + selectActId.value)
if (code === 0) {
teamMembers.value = data;
isSelfLeader.value = data.find(t => t.userId===userStore?.userInfo.id)?.isLeader
isSelfLeader.value = data.find(t => t.userId === userStore?.userInfo.id)?.isLeader
} else {
Toast.error(msg)
}
@@ -222,10 +268,10 @@ const team = ref({})
// 选择项目
const selectProject = (project) => {
selectedItemId.value = project.id;
team.value=project
if (project.isTeamApply){
team.value = project
if (project.isTeamApply) {
selectedMemberIds.value = teamMembers.value.map(v => v.userId)
}else{
} else {
selectedMemberIds.value = selectedMemberList.value.filter(v => v.itemId === project.id).map(v => v.userId)
}
showMemberPicker.value = true;
@@ -245,7 +291,23 @@ const getApplyUsers = async () => {
Toast.error(e.message)
}
}
// 取消报名
const cancelRegistration = async () => {
try {
let data = {}
data.activityId = selectActId.value
data.itemId = selectedItemId.value
const {code, msg} = await useRequest().post('/client/item/cancel-team-sign-up/' ,{...data})
if (code === 0) {
Toast.success('取消报名成功')
showMemberPicker.value = false;
await getApplyUsers();
fetchRegistrationStatus();
}
} catch (e) {
console.log(e)
}
};
// 提交报名 - 使用静态数据模拟
const submitRegistration = async () => {
@@ -312,6 +374,71 @@ const submitRegistration = async () => {
margin-bottom: 24px;
}
.event-item-header {
display: flex;
align-items: center;
padding: 20rpx 24rpx;
background-color: #f9f9f9;
border-left: 8rpx solid var(--td-brand-color-5);
position: relative;
}
.event-item-name {
color: #333333;
font-size: 30rpx;
font-weight: 500;
flex: 1;
margin-right: 8rpx;
position: relative;
z-index: 1;
}
.event-item-content {
padding: 0;
}
.event-item-image {
height: 300rpx;
display: block;
}
.event-item-info {
padding: 24rpx;
}
.event-item-section {
margin-bottom: 24rpx;
&:last-child {
margin-bottom: 0;
}
}
.event-item-section-title {
display: flex;
align-items: center;
margin-bottom: 12rpx;
.t-icon {
margin-right: 8rpx;
}
text {
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
}
.event-item-section-content {
font-size: 28rpx;
color: #666666;
line-height: 1.5;
word-break: break-all;
padding-left: 32rpx;
}
.project-card {
background-color: #fff;
border-radius: 12px;
@@ -323,6 +450,22 @@ const submitRegistration = async () => {
position: relative;
overflow: hidden;
.project-card__image {
height: 150px !important;
}
.project-card__title {
font-size: 15px !important;
margin: 10px;
}
.project-card__button {
margin-left: 10px;
background-color: #0052D9;
color: #ffffff;
}
&:active {
transform: scale(0.98);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
+79 -6
View File
@@ -59,7 +59,7 @@
<div class="section-badge">{{ team.groupUsers.length }}</div>
</div>
<div class="member-grid">
<div class="member-grid-item" v-for="member in team.groupUsers" :key="member.id">
<div class="member-grid-item" v-for="member in team.groupUsers" :key="member.id" @click="openUserDetail(member)">
<div class="member-name">
{{ member.userName }}
<t-tag theme="danger" size="small" v-if="member.isLeader">队长</t-tag>
@@ -144,6 +144,15 @@
</div>
</template>
</t-dialog>
<t-popup v-model:visible="showUserDetailPicker" placement="bottom" destroy-on-close style="height: 50%">
<view class="member-picker">
<view class="picker-header">
<text class="picker-title">成员信息</text>
<t-icon name="close" @click="showUserDetailPicker = false"/>
</view>
</view>
</t-popup>
</template>
<script setup>
@@ -175,11 +184,12 @@ let team = ref(null);
// 申请成为队长弹框提示
const leaderConfirmVisible = ref(false)
const handleMenuOpened = () => {
}
const handleMenuClosed = () => {
// 用户详情弹框
const showUserDetailPicker=ref(false)
// 打开用户详情
const openUserDetail = (val) => {
showUserDetailPicker.value = true
console.log(val)
}
const actChange = (val) => {
@@ -262,6 +272,69 @@ onLoad(() => {
.content-area {
padding: 0 16px 24px;
}
/*用户弹框*/
.member-picker {
background-color: #fff;
border-radius: 16px 16px 0 0;
padding: 20px;
.picker-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
.picker-title {
font-size: 18px;
font-weight: 600;
color: #333;
}
}
.picker-subtitle {
font-size: 14px;
color: #ff5f5c;
margin-bottom: 20px;
padding-bottom: 12px;
border-bottom: 1px solid #f0f0f0;
}
.member-list {
max-height: 50vh;
overflow-y: auto;
margin-bottom: 20px;
padding: 0 4px;
}
.member-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 0;
border-bottom: 1px solid #f5f5f5;
&:last-child {
border-bottom: none;
}
&--disabled {
opacity: 0.7;
}
.member-status {
font-size: 12px;
color: #52c41a;
}
:deep(.t-checkbox) {
margin: 0;
}
}
.picker-footer {
padding-top: 12px;
}
}
/* 团队卡片 */
.team-card {
@@ -0,0 +1,56 @@
<template>
<view class="container">
<h3 class="container-title">{{ viewData?.title }}</h3>
<view class="container-sub-title">
<span>阅读 {{ viewData?.readCount }}</span>
<span style="margin-left: 30px">{{ moment(viewData?.publishTime).format('YYYY年MM月DD日 HH:mm') }}</span>
</view>
<view v-html="viewData?.content"></view>
</view>
</template>
<script setup>
import {ref, reactive, onMounted, computed, h} from 'vue';
import {onLoad} from "@dcloudio/uni-app";
import {Toast} from "tdesign-mobile-vue";
import {useRequest} from "@/utils/request";
import moment from "moment";
const request = useRequest()
const momentId = ref(null);
const viewData = ref(null);
function getWonderfulMoment() {
request.post('/platform/activity/wonderfulMoment/getWonderfulMomentById/' + momentId.value).then(res=>{
if(res.code === 0){
viewData.value = res.data
}else{
Toast({message: res.msg, theme: 'error'});
}
})
}
onLoad((option) => {
if (option.id) {
momentId.value = Number(option.id);
getWonderfulMoment()
}
});
onMounted(() => {
});
</script>
<style scoped lang="less">
.container {
padding: 10px;
background-color: white !important;
min-height: 100%;
}
.container-sub-title {
margin-top: 20px;
color: #C9C9C9;
margin-bottom: 20px;
}
</style>
+125 -19
View File
@@ -32,41 +32,90 @@
</view>
<view class="menu-text">项目报名</view>
</view>
<view class="menu-item" @click="navigateTo('/pages/activity/dynamic/index')">
<view class="menu-icon-wrapper blue-bg">
<view class="menu-icon star-icon"></view>
</view>
<view class="menu-text">精彩瞬间</view>
</view>
<!-- <view class="menu-item" @click="navigateTo('/pages/activity/dynamic/index')">-->
<!-- <view class="menu-icon-wrapper blue-bg">-->
<!-- <view class="menu-icon star-icon"></view>-->
<!-- </view>-->
<!-- <view class="menu-text">精彩瞬间</view>-->
<!-- </view>-->
</view>
<!-- 精选内容区 -->
<view class="content-section">
<view class="section-header">
<view class="section-title">精选活动</view>
<view class="section-more" @click="navigateTo('/pages/activity/index')">更多</view>
<view class="section-title">近期活动</view>
<view class="section-more" @click="navigateTo('/pages/activity/list/index')">更多</view>
</view>
<view class="activity-list">
<view class="activity-item" @click="navigateTo('/pages/process/index')">
<image class="activity-image"
src="https://erp-bucket.pek3b.qingstor.com/assistant/746c37d6-018d-4c64-8a98-ea9ec8b0b3b5.png"
<t-swiper
v-if="actList.length > 0"
:autoplay="actList.length > 1"
:navigation="{ type: 'fraction', paginationPosition: 'bottom-right', showControls: true }"
>
<t-swiper-item v-for="(item, index) in actList" :key="index" style="height: 192px">
<view class="activity-list" @click="navigateTo('/pages/activity/detail/index?id=' + item.id)">
<view class="activity-item">
<image class="activity-image"
:src="item.cover"
mode="widthFix"></image>
<view class="activity-info">
<view class="activity-title">{{ item.title }}</view>
<view class="activity-meta">
<text class="activity-time">{{ moment(item.startTime).format('M月DD日') + '-' + moment(item.endTime).format('DD日') }}</text>
<text class="activity-location">{{ item.address }}</text>
</view>
</view>
</view>
</view>
</t-swiper-item>
</t-swiper>
<t-empty
v-if="actList.length === 0"
description="暂无精彩瞬间"
/>
</view>
<view class="content-section">
<view class="section-header">
<view class="section-title">精彩瞬间</view>
</view>
<view class="activity-list" v-if="wonderfulMomentList.length > 0">
<view class="moment-item" v-for="item in wonderfulMomentList" :key="item.id"
@click="handleWonderfulMoment(item)">
<image class="moment-image"
:src="item.cover"
mode="widthFix"></image>
<view class="activity-info">
<view class="activity-title">一分钟了解运动会流程</view>
<view class="activity-meta">
<text class="activity-time">6月15日-20日</text>
<text class="activity-location">江苏省体育中心</text>
<view class="moment-content">
<view class="moment-title">{{ item.title }}</view>
<view class="moment-sub-content">
<view style="float: right;">{{ item.time }}</view>
<view>阅读 {{ item.readCount }}</view>
</view>
</view>
</view>
</view>
<t-empty
v-if="wonderfulMomentList.length === 0"
description="暂无精彩瞬间"
/>
</view>
</view>
</template>
<script setup>
import {onMounted} from "vue";
import {onMounted, ref} from "vue";
import {Toast} from "tdesign-mobile-vue";
import {useRequest} from "@/utils/request";
import moment from "moment";
const request = useRequest()
const actList = ref([])
const wonderfulMomentList = ref([])
function navigateTo(url) {
uni.navigateTo({
@@ -74,8 +123,39 @@ function navigateTo(url) {
})
}
function getActivity() {
request.post('/platform/activity/manage/getActivity').then(res=>{
if(res.code === 0){
actList.value = res.data
}else{
Toast({message: res.msg, theme: 'error'});
}
})
}
function getWonderfulMoment() {
request.post('/platform/activity/wonderfulMoment/getWonderfulMoment').then(res=>{
if(res.code === 0){
wonderfulMomentList.value = res.data
}else{
Toast({message: res.msg, theme: 'error'});
}
})
}
function handleWonderfulMoment(row) {
request.post('/platform/activity/wonderfulMoment/handleWonderfulMoment/' + row.id).then(res=>{
if(res.code === 0){
getWonderfulMoment()
navigateTo('/pages/activity/wonderfulMoment/index?id=' + row.id)
}else{
Toast({message: res.msg, theme: 'error'});
}
})
}
onMounted(() => {
console.log('...........')
getActivity()
getWonderfulMoment()
uni.showToast({
title: '欢迎使用',
icon: 'none',
@@ -87,6 +167,9 @@ onMounted(() => {
</script>
<style lang="less" scoped>
uni-page-body {
height: auto;
}
// 头部区域样式
.header {
position: relative;
@@ -272,4 +355,27 @@ onMounted(() => {
.activity-time {
margin-right: 15px;
}
.moment-image {
width: 180px;
height: 160px;
margin-right: 8px;
}
.moment-item {
width: 100%;
display: flex;
margin-bottom: 16px;
}
.moment-title {
font-weight: bold;
}
.moment-content {
display: flex;
width: 100%;
justify-content: space-between;
flex-direction: column;
}
.moment-sub-content {
font-size: 12px;
color: grey;
}
</style>
+28 -15
View File
@@ -62,16 +62,16 @@
<view class="login-card">
<view class="login-tabs">
<view
:class="['tab', activeMethod === 'phone' ? 'active' : '']"
@click="setActiveMethod('phone')"
:class="['tab', loginForm.loginMethod === 'sms' ? 'active' : '']"
@click="loginForm.loginMethod = 'sms'"
>
手机快速登录
验证码登录
</view>
<view
:class="['tab', activeMethod === 'password' ? 'active' : '']"
@click="setActiveMethod('password')"
:class="['tab', loginForm.loginMethod === 'password' ? 'active' : '']"
@click="loginForm.loginMethod = 'password'"
>
账号密码登录
密码登录
</view>
</view>
@@ -90,7 +90,7 @@
</view>
<!-- 验证码输入框 -->
<view class="input-box">
<view class="input-box" v-if="loginForm.loginMethod==='sms'">
<t-icon name="shield-error" size="20px" class="input-icon"/>
<input
class="input"
@@ -104,6 +104,18 @@
</view>
</view>
<!-- 密码输入框 -->
<view class="input-box" v-else>
<t-icon name="user-password" size="20px" class="input-icon"/>
<input
class="input"
type="password"
v-model="loginForm.password"
placeholder="请输入密码"
maxlength="20"
/>
</view>
<!-- 登录按钮 -->
<view class="submit-btn" @click="handleLogin">
立即登录
@@ -127,17 +139,14 @@ import {useUserStore} from "@/store";
const request = useRequest()
const userStore = useUserStore()
const activeMethod = ref('phone')
const loginForm = reactive({
phone: '',
smsCode: ''
smsCode: '',
password: '',
loginMethod: 'sms'
})
const setActiveMethod = (method) => {
activeMethod.value = method
}
// 倒计时相关
const countdown = ref(0)
const timer = ref(null)
@@ -265,10 +274,14 @@ async function handleLogin() {
Toast('请输入手机号码');
return
}
if (!loginForm.smsCode) {
if (!loginForm.smsCode && loginForm.loginMethod === 'sms') {
Toast('请输入验证码');
return
}
if (!loginForm.password && loginForm.loginMethod === 'password') {
Toast('请输入密码');
return
}
try {
userStore.smsLogin(loginForm).then(() => {
@@ -318,7 +331,7 @@ async function handleLogin() {
}
}
function navigateToRegister(){
function navigateToRegister() {
uni.redirectTo({
url: '/pages/login/register'
})
+244 -220
View File
@@ -1,8 +1,57 @@
<template>
<view class="register-container">
<view class="title-area">
<image class="bg-image" src="/static/login-bg.jpg" mode="aspectFill"></image>
<view class="overlay"></view>
<!-- 上半部分:图片区域 -->
<view class="image-area">
<div class="tech-animation">
<svg preserveAspectRatio="xMidYMid slice" viewBox="0 0 300 100">
<pattern id="pattern-hex" x="0" y="0" width="10" height="10" patternUnits="userSpaceOnUse"
patternTransform="scale(0.8)">
<rect x="0" y="0" width="10" height="10" fill="none"/>
<path d="M0,5 L2.5,0 L7.5,0 L10,5 L7.5,10 L2.5,10 Z" stroke-width="0.5" stroke="rgba(244, 90, 90, 0.2)"
fill="rgba(244, 90, 90, 0.1)">
<animate attributeName="stroke-opacity" values="0.1;0.3;0.1" dur="3s" repeatCount="indefinite"/>
</path>
</pattern>
<rect x="0" y="0" width="100%" height="100%" fill="url(#pattern-hex)"/>
<g fill="none" stroke-width="0.5">
<path d="M20,50 Q60,20 100,50 T180,50 T260,50" stroke="rgba(244, 90, 90, 0.6)">
<animate attributeName="d"
values="M20,50 Q60,20 100,50 T180,50 T260,50;
M20,50 Q60,80 100,50 T180,50 T260,50;
M20,50 Q60,20 100,50 T180,50 T260,50"
dur="10s" repeatCount="indefinite"/>
</path>
<path d="M20,70 Q60,40 100,70 T180,70 T260,70" stroke="rgba(244, 90, 90, 0.4)">
<animate attributeName="d"
values="M20,70 Q60,40 100,70 T180,70 T260,70;
M20,70 Q60,100 100,70 T180,70 T260,70;
M20,70 Q60,40 100,70 T180,70 T260,70"
dur="12s" repeatCount="indefinite"/>
</path>
</g>
<circle cx="50" cy="50" r="1" fill="rgba(244, 90, 90, 0.8)">
<animate attributeName="cx" values="50;250;50" dur="20s" repeatCount="indefinite"/>
<animate attributeName="cy" values="50;30;80;50" dur="16s" repeatCount="indefinite"/>
<animate attributeName="r" values="1;1.5;1" dur="5s" repeatCount="indefinite"/>
</circle>
<circle cx="150" cy="30" r="1" fill="rgba(244, 90, 90, 0.8)">
<animate attributeName="cx" values="150;100;200;150" dur="25s" repeatCount="indefinite"/>
<animate attributeName="cy" values="30;60;20;30" dur="18s" repeatCount="indefinite"/>
<animate attributeName="r" values="1;1.8;1" dur="6s" repeatCount="indefinite"/>
</circle>
<circle cx="250" cy="70" r="1" fill="rgba(244, 90, 90, 0.8)">
<animate attributeName="cx" values="250;150;250" dur="22s" repeatCount="indefinite"/>
<animate attributeName="cy" values="70;40;70" dur="15s" repeatCount="indefinite"/>
<animate attributeName="r" values="1;1.2;1" dur="4s" repeatCount="indefinite"/>
</circle>
</svg>
</div>
<view class="title-content">
<text class="main-title">JOIN US</text>
<view class="sub-title-container">
@@ -11,91 +60,77 @@
</view>
</view>
<view class="form-wrapper">
<!-- 注册表单区域 -->
<view class="form-container">
<view class="form-title">填写信息</view>
<!-- 下半部分:表单区域 -->
<view class="form-area">
<!-- 姓名输入框 -->
<view class="input-box">
<t-icon name="user" size="20px" class="input-icon"/>
<input
class="input"
type="text"
v-model="formData.name"
placeholder="请输入姓名"
maxlength="20"
/>
</view>
<!-- 姓名输入框 -->
<view class="input-box">
<view class="input-icon-container">
<t-icon name="user" size="22px" class="input-icon"/>
</view>
<input
class="input"
type="text"
v-model="formData.name"
placeholder="请输入姓名"
maxlength="20"
/>
</view>
<!-- 手机号码输入框 -->
<view class="input-box">
<t-icon name="mobile" size="20px" class="input-icon"/>
<input
class="input"
type="tel"
v-model="formData.phone"
placeholder="请输入手机号"
maxlength="11"
/>
</view>
<!-- 手机号码输入框 -->
<view class="input-box">
<view class="input-icon-container">
<t-icon name="mobile" size="22px" class="input-icon"/>
</view>
<input
class="input"
type="tel"
v-model="formData.phone"
placeholder="请输入手机号"
maxlength="11"
/>
<!-- 单位输入框 -->
<view class="input-box" @click="showUnitPicker = true">
<t-icon name="home" size="20px" class="input-icon"/>
<view class="unit-selector" :class="{'has-value': formData.unitName}">
{{ formData.unitName || '请选择单位' }}
</view>
<t-icon name="chevron-right" size="20px" class="arrow-icon"/>
</view>
<!-- 单位输入框 -->
<view class="input-box" @click="showUnitPicker = true">
<view class="input-icon-container">
<t-icon name="home" size="22px" class="input-icon"/>
</view>
<view class="input placeholder" :class="{'has-value': formData.unitName}">
{{ formData.unitName || '请选择单位' }}
</view>
<t-icon name="chevron-right" size="20px" class="arrow-icon"/>
</view>
<!-- 身份证输入框 -->
<view class="input-box">
<t-icon name="creditcard" size="20px" class="input-icon"/>
<input
class="input"
type="text"
v-model="formData.idCard"
placeholder="请输入身份证号码"
maxlength="18"
/>
</view>
<!-- 身份证输入框 -->
<view class="input-box">
<view class="input-icon-container">
<t-icon name="id-card" size="22px" class="input-icon"/>
</view>
<input
class="input"
type="text"
v-model="formData.idCard"
placeholder="请输入身份证号码"
maxlength="18"
/>
<!-- 验证码输入框 -->
<view class="input-box">
<t-icon name="shield-error" size="20px" class="input-icon"/>
<input
class="input"
type="number"
v-model="formData.verificationCode"
placeholder="请输入验证码"
maxlength="6"
/>
<view class="verify-code-btn" @click="sendVerificationCode" :class="{ disabled: countdown > 0 }">
{{ countdown > 0 ? `${countdown}秒` : '获取验证码' }}
</view>
</view>
<!-- 验证码输入框 -->
<view class="input-box">
<view class="input-icon-container">
<t-icon name="shield-check" size="22px" class="input-icon"/>
</view>
<input
class="input"
type="number"
v-model="formData.verificationCode"
placeholder="请输入验证码"
maxlength="6"
/>
<view class="verify-code-btn" @click="sendVerificationCode" :class="{ disabled: countdown > 0 }">
{{ countdown > 0 ? `${countdown}秒` : '获取验证码' }}
</view>
</view>
<!-- 注册按钮 -->
<view class="submit-btn" @click="handleRegister">
{{ registering ? '注册中...' : '立即注册' }}
</view>
<!-- 注册按钮 -->
<view class="submit-btn" :class="{ disabled: !isFormValid }" @click="handleRegister">
{{ registering ? '注册中...' : '立即注册' }}
</view>
<!-- 登录链接 -->
<view class="login-link-box">
<text>已有账号?</text>
<text class="link-text" @click="goToLogin">立即登录</text>
</view>
<!-- 登录链接 -->
<view class="login-link-box">
<text>已有账号?</text>
<text class="link-text" @click="goToLogin">立即登录</text>
</view>
</view>
@@ -107,36 +142,36 @@
<view class="picker-title">选择单位</view>
<view class="confirm-btn" @click="confirmUnitSelection">确定</view>
</view>
<!-- 搜索框 -->
<view class="search-box">
<t-icon name="search" size="22px" class="search-icon" />
<input
class="search-input"
type="text"
v-model="searchKeyword"
<input
class="search-input"
type="text"
v-model="searchKeyword"
placeholder="搜索单位"
@input="handleSearch"
@input="handleSearch"
/>
<t-icon
v-if="searchKeyword"
name="close-circle-filled"
size="22px"
class="clear-icon"
@click="clearSearch"
<t-icon
v-if="searchKeyword"
name="close-circle-filled"
size="22px"
class="clear-icon"
@click="clearSearch"
/>
</view>
<!-- 单位列表 -->
<scroll-view
scroll-y
class="units-scroll-view"
<scroll-view
scroll-y
class="units-scroll-view"
scroll-with-animation
:scroll-into-view="scrollViewId"
>
<view
v-for="unit in filteredUnits"
:key="unit.id"
<view
v-for="unit in filteredUnits"
:key="unit.id"
:id="'unit-' + unit.id"
class="unit-item"
:class="{'unit-selected': selectedUnitId === unit.id}"
@@ -187,7 +222,7 @@ const filteredUnits = computed(() => {
if (!searchKeyword.value) {
return unitList.value;
}
return unitList.value.filter(unit =>
return unitList.value.filter(unit =>
unit.name.toLowerCase().includes(searchKeyword.value.toLowerCase())
);
});
@@ -238,7 +273,7 @@ const confirmUnitSelection = () => {
Toast({ message: '请选择单位', theme: 'warning' });
return;
}
const selectedUnit = unitList.value.find(unit => unit.id === selectedUnitId.value);
if (selectedUnit) {
formData.unitId = selectedUnit.id;
@@ -268,16 +303,16 @@ const sendVerificationCode = async () => {
Toast({ message: '请输入正确的手机号', theme: 'error' });
return;
}
if (countdown.value > 0) return;
sendingCode.value = true;
try {
const { code, msg } = await useRequest().post('/client/auth/send-verification-code', {
phone: formData.phone,
type: 'register'
});
if (code === 0) {
Toast({ message: '验证码已发送' });
startCountdown();
@@ -309,7 +344,7 @@ const handleRegister = async () => {
Toast({ message: '请完善注册信息', theme: 'error' });
return;
}
registering.value = true;
try {
const { code, msg } = await useRequest().post('/client/auth/register', {
@@ -319,7 +354,7 @@ const handleRegister = async () => {
idCard: formData.idCard,
verificationCode: formData.verificationCode
});
if (code === 0) {
Toast({ message: '注册成功' });
// 注册成功后跳转到登录页
@@ -368,184 +403,173 @@ onMounted(() => {
<style scoped lang="less">
.register-container {
height: 100vh;
background: #f4f2f2;
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: #ffffff;
}
.title-area {
.image-area {
padding: 0;
height: 30vh;
position: relative;
height: 380rpx;
overflow: hidden;
display: flex;
align-items: center;
background: linear-gradient(135deg, #7a1818 0%, #d03e3e 50%, #f45a5a 100%);
}
.tech-animation {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.tech-animation svg {
width: 100%;
height: 100%;
}
.bg-image {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 1;
display: none; /* 隐藏背景图片,使用动画背景 */
}
.overlay {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: linear-gradient(to bottom, rgba(244, 90, 90, 0.8), rgba(244, 90, 90, 0.5));
z-index: 2;
display: none; /* 不需要叠加层 */
}
.title-content {
padding: 0 30px;
position: relative;
z-index: 3;
padding: 80rpx 40rpx;
display: flex;
flex-direction: column;
z-index: 1;
}
.main-title {
font-size: 68rpx;
font-size: 36px;
font-weight: bold;
color: #fff;
margin-bottom: 20rpx;
letter-spacing: 2rpx;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
margin-bottom: 8px;
display: block;
position: relative;
z-index: 1;
color: #ffffff;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.sub-title-container {
display: flex;
align-items: center;
position: relative;
z-index: 1;
}
.sub-title {
font-size: 38rpx;
color: #fff;
font-weight: 500;
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.form-wrapper {
font-size: 18px;
color: #ffffff;
position: relative;
z-index: 1;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.form-area {
flex: 1;
background-color: #ffffff;
padding: 0 40rpx;
margin-top: -60rpx;
z-index: 10;
border-radius: 50rpx 50rpx 0 0;
}
.form-container {
padding: 60rpx 0 50rpx;
}
.form-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 40rpx;
text-align: center;
border-radius: 30px 30px 0 0;
margin-top: -30px;
padding: 30px 30px 0;
position: relative;
z-index: 2;
box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}
.input-box {
height: 50px;
background-color: #eceaea;
border-radius: 25px;
display: flex;
align-items: center;
padding: 20rpx 0;
margin-bottom: 30rpx;
position: relative;
border-bottom: 1px solid #f0f0f0;
transition: border-color 0.3s;
}
.input-box:focus-within {
border-bottom-color: #f45a5a;
}
.input-icon-container {
display: flex;
align-items: center;
justify-content: center;
width: 70rpx;
height: 70rpx;
border-radius: 50%;
background: rgba(244, 90, 90, 0.1);
margin-right: 20rpx;
padding: 0 15px;
margin-bottom: 16px;
border-bottom: none;
}
.input-icon {
color: #f45a5a;
}
.arrow-icon {
color: #ccc;
}
.input {
flex: 1;
font-size: 28rpx;
height: 40rpx;
line-height: 40rpx;
color: #333;
}
.placeholder {
color: #999;
margin-right: 10px;
}
.input-icon-container {
display: none; /* 不使用图标容器 */
}
.input, .unit-selector {
flex: 1;
height: 100%;
border: none;
font-size: 15px;
background-color: transparent;
}
.unit-selector {
display: flex;
align-items: center;
color: gray;
}
.has-value {
color: #333;
}
.verify-code-btn {
padding: 10rpx 20rpx;
background-color: #f45a5a;
color: #fff;
font-size: 26rpx;
border-radius: 8rpx;
text-align: center;
min-width: 180rpx;
margin-left: 10rpx;
.arrow-icon {
color: #999;
}
.disabled {
background-color: #f8a8a8;
color: #fff;
pointer-events: none;
.verify-code-btn {
color: #f45a5a;
font-size: 14px;
white-space: nowrap;
background: none;
padding: 0;
margin: 0;
min-width: auto;
&.disabled {
color: #999;
background: none;
}
}
.submit-btn {
background: linear-gradient(135deg, #f45a5a, #f78484);
height: 90rpx;
border-radius: 45rpx;
color: #fff;
font-size: 32rpx;
margin-top: 32px;
height: 50px;
background-color: #f45a5a;
border-radius: 25px;
color: white;
font-size: 16px;
display: flex;
align-items: center;
justify-content: center;
margin: 50rpx 0 30rpx;
transition: transform 0.2s;
}
.submit-btn:active {
transform: scale(0.98);
}
.submit-btn.disabled {
opacity: 0.7;
background: #ccc;
&.disabled {
opacity: 0.6;
background-color: #f45a5a;
}
}
.login-link-box {
margin-top: 16px;
text-align: center;
font-size: 28rpx;
color: #666;
margin: 20rpx 0;
}
.link-text {
color: #f45a5a;
margin-left: 4px;
}
.custom-picker {
+3
View File
@@ -0,0 +1,3 @@
export const config = {
fileDomain: 'http://localhost',
}
+4 -4
View File
@@ -28,10 +28,10 @@ export default defineConfig({
}
},
server: {
// https: {
// cert: fs.readFileSync(path.join(__dirname, 'src/ssl/localhost+2.pem')),
// key: fs.readFileSync(path.join(__dirname, 'src/ssl/localhost+2-key.pem'))
// },
/* https: {
cert: fs.readFileSync(path.join(__dirname, 'src/ssl/localhost+2.pem')),
key: fs.readFileSync(path.join(__dirname, 'src/ssl/localhost+2-key.pem'))
},*/
proxy: {
'/api': {
target: 'http://localhost:9090',