添加 共赴宁波之春 报名网页

This commit is contained in:
范露尧
2023-03-09 22:16:03 +08:00
parent 21dd025ab8
commit 5755e9d9b0
44 changed files with 1386 additions and 534 deletions

View File

@@ -1,7 +1,7 @@
//using Ewide.Application;
using Furion;
using Furion.DataEncryption;
using Furion.TaskScheduler;
//using Furion.TaskScheduler;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
@@ -24,13 +24,13 @@ namespace Ewide.Web.Entry.Controllers
}
public IActionResult Index2()
{
//SpareTime.Do
var workers = SpareTime.GetWorkers().ToList();
SpareTime.DoOnce(3000, (timer, count) =>
{
// 这里发送短信,发送邮件或记录访问记录
Console.WriteLine("现在时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
});
////SpareTime.Do
//var workers = SpareTime.GetWorkers().ToList();
//SpareTime.DoOnce(3000, (timer, count) =>
// {
// // 这里发送短信,发送邮件或记录访问记录
// Console.WriteLine("现在时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
// });
return View();
}
}

View File

@@ -10,7 +10,7 @@ namespace Ewide.Web.Entry.Controllers
[AllowAnonymous]
public class ManageController : Controller
{
public IActionResult Index()
public IActionResult VoteResult()
{
ViewBag.Title = "宁波市“甬江建设杯”选票";
return View();
@@ -25,5 +25,10 @@ namespace Ewide.Web.Entry.Controllers
ViewBag.Title = "宁波市“甬江建设杯”选票";
return View();
}
public IActionResult nbczResult()
{
ViewBag.Title = "共赴宁波之春 报名结果";
return View();
}
}
}

View File

@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Ewide.Web.Entry.Controllers
{
public class NingboZhiChunController : Controller
{
[AllowAnonymous]
public IActionResult Index()
{
return View();
}
}
}

View File

@@ -101,7 +101,8 @@
_this.$alert(response.data.data.descriptions);
else {
window.sessionStorage.setItem('__TOKEN', response.data.data.token);
location = '/gb/yjb/manage/index'
//location = '/gb/yjb/manage/VoteResult'
location = '/gb/yjb/manage/GfnbczResult'
}
}
_this.loading = false;

View File

