..
This commit is contained in:
+3
-3
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -92,7 +92,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ jetty:
|
|||||||
#结合ftp使用,或用nginx代理ftp路径
|
#结合ftp使用,或用nginx代理ftp路径
|
||||||
#staticPath: E:/project/NutzWk/upload
|
#staticPath: E:/project/NutzWk/upload
|
||||||
#开发模式静态资源
|
#开发模式静态资源
|
||||||
staticPathLocal: E:/projects/hmc_gbhd/src/main/resources/static
|
staticPathLocal: E:/project/hmd_gbhd/src/main/resources/static
|
||||||
|
|
||||||
security:
|
security:
|
||||||
tokenName: token
|
tokenName: token
|
||||||
@@ -69,7 +69,7 @@ xsssql:
|
|||||||
beetl:
|
beetl:
|
||||||
RESOURCE:
|
RESOURCE:
|
||||||
#本地路径,开发时设置本地路径,便于调试
|
#本地路径,开发时设置本地路径,便于调试
|
||||||
rootLocal: E:/projects/hmc_gbhd/src/main/resources/views/
|
rootLocal: E:/project/hmd_gbhd/src/main/resources/views/
|
||||||
root: views/
|
root: views/
|
||||||
DELIMITER_STATEMENT_START: '<!--#'
|
DELIMITER_STATEMENT_START: '<!--#'
|
||||||
DELIMITER_STATEMENT_END: '#-->'
|
DELIMITER_STATEMENT_END: '#-->'
|
||||||
|
|||||||
+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>
|
<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 -->
|
||||||
|
|||||||
@@ -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("/pages/activity/detail/index?id=" + this.actId)
|
||||||
|
|
||||||
|
let signInCode = new QRCode(document.getElementById("signInCode"), {
|
||||||
|
width: 150,
|
||||||
|
height: 150
|
||||||
|
})
|
||||||
|
signInCode.makeCode("/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 {
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -18,22 +9,21 @@
|
|||||||
label-align="left"
|
label-align="left"
|
||||||
scroll-to-first-error="auto"
|
scroll-to-first-error="auto"
|
||||||
>
|
>
|
||||||
<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 +69,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}].isStay`"
|
||||||
|
:rules="[{required:true,message: '请选择是否住宿'}]">
|
||||||
|
<t-radio-group v-model="user.isStay" 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 +104,14 @@
|
|||||||
{{ isSignUp ? '重新提交报名信息' : '提交报名'}}
|
{{ isSignUp ? '重新提交报名信息' : '提交报名'}}
|
||||||
</t-button>
|
</t-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 引导 -->
|
||||||
|
<t-guide
|
||||||
|
v-model="guideCurrent"
|
||||||
|
:steps="guideSteps"
|
||||||
|
>
|
||||||
|
</t-guide>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -113,9 +120,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 +154,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.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'});
|
||||||
}
|
}
|
||||||
@@ -308,7 +337,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 +407,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,10 +14,10 @@
|
|||||||
</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">
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user