Conflicts:
	backend/src/main/resources/application.yaml
	frontend/vite.config.js
This commit is contained in:
zhengziru
2025-05-06 20:31:52 +08:00
31 changed files with 573 additions and 338 deletions
@@ -67,9 +67,8 @@ public class ClientAuthController {
@ApiOperation(value = "注册", nickname = "/register", httpMethod = "POST") @ApiOperation(value = "注册", nickname = "/register", httpMethod = "POST")
public Result register(ClientRegisterBody registerBody) { public Result register(ClientRegisterBody registerBody) {
try { try {
// String token = clientAuthService.doRegister(registerBody); String token = clientAuthService.doRegister(registerBody);
// return Result.success().addData(token); return Result.success().addData(token);
return Result.success();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@@ -130,6 +129,7 @@ public class ClientAuthController {
@SaCheckLogin(type = StpClientUtil.TYPE) @SaCheckLogin(type = StpClientUtil.TYPE)
public Result info() { public Result info() {
Client_user user = dao.fetch(Client_user.class, StpClientUtil.STP.getLoginIdAsLong()); Client_user user = dao.fetch(Client_user.class, StpClientUtil.STP.getLoginIdAsLong());
dao.fetchLinks(user, "unit");
return Result.success(user); return Result.success(user);
} }
@@ -1,6 +1,7 @@
package com.budwk.app.client.auth.models; package com.budwk.app.client.auth.models;
import com.budwk.app.base.model.BaseModel; import com.budwk.app.base.model.BaseModel;
import com.budwk.app.sys.models.Sys_unit;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
@@ -62,4 +63,7 @@ public class Client_user extends BaseModel implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 255) @ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("openId") @Comment("openId")
private String openId; private String openId;
@One(field = "unitId")
private Sys_unit unit;
} }
@@ -49,12 +49,14 @@ public class ClientActivityController {
t1.endTime, t1.endTime,
t1.signStartTime, t1.signStartTime,
t1.signEndTime, t1.signEndTime,
t1.coHostUnit,
t1.cover t1.cover
FROM FROM
activity t1 activity t1
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.and(Cnd.likeEX("t1.title", pageForm.getSearchKeyword()));
sql.setCondition(cnd); sql.setCondition(cnd);
Pagination pagination = clientActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); Pagination pagination = clientActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination); return Result.success(pagination);
@@ -92,7 +94,10 @@ public class ClientActivityController {
SqlExpressionGroup group = new SqlExpressionGroup(); SqlExpressionGroup group = new SqlExpressionGroup();
group.or(ActUser::getUserId, "=", StpClientUtil.STP.getLoginIdAsLong()); group.or(ActUser::getUserId, "=", StpClientUtil.STP.getLoginIdAsLong());
group.or(ActUser::getSignUpUserId, "=", StpClientUtil.STP.getLoginIdAsLong()); group.or(ActUser::getSignUpUserId, "=", StpClientUtil.STP.getLoginIdAsLong());
List<ActUser> list = dao.query(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(group)); ActUser actUser = dao.fetch(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(group));
List<ActUser> list = dao.query(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId)
.and(ActUser::getSignUpUserId, "=", actUser.getSignUpUserId()));
return Result.success(list); return Result.success(list);
} }
@@ -47,6 +47,9 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
public void signUp(ClientActivitySignVO signVO) { public void signUp(ClientActivitySignVO signVO) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
Client_user selfUser = dao().fetch(Client_user.class, StpClientUtil.STP.getLoginIdAsLong());
dao().fetchLinks(selfUser, "unit");
List<ActUser> userList = signVO.getUserList(); List<ActUser> userList = signVO.getUserList();
// 首先检查报名人员是否已经在用户表中 // 首先检查报名人员是否已经在用户表中
for (ActUser user : userList) { for (ActUser user : userList) {
@@ -58,6 +61,7 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
clientUser.setSex(user.getSex()); clientUser.setSex(user.getSex());
clientUser.setPhone(user.getPhone()); clientUser.setPhone(user.getPhone());
clientUser.setIdCard(user.getIdCard()); clientUser.setIdCard(user.getIdCard());
clientUser.setUnitId(selfUser.getUnitId());
dao().insert(clientUser); dao().insert(clientUser);
} else { } else {
// 验证用户之前是不是已经报名 别人帮报 自己报 管理员报 // 验证用户之前是不是已经报名 别人帮报 自己报 管理员报
@@ -71,6 +75,7 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
user.setActivityId(signVO.getActivityId()); user.setActivityId(signVO.getActivityId());
user.setUserId(clientUser.getId()); user.setUserId(clientUser.getId());
user.setUnitId(selfUser.getUnitId());
user.setUnitName(signVO.getUnitName()); user.setUnitName(signVO.getUnitName());
user.setSignUpContacts(signVO.getContactName()); user.setSignUpContacts(signVO.getContactName());
user.setSignUpMobile(signVO.getContactPhone()); user.setSignUpMobile(signVO.getContactPhone());
@@ -12,6 +12,7 @@ import java.util.List;
public class ClientActivitySignVO { public class ClientActivitySignVO {
private Long activityId; private Long activityId;
private Long itemId; private Long itemId;
private String unitId; private String unitId;
@@ -223,6 +223,7 @@ public class ActUserController {
add(new ExcelExportEntity("职务", "position", 20)); add(new ExcelExportEntity("职务", "position", 20));
add(new ExcelExportEntity("所属单位", "unitName", 20)); add(new ExcelExportEntity("所属单位", "unitName", 20));
add(new ExcelExportEntity("报名时间", "signUpTime2", 20)); add(new ExcelExportEntity("报名时间", "signUpTime2", 20));
add(new ExcelExportEntity("是否签到", "isSignInDesc", 20));
}}; }};
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((activity.getTitle() + "报名数据表.xlsx").getBytes(StandardCharsets.UTF_8), "ISO8859-1")); response.setHeader("Content-Disposition", "attachment;filename=" + new String((activity.getTitle() + "报名数据表.xlsx").getBytes(StandardCharsets.UTF_8), "ISO8859-1"));
@@ -79,9 +79,10 @@ public class ActivityItemApplyQueryController {
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup group = new SqlExpressionGroup(); SqlExpressionGroup group = new SqlExpressionGroup();
group.or("au.userName", "LIKE", "%" + pageForm.getSearchKeyword() + "%"); group.or("au.userName", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
group.or("au.unitName", "LIKE", "%" + pageForm.getSearchKeyword() + "%"); group.or("au.phone", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
cnd.and(group); cnd.and(group);
} }
cnd.andEX("au.unitId","=",pageForm.getUnitId());
cnd.and("au.activityId", "=", pageForm.getActivityId()); cnd.and("au.activityId", "=", pageForm.getActivityId());
cnd.andEX("aiu.itemId", "=", pageForm.getItemId()); cnd.andEX("aiu.itemId", "=", pageForm.getItemId());
cnd.asc("ai.`name`"); cnd.asc("ai.`name`");
@@ -76,9 +76,12 @@ public class ActivitySignInQueryController {
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup group = new SqlExpressionGroup(); SqlExpressionGroup group = new SqlExpressionGroup();
group.or("au.userName", "LIKE", "%" + pageForm.getSearchKeyword() + "%"); group.or("au.userName", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
group.or("au.unitName", "LIKE", "%" + pageForm.getSearchKeyword() + "%"); group.or("au.phone", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
cnd.and(group); cnd.and(group);
} }
cnd.andEX("au.unitId","=",pageForm.getUnitId());
cnd.andEX("au.isStay","=",pageForm.getIsStay());
cnd.andEX("au.isGrant","=",pageForm.getIsGrant());
cnd.and("au.activityId", "=", pageForm.getActivityId()); cnd.and("au.activityId", "=", pageForm.getActivityId());
cnd.and("au.isSignIn", "=", 1); cnd.and("au.isSignIn", "=", 1);
cnd.desc("au.signInTime"); cnd.desc("au.signInTime");
@@ -109,7 +112,15 @@ public class ActivitySignInQueryController {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
au.*, au.*,
DATE_FORMAT(signInTime, '%Y-%m-%d %H:%i:%s') signInTime DATE_FORMAT(signInTime, '%Y-%m-%d %H:%i:%s') signInTime,
CASE au.isStay
WHEN 1 THEN '住宿'
WHEN 0 THEN '不住宿'
END AS isStayDesc,
CASE au.isGrant
WHEN 1 THEN '已发放'
WHEN 0 THEN '未发放'
END AS isGrantDesc
FROM FROM
`act_user` au `act_user` au
$condition $condition
@@ -117,9 +128,12 @@ public class ActivitySignInQueryController {
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) { if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
SqlExpressionGroup group = new SqlExpressionGroup(); SqlExpressionGroup group = new SqlExpressionGroup();
group.or("au.userName", "LIKE", "%" + pageForm.getSearchKeyword() + "%"); group.or("au.userName", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
group.or("au.unitName", "LIKE", "%" + pageForm.getSearchKeyword() + "%"); group.or("au.phone", "LIKE", "%" + pageForm.getSearchKeyword() + "%");
cnd.and(group); cnd.and(group);
} }
cnd.andEX("au.isStay","=",pageForm.getIsStay());
cnd.andEX("au.isGrant","=",pageForm.getIsGrant());
cnd.andEX("au.unitId","=",pageForm.getUnitId());
cnd.and("au.activityId", "=", pageForm.getActivityId()); cnd.and("au.activityId", "=", pageForm.getActivityId());
cnd.and("au.isSignIn", "=", 1); cnd.and("au.isSignIn", "=", 1);
cnd.desc("au.signInTime"); cnd.desc("au.signInTime");
@@ -132,7 +146,9 @@ public class ActivitySignInQueryController {
add(new ExcelExportEntity("身份证号码", "idCard", 20)); add(new ExcelExportEntity("身份证号码", "idCard", 20));
add(new ExcelExportEntity("联系方式", "mobile", 20)); add(new ExcelExportEntity("联系方式", "mobile", 20));
add(new ExcelExportEntity("参加单位名称", "unitName", 20)); add(new ExcelExportEntity("参加单位名称", "unitName", 20));
add(new ExcelExportEntity("签到时间", "signUpTime2", 20)); add(new ExcelExportEntity("签到时间", "signInTime", 20));
add(new ExcelExportEntity("是否住宿", "isStayDesc", 20));
add(new ExcelExportEntity("物资发放", "isGrantDesc", 20));
}}; }};
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
@@ -39,6 +39,10 @@ public class ActUserServiceImpl extends BaseServiceImpl<ActUser> implements ActU
SELECT SELECT
u.*, u.*,
DATE_FORMAT(signUpTime, '%Y-%m-%d %H:%i:%s') signUpTime2, DATE_FORMAT(signUpTime, '%Y-%m-%d %H:%i:%s') signUpTime2,
CASE u.isSignIn
WHEN 1 THEN '已签到'
WHEN 0 THEN '未签到'
END AS isSignInDesc,
act.`title` AS activityName act.`title` AS activityName
FROM FROM
act_user u act_user u
@@ -53,13 +57,8 @@ public class ActUserServiceImpl extends BaseServiceImpl<ActUser> implements ActU
seg.orLike("u.phone", pageForm.getSearchKeyword()); seg.orLike("u.phone", pageForm.getSearchKeyword());
cnd.and(seg); cnd.and(seg);
} }
if (pageForm.getIsSignIn() != 1) { cnd.andEX("u.isSignIn", "=", pageForm.getIsSignIn());
cnd.andEX("u.isSignIn", "=", pageForm.getIsSignIn() == 2 ? 1 : 0); cnd.andEX("u.unitId", "=", pageForm.getUnitId());
}
// cnd.andEX("u.phone", "like", "%" + pageForm.getPhone() + "%");
if (StrUtil.isNotBlank(pageForm.getUnitName())) {
cnd.and("u.unitName", "like", "%" + pageForm.getUnitName() + "%");
}
sql.setCondition(cnd); sql.setCondition(cnd);
return sql; return sql;
} }
@@ -23,5 +23,11 @@ public class ActSignInUserPageForm extends PageForm {
// 所属单位 // 所属单位
private String unitName; private String unitName;
// 发放状态
private Integer isGrant;
// 单位
private Integer unitId;
// 是否住宿
private Integer isStay;
} }
@@ -23,6 +23,8 @@ public class ActUserPageForm extends PageForm {
// 所属单位 // 所属单位
private String unitName; private String unitName;
// 是否签到1.全部2.已签到3.未签到 // 所属单位
private String unitId;
// 是否签到
private Integer isSignIn; private Integer isSignIn;
} }
File diff suppressed because one or more lines are too long
@@ -37,6 +37,8 @@
<script src="${base!}/assets/platform/plugins/adminLte/adminlte.min.js"></script> <script src="${base!}/assets/platform/plugins/adminLte/adminlte.min.js"></script>
<!-- echarts --> <!-- echarts -->
<script src="${base!}/assets/platform/plugins/echarts/echarts.min.js"></script> <script src="${base!}/assets/platform/plugins/echarts/echarts.min.js"></script>
<!-- qrcode -->
<script src="${base!}/assets/platform/plugins/qrcode/qrcode.min.js"></script>
<!-- 自定义工具类 --> <!-- 自定义工具类 -->
<script src="${base!}/assets/platform/module/mixins/initTableMixins.js?v=1.0.0"></script> <script src="${base!}/assets/platform/module/mixins/initTableMixins.js?v=1.0.0"></script>
<!-- main --> <!-- main -->
@@ -46,14 +46,28 @@ layout("/layouts/platform_1.html"){
</div> </div>
</div> </div>
<div class="search-item"> <div class="search-item">
<div class="search-item-label">姓名/单位</div> <div class="search-item-label">姓名/电话</div>
<div class="search-item-option"> <div class="search-item-option">
<el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入姓名/单位"></el-input> <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-select placeholder="请选择所属单位"
style="width: 100%;" clearable
filterable
@change="setModifyFormUnit"
v-model="pageForm.unitId">
<el-option :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</div> </div>
</div> </div>
<div class="search-query"> <div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button> <el-button type="primary" @click="doSearch">搜索</el-button>
</div> </div>
</div> </div>
</el-card> </el-card>
@@ -72,7 +86,7 @@ layout("/layouts/platform_1.html"){
<el-table-column label="性别" prop="sex"width="150"></el-table-column> <el-table-column label="性别" prop="sex"width="150"></el-table-column>
<el-table-column label="职务" prop="position"></el-table-column> <el-table-column label="职务" prop="position"></el-table-column>
<el-table-column label="身份证号码" prop="idCard"></el-table-column> <el-table-column label="身份证号码" prop="idCard"></el-table-column>
<el-table-column label="联系方式" prop="mobile"></el-table-column> <el-table-column label="联系方式" prop="phone"></el-table-column>
<el-table-column label="参加单位名称" prop="unitName"></el-table-column> <el-table-column label="参加单位名称" prop="unitName"></el-table-column>
<el-table-column label="参加项目" prop="itemName"></el-table-column> <el-table-column label="参加项目" prop="itemName"></el-table-column>
</el-table> </el-table>
@@ -92,7 +106,8 @@ layout("/layouts/platform_1.html"){
year: new Date().getFullYear() + "" year: new Date().getFullYear() + ""
}, },
activityOptions: [], activityOptions: [],
activityItemOptions: [] activityItemOptions: [],
units: [],
} }
}, },
methods: { methods: {
@@ -126,9 +141,16 @@ layout("/layouts/platform_1.html"){
}) })
}, },
async getUnits(){
const resp = await $.post('/open/common/units')
if (resp.code === 0) {
this.units = resp.data
}
}
}, },
created() { created() {
this.getActivityOptions() this.getActivityOptions()
this.getUnits()
} }
}) })
</script> </script>
@@ -0,0 +1,62 @@
const actQrCode = {
template: /*language=HTML*/ `
<el-dialog title="二维码" :visible.sync="visible" width="500px">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="活动报名二维码" name="signUp">
<div id="signUpCode" style="width:150px; height:150px;margin: 0 auto"></div>
</el-tab-pane>
<el-tab-pane label="活动签到二维码" name="signIn">
<div id="signInCode" style="width:150px; height:150px;margin: 0 auto"></div>
</el-tab-pane>
</el-tabs>
<template #footer>
<span class="dialog-footer">
<el-button size="small" @click="visible = false">取 消</el-button>
<el-button size="small" type="primary" @click="download">下载</el-button>
</span>
</template>
</el-dialog>
`,
data() {
return {
visible: false,
actId: "",
activeName: "signUp"
}
},
methods: {
handleClick(tab, event) {
},
onOpen(id) {
this.visible = true
this.actId = id
this.$nextTick(() => {
this.renderCode()
})
},
renderCode() {
let signUpCode = new QRCode(document.getElementById("signUpCode"), {
width: 150,
height: 150
})
signUpCode.makeCode("https://192.168.41.118:5173" + "/pages/activity/detail/index?id=" + this.actId)
let signInCode = new QRCode(document.getElementById("signInCode"), {
width: 150,
height: 150
})
signInCode.makeCode("https://192.168.41.118:5173" + "/pages/activity/scan-sign/index?id=" + this.actId)
},
download() {
// 获取base64
const src = $("#" + this.activeName + "Code img").attr("src")
// 利用a标签进行下载
const a = document.createElement("a")
a.href = src
a.download = (this.activeName === "signUp" ? "报名" : "签到") + "二维码.png"
a.click()
a.remove()
}
}
}
@@ -37,6 +37,7 @@ layout("/layouts/platform_1.html"){
<el-table-column label="活动结束时间" prop="endTime"></el-table-column> <el-table-column label="活动结束时间" prop="endTime"></el-table-column>
<el-table-column label="操作" fixed="right" width="250"> <el-table-column label="操作" fixed="right" width="250">
<template #default="scope"> <template #default="scope">
<el-button type="text" @click="$refs.actQrCodeRef.onOpen(scope.row.id)">二维码</el-button>
<el-button type="text" @click="$refs.addOrUpdateRef.onOpen(scope.row.id)">修改</el-button> <el-button type="text" @click="$refs.addOrUpdateRef.onOpen(scope.row.id)">修改</el-button>
<el-button type="text" @click="$refs.itemFormRef.onOpen(scope.row.id)">项目管理</el-button> <el-button type="text" @click="$refs.itemFormRef.onOpen(scope.row.id)">项目管理</el-button>
<el-button type="text" class="text-danger" @click="onTableRowDelete(scope.row.id)">删除</el-button> <el-button type="text" class="text-danger" @click="onTableRowDelete(scope.row.id)">删除</el-button>
@@ -47,17 +48,20 @@ layout("/layouts/platform_1.html"){
</el-card> </el-card>
<add-or-update ref="addOrUpdateRef" @refresh="doSearch"></add-or-update> <add-or-update ref="addOrUpdateRef" @refresh="doSearch"></add-or-update>
<item-form ref="itemFormRef"></item-form> <item-form ref="itemFormRef"></item-form>
<act-qr-code ref="actQrCodeRef"></act-qr-code>
</div> </div>
<script> <script>
<!--#include('addOrUpdate.js'){}#--> <!--#include('addOrUpdate.js'){}#-->
<!--#include('itemForm.js'){}#--> <!--#include('itemForm.js'){}#-->
<!--#include('actQrCode.js'){}#-->
new Vue({ new Vue({
el: "#app", el: "#app",
mixins: [initTableMixins], mixins: [initTableMixins],
components: { components: {
"add-or-update": addOrUpdate, "add-or-update": addOrUpdate,
"item-form": itemForm "item-form": itemForm,
"act-qr-code": actQrCode
}, },
data() { data() {
return { return {
@@ -33,9 +33,39 @@ layout("/layouts/platform_1.html"){
</div> </div>
</div> </div>
<div class="search-item"> <div class="search-item">
<div class="search-item-label">姓名/单位</div> <div class="search-item-label">发放状态</div>
<div class="search-item-option"> <div class="search-item-option">
<el-input v-model="pageForm.searchKeyword" clearable placeholder="请输入姓名/单位"></el-input> <el-select v-model="pageForm.isGrant" placeholder="请选择发放状态" clearable>
<el-option label="已发放" :value="1"></el-option>
<el-option label="未发放" :value="0"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">住宿状态</div>
<div class="search-item-option">
<el-select v-model="pageForm.isStay" placeholder="请选择住宿状态" clearable>
<el-option label="住宿" :value="1"></el-option>
<el-option label="不住宿" :value="0"></el-option>
</el-select>
</div>
</div>
<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-select placeholder="请选择所属单位"
style="width: 100%;" clearable
filterable
v-model="pageForm.unitId">
<el-option :label="item.name" :value="item.id"
v-for="item in units"></el-option>
</el-select>
</div> </div>
</div> </div>
@@ -47,7 +77,7 @@ layout("/layouts/platform_1.html"){
<el-card shadow="never" class="mt-3"> <el-card shadow="never" class="mt-3">
<el-row type="flex" class="mb-3" style="justify-content: flex-end"> <el-row type="flex" class="mb-3" style="justify-content: flex-end">
<el-button icon="el-icon-plus" type="primary" size="small" @click="doExport">导出</el-button> <el-button type="primary" size="small" @click="doExport">导出</el-button>
</el-row> </el-row>
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData"> <el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
<el-table-column label="序号" prop="index" header-align="center" align="center" width="50"> <el-table-column label="序号" prop="index" header-align="center" align="center" width="50">
@@ -59,21 +89,28 @@ layout("/layouts/platform_1.html"){
<el-table-column label="性别" prop="sex"></el-table-column> <el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="职务" prop="position"></el-table-column> <el-table-column label="职务" prop="position"></el-table-column>
<el-table-column label="身份证号码" prop="idCard"></el-table-column> <el-table-column label="身份证号码" prop="idCard"></el-table-column>
<el-table-column label="联系方式" prop="mobile"></el-table-column> <el-table-column label="联系方式" prop="phone"></el-table-column>
<el-table-column label="参加单位名称" prop="unitName"></el-table-column> <el-table-column label="参加单位名称" prop="unitName"></el-table-column>
<el-table-column label="签到时间" prop="signInTime"></el-table-column> <el-table-column label="签到时间" prop="signInTime"></el-table-column>
<el-table-column label="是否住宿" prop="isStay">
<template slot-scope="{row}">
{{row.isStay?'住宿':'不住宿'}}
</template>
</el-table-column>
<el-table-column label="物资发放" prop="isGrant"> <el-table-column label="物资发放" prop="isGrant">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.isGrant" type="success">已发放</el-tag> <el-tag v-if="scope.row.isGrant" type="success">已发放</el-tag>
<el-tag v-else type="danger">未发放</el-tag> <el-tag v-else type="danger">未发放</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" width="200"> <el-table-column label="操作" fixed="right" width="200">
<template #default="{row}"> <template #default="{row}">
<el-button v-if="!row.isGrant || row.isGrant === 0" type="primary" size="mini" @click="doGrant(row, true)">设为已发放物资</el-button> <el-button v-if="!row.isGrant || row.isGrant === 0" type="primary" size="mini"
<el-button v-else type="danger" size="mini" @click="doGrant(row, false)">设为未发放物资</el-button> @click="doGrant(row, true)">设为已发放物资
</template> </el-button>
</el-table-column> <el-button v-else type="danger" size="mini" @click="doGrant(row, false)">设为未发放物资</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<!--#include("/layouts/pagination.html"){}#--> <!--#include("/layouts/pagination.html"){}#-->
</el-card> </el-card>
@@ -90,28 +127,29 @@ layout("/layouts/platform_1.html"){
pageForm: { pageForm: {
year: new Date().getFullYear() + "" year: new Date().getFullYear() + ""
}, },
activityOptions: [] activityOptions: [],
units: [],
} }
}, },
methods: { methods: {
async doGrant(row, isGrant) { async doGrant(row, isGrant) {
this.$confirm('您确定要设置成' + (isGrant ? '已发放' : '未发放') + '状态吗?', '提示', { this.$confirm('您确定要设置成' + (isGrant ? '已发放' : '未发放') + '状态吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(async () => { }).then(async () => {
const resp = await $.post("/platform/activity/signInUserQuery/doGrant", { const resp = await $.post("/platform/activity/signInUserQuery/doGrant", {
id: row.id, id: row.id,
isGrant: isGrant isGrant: isGrant
}) })
if (resp.code === 0) { if (resp.code === 0) {
this.doSearch() this.doSearch()
this.$message.success(resp.msg) this.$message.success(resp.msg)
} else { } else {
this.$message.error(resp.msg) this.$message.error(resp.msg)
} }
}) })
}, },
doExport() { doExport() {
window.open("/platform/activity/signInUserQuery/doExport?activityId=" + this.pageForm.activityId + "&searchKeyword=" + this.pageForm.searchKeyword) window.open("/platform/activity/signInUserQuery/doExport?activityId=" + this.pageForm.activityId + "&searchKeyword=" + this.pageForm.searchKeyword)
}, },
@@ -131,9 +169,16 @@ layout("/layouts/platform_1.html"){
}) })
}, },
async getUnits() {
const resp = await $.post('/open/common/units')
if (resp.code === 0) {
this.units = resp.data
}
}
}, },
created() { created() {
this.getActivityOptions() this.getActivityOptions()
this.getUnits()
} }
}) })
</script> </script>
+11
View File
@@ -127,6 +127,17 @@
"selectedColor": "#f45a5a" "selectedColor": "#f45a5a"
} }
}, },
{
"pagePath": "pages/activity/rank/index",
"text": "排行榜",
"iconfont": {
"text": "\ue8b3",
"selectedText": "\ue8b3",
"fontSize": "17px",
"color": "#333",
"selectedColor": "#f45a5a"
}
},
{ {
"pagePath": "pages/profile/index", "pagePath": "pages/profile/index",
"text": "我的", "text": "我的",
+9 -13
View File
@@ -5,7 +5,8 @@
<view style="flex: 1;overflow-y: auto"> <view style="flex: 1;overflow-y: auto">
<!-- 活动图片 --> <!-- 活动图片 -->
<view class="event-header"> <view class="event-header">
<image :src="detailData.cover" mode="aspectFill" class="event-cover"/> <t-image :src=config.fileDomain+detailData.cover shape="round"
class="event-cover" fit="fill"/>
</view> </view>
<!-- 活动标题与标签 --> <!-- 活动标题与标签 -->
@@ -76,11 +77,13 @@
<!-- 项目图片区域 --> <!-- 项目图片区域 -->
<!-- v-if="item.img"--> <!-- v-if="item.img"-->
<!-- :src="item.img"--> <!-- :src="item.img"-->
<image <!-- <image
src="https://api.zzzmh.cn/v2/bz/v3/getUrl/c9d3deb2880411ebb6edd017c2d2eca220" src="https://api.zzzmh.cn/v2/bz/v3/getUrl/c9d3deb2880411ebb6edd017c2d2eca220"
mode="aspectFill" mode="aspectFill"
class="event-item-image" class="event-item-image"
/> />-->
<t-image :src=config.fileDomain+item.img shape="round"
class="event-item-image" fit="fill"/>
<!-- 项目信息区域 --> <!-- 项目信息区域 -->
<view class="event-item-info"> <view class="event-item-info">
@@ -170,6 +173,7 @@ import {ref, onMounted, computed} from 'vue';
import {onLoad} from '@dcloudio/uni-app'; import {onLoad} from '@dcloudio/uni-app';
import {Toast} from 'tdesign-mobile-vue'; import {Toast} from 'tdesign-mobile-vue';
import {useRequest} from "@/utils/request"; import {useRequest} from "@/utils/request";
import {config} from "@/utils/config";
const request = useRequest(); const request = useRequest();
const actId = ref(null); const actId = ref(null);
@@ -229,23 +233,15 @@ const navigateToSignUp = () => {
// 获取活动详情 // 获取活动详情
const getActivityDetail = async (id) => { const getActivityDetail = async (id) => {
try { try {
const loading = Toast({
message: '加载中...',
theme: 'loading',
duration: 0
});
const {code, data} = await request.get(`/client/activity/get/${id}`); const {code, data} = await request.get(`/client/activity/get/${id}`);
if (code === 0 && data) { if (code === 0 && data) {
detailData.value = data; detailData.value = data;
} else { } else {
Toast({message: '获取活动详情失败', theme: 'error'}); // Toast({message: '获取活动详情失败', theme: 'error'});
} }
loading.clear();
} catch (error) { } catch (error) {
console.error('获取活动详情错误', error); console.error('获取活动详情错误', error);
Toast({message: '获取活动详情失败', theme: 'error'}); // Toast({message: '获取活动详情失败', theme: 'error'});
} }
}; };
+8 -2
View File
@@ -8,6 +8,9 @@
shape="round" shape="round"
class="search-input" class="search-input"
@onSearch="handleSearch" @onSearch="handleSearch"
@onSubmit="handleSearch"
@submit="handleSearch"
@search="handleSearch"
/> />
</view> </view>
</view> </view>
@@ -31,6 +34,7 @@
<view> <view>
<view style="display: flex;align-items: center;margin-bottom: 10px"> <view style="display: flex;align-items: center;margin-bottom: 10px">
<image <image
src="https://assets.cumen.fun/upload/017cdaf1-c5fa-788e-eea2-d0ee249f902b/0187376a-3cfa-07b3-3cd6-7479bf463865?x-oss-process=style/720-jpg" src="https://assets.cumen.fun/upload/017cdaf1-c5fa-788e-eea2-d0ee249f902b/0187376a-3cfa-07b3-3cd6-7479bf463865?x-oss-process=style/720-jpg"
style="width: 30px;height: 30px;flex-shrink: 0" style="width: 30px;height: 30px;flex-shrink: 0"
@@ -41,7 +45,8 @@
</view> </view>
</view> </view>
<view style="display: flex;"> <view style="display: flex;">
<image :src="item.cover" mode="aspectFill" style="flex-shrink:0;width: 120px;height: 90px;border-radius: 5px;"></image> <t-image :src=config.fileDomain+item.cover shape="round"
style="flex-shrink:0;width: 120px;height: 90px;border-radius: 5px;" fit="fill"/>
<view <view
style="margin-left:10px;flex:1;overflow:hidden;display: flex;flex-direction: column;justify-content:space-around;color: #534d4d;"> style="margin-left:10px;flex:1;overflow:hidden;display: flex;flex-direction: column;justify-content:space-around;color: #534d4d;">
<view <view
@@ -61,7 +66,7 @@
</view> </view>
<view style="border-top: 1px solid #f0f0f0;margin-top: 10px;padding-top: 12px;display: flex;align-items: center;justify-content: space-between"> <view style="border-top: 1px solid #f0f0f0;margin-top: 10px;padding-top: 12px;display: flex;align-items: center;justify-content: space-between">
<view> <view>
100人已报名 <!-- 100人已报名-->
</view> </view>
<t-button theme="primary" shape="round" size="small">立即报名</t-button> <t-button theme="primary" shape="round" size="small">立即报名</t-button>
</view> </view>
@@ -89,6 +94,7 @@ import {ref, reactive, onMounted} from 'vue';
import {Toast} from 'tdesign-mobile-vue'; import {Toast} from 'tdesign-mobile-vue';
import {useRequest} from "@/utils/request"; import {useRequest} from "@/utils/request";
import moment from "moment"; import moment from "moment";
import {config} from "@/utils/config";
// 活动状态筛选选项 // 活动状态筛选选项
const statusOptions = [ const statusOptions = [
+38 -6
View File
@@ -1,5 +1,10 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<t-dropdown-menu class="top-dropdown">
<t-dropdown-item :options="actOptions" :value="activityId"/>
</t-dropdown-menu>
<view class="rank-header"> <view class="rank-header">
<view class="title-container"> <view class="title-container">
<view class="title">活动排行榜</view> <view class="title">活动排行榜</view>
@@ -75,17 +80,27 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import {ref, onMounted, computed} from 'vue';
import { Toast } from 'tdesign-mobile-vue'; import { Toast } from 'tdesign-mobile-vue';
import { useRequest } from "@/utils/request"; import { useRequest } from "@/utils/request";
import {onLoad} from "@dcloudio/uni-app"; import {onLoad} from "@dcloudio/uni-app";
// 排行榜数据 // 排行榜数据
const actList = ref([])
const rankList = ref([]); const rankList = ref([]);
const activityId = ref([]); const activityId = ref(null);
const loading = ref(false); const loading = ref(false);
const refresherTriggered = ref(false); const refresherTriggered = ref(false);
const actOptions = computed(() => {
return actList.value.map(item => {
return {
value: item.id,
label: item.title
}
})
})
// 获取排行榜数据 // 获取排行榜数据
const getRankData = async () => { const getRankData = async () => {
loading.value = true; loading.value = true;
@@ -110,6 +125,22 @@ const getRankData = async () => {
} }
}; };
async function listMineAct() {
try {
const {data, code, msg} = await useRequest().get('/client/activity/list-mine-act')
if (code === 0) {
actList.value = data
if (actList.value.length && activityId.value == null) {
activityId.value = actList.value[0].id
}
} else {
Toast.error(msg)
}
} catch (e) {
Toast.error(e.message)
}
}
// 刷新 // 刷新
const handleRefresh = () => { const handleRefresh = () => {
if (loading.value) { if (loading.value) {
@@ -122,12 +153,13 @@ const handleRefresh = () => {
}; };
onLoad((option) => { onLoad((option) => {
if (option.id) { if (option.id) {
activityId.value=option.id activityId.value = Number(option.id)
} }
}); });
// 页面加载时获取数据 // 页面加载时获取数据
onMounted(() => { onMounted(async () => {
getRankData(); await listMineAct()
await getRankData()
}); });
</script> </script>
@@ -441,7 +473,7 @@ onMounted(() => {
.refresh-btn { .refresh-btn {
position: fixed; position: fixed;
right: 30rpx; right: 30rpx;
bottom: 40rpx; bottom: 140rpx;
width: 90rpx; width: 90rpx;
height: 90rpx; height: 90rpx;
border-radius: 50%; border-radius: 50%;
@@ -1,14 +1,5 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<!-- <view class="act-info">-->
<!-- <view class="act-title">奋进新征程 运动促健康 2024晴江第六届"牧城之夜"荧光跑</view>-->
<!-- <view class="act-meta">-->
<!-- <view class="act-meta-item">22222</view>-->
<!-- <view class="act-meta-item">22222222222222222222</view>-->
<!-- </view>-->
<!-- </view>-->
<view class="form-area"> <view class="form-area">
<t-form <t-form
ref="formRef" ref="formRef"
@@ -17,23 +8,23 @@
show-error-message show-error-message
label-align="left" label-align="left"
scroll-to-first-error="auto" scroll-to-first-error="auto"
labelWidth="90px"
> >
<view class="form-block"> <!-- <view class="form-block">-->
<view class="form-block-title"> <!-- <view class="form-block-title">-->
<t-icon name="institution"></t-icon> <!-- <t-icon name="institution"></t-icon>-->
单位信息 <!-- 单位信息-->
</view> <!-- </view>-->
<t-form-item label="参加单位" name="unitName" :rules="[{required:true,message: '请输入单位名称'}]"> <!-- <t-form-item label="参加单位" name="unitName" :rules="[{required:true,message: '请输入单位名称'}]">-->
<!-- <t-input v-model="formData.unitName" borderless placeholder="请输入参加单位名称"></t-input>--> <!-- <t-input v-model="formData.unitName" borderless readonly placeholder="请输入参加单位名称"></t-input>-->
<search-picker v-model="formData.unitName" :options="unitOptions" placeholder="请选择单位"></search-picker> <!-- </t-form-item>-->
</t-form-item> <!-- <t-form-item label="联系人" name="contactName" :rules="[{required:true,message: '请输入联系人姓名'}]">-->
<t-form-item label="联系人" name="contactName" :rules="[{required:true,message: '请输入联系人姓名'}]"> <!-- <t-input v-model="formData.contactName" borderless placeholder="请输入联系人姓名"></t-input>-->
<t-input v-model="formData.contactName" borderless placeholder="请输入联系人姓名"></t-input> <!-- </t-form-item>-->
</t-form-item> <!-- <t-form-item label="联系方式" name="contactPhone" :rules="[{required:true,message: '请输入联系电话'}]">-->
<t-form-item label="联系方式" name="contactPhone" :rules="[{required:true,message: '请输入联系电话'}]"> <!-- <t-input v-model="formData.contactPhone" borderless placeholder="请输入联系电话"></t-input>-->
<t-input v-model="formData.contactPhone" borderless placeholder="请输入联系电话"></t-input> <!-- </t-form-item>-->
</t-form-item> <!-- </view>-->
</view>
<view class="form-block"> <view class="form-block">
<view class="form-block-title"> <view class="form-block-title">
@@ -79,14 +70,23 @@
<t-radio :block="false" name="radio" :value="false" label="否"/> <t-radio :block="false" name="radio" :value="false" label="否"/>
</t-radio-group> </t-radio-group>
</t-form-item> </t-form-item>
<t-form-item label="是否联系人" :name="`userList[${index}].isContacts`"
:rules="[{required:true,message: '请选择是否为联系人'}]">
<t-radio-group v-model="user.isContacts" class="radio-box">
<t-radio :block="false" name="radio" :value="true" label="是"/>
<t-radio :block="false" name="radio" :value="false" label="否"/>
</t-radio-group>
</t-form-item>
</view> </view>
</view> </view>
</t-form> </t-form>
<view class="add-user" @click="formData.userList.push({})">
<t-icon name="plus" size="24px"></t-icon>
<text>添加人员</text>
</view>
</view> </view>
<!-- 悬浮添加按钮 -->
<view class="float-add-btn" @click="formData.userList.push({})">
<t-icon name="plus" size="24px" color="#fff"></t-icon>
</view>
<view class="footer"> <view class="footer">
<view class="agreement-checkbox"> <view class="agreement-checkbox">
<t-checkbox label="多选" icon="rectangle" v-model:checked="agreementChecked" default-checked> <t-checkbox label="多选" icon="rectangle" v-model:checked="agreementChecked" default-checked>
@@ -105,6 +105,14 @@
{{ isSignUp ? '重新提交报名信息' : '提交报名'}} {{ isSignUp ? '重新提交报名信息' : '提交报名'}}
</t-button> </t-button>
</view> </view>
<!-- 引导 -->
<t-guide
v-model="guideCurrent"
:steps="guideSteps"
>
</t-guide>
</view> </view>
</template> </template>
@@ -113,9 +121,32 @@ import {ref} from 'vue'
import {useRequest} from '@/utils/request'; import {useRequest} from '@/utils/request';
import {Dialog, Toast} from "tdesign-mobile-vue"; import {Dialog, Toast} from "tdesign-mobile-vue";
import {onLoad} from "@dcloudio/uni-app"; import {onLoad} from "@dcloudio/uni-app";
import SearchPicker from "@/components/SearchPicker.vue"; import {useUserStore} from "@/store";
const request = useRequest() const request = useRequest()
const userStore= useUserStore()
// 引导部分
const guideCurrent = ref(-1)
const guideSteps = [
{
element:()=> document.querySelector('.float-add-btn'),
title: '添加活动报名人员',
placement: 'top'
},
{
element:()=> document.querySelector('.t-form'),
title: '填写报名信息',
placement: 'top'
},
{
element:()=> document.querySelector('.footer'),
title: '提交报名信息',
placement: 'top'
}
]
// 报名信息
const actId = ref(null) const actId = ref(null)
const isSignUp = ref(null) const isSignUp = ref(null)
const agreementChecked = ref(false) const agreementChecked = ref(false)
@@ -124,18 +155,17 @@ const formData = ref({
userList: [{}] userList: [{}]
}) })
const unitOptions = ref([
{value:'单位1',label:'单位1'},
{value:'单位2',label:'单位2'},
{value:'单位3',label:'单位3'},
])
onLoad((option) => { onLoad((option) => {
if (option.id) { if (option.id) {
actId.value = option.id actId.value = option.id
formData.value.activityId = option.id formData.value.activityId = option.id
listSignUpUser() listSignUpUser()
getIsSignUp() getIsSignUp()
// 没报名进行引导
if(formData.value.userList.length === 0){
guideCurrent.value = 0
//formData.value.unitName = userStore.userInfo?.unit.name
}
} else { } else {
Toast({message: 'ID不存在', theme: 'error'}); Toast({message: 'ID不存在', theme: 'error'});
} }
@@ -226,6 +256,7 @@ async function submitForm() {
title: '提交中...', title: '提交中...',
mask: true, mask: true,
}) })
console.log(formData.value)
try { try {
const {code, data, msg} = await request.post('/client/activity/sign-up', formData.value) const {code, data, msg} = await request.post('/client/activity/sign-up', formData.value)
if (code === 0) { if (code === 0) {
@@ -308,7 +339,6 @@ async function removeUser(index) {
.form-area { .form-area {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
//margin-top: 100px;
margin-bottom: 130px; margin-bottom: 130px;
} }
@@ -379,16 +409,23 @@ async function removeUser(index) {
} }
} }
.add-user { .float-add-btn {
padding: 15px; position: fixed;
text-align: center; right: 32rpx;
color: #e74c3c; bottom: 160rpx;
font-weight: 500; width: 110rpx;
cursor: pointer; height: 110rpx;
border-radius: 50%;
background-color: #e74c3c;
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
background: #ffffff; justify-content: center;
z-index: 100;
transition: transform 0.2s;
}
.float-add-btn:active {
transform: scale(0.95);
} }
.radio-box { .radio-box {
@@ -14,25 +14,25 @@
</view> </view>
<!-- 小提示 --> <!-- 小提示 -->
<view class="success-tips"> <!-- <view class="success-tips">-->
<t-icon name="info-circle-filled" size="16px" /> <!-- <t-icon name="info-circle-filled" size="16px" />-->
<text>活动开始前我们将通过短信通知您</text> <!-- <text>活动开始前我们将通过短信通知您</text>-->
</view> <!-- </view>-->
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="action-buttons"> <view class="action-buttons">
<t-button theme="default" shape="round" @click="navigateToHome">返回首页</t-button> <t-button theme="default" shape="round" @click="navigateToHome">返回首页</t-button>
<t-button theme="primary" shape="round" @click="viewRegistrationDetails">查看报名详情</t-button> <t-button theme="primary" shape="round" @click="navigateToEdit">修改报名信息</t-button>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import {ref} from 'vue';
import { onLoad } from '@dcloudio/uni-app'; import {onLoad} from '@dcloudio/uni-app';
import { Toast } from 'tdesign-mobile-vue'; import {Toast} from 'tdesign-mobile-vue';
import { useRequest } from '@/utils/request'; import {useRequest} from '@/utils/request';
const request = useRequest(); const request = useRequest();
const actId = ref(null); const actId = ref(null);
@@ -69,9 +69,9 @@ const navigateToHome = () => {
}; };
// 查看报名详情 // 查看报名详情
const viewRegistrationDetails = () => { const navigateToEdit = () => {
uni.navigateTo({ uni.redirectTo({
url: '/pages/activity/registration-details/index?id=' + actId.value url: '/pages/activity/registration-form/index?id=' + actId.value
}); });
}; };
</script> </script>
@@ -106,7 +106,7 @@ const viewRegistrationDetails = () => {
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
animation: float 3s ease-in-out infinite; //animation: float 3s ease-in-out infinite;
} }
} }
+42 -51
View File
@@ -69,32 +69,10 @@
</view> </view>
</view> </view>
</view> </view>
<div class="bg-decoration">
<svg class="wave" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
<path fill="#f45a5a" fill-opacity="0.1" d="M0,160L48,154.7C96,149,192,139,288,144C384,149,480,171,576,176C672,181,768,171,864,154.7C960,139,1056,117,1152,128C1248,139,1344,181,1392,202.7L1440,224L1440,0L1392,0C1344,0,1248,0,1152,0C1056,0,960,0,864,0C768,0,672,0,576,0C480,0,384,0,288,0C192,0,96,0,48,0L0,0Z"></path>
</svg>
<svg class="dots" width="100" height="100" viewBox="0 0 100 100">
<circle fill="#f45a5a" fill-opacity="0.2" cx="10" cy="10" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="30" cy="10" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="50" cy="10" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="70" cy="10" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="90" cy="10" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="10" cy="30" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="30" cy="30" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="50" cy="30" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="70" cy="30" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="90" cy="30" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="10" cy="50" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="30" cy="50" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="50" cy="50" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="70" cy="50" r="3" />
<circle fill="#f45a5a" fill-opacity="0.2" cx="90" cy="50" r="3" />
</svg>
</div>
</template> </template>
<view style="flex: 1;display: flex;justify-content: center;align-items: center"> <view v-if="actOptions && actOptions.length === 0" style="flex: 1;display: flex;justify-content: center;align-items: center">
<t-empty v-if="actOptions && actOptions.length === 0" <t-empty
image="/static/img/empty.png" image="/static/img/empty.png"
description="报名活动后才能扫码签到" description="报名活动后才能扫码签到"
style="flex: 1"> style="flex: 1">
@@ -114,12 +92,14 @@
<script setup> <script setup>
import {ref, computed, onMounted} from 'vue'; import {ref, computed, onMounted} from 'vue';
import {onBackPress, onLoad} from "@dcloudio/uni-app";
import {useRequest} from '@/utils/request'; import {useRequest} from '@/utils/request';
import {useUserStore} from "@/store";
import {Dialog, Toast} from 'tdesign-mobile-vue'; import {Dialog, Toast} from 'tdesign-mobile-vue';
import moment from 'moment';
import ScanQRCode from '@/components/scanQrCode.vue' import ScanQRCode from '@/components/scanQrCode.vue'
const request = useRequest() const request = useRequest()
const userStore = useUserStore()
const list = ref([]) const list = ref([])
const signInfo = ref({}) const signInfo = ref({})
@@ -138,6 +118,20 @@ onMounted(() => {
listMineAct(); listMineAct();
}); });
onLoad((options)=>{
if(options.id){
selectActId.value = Number(options.id)
signIn()
}
})
// 返回按钮
onBackPress(()=>{
uni.redirectTo({
url: '/pages/index/index'
})
})
// 获取活动列表 // 获取活动列表
async function listMineAct() { async function listMineAct() {
try { try {
@@ -175,6 +169,10 @@ async function getSignInfo(val) {
// 扫码签到 // 扫码签到
function handleScan() { function handleScan() {
if(signInfo.value.isSignIn){
Toast('您已签到')
return
}
qrScannerRef.value.startScan() qrScannerRef.value.startScan()
} }
@@ -185,6 +183,20 @@ function handleScanSuccess(val) {
Toast.error("请扫描合法的二维码") Toast.error("请扫描合法的二维码")
return return
} }
if(val.indexOf('http')!== -1){
const url = new URL(val)
const id = url.searchParams.get('id')
if(id){
val = id
signIn()
return;
}else{
Toast.error("请扫描合法的二维码")
return
}
}
if (String(val) !== String(selectActId.value)) { if (String(val) !== String(selectActId.value)) {
Toast.error('请扫码签到当前活动,扫描成功,活动ID为' + val + ",当前选择活动ID为" + selectActId.value) Toast.error('请扫码签到当前活动,扫描成功,活动ID为' + val + ",当前选择活动ID为" + selectActId.value)
return return
@@ -195,6 +207,11 @@ function handleScanSuccess(val) {
// 签到 // 签到
async function signIn() { async function signIn() {
try { try {
if(signInfo.value.isSignIn){
Toast.error('您已签到')
return
}
await uni.showLoading({ await uni.showLoading({
title: '签到中...', title: '签到中...',
mask: true, mask: true,
@@ -538,32 +555,6 @@ function navigateToSignUp(){
color: #999999; color: #999999;
} }
.bg-decoration {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1;
overflow: hidden;
}
.wave {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 200px;
}
.dots {
position: absolute;
bottom: 5%;
right: 5%;
animation: float 4s ease-in-out infinite;
}
/* 导入Animate.css的部分动画 */ /* 导入Animate.css的部分动画 */
.animate__animated { .animate__animated {
animation-duration: 1s; animation-duration: 1s;
+18 -18
View File
@@ -1,9 +1,10 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<template v-if="actOptions && actOptions.length>0"> <t-dropdown-menu class="top-dropdown">
<t-dropdown-menu class="top-dropdown"> <t-dropdown-item :options="actOptions" :value="selectActId"/>
<t-dropdown-item :options="actOptions" :value="selectActId"/> </t-dropdown-menu>
</t-dropdown-menu>
<template v-if="actOptions && actOptions.length > 0 && teamMembers.length > 0">
<view class="content-container"> <view class="content-container">
<!-- <view class="page-header">--> <!-- <view class="page-header">-->
<!-- <text class="page-title">团队报名</text>--> <!-- <text class="page-title">团队报名</text>-->
@@ -25,8 +26,11 @@
<view class="project-card__title">{{ project.name }}</view> <view class="project-card__title">{{ project.name }}</view>
<div style="display: flex;justify-content: flex-end;margin-top: 10px;"> <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 theme="primary" size="small" class="project-card__button" @click="openDesc(project)">
<t-button size="small" @click="selectProject(project)" class="project-card__button"> 活动报名 {{ 项目介绍
</t-button>
<t-button theme="primary" size="small" @click="selectProject(project)" class="project-card__button">
活动报名 {{
registrationStatus.get(project.id)?.length ? registrationStatus.get(project.id)?.length : 0 registrationStatus.get(project.id)?.length ? registrationStatus.get(project.id)?.length : 0
}}人 }}人
</t-button> </t-button>
@@ -41,10 +45,10 @@
</view> </view>
</template> </template>
<view v-else style="flex: 1;display: flex;justify-content: center;align-items: center"> <view v-else style="flex: 1;display: flex;justify-content: center;align-items: center">
<t-empty v-if="actOptions && actOptions.length === 0" <t-empty
image="/static/img/empty.png" image="/static/img/empty.png"
description="您没有任何团队信息,无法进行项目报名" description="您没有任何团队信息,无法进行项目报名"
style="flex: 1"> style="flex: 1">
</t-empty> </t-empty>
</view> </view>
@@ -205,9 +209,9 @@ async function listActs() {
label: item.title label: item.title
} }
}) })
// if(selectActId.value === null && data.length){ if (selectActId.value === null && data.length) {
// selectActId.value = data[0].id selectActId.value = data[0].id
// } }
} else { } else {
Toast.error(msg) Toast.error(msg)
} }
@@ -240,7 +244,6 @@ async function listTeamUser() {
teamMembers.value = data; 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 { } else {
Toast.error(msg)
} }
} catch (e) { } catch (e) {
Toast.error(e) Toast.error(e)
@@ -285,7 +288,6 @@ const getApplyUsers = async () => {
if (code === 0) { if (code === 0) {
selectedMemberList.value = data selectedMemberList.value = data
} else { } else {
Toast.error(msg)
} }
} catch (e) { } catch (e) {
Toast.error(e.message) Toast.error(e.message)
@@ -297,7 +299,7 @@ const cancelRegistration = async () => {
let data = {} let data = {}
data.activityId = selectActId.value data.activityId = selectActId.value
data.itemId = selectedItemId.value data.itemId = selectedItemId.value
const {code, msg} = await useRequest().post('/client/item/cancel-team-sign-up/' ,{...data}) const {code, msg} = await useRequest().post('/client/item/cancel-team-sign-up/', {...data})
if (code === 0) { if (code === 0) {
Toast.success('取消报名成功') Toast.success('取消报名成功')
showMemberPicker.value = false; showMemberPicker.value = false;
@@ -461,8 +463,6 @@ const submitRegistration = async () => {
.project-card__button { .project-card__button {
margin-left: 10px; margin-left: 10px;
background-color: #0052D9;
color: #ffffff;
} }
+8 -8
View File
@@ -1,11 +1,11 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<t-sticky>
<t-dropdown-menu class="top-dropdown-menu">
<t-dropdown-item :options="actOptions" :value="pageForm.actId" @change="actChange"/>
</t-dropdown-menu>
</t-sticky>
<view v-if="team"> <view v-if="team">
<t-sticky>
<t-dropdown-menu class="top-dropdown-menu">
<t-dropdown-item :options="actOptions" :value="pageForm.actId" @change="actChange"/>
</t-dropdown-menu>
</t-sticky>
<!-- 团队卡片 --> <!-- 团队卡片 -->
<div class="content-area"> <div class="content-area">
<div class="team-card"> <div class="team-card">
@@ -118,8 +118,7 @@
</div> </div>
</view> </view>
<view v-else style="flex: 1;display: flex;justify-content: center;align-items: center"> <view v-else style="flex: 1;display: flex;justify-content: center;align-items: center">
<t-empty v-if="actOptions && actOptions.length === 0" <t-empty image="/static/img/empty.png"
image="/static/img/empty.png"
description="您没有任何团队信息" description="您没有任何团队信息"
style="flex: 1"> style="flex: 1">
</t-empty> </t-empty>
@@ -265,7 +264,8 @@ const getListAct = async () => {
// 点击查看成绩排名 // 点击查看成绩排名
const queryRank = () => { const queryRank = () => {
uni.navigateTo({url: '/pages/activity/rank/index?id=' + pageForm.actId}) // uni.navigateTo({url: '/pages/activity/rank/index?id=' + pageForm.actId})
uni.switchTab({url: '/pages/activity/rank/index?id=' + pageForm.actId})
} }
// 初始化 // 初始化
+8 -8
View File
@@ -22,7 +22,7 @@
<view class="menu-item" @click="navigateTo('/pages/activity/team/index')"> <view class="menu-item" @click="navigateTo('/pages/activity/team/index')">
<view class="menu-icon-wrapper yellow-bg"> <view class="menu-icon-wrapper yellow-bg">
<view class="menu-icon team-icon"></view> <view class="menu-icon team-icon"></view>
<view class="badge">3</view> <!-- <view class="badge">3</view>-->
</view> </view>
<view class="menu-text">我的团队</view> <view class="menu-text">我的团队</view>
</view> </view>
@@ -55,9 +55,8 @@
<t-swiper-item v-for="(item, index) in actList" :key="index" style="height: 192px"> <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-list" @click="navigateTo('/pages/activity/detail/index?id=' + item.id)">
<view class="activity-item"> <view class="activity-item">
<image class="activity-image" <t-image :src=config.fileDomain+item.cover shape="round"
:src="item.cover" class="activity-image" fit="fill"/>
mode="widthFix"></image>
<view class="activity-info"> <view class="activity-info">
<view class="activity-title">{{ item.title }}</view> <view class="activity-title">{{ item.title }}</view>
<view class="activity-meta"> <view class="activity-meta">
@@ -71,7 +70,7 @@
</t-swiper> </t-swiper>
<t-empty <t-empty
v-if="actList.length === 0" v-if="actList.length === 0"
description="暂无精彩瞬间" description="暂无近期活动"
/> />
</view> </view>
@@ -84,9 +83,8 @@
<view class="activity-list" v-if="wonderfulMomentList.length > 0"> <view class="activity-list" v-if="wonderfulMomentList.length > 0">
<view class="moment-item" v-for="item in wonderfulMomentList" :key="item.id" <view class="moment-item" v-for="item in wonderfulMomentList" :key="item.id"
@click="handleWonderfulMoment(item)"> @click="handleWonderfulMoment(item)">
<image class="moment-image" <t-image :src=config.fileDomain+item.cover shape="round"
:src="item.cover" class="moment-image" fit="fill"/>
mode="widthFix"></image>
<view class="moment-content"> <view class="moment-content">
<view class="moment-title">{{ item.title }}</view> <view class="moment-title">{{ item.title }}</view>
<view class="moment-sub-content"> <view class="moment-sub-content">
@@ -111,6 +109,7 @@ import {onMounted, ref} from "vue";
import {Toast} from "tdesign-mobile-vue"; import {Toast} from "tdesign-mobile-vue";
import {useRequest} from "@/utils/request"; import {useRequest} from "@/utils/request";
import moment from "moment"; import moment from "moment";
import {config} from "@/utils/config";
const request = useRequest() const request = useRequest()
@@ -332,6 +331,7 @@ uni-page-body {
} }
.activity-image { .activity-image {
height: 200px;
width: 100%; width: 100%;
} }
+18 -31
View File
@@ -136,6 +136,7 @@ import {ref, reactive, computed, onMounted, onBeforeUnmount} from 'vue'
import {Toast} from 'tdesign-mobile-vue'; import {Toast} from 'tdesign-mobile-vue';
import {useRequest} from "@/utils/request"; import {useRequest} from "@/utils/request";
import {useUserStore} from "@/store"; import {useUserStore} from "@/store";
import {onLoad} from "@dcloudio/uni-app";
const request = useRequest() const request = useRequest()
const userStore = useUserStore() const userStore = useUserStore()
@@ -287,44 +288,30 @@ async function handleLogin() {
userStore.smsLogin(loginForm).then(() => { userStore.smsLogin(loginForm).then(() => {
userStore.getUserInfo().then(() => { userStore.getUserInfo().then(() => {
Toast({message: '登录成功', theme: 'success'}) Toast({message: '登录成功', theme: 'success'})
uni.switchTab({ const redirect = uni.getStorageSync("REDIRECT_URL")
url: '/pages/index/index' if(redirect){
}) if(redirect.startsWith('/pages/index/index') || redirect.startsWith('/pages/profile/index')){
uni.switchTab({
url: redirect
})
}else{
uni.navigateTo({
url: redirect
})
}
}else{
uni.switchTab({
url: '/pages/index/index'
})
}
}).catch(e => { }).catch(e => {
console.log(e)
Toast({message: e.message, theme: 'error'}) Toast({message: e.message, theme: 'error'})
}) })
}).catch(e => { }).catch(e => {
console.log(e) console.log(e)
Toast({message: e.message, theme: 'error'}) Toast({message: e.message, theme: 'error'})
}) })
// const {data, code, msg} = await request.post('/client/auth/sms-login', loginForm)
// if (code === 0) {
// Toast({message: '登录成功', theme: 'success'})
// // 保存token
// uni.setStorageSync('token', data)
//
// // 获取之前保存的重定向URL
// const redirectUrl = uni.getStorageSync('REDIRECT_URL') || '/pages/index/index'
// uni.removeStorageSync('REDIRECT_URL') // 使用后删除
//
// // 延迟跳转,让用户看到成功提示
// setTimeout(() => {
// if (redirectUrl.startsWith('/pages/index/') || redirectUrl.startsWith('/pages/profile/')) {
// // 主页和个人中心,使用switchTab
// uni.switchTab({
// url: redirectUrl
// })
// } else {
// // 其他页面使用reLaunch
// uni.reLaunch({
// url: redirectUrl
// })
// }
// }, 1000)
// } else {
// Toast({message: msg, theme: 'error'})
// }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
Toast({message: e.message, theme: 'error'}) Toast({message: e.message, theme: 'error'})
+87 -85
View File
@@ -68,7 +68,7 @@
<input <input
class="input" class="input"
type="text" type="text"
v-model="formData.name" v-model="formData.userName"
placeholder="请输入姓名" placeholder="请输入姓名"
maxlength="20" maxlength="20"
/> />
@@ -113,7 +113,7 @@
<input <input
class="input" class="input"
type="number" type="number"
v-model="formData.verificationCode" v-model="formData.smsCode"
placeholder="请输入验证码" placeholder="请输入验证码"
maxlength="6" maxlength="6"
/> />
@@ -145,37 +145,37 @@
<!-- 搜索框 --> <!-- 搜索框 -->
<view class="search-box"> <view class="search-box">
<t-icon name="search" size="22px" class="search-icon" /> <t-icon name="search" size="22px" class="search-icon"/>
<input <input
class="search-input" class="search-input"
type="text" type="text"
v-model="searchKeyword" v-model="searchKeyword"
placeholder="搜索单位" placeholder="搜索单位"
@input="handleSearch" @input="handleSearch"
/> />
<t-icon <t-icon
v-if="searchKeyword" v-if="searchKeyword"
name="close-circle-filled" name="close-circle-filled"
size="22px" size="22px"
class="clear-icon" class="clear-icon"
@click="clearSearch" @click="clearSearch"
/> />
</view> </view>
<!-- 单位列表 --> <!-- 单位列表 -->
<scroll-view <scroll-view
scroll-y scroll-y
class="units-scroll-view" class="units-scroll-view"
scroll-with-animation scroll-with-animation
:scroll-into-view="scrollViewId" :scroll-into-view="scrollViewId"
> >
<view <view
v-for="unit in filteredUnits" v-for="unit in filteredUnits"
:key="unit.id" :key="unit.id"
:id="'unit-' + unit.id" :id="'unit-' + unit.id"
class="unit-item" class="unit-item"
:class="{'unit-selected': selectedUnitId === unit.id}" :class="{'unit-selected': selectedUnitId === unit.id}"
@click="selectUnit(unit)" @click="selectUnit(unit)"
> >
<text class="unit-name">{{ unit.name }}</text> <text class="unit-name">{{ unit.name }}</text>
<t-icon v-if="selectedUnitId === unit.id" name="check" size="22px" class="check-icon"/> <t-icon v-if="selectedUnitId === unit.id" name="check" size="22px" class="check-icon"/>
@@ -191,18 +191,21 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, computed, onMounted, watch, nextTick, getCurrentInstance } from 'vue'; import {ref, reactive, computed, onMounted, watch, nextTick, getCurrentInstance} from 'vue';
import { Toast } from 'tdesign-mobile-vue'; import {Dialog, Toast} from 'tdesign-mobile-vue';
import { useRequest } from "@/utils/request"; import {useRequest} from "@/utils/request";
import {useUserStore} from "@/store";
const userStore = useUserStore();
// 表单数据 // 表单数据
const formData = reactive({ const formData = reactive({
name: '', userName: '',
phone: '', phone: '',
unitId: '', unitId: '',
unitName: '', unitName: '',
idCard: '', idCard: '',
verificationCode: '' smsCode: ''
}); });
// 验证码倒计时 // 验证码倒计时
@@ -223,21 +226,10 @@ const filteredUnits = computed(() => {
return unitList.value; return unitList.value;
} }
return unitList.value.filter(unit => return unitList.value.filter(unit =>
unit.name.toLowerCase().includes(searchKeyword.value.toLowerCase()) unit.name.toLowerCase().includes(searchKeyword.value.toLowerCase())
); );
}); });
// 表单验证
const isFormValid = computed(() => {
return formData.name &&
formData.phone &&
formData.phone.length === 11 &&
formData.unitId &&
formData.idCard &&
formData.idCard.length === 18 &&
formData.verificationCode;
});
// 当选择器打开时,预设选中当前已选单位 // 当选择器打开时,预设选中当前已选单位
watch(showUnitPicker, (newVal) => { watch(showUnitPicker, (newVal) => {
if (newVal && formData.unitId) { if (newVal && formData.unitId) {
@@ -270,7 +262,7 @@ const selectUnit = (unit) => {
// 确认选择 // 确认选择
const confirmUnitSelection = () => { const confirmUnitSelection = () => {
if (!selectedUnitId.value) { if (!selectedUnitId.value) {
Toast({ message: '请选择单位', theme: 'warning' }); Toast({message: '请选择单位', theme: 'warning'});
return; return;
} }
@@ -285,22 +277,22 @@ const confirmUnitSelection = () => {
// 获取单位列表 // 获取单位列表
const getUnitList = async () => { const getUnitList = async () => {
try { try {
const { code, data, msg } = await useRequest().get('/open/common/units'); const {code, data, msg} = await useRequest().get('/open/common/units');
if (code === 0) { if (code === 0) {
unitList.value = data || []; unitList.value = data || [];
} else { } else {
Toast({ message: msg || '获取单位列表失败', theme: 'error' }); Toast({message: msg || '获取单位列表失败', theme: 'error'});
} }
} catch (error) { } catch (error) {
console.error('获取单位列表失败', error); console.error('获取单位列表失败', error);
Toast({ message: '获取单位列表失败', theme: 'error' }); Toast({message: '获取单位列表失败', theme: 'error'});
} }
}; };
// 发送验证码 // 发送验证码
const sendVerificationCode = async () => { const sendVerificationCode = async () => {
if (!formData.phone || formData.phone.length !== 11) { if (!formData.phone || formData.phone.length !== 11) {
Toast({ message: '请输入正确的手机号', theme: 'error' }); Toast({message: '请输入正确的手机号', theme: 'error'});
return; return;
} }
@@ -308,20 +300,17 @@ const sendVerificationCode = async () => {
sendingCode.value = true; sendingCode.value = true;
try { try {
const { code, msg } = await useRequest().post('/client/auth/send-verification-code', { const {code, msg} = await useRequest().post('/client/auth//send-reg-code/' + formData.phone);
phone: formData.phone,
type: 'register'
});
if (code === 0) { if (code === 0) {
Toast({ message: '验证码已发送' }); Toast({message: '验证码已发送'});
startCountdown(); startCountdown();
} else { } else {
Toast({ message: msg || '发送验证码失败', theme: 'error' }); Toast({message: msg || '发送验证码失败', theme: 'error'});
} }
} catch (error) { } catch (error) {
console.error('发送验证码失败', error); console.error('发送验证码失败', error);
Toast({ message: '发送验证码失败', theme: 'error' }); Toast({message: '发送验证码失败', theme: 'error'});
} finally { } finally {
sendingCode.value = false; sendingCode.value = false;
} }
@@ -340,54 +329,67 @@ const startCountdown = () => {
// 注册 // 注册
const handleRegister = async () => { const handleRegister = async () => {
if (!isFormValid.value) { if (!formData.userName) {
Toast({ message: '请完善注册信息', theme: 'error' }); Toast('请输入姓名');
return; return
}
if (!formData.phone) {
Toast('请输入手机号码');
return
}
if (!formData.phone.match(/^1[3456789]\d{9}$/)) {
Toast('请输入正确的手机号码');
return
}
if (!formData.idCard) {
Toast('请输入身份证号');
return
}
if (!formData.unitId) {
Toast('请选择单位');
return
}
if (!formData.idCard.match(/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/)) {
Toast('请输入正确的身份证号');
return
}
if (!formData.smsCode) {
Toast('请输入验证码');
return
} }
registering.value = true; registering.value = true;
try { try {
const { code, msg } = await useRequest().post('/client/auth/register', { const {code, msg, data} = await useRequest().post('/client/auth/register', formData);
name: formData.name,
phone: formData.phone,
unitId: formData.unitId,
idCard: formData.idCard,
verificationCode: formData.verificationCode
});
if (code === 0) { if (code === 0) {
Toast({ message: '注册成功' }); Dialog.confirm({
// 注册成功后跳转到登录页 title: '注册成功',
setTimeout(() => { content: '是否立即进入系统?',
uni.navigateTo({ confirmBtn: '确定',
url: '/pages/login/index' cancelBtn: '取消',
}); onConfirm: () => {
}, 1500); userStore.setToken(data)
userStore.getUserInfo().then(() => {
uni.switchTab({
url: '/pages/index/index'
})
}).catch(e => {
Toast({message: e.message, theme: 'error'})
})
}
})
} else { } else {
Toast({ message: msg || '注册失败', theme: 'error' }); Toast({message: msg || '注册失败', theme: 'error'});
} }
} catch (error) { } catch (error) {
console.error('注册失败', error); console.error('注册失败', error);
Toast({ message: '注册失败', theme: 'error' }); Toast({message: '注册失败', theme: 'error'});
} finally { } finally {
registering.value = false; registering.value = false;
} }
}; };
// 显示协议
const showAgreement = () => {
uni.navigateTo({
url: '/pages/agreement/index'
});
};
// 显示隐私政策
const showPrivacy = () => {
uni.navigateTo({
url: '/pages/privacy/index'
});
};
// 跳转登录页面 // 跳转登录页面
const goToLogin = () => { const goToLogin = () => {
uni.navigateTo({ uni.navigateTo({
Binary file not shown.
+2 -5
View File
@@ -19,6 +19,7 @@ export const checkAuth = async () => {
if (token) { if (token) {
await useUserStore().getUserInfo() await useUserStore().getUserInfo()
} else { } else {
uni.setStorageSync('REDIRECT_URL', window.location.pathname + window.location.search)
await uni.redirectTo({ await uni.redirectTo({
url: '/pages/login/index' url: '/pages/login/index'
}) })
@@ -88,12 +89,8 @@ async function routeInterceptor(args, whiteList) {
return args return args
} else { } else {
console.log('拦截导航,跳转到登录页') console.log('拦截导航,跳转到登录页')
// 保存用户尝试访问的页面,以便登录后跳回 // 保存用户尝试访问的页面,以便登录后跳回
try { uni.setStorageSync('REDIRECT_URL', targetUrl + args.query)
uni.setStorageSync('REDIRECT_URL', targetUrl)
} catch (e) {
}
Dialog.confirm({ Dialog.confirm({
title: '提示', title: '提示',