@@ -0,0 +1,239 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="http://lib.baomitu.com/qs/6.10.3/qs.min.js"></script>
</head>
<body>
<div id="app" v-loading="loading">
<h3 style="text-align:center;">共赴宁波之春 报名结果</h3>
<el-table :data="tableData" style="width: 100%">
<el-table-column type="expand">
<template slot-scope="props">
<el-descriptions class="margin-top" title="" :column="2" border>
<el-descriptions-item :span="2">
<template slot="label">
@* <i class="el-icon-user"></i>*@
报名日期
</template>
{{ props.row.createdTime }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@* <i class="el-icon-user"></i>*@
姓名
</template>
{{ props.row.name }}
</el-descriptions-item>
<el-descriptions-item labelStyle="width:90px;">
<template slot="label">
@* <i class="el-icon-user"></i>*@
手机号码
</template>
{{ props.row.phone }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@* <i class="el-icon-mobile-phone"></i>*@
微信号码
</template>
{{ props.row.weixin_number }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@* <i class="el-icon-location-outline"></i>*@
身份证号码
</template>
{{ props.row.cardno }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@* <i class="el-icon-tickets"></i>*@
行业
</template>
@* <el-tag size="small">学校</el-tag>*@
{{ props.row.hangye }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@*<i class="el-icon-office-building"></i>*@
所在地
</template>
{{ props.row.address }}
</el-descriptions-item>
</el-descriptions>
</template>
</el-table-column>
<el-table-column label="报名日期"><template slot-scope="props">{{ dateFormat("mm-dd", props.row.createdTime )}}</template></el-table-column>
<el-table-column label="姓名/手机号码"><template slot-scope="props">{{ props.row.name}}<br />{{ props.row.phone}}</template></el-table-column>
<el-table-column label="日期/线路"><template slot-scope="props">{{ props.row.date}} 线路{{ props.row.line}}</template></el-table-column>
</el-table>
<h3 style="text-align:center;">
<el-button @@click="load_projects">刷新数据</el-button>
<el-button type="primary" @@click="export_excel" :loading="loading">导出Excel</el-button>
</h3>
</div>
</body>
<style scoped>
.buhuanhang {
white-space: nowrap;
width: 21%;
}
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 90px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
width: 50%;
}
</style>
<script>
new Vue({
el: '#app',
data: function () {
return {
tableData: [],
loading: false,
token: ''
}
},
created: function () {
this.check_login()
this.loading = true;
this.load_projects();
},
methods: {
export_excel() {
this.loading = true;
this.download('/gb/yjb/api/ningbozhichun/export_excel', this.dateFormat("YYYYmmddHHMMSS", new Date()) + "-共赴宁波之春.xlsx", this.loading_false);
},
check_login() {
this.token = window.sessionStorage.getItem('__TOKEN');
if (!this.token)
location = '/gb/yjb/manage/login'
},
load_projects() {
this.loading = true;
let _this = this;
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/ningbozhichun/GetPersonList',
data: {},
responseType: "json",
headers: {
Authorization: 'Bearer ' + _this.token
}
}).then(function (response) {
console.log(response)
_this.tableData = response.data.data
_this.loading = false;
}).catch(function (error) {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
})
},
loading_false() { this.loading = false },
download(url, filename, callback) {
let _this = this;
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: url,
data: {},
responseType: "blob",
headers: {
Authorization: 'Bearer ' + _this.token
}
}).then(function (response) {
console.log(response);
//解析文件充blod中解析
const url = window.URL.createObjectURL(
new Blob([response.data], { type: "application/vnd.ms-excel" })
);
const link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", filename);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
callback();
}).catch(function (error) {
callback();
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
})
},
getMonthWeek(now) {
var a = now.getYear();
var b = now.getMonth() + 1;
var c = now.getDate();
/*
a = d = 当前日期
b = 6 - w = 当前周的还有几天过完(不算今天)
a + b 的和在除以7 就是当天是当前月份的第几周
*/
var date = new Date(a, parseInt(b) - 1, c), w = date.getDay(), d = date.getDate();
return Math.ceil(
(d + 6 - w) / 7
);
},
dateFormat(fmt, d) {
const date = new Date(d);
let ret;
const opt = {
"Y+": date.getFullYear().toString(), // 年
"m+": (date.getMonth() + 1).toString(), // 月
"d+": date.getDate().toString(), // 日
"H+": date.getHours().toString(), // 时
"M+": date.getMinutes().toString(), // 分
"S+": date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt;
}
}
})
</script>
</html>

View File

@@ -0,0 +1,334 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="http://lib.baomitu.com/qs/6.10.3/qs.min.js"></script>
</head>
<body>
<div id="app" v-loading="loading">
<h3 style="text-align:center;">共赴宁波之春 参与报名</h3>
<el-card class="box-card">
<p>本地活动共三条线路,分别为:</p>
<p>A.“历史之路 文化之路 创新之路 共富之路”的慈溪南部沿山风情共富线。</p>
<p>B.“应梦明山入城,剡水桃源归野”的奉化明山剡水共富线。</p>
<p>C.“万象山海,逐梦亚运”象山扬帆亚运风情共富线三条体验游览线。</p>
<p>每天三条线齐发(奉,宁,慈)</p>
</el-card>
<el-form label-position="left" ref="form" :model="form" :rules="rules" label-width="120px" style="margin-top:15px;">
<el-form-item label="姓名:" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="手机号码:" prop="phone">
<el-input v-model="form.phone"></el-input>
</el-form-item>
<el-form-item label="验证码" prop="code">
<el-input type="text" maxlength="4" placeholder="验证码" v-model="form.code">
<template slot="append">
<el-button :disabled="disabled" @@click="getCode">{{ valiBtn }}</el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="微信号码:" prop="weixin_number">
<el-input v-model="form.weixin_number"></el-input>
</el-form-item>
<el-form-item label="身份证号码:" prop="cardno">
<el-input v-model="form.cardno"></el-input>
</el-form-item>
<el-form-item label="行业:" prop="hangye">
<el-input v-model="form.hangye"></el-input>
</el-form-item>
<el-form-item label="所在地:" prop="address">
<el-input v-model="form.address"></el-input>
</el-form-item>
<el-form-item label="参加时间:" prop="date">
<el-popover placement="top"
title=""
width="200"
trigger="focus"
:content="datePersonNumber">
<el-radio-group v-model="form.date" @@input="getNumber()" slot="reference" size="small">
<el-radio-button label="3.18/19" border></el-radio-button>
<el-radio-button label="3.25/26" border></el-radio-button>
<el-radio-button label="4.8/9" border></el-radio-button>
<el-radio-button label="4.15/16" border></el-radio-button>
</el-radio-group>
</el-popover>
</el-form-item>
<el-form-item label="选择线路:" prop="line">
<el-card class="box-card">
<p>A.慈溪南部沿山风情共富线。</p>
<p>B.奉化明山剡水共富线。</p>
<p>C.象山扬帆亚运风情共富线。</p>
</el-card>
<el-radio-group v-model="form.line" size="small">
<el-radio-button label="A" border></el-radio-button>
<el-radio-button label="B" border></el-radio-button>
<el-radio-button label="C" border></el-radio-button>
</el-radio-group>
</el-form-item>
@*<el-form-item label="备注:">
<el-input type="textarea" v-model="form.remark"></el-input>
</el-form-item>*@
<el-form-item>
<el-button type="primary" @@click.prevent="onSubmit('form')">提交</el-button>
<el-button @@click.prevent="showinfo()">我的报名</el-button>
</el-form-item>
</el-form>
</div>
</body>
<script>
new Vue({
el: '#app',
data: function () {
var checkPhone = (rule, value, callback) => {
const regMobile = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/;
if (regMobile.test(value)) {
callback()
}
callback(new Error("请输入正确的手机号码"))
};
var checkCode = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入验证码"))
} else if (!/^[0-9]+$/.test(value) || !/^\d{4}$/.test(value)) {
callback(new Error("请输入4位数字的验证码"))
} else {
callback()
}
};
var checkCardNo = (rule, value, callback) => {
const regMobile = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if (regMobile.test(value)) {
callback()
}
callback(new Error("请输入正确的身份证号码"))
};
return {
form: {
name: '',
phone: '',
weixin_number: '',
cardno: '',
hangye: '',
address: '',
date: '',
line: '',
code: '',
token: ''
//,remark: ''
}, rules: {
name: [{ required: true, trigger: 'blur', message: '请输入姓名' }],
phone: [{ validator: checkPhone, required: true, trigger: 'blur' }],
code: [{ validator: checkCode, required: true, trigger: 'blur' }],
weixin_number: [{ required: true, trigger: 'blur', message: '请输入微信号码' }],
cardno: [{ validator: checkCardNo, required: true, trigger: 'blur' }],
hangye: [{ required: true, trigger: 'blur', message: '请输入行业' }],
address: [{ required: true, trigger: 'blur', message: '请输入所在地' }],
date: [{ required: true, trigger: 'blur', message: '请选择参加时间' }],
line: [{ required: true, trigger: 'blur', message: '请选择线路' }],
},
valiBtn: '获取验证码',
disabled: false,
datePersonNumber: ''
}
},
created: function () {
this.loading = true;
this.loading_false();
},
methods: {
getCode() {
this.$refs['form'].validateField('phone', (err) => {
if (err) {
console.log('未通过')
return;
} else {
console.log('已通过')
console.log(this.form.phone)
let _this = this;
//this.$alert("成功", "提示")
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/ningbozhichun/sendcode',
data: _this.form,
responseType: "json",
}).then(async response => {
if (response.data.data != true) {
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
} else {
_this.tackBtn(); //验证码倒数60秒
}
_this.loading = false;
}).catch(async error => {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
})
}
})
},
tackBtn() { //验证码倒数60秒
let time = 60;
let timer = setInterval(() => {
if (time == 0) {
clearInterval(timer);
this.valiBtn = '获取验证码';
this.disabled = false;
} else {
this.disabled = true;
this.valiBtn = time + '秒后重试';
time--;
}
}, 1000);
},
onSubmit(formName) {
console.log('submit!');
let _this = this;
this.$refs[formName].validate((valid) => { // 为表单绑定验证功能
if (valid) {
//this.$alert("成功", "提示")
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/ningbozhichun/submit',
data: _this.form,
responseType: "json",
}).then(async response => {
if (response.data?.data?.success == true) {
let token = response.data.data.token;
localStorage.setItem(_this.form.phone + "_token", token)
_this.$alert(`<div>提交成功</div>`, '成功', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
} else {
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
}
_this.loading = false;
}).catch(async error => {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
})
}
});
},
loading_false() { this.loading = false },
showinfo() {
let _this = this;
_this.form.token = localStorage.getItem(_this.form.phone + "_token");
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/ningbozhichun/getmyinfo',
data: _this.form,
responseType: "json",
}).then(async response => {
if (response.data?.data?.success == true) {
_this.form = response.data?.data.entity;
let token = response.data.data.token;
localStorage.setItem(_this.form.phone + "_token", token)
} else {
_this.$alert(`<div>` + response.data.message + `,请再次验证手机号码后继续</div>`, '错误', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
}
_this.loading = false;
}).catch(async error => {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
})
},
getNumber() {
let _this = this;
axios({
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
method: 'post',
url: '/gb/yjb/api/ningbozhichun/getnumber',
data: _this.form,
responseType: "json",
}).then(async response => {
if (response.data?.data?.success == true) {
_this.datePersonNumber = _this.form.date + ` 还剩余 ` + response.data?.data?.n + ` 个名额`
} else {
_this.$alert(`<div>` + response.data.message + `</div>`, '错误', {
confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true
}).then(a => { }).catch(err => { console.log(err) });
}
_this.loading = false;
}).catch(async error => {
console.log(error)
_this.$message({
type: 'error',
message: error.message
})
_this.loading = false;
})
}
}
})
</script>
<style scoped>
.buhuanhang {
white-space: nowrap;
width: 21%;
}
.text {
font-size: 14px;
}
.item {
padding: 18px 0;
}
.box-card {
width: 98%;
margin: 0 auto;
}
.el-card__body {
padding: 12px;
}
.el-card__body p {
margin: 0px;
margin-bottom: 5px;
line-height: 1.2;
}
.el-radio.is-bordered {
margin-bottom: 10px;
}
</style>
</html>

View File

@@ -42,6 +42,14 @@
"AccessKey": "C4D30C2801D928AAF687",
"SecretKey": "ooZVXaB1tqIz7DHTv53RILD7o5cAAAGAAdkoqlR2",
"IsEnableCache": true //是否启用缓存,推荐开启
},
"NingboZhiChun": {
"OpenSms": 0,
"SmsTokenUrl": "http://10.19.94.16/api/user/login",
"SmsSendUrl": "http://10.19.94.16/api/sms/send",
"SmsAccount": "tempaccount0309",
"SmsPwd": "Aabc!@#20KHL+@+124bjaT(6q",
"TotalCount": 40
}
}