Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/hmc_gbhd
Conflicts: backend/src/main/resources/application.yaml frontend/vite.config.js
This commit is contained in:
+3
-3
@@ -67,9 +67,8 @@ public class ClientAuthController {
|
||||
@ApiOperation(value = "注册", nickname = "/register", httpMethod = "POST")
|
||||
public Result register(ClientRegisterBody registerBody) {
|
||||
try {
|
||||
// String token = clientAuthService.doRegister(registerBody);
|
||||
// return Result.success().addData(token);
|
||||
return Result.success();
|
||||
String token = clientAuthService.doRegister(registerBody);
|
||||
return Result.success().addData(token);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
@@ -130,6 +129,7 @@ public class ClientAuthController {
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
public Result info() {
|
||||
Client_user user = dao.fetch(Client_user.class, StpClientUtil.STP.getLoginIdAsLong());
|
||||
dao.fetchLinks(user, "unit");
|
||||
return Result.success(user);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.client.auth.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.models.Sys_unit;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
@@ -62,4 +63,7 @@ public class Client_user extends BaseModel implements Serializable {
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@Comment("openId")
|
||||
private String openId;
|
||||
|
||||
@One(field = "unitId")
|
||||
private Sys_unit unit;
|
||||
}
|
||||
|
||||
+6
-1
@@ -49,12 +49,14 @@ public class ClientActivityController {
|
||||
t1.endTime,
|
||||
t1.signStartTime,
|
||||
t1.signEndTime,
|
||||
t1.coHostUnit,
|
||||
t1.cover
|
||||
FROM
|
||||
activity t1
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(Cnd.likeEX("t1.title", pageForm.getSearchKeyword()));
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = clientActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
@@ -92,7 +94,10 @@ public class ClientActivityController {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.or(ActUser::getUserId, "=", 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);
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -47,6 +47,9 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
|
||||
public void signUp(ClientActivitySignVO signVO) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
Client_user selfUser = dao().fetch(Client_user.class, StpClientUtil.STP.getLoginIdAsLong());
|
||||
dao().fetchLinks(selfUser, "unit");
|
||||
|
||||
List<ActUser> userList = signVO.getUserList();
|
||||
// 首先检查报名人员是否已经在用户表中
|
||||
for (ActUser user : userList) {
|
||||
@@ -58,6 +61,7 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
|
||||
clientUser.setSex(user.getSex());
|
||||
clientUser.setPhone(user.getPhone());
|
||||
clientUser.setIdCard(user.getIdCard());
|
||||
clientUser.setUnitId(selfUser.getUnitId());
|
||||
dao().insert(clientUser);
|
||||
} else {
|
||||
// 验证用户之前是不是已经报名 别人帮报 自己报 管理员报
|
||||
@@ -71,6 +75,7 @@ public class ClientActivityServiceImpl extends BaseServiceImpl<Activity> impleme
|
||||
|
||||
user.setActivityId(signVO.getActivityId());
|
||||
user.setUserId(clientUser.getId());
|
||||
user.setUnitId(selfUser.getUnitId());
|
||||
user.setUnitName(signVO.getUnitName());
|
||||
user.setSignUpContacts(signVO.getContactName());
|
||||
user.setSignUpMobile(signVO.getContactPhone());
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
public class ClientActivitySignVO {
|
||||
|
||||
private Long activityId;
|
||||
|
||||
private Long itemId;
|
||||
|
||||
private String unitId;
|
||||
|
||||
@@ -223,6 +223,7 @@ public class ActUserController {
|
||||
add(new ExcelExportEntity("职务", "position", 20));
|
||||
add(new ExcelExportEntity("所属单位", "unitName", 20));
|
||||
add(new ExcelExportEntity("报名时间", "signUpTime2", 20));
|
||||
add(new ExcelExportEntity("是否签到", "isSignInDesc", 20));
|
||||
}};
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String((activity.getTitle() + "报名数据表.xlsx").getBytes(StandardCharsets.UTF_8), "ISO8859-1"));
|
||||
|
||||
+2
-1
@@ -79,9 +79,10 @@ public class ActivityItemApplyQueryController {
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
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.andEX("au.unitId","=",pageForm.getUnitId());
|
||||
cnd.and("au.activityId", "=", pageForm.getActivityId());
|
||||
cnd.andEX("aiu.itemId", "=", pageForm.getItemId());
|
||||
cnd.asc("ai.`name`");
|
||||
|
||||
+20
-4
@@ -76,9 +76,12 @@ public class ActivitySignInQueryController {
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
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.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.isSignIn", "=", 1);
|
||||
cnd.desc("au.signInTime");
|
||||
@@ -109,7 +112,15 @@ public class ActivitySignInQueryController {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
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
|
||||
`act_user` au
|
||||
$condition
|
||||
@@ -117,9 +128,12 @@ public class ActivitySignInQueryController {
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
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.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.isSignIn", "=", 1);
|
||||
cnd.desc("au.signInTime");
|
||||
@@ -132,7 +146,9 @@ public class ActivitySignInQueryController {
|
||||
add(new ExcelExportEntity("身份证号码", "idCard", 20));
|
||||
add(new ExcelExportEntity("联系方式", "mobile", 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");
|
||||
|
||||
+6
-7
@@ -39,6 +39,10 @@ public class ActUserServiceImpl extends BaseServiceImpl<ActUser> implements ActU
|
||||
SELECT
|
||||
u.*,
|
||||
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
|
||||
FROM
|
||||
act_user u
|
||||
@@ -53,13 +57,8 @@ public class ActUserServiceImpl extends BaseServiceImpl<ActUser> implements ActU
|
||||
seg.orLike("u.phone", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (pageForm.getIsSignIn() != 1) {
|
||||
cnd.andEX("u.isSignIn", "=", pageForm.getIsSignIn() == 2 ? 1 : 0);
|
||||
}
|
||||
// cnd.andEX("u.phone", "like", "%" + pageForm.getPhone() + "%");
|
||||
if (StrUtil.isNotBlank(pageForm.getUnitName())) {
|
||||
cnd.and("u.unitName", "like", "%" + pageForm.getUnitName() + "%");
|
||||
}
|
||||
cnd.andEX("u.isSignIn", "=", pageForm.getIsSignIn());
|
||||
cnd.andEX("u.unitId", "=", pageForm.getUnitId());
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
|
||||
@@ -23,5 +23,11 @@ public class ActSignInUserPageForm extends PageForm {
|
||||
|
||||
// 所属单位
|
||||
private String unitName;
|
||||
// 发放状态
|
||||
private Integer isGrant;
|
||||
// 单位
|
||||
private Integer unitId;
|
||||
// 是否住宿
|
||||
private Integer isStay;
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public class ActUserPageForm extends PageForm {
|
||||
|
||||
// 所属单位
|
||||
private String unitName;
|
||||
// 是否签到1.全部2.已签到3.未签到
|
||||
// 所属单位
|
||||
private String unitId;
|
||||
// 是否签到
|
||||
private Integer isSignIn;
|
||||
}
|
||||
|
||||
+1
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>
|
||||
<!-- echarts -->
|
||||
<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>
|
||||
<!-- main -->
|
||||
|
||||
@@ -46,14 +46,28 @@ layout("/layouts/platform_1.html"){
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">姓名/单位</div>
|
||||
<div class="search-item-label">姓名/电话</div>
|
||||
<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 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>
|
||||
</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="position"></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="itemName"></el-table-column>
|
||||
</el-table>
|
||||
@@ -92,7 +106,8 @@ layout("/layouts/platform_1.html"){
|
||||
year: new Date().getFullYear() + ""
|
||||
},
|
||||
activityOptions: [],
|
||||
activityItemOptions: []
|
||||
activityItemOptions: [],
|
||||
units: [],
|
||||
}
|
||||
},
|
||||
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() {
|
||||
this.getActivityOptions()
|
||||
this.getUnits()
|
||||
}
|
||||
})
|
||||
</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="操作" fixed="right" width="250">
|
||||
<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.itemFormRef.onOpen(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>
|
||||
<add-or-update ref="addOrUpdateRef" @refresh="doSearch"></add-or-update>
|
||||
<item-form ref="itemFormRef"></item-form>
|
||||
<act-qr-code ref="actQrCodeRef"></act-qr-code>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--#include('addOrUpdate.js'){}#-->
|
||||
<!--#include('itemForm.js'){}#-->
|
||||
<!--#include('actQrCode.js'){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"add-or-update": addOrUpdate,
|
||||
"item-form": itemForm
|
||||
"item-form": itemForm,
|
||||
"act-qr-code": actQrCode
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -33,9 +33,39 @@ layout("/layouts/platform_1.html"){
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">姓名/单位</div>
|
||||
<div class="search-item-label">发放状态</div>
|
||||
<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>
|
||||
|
||||
@@ -47,7 +77,7 @@ layout("/layouts/platform_1.html"){
|
||||
|
||||
<el-card shadow="never" class="mt-3">
|
||||
<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-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
|
||||
<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="position"></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="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">
|
||||
<template slot-scope="scope">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.isGrant" type="success">已发放</el-tag>
|
||||
<el-tag v-else type="danger">未发放</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="200">
|
||||
<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-else type="danger" size="mini" @click="doGrant(row, false)">设为未发放物资</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="200">
|
||||
<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-else type="danger" size="mini" @click="doGrant(row, false)">设为未发放物资</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
@@ -90,28 +127,29 @@ layout("/layouts/platform_1.html"){
|
||||
pageForm: {
|
||||
year: new Date().getFullYear() + ""
|
||||
},
|
||||
activityOptions: []
|
||||
activityOptions: [],
|
||||
units: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doGrant(row, isGrant) {
|
||||
this.$confirm('您确定要设置成' + (isGrant ? '已发放' : '未发放') + '状态吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const resp = await $.post("/platform/activity/signInUserQuery/doGrant", {
|
||||
id: row.id,
|
||||
isGrant: isGrant
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
async doGrant(row, isGrant) {
|
||||
this.$confirm('您确定要设置成' + (isGrant ? '已发放' : '未发放') + '状态吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const resp = await $.post("/platform/activity/signInUserQuery/doGrant", {
|
||||
id: row.id,
|
||||
isGrant: isGrant
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
doExport() {
|
||||
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() {
|
||||
this.getActivityOptions()
|
||||
this.getUnits()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -127,6 +127,17 @@
|
||||
"selectedColor": "#f45a5a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/activity/rank/index",
|
||||
"text": "排行榜",
|
||||
"iconfont": {
|
||||
"text": "\ue8b3",
|
||||
"selectedText": "\ue8b3",
|
||||
"fontSize": "17px",
|
||||
"color": "#333",
|
||||
"selectedColor": "#f45a5a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/profile/index",
|
||||
"text": "我的",
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
<view style="flex: 1;overflow-y: auto">
|
||||
<!-- 活动图片 -->
|
||||
<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>
|
||||
|
||||
<!-- 活动标题与标签 -->
|
||||
@@ -76,11 +77,13 @@
|
||||
<!-- 项目图片区域 -->
|
||||
<!-- v-if="item.img"-->
|
||||
<!-- :src="item.img"-->
|
||||
<image
|
||||
<!-- <image
|
||||
src="https://api.zzzmh.cn/v2/bz/v3/getUrl/c9d3deb2880411ebb6edd017c2d2eca220"
|
||||
mode="aspectFill"
|
||||
class="event-item-image"
|
||||
/>
|
||||
/>-->
|
||||
<t-image :src=config.fileDomain+item.img shape="round"
|
||||
class="event-item-image" fit="fill"/>
|
||||
|
||||
<!-- 项目信息区域 -->
|
||||
<view class="event-item-info">
|
||||
@@ -170,6 +173,7 @@ import {ref, onMounted, computed} from 'vue';
|
||||
import {onLoad} from '@dcloudio/uni-app';
|
||||
import {Toast} from 'tdesign-mobile-vue';
|
||||
import {useRequest} from "@/utils/request";
|
||||
import {config} from "@/utils/config";
|
||||
|
||||
const request = useRequest();
|
||||
const actId = ref(null);
|
||||
@@ -229,23 +233,15 @@ const navigateToSignUp = () => {
|
||||
// 获取活动详情
|
||||
const getActivityDetail = async (id) => {
|
||||
try {
|
||||
const loading = Toast({
|
||||
message: '加载中...',
|
||||
theme: 'loading',
|
||||
duration: 0
|
||||
});
|
||||
|
||||
const {code, data} = await request.get(`/client/activity/get/${id}`);
|
||||
if (code === 0 && data) {
|
||||
detailData.value = data;
|
||||
} else {
|
||||
Toast({message: '获取活动详情失败', theme: 'error'});
|
||||
// Toast({message: '获取活动详情失败', theme: 'error'});
|
||||
}
|
||||
|
||||
loading.clear();
|
||||
} catch (error) {
|
||||
console.error('获取活动详情错误', error);
|
||||
Toast({message: '获取活动详情失败', theme: 'error'});
|
||||
// Toast({message: '获取活动详情失败', theme: 'error'});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
shape="round"
|
||||
class="search-input"
|
||||
@onSearch="handleSearch"
|
||||
@onSubmit="handleSearch"
|
||||
@submit="handleSearch"
|
||||
@search="handleSearch"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
@@ -31,6 +34,7 @@
|
||||
|
||||
<view>
|
||||
<view style="display: flex;align-items: center;margin-bottom: 10px">
|
||||
|
||||
<image
|
||||
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"
|
||||
@@ -41,7 +45,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<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
|
||||
style="margin-left:10px;flex:1;overflow:hidden;display: flex;flex-direction: column;justify-content:space-around;color: #534d4d;">
|
||||
<view
|
||||
@@ -61,7 +66,7 @@
|
||||
</view>
|
||||
<view style="border-top: 1px solid #f0f0f0;margin-top: 10px;padding-top: 12px;display: flex;align-items: center;justify-content: space-between">
|
||||
<view>
|
||||
100人已报名
|
||||
<!-- 100人已报名-->
|
||||
</view>
|
||||
<t-button theme="primary" shape="round" size="small">立即报名</t-button>
|
||||
</view>
|
||||
@@ -89,6 +94,7 @@ import {ref, reactive, onMounted} from 'vue';
|
||||
import {Toast} from 'tdesign-mobile-vue';
|
||||
import {useRequest} from "@/utils/request";
|
||||
import moment from "moment";
|
||||
import {config} from "@/utils/config";
|
||||
|
||||
// 活动状态筛选选项
|
||||
const statusOptions = [
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<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="title-container">
|
||||
<view class="title">活动排行榜</view>
|
||||
@@ -75,17 +80,27 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import {ref, onMounted, computed} from 'vue';
|
||||
import { Toast } from 'tdesign-mobile-vue';
|
||||
import { useRequest } from "@/utils/request";
|
||||
import {onLoad} from "@dcloudio/uni-app";
|
||||
|
||||
// 排行榜数据
|
||||
const actList = ref([])
|
||||
const rankList = ref([]);
|
||||
const activityId = ref([]);
|
||||
const activityId = ref(null);
|
||||
const loading = ref(false);
|
||||
const refresherTriggered = ref(false);
|
||||
|
||||
const actOptions = computed(() => {
|
||||
return actList.value.map(item => {
|
||||
return {
|
||||
value: item.id,
|
||||
label: item.title
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 获取排行榜数据
|
||||
const getRankData = async () => {
|
||||
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 = () => {
|
||||
if (loading.value) {
|
||||
@@ -122,12 +153,13 @@ const handleRefresh = () => {
|
||||
};
|
||||
onLoad((option) => {
|
||||
if (option.id) {
|
||||
activityId.value=option.id
|
||||
activityId.value = Number(option.id)
|
||||
}
|
||||
});
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getRankData();
|
||||
onMounted(async () => {
|
||||
await listMineAct()
|
||||
await getRankData()
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -441,7 +473,7 @@ onMounted(() => {
|
||||
.refresh-btn {
|
||||
position: fixed;
|
||||
right: 30rpx;
|
||||
bottom: 40rpx;
|
||||
bottom: 140rpx;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
border-radius: 50%;
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
<template>
|
||||
<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">
|
||||
<t-form
|
||||
ref="formRef"
|
||||
@@ -17,23 +8,23 @@
|
||||
show-error-message
|
||||
label-align="left"
|
||||
scroll-to-first-error="auto"
|
||||
labelWidth="90px"
|
||||
>
|
||||
<view class="form-block">
|
||||
<view class="form-block-title">
|
||||
<t-icon name="institution"></t-icon>
|
||||
单位信息
|
||||
</view>
|
||||
<t-form-item label="参加单位" name="unitName" :rules="[{required:true,message: '请输入单位名称'}]">
|
||||
<!-- <t-input v-model="formData.unitName" borderless placeholder="请输入参加单位名称"></t-input>-->
|
||||
<search-picker v-model="formData.unitName" :options="unitOptions" placeholder="请选择单位"></search-picker>
|
||||
</t-form-item>
|
||||
<t-form-item label="联系人" name="contactName" :rules="[{required:true,message: '请输入联系人姓名'}]">
|
||||
<t-input v-model="formData.contactName" borderless placeholder="请输入联系人姓名"></t-input>
|
||||
</t-form-item>
|
||||
<t-form-item label="联系方式" name="contactPhone" :rules="[{required:true,message: '请输入联系电话'}]">
|
||||
<t-input v-model="formData.contactPhone" borderless placeholder="请输入联系电话"></t-input>
|
||||
</t-form-item>
|
||||
</view>
|
||||
<!-- <view class="form-block">-->
|
||||
<!-- <view class="form-block-title">-->
|
||||
<!-- <t-icon name="institution"></t-icon>-->
|
||||
<!-- 单位信息-->
|
||||
<!-- </view>-->
|
||||
<!-- <t-form-item label="参加单位" name="unitName" :rules="[{required:true,message: '请输入单位名称'}]">-->
|
||||
<!-- <t-input v-model="formData.unitName" borderless readonly placeholder="请输入参加单位名称"></t-input>-->
|
||||
<!-- </t-form-item>-->
|
||||
<!-- <t-form-item label="联系人" name="contactName" :rules="[{required:true,message: '请输入联系人姓名'}]">-->
|
||||
<!-- <t-input v-model="formData.contactName" borderless placeholder="请输入联系人姓名"></t-input>-->
|
||||
<!-- </t-form-item>-->
|
||||
<!-- <t-form-item label="联系方式" name="contactPhone" :rules="[{required:true,message: '请输入联系电话'}]">-->
|
||||
<!-- <t-input v-model="formData.contactPhone" borderless placeholder="请输入联系电话"></t-input>-->
|
||||
<!-- </t-form-item>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<view class="form-block">
|
||||
<view class="form-block-title">
|
||||
@@ -79,14 +70,23 @@
|
||||
<t-radio :block="false" name="radio" :value="false" label="否"/>
|
||||
</t-radio-group>
|
||||
</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>
|
||||
</t-form>
|
||||
<view class="add-user" @click="formData.userList.push({})">
|
||||
<t-icon name="plus" size="24px"></t-icon>
|
||||
<text>添加人员</text>
|
||||
</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="agreement-checkbox">
|
||||
<t-checkbox label="多选" icon="rectangle" v-model:checked="agreementChecked" default-checked>
|
||||
@@ -105,6 +105,14 @@
|
||||
{{ isSignUp ? '重新提交报名信息' : '提交报名'}}
|
||||
</t-button>
|
||||
</view>
|
||||
|
||||
<!-- 引导 -->
|
||||
<t-guide
|
||||
v-model="guideCurrent"
|
||||
:steps="guideSteps"
|
||||
>
|
||||
</t-guide>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -113,9 +121,32 @@ import {ref} from 'vue'
|
||||
import {useRequest} from '@/utils/request';
|
||||
import {Dialog, Toast} from "tdesign-mobile-vue";
|
||||
import {onLoad} from "@dcloudio/uni-app";
|
||||
import SearchPicker from "@/components/SearchPicker.vue";
|
||||
import {useUserStore} from "@/store";
|
||||
|
||||
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 isSignUp = ref(null)
|
||||
const agreementChecked = ref(false)
|
||||
@@ -124,18 +155,17 @@ const formData = ref({
|
||||
userList: [{}]
|
||||
})
|
||||
|
||||
const unitOptions = ref([
|
||||
{value:'单位1',label:'单位1'},
|
||||
{value:'单位2',label:'单位2'},
|
||||
{value:'单位3',label:'单位3'},
|
||||
])
|
||||
|
||||
onLoad((option) => {
|
||||
if (option.id) {
|
||||
actId.value = option.id
|
||||
formData.value.activityId = option.id
|
||||
listSignUpUser()
|
||||
getIsSignUp()
|
||||
// 没报名进行引导
|
||||
if(formData.value.userList.length === 0){
|
||||
guideCurrent.value = 0
|
||||
//formData.value.unitName = userStore.userInfo?.unit.name
|
||||
}
|
||||
} else {
|
||||
Toast({message: 'ID不存在', theme: 'error'});
|
||||
}
|
||||
@@ -226,6 +256,7 @@ async function submitForm() {
|
||||
title: '提交中...',
|
||||
mask: true,
|
||||
})
|
||||
console.log(formData.value)
|
||||
try {
|
||||
const {code, data, msg} = await request.post('/client/activity/sign-up', formData.value)
|
||||
if (code === 0) {
|
||||
@@ -308,7 +339,6 @@ async function removeUser(index) {
|
||||
.form-area {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
//margin-top: 100px;
|
||||
margin-bottom: 130px;
|
||||
}
|
||||
|
||||
@@ -379,16 +409,23 @@ async function removeUser(index) {
|
||||
}
|
||||
}
|
||||
|
||||
.add-user {
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
color: #e74c3c;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
.float-add-btn {
|
||||
position: fixed;
|
||||
right: 32rpx;
|
||||
bottom: 160rpx;
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #e74c3c;
|
||||
display: flex;
|
||||
justify-content: 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 {
|
||||
|
||||
@@ -14,25 +14,25 @@
|
||||
</view>
|
||||
|
||||
<!-- 小提示 -->
|
||||
<view class="success-tips">
|
||||
<t-icon name="info-circle-filled" size="16px" />
|
||||
<text>活动开始前我们将通过短信通知您</text>
|
||||
</view>
|
||||
<!-- <view class="success-tips">-->
|
||||
<!-- <t-icon name="info-circle-filled" size="16px" />-->
|
||||
<!-- <text>活动开始前我们将通过短信通知您</text>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="action-buttons">
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { Toast } from 'tdesign-mobile-vue';
|
||||
import { useRequest } from '@/utils/request';
|
||||
import {ref} from 'vue';
|
||||
import {onLoad} from '@dcloudio/uni-app';
|
||||
import {Toast} from 'tdesign-mobile-vue';
|
||||
import {useRequest} from '@/utils/request';
|
||||
|
||||
const request = useRequest();
|
||||
const actId = ref(null);
|
||||
@@ -69,9 +69,9 @@ const navigateToHome = () => {
|
||||
};
|
||||
|
||||
// 查看报名详情
|
||||
const viewRegistrationDetails = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/activity/registration-details/index?id=' + actId.value
|
||||
const navigateToEdit = () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/activity/registration-form/index?id=' + actId.value
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -106,7 +106,7 @@ const viewRegistrationDetails = () => {
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
animation: float 3s ease-in-out infinite;
|
||||
//animation: float 3s ease-in-out infinite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,32 +69,10 @@
|
||||
</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>
|
||||
|
||||
<view style="flex: 1;display: flex;justify-content: center;align-items: center">
|
||||
<t-empty v-if="actOptions && actOptions.length === 0"
|
||||
<view v-if="actOptions && actOptions.length === 0" style="flex: 1;display: flex;justify-content: center;align-items: center">
|
||||
<t-empty
|
||||
image="/static/img/empty.png"
|
||||
description="报名活动后才能扫码签到"
|
||||
style="flex: 1">
|
||||
@@ -114,12 +92,14 @@
|
||||
|
||||
<script setup>
|
||||
import {ref, computed, onMounted} from 'vue';
|
||||
import {onBackPress, onLoad} from "@dcloudio/uni-app";
|
||||
import {useRequest} from '@/utils/request';
|
||||
import {useUserStore} from "@/store";
|
||||
import {Dialog, Toast} from 'tdesign-mobile-vue';
|
||||
import moment from 'moment';
|
||||
import ScanQRCode from '@/components/scanQrCode.vue'
|
||||
|
||||
const request = useRequest()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const list = ref([])
|
||||
const signInfo = ref({})
|
||||
@@ -138,6 +118,20 @@ onMounted(() => {
|
||||
listMineAct();
|
||||
});
|
||||
|
||||
onLoad((options)=>{
|
||||
if(options.id){
|
||||
selectActId.value = Number(options.id)
|
||||
signIn()
|
||||
}
|
||||
})
|
||||
|
||||
// 返回按钮
|
||||
onBackPress(()=>{
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
})
|
||||
|
||||
// 获取活动列表
|
||||
async function listMineAct() {
|
||||
try {
|
||||
@@ -175,6 +169,10 @@ async function getSignInfo(val) {
|
||||
|
||||
// 扫码签到
|
||||
function handleScan() {
|
||||
if(signInfo.value.isSignIn){
|
||||
Toast('您已签到')
|
||||
return
|
||||
}
|
||||
qrScannerRef.value.startScan()
|
||||
}
|
||||
|
||||
@@ -185,6 +183,20 @@ function handleScanSuccess(val) {
|
||||
Toast.error("请扫描合法的二维码")
|
||||
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)) {
|
||||
Toast.error('请扫码签到当前活动,扫描成功,活动ID为' + val + ",当前选择活动ID为" + selectActId.value)
|
||||
return
|
||||
@@ -195,6 +207,11 @@ function handleScanSuccess(val) {
|
||||
// 签到
|
||||
async function signIn() {
|
||||
try {
|
||||
if(signInfo.value.isSignIn){
|
||||
Toast.error('您已签到')
|
||||
return
|
||||
}
|
||||
|
||||
await uni.showLoading({
|
||||
title: '签到中...',
|
||||
mask: true,
|
||||
@@ -538,32 +555,6 @@ function navigateToSignUp(){
|
||||
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__animated {
|
||||
animation-duration: 1s;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<template>
|
||||
<view class="page-container">
|
||||
<template v-if="actOptions && actOptions.length>0">
|
||||
<t-dropdown-menu class="top-dropdown">
|
||||
<t-dropdown-item :options="actOptions" :value="selectActId"/>
|
||||
</t-dropdown-menu>
|
||||
<t-dropdown-menu class="top-dropdown">
|
||||
<t-dropdown-item :options="actOptions" :value="selectActId"/>
|
||||
</t-dropdown-menu>
|
||||
|
||||
<template v-if="actOptions && actOptions.length > 0 && teamMembers.length > 0">
|
||||
<view class="content-container">
|
||||
<!-- <view class="page-header">-->
|
||||
<!-- <text class="page-title">团队报名</text>-->
|
||||
@@ -25,8 +26,11 @@
|
||||
<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"> 活动报名 {{
|
||||
<t-button theme="primary" size="small" class="project-card__button" @click="openDesc(project)">
|
||||
项目介绍
|
||||
</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
|
||||
}}人
|
||||
</t-button>
|
||||
@@ -41,10 +45,10 @@
|
||||
</view>
|
||||
</template>
|
||||
<view v-else style="flex: 1;display: flex;justify-content: center;align-items: center">
|
||||
<t-empty v-if="actOptions && actOptions.length === 0"
|
||||
image="/static/img/empty.png"
|
||||
description="您没有任何团队信息,无法进行项目报名"
|
||||
style="flex: 1">
|
||||
<t-empty
|
||||
image="/static/img/empty.png"
|
||||
description="您没有任何团队信息,无法进行项目报名"
|
||||
style="flex: 1">
|
||||
</t-empty>
|
||||
</view>
|
||||
|
||||
@@ -205,9 +209,9 @@ async function listActs() {
|
||||
label: item.title
|
||||
}
|
||||
})
|
||||
// if(selectActId.value === null && data.length){
|
||||
// selectActId.value = data[0].id
|
||||
// }
|
||||
if (selectActId.value === null && data.length) {
|
||||
selectActId.value = data[0].id
|
||||
}
|
||||
} else {
|
||||
Toast.error(msg)
|
||||
}
|
||||
@@ -240,7 +244,6 @@ async function listTeamUser() {
|
||||
teamMembers.value = data;
|
||||
isSelfLeader.value = data.find(t => t.userId === userStore?.userInfo.id)?.isLeader
|
||||
} else {
|
||||
Toast.error(msg)
|
||||
}
|
||||
} catch (e) {
|
||||
Toast.error(e)
|
||||
@@ -285,7 +288,6 @@ const getApplyUsers = async () => {
|
||||
if (code === 0) {
|
||||
selectedMemberList.value = data
|
||||
} else {
|
||||
Toast.error(msg)
|
||||
}
|
||||
} catch (e) {
|
||||
Toast.error(e.message)
|
||||
@@ -297,7 +299,7 @@ const cancelRegistration = async () => {
|
||||
let data = {}
|
||||
data.activityId = selectActId.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) {
|
||||
Toast.success('取消报名成功')
|
||||
showMemberPicker.value = false;
|
||||
@@ -461,8 +463,6 @@ const submitRegistration = async () => {
|
||||
|
||||
.project-card__button {
|
||||
margin-left: 10px;
|
||||
background-color: #0052D9;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<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">
|
||||
<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="team-card">
|
||||
@@ -118,8 +118,7 @@
|
||||
</div>
|
||||
</view>
|
||||
<view v-else style="flex: 1;display: flex;justify-content: center;align-items: center">
|
||||
<t-empty v-if="actOptions && actOptions.length === 0"
|
||||
image="/static/img/empty.png"
|
||||
<t-empty image="/static/img/empty.png"
|
||||
description="您没有任何团队信息"
|
||||
style="flex: 1">
|
||||
</t-empty>
|
||||
@@ -265,7 +264,8 @@ const getListAct = async () => {
|
||||
|
||||
// 点击查看成绩排名
|
||||
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})
|
||||
}
|
||||
|
||||
// 初始化
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<view class="menu-item" @click="navigateTo('/pages/activity/team/index')">
|
||||
<view class="menu-icon-wrapper yellow-bg">
|
||||
<view class="menu-icon team-icon"></view>
|
||||
<view class="badge">3</view>
|
||||
<!-- <view class="badge">3</view>-->
|
||||
</view>
|
||||
<view class="menu-text">我的团队</view>
|
||||
</view>
|
||||
@@ -55,9 +55,8 @@
|
||||
<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>
|
||||
<t-image :src=config.fileDomain+item.cover shape="round"
|
||||
class="activity-image" fit="fill"/>
|
||||
<view class="activity-info">
|
||||
<view class="activity-title">{{ item.title }}</view>
|
||||
<view class="activity-meta">
|
||||
@@ -71,7 +70,7 @@
|
||||
</t-swiper>
|
||||
<t-empty
|
||||
v-if="actList.length === 0"
|
||||
description="暂无精彩瞬间"
|
||||
description="暂无近期活动"
|
||||
/>
|
||||
|
||||
</view>
|
||||
@@ -84,9 +83,8 @@
|
||||
<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>
|
||||
<t-image :src=config.fileDomain+item.cover shape="round"
|
||||
class="moment-image" fit="fill"/>
|
||||
<view class="moment-content">
|
||||
<view class="moment-title">{{ item.title }}</view>
|
||||
<view class="moment-sub-content">
|
||||
@@ -111,6 +109,7 @@ import {onMounted, ref} from "vue";
|
||||
import {Toast} from "tdesign-mobile-vue";
|
||||
import {useRequest} from "@/utils/request";
|
||||
import moment from "moment";
|
||||
import {config} from "@/utils/config";
|
||||
|
||||
const request = useRequest()
|
||||
|
||||
@@ -332,6 +331,7 @@ uni-page-body {
|
||||
}
|
||||
|
||||
.activity-image {
|
||||
height: 200px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +136,7 @@ import {ref, reactive, computed, onMounted, onBeforeUnmount} from 'vue'
|
||||
import {Toast} from 'tdesign-mobile-vue';
|
||||
import {useRequest} from "@/utils/request";
|
||||
import {useUserStore} from "@/store";
|
||||
import {onLoad} from "@dcloudio/uni-app";
|
||||
|
||||
const request = useRequest()
|
||||
const userStore = useUserStore()
|
||||
@@ -287,44 +288,30 @@ async function handleLogin() {
|
||||
userStore.smsLogin(loginForm).then(() => {
|
||||
userStore.getUserInfo().then(() => {
|
||||
Toast({message: '登录成功', theme: 'success'})
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
const redirect = uni.getStorageSync("REDIRECT_URL")
|
||||
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 => {
|
||||
console.log(e)
|
||||
Toast({message: e.message, theme: 'error'})
|
||||
})
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
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) {
|
||||
console.error(e)
|
||||
Toast({message: e.message, theme: 'error'})
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<input
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="formData.name"
|
||||
v-model="formData.userName"
|
||||
placeholder="请输入姓名"
|
||||
maxlength="20"
|
||||
/>
|
||||
@@ -113,7 +113,7 @@
|
||||
<input
|
||||
class="input"
|
||||
type="number"
|
||||
v-model="formData.verificationCode"
|
||||
v-model="formData.smsCode"
|
||||
placeholder="请输入验证码"
|
||||
maxlength="6"
|
||||
/>
|
||||
@@ -145,37 +145,37 @@
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-box">
|
||||
<t-icon name="search" size="22px" class="search-icon" />
|
||||
<t-icon name="search" size="22px" class="search-icon"/>
|
||||
<input
|
||||
class="search-input"
|
||||
type="text"
|
||||
v-model="searchKeyword"
|
||||
placeholder="搜索单位"
|
||||
@input="handleSearch"
|
||||
class="search-input"
|
||||
type="text"
|
||||
v-model="searchKeyword"
|
||||
placeholder="搜索单位"
|
||||
@input="handleSearch"
|
||||
/>
|
||||
<t-icon
|
||||
v-if="searchKeyword"
|
||||
name="close-circle-filled"
|
||||
size="22px"
|
||||
class="clear-icon"
|
||||
@click="clearSearch"
|
||||
v-if="searchKeyword"
|
||||
name="close-circle-filled"
|
||||
size="22px"
|
||||
class="clear-icon"
|
||||
@click="clearSearch"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 单位列表 -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="units-scroll-view"
|
||||
scroll-with-animation
|
||||
:scroll-into-view="scrollViewId"
|
||||
scroll-y
|
||||
class="units-scroll-view"
|
||||
scroll-with-animation
|
||||
:scroll-into-view="scrollViewId"
|
||||
>
|
||||
<view
|
||||
v-for="unit in filteredUnits"
|
||||
:key="unit.id"
|
||||
:id="'unit-' + unit.id"
|
||||
class="unit-item"
|
||||
:class="{'unit-selected': selectedUnitId === unit.id}"
|
||||
@click="selectUnit(unit)"
|
||||
v-for="unit in filteredUnits"
|
||||
:key="unit.id"
|
||||
:id="'unit-' + unit.id"
|
||||
class="unit-item"
|
||||
:class="{'unit-selected': selectedUnitId === unit.id}"
|
||||
@click="selectUnit(unit)"
|
||||
>
|
||||
<text class="unit-name">{{ unit.name }}</text>
|
||||
<t-icon v-if="selectedUnitId === unit.id" name="check" size="22px" class="check-icon"/>
|
||||
@@ -191,18 +191,21 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, onMounted, watch, nextTick, getCurrentInstance } from 'vue';
|
||||
import { Toast } from 'tdesign-mobile-vue';
|
||||
import { useRequest } from "@/utils/request";
|
||||
import {ref, reactive, computed, onMounted, watch, nextTick, getCurrentInstance} from 'vue';
|
||||
import {Dialog, Toast} from 'tdesign-mobile-vue';
|
||||
import {useRequest} from "@/utils/request";
|
||||
import {useUserStore} from "@/store";
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
name: '',
|
||||
userName: '',
|
||||
phone: '',
|
||||
unitId: '',
|
||||
unitName: '',
|
||||
idCard: '',
|
||||
verificationCode: ''
|
||||
smsCode: ''
|
||||
});
|
||||
|
||||
// 验证码倒计时
|
||||
@@ -223,21 +226,10 @@ const filteredUnits = computed(() => {
|
||||
return unitList.value;
|
||||
}
|
||||
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) => {
|
||||
if (newVal && formData.unitId) {
|
||||
@@ -270,7 +262,7 @@ const selectUnit = (unit) => {
|
||||
// 确认选择
|
||||
const confirmUnitSelection = () => {
|
||||
if (!selectedUnitId.value) {
|
||||
Toast({ message: '请选择单位', theme: 'warning' });
|
||||
Toast({message: '请选择单位', theme: 'warning'});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -285,22 +277,22 @@ const confirmUnitSelection = () => {
|
||||
// 获取单位列表
|
||||
const getUnitList = async () => {
|
||||
try {
|
||||
const { code, data, msg } = await useRequest().get('/open/common/units');
|
||||
const {code, data, msg} = await useRequest().get('/open/common/units');
|
||||
if (code === 0) {
|
||||
unitList.value = data || [];
|
||||
} else {
|
||||
Toast({ message: msg || '获取单位列表失败', theme: 'error' });
|
||||
Toast({message: msg || '获取单位列表失败', theme: 'error'});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取单位列表失败', error);
|
||||
Toast({ message: '获取单位列表失败', theme: 'error' });
|
||||
Toast({message: '获取单位列表失败', theme: 'error'});
|
||||
}
|
||||
};
|
||||
|
||||
// 发送验证码
|
||||
const sendVerificationCode = async () => {
|
||||
if (!formData.phone || formData.phone.length !== 11) {
|
||||
Toast({ message: '请输入正确的手机号', theme: 'error' });
|
||||
Toast({message: '请输入正确的手机号', theme: 'error'});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -308,20 +300,17 @@ const sendVerificationCode = async () => {
|
||||
|
||||
sendingCode.value = true;
|
||||
try {
|
||||
const { code, msg } = await useRequest().post('/client/auth/send-verification-code', {
|
||||
phone: formData.phone,
|
||||
type: 'register'
|
||||
});
|
||||
const {code, msg} = await useRequest().post('/client/auth//send-reg-code/' + formData.phone);
|
||||
|
||||
if (code === 0) {
|
||||
Toast({ message: '验证码已发送' });
|
||||
Toast({message: '验证码已发送'});
|
||||
startCountdown();
|
||||
} else {
|
||||
Toast({ message: msg || '发送验证码失败', theme: 'error' });
|
||||
Toast({message: msg || '发送验证码失败', theme: 'error'});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('发送验证码失败', error);
|
||||
Toast({ message: '发送验证码失败', theme: 'error' });
|
||||
Toast({message: '发送验证码失败', theme: 'error'});
|
||||
} finally {
|
||||
sendingCode.value = false;
|
||||
}
|
||||
@@ -340,54 +329,67 @@ const startCountdown = () => {
|
||||
|
||||
// 注册
|
||||
const handleRegister = async () => {
|
||||
if (!isFormValid.value) {
|
||||
Toast({ message: '请完善注册信息', theme: 'error' });
|
||||
return;
|
||||
if (!formData.userName) {
|
||||
Toast('请输入姓名');
|
||||
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;
|
||||
try {
|
||||
const { code, msg } = await useRequest().post('/client/auth/register', {
|
||||
name: formData.name,
|
||||
phone: formData.phone,
|
||||
unitId: formData.unitId,
|
||||
idCard: formData.idCard,
|
||||
verificationCode: formData.verificationCode
|
||||
});
|
||||
const {code, msg, data} = await useRequest().post('/client/auth/register', formData);
|
||||
|
||||
if (code === 0) {
|
||||
Toast({ message: '注册成功' });
|
||||
// 注册成功后跳转到登录页
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/index'
|
||||
});
|
||||
}, 1500);
|
||||
Dialog.confirm({
|
||||
title: '注册成功',
|
||||
content: '是否立即进入系统?',
|
||||
confirmBtn: '确定',
|
||||
cancelBtn: '取消',
|
||||
onConfirm: () => {
|
||||
userStore.setToken(data)
|
||||
userStore.getUserInfo().then(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}).catch(e => {
|
||||
Toast({message: e.message, theme: 'error'})
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Toast({ message: msg || '注册失败', theme: 'error' });
|
||||
Toast({message: msg || '注册失败', theme: 'error'});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('注册失败', error);
|
||||
Toast({ message: '注册失败', theme: 'error' });
|
||||
Toast({message: '注册失败', theme: 'error'});
|
||||
} finally {
|
||||
registering.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 显示协议
|
||||
const showAgreement = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/agreement/index'
|
||||
});
|
||||
};
|
||||
|
||||
// 显示隐私政策
|
||||
const showPrivacy = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/privacy/index'
|
||||
});
|
||||
};
|
||||
|
||||
// 跳转登录页面
|
||||
const goToLogin = () => {
|
||||
uni.navigateTo({
|
||||
|
||||
Binary file not shown.
@@ -19,6 +19,7 @@ export const checkAuth = async () => {
|
||||
if (token) {
|
||||
await useUserStore().getUserInfo()
|
||||
} else {
|
||||
uni.setStorageSync('REDIRECT_URL', window.location.pathname + window.location.search)
|
||||
await uni.redirectTo({
|
||||
url: '/pages/login/index'
|
||||
})
|
||||
@@ -88,12 +89,8 @@ async function routeInterceptor(args, whiteList) {
|
||||
return args
|
||||
} else {
|
||||
console.log('拦截导航,跳转到登录页')
|
||||
|
||||
// 保存用户尝试访问的页面,以便登录后跳回
|
||||
try {
|
||||
uni.setStorageSync('REDIRECT_URL', targetUrl)
|
||||
} catch (e) {
|
||||
}
|
||||
uni.setStorageSync('REDIRECT_URL', targetUrl + args.query)
|
||||
|
||||
Dialog.confirm({
|
||||
title: '提示',
|
||||
|
||||
Reference in New Issue
Block a user