diff --git a/public/imgs/FaultUpload.jpg b/public/imgs/FaultUpload.jpg new file mode 100644 index 0000000..1097d8b Binary files /dev/null and b/public/imgs/FaultUpload.jpg differ diff --git a/public/imgs/web_btn_delete.png b/public/imgs/web_btn_delete.png new file mode 100644 index 0000000..1b3c67b Binary files /dev/null and b/public/imgs/web_btn_delete.png differ diff --git a/src/api/auth.js b/src/api/auth.js index 028f137..9329d6e 100644 --- a/src/api/auth.js +++ b/src/api/auth.js @@ -9,4 +9,9 @@ export function authOpenid(openid) { // 获取用户信息 export function userInfo() { return get('/auth/user') +} + + +export function login(data) { + return post('/auth/login', data) } \ No newline at end of file diff --git a/src/api/sms.js b/src/api/sms.js index 644dc40..10ecde9 100644 --- a/src/api/sms.js +++ b/src/api/sms.js @@ -2,4 +2,7 @@ import { post } from '@/util/request' export function send(phone) { return post('/sms/send?phone=' + phone) +} +export function sendLogin(phone) { + return post('/sms/sendLogin?phone=' + phone) } \ No newline at end of file diff --git a/src/layout/Index.vue b/src/layout/Index.vue index 58d4fed..d1a886b 100644 --- a/src/layout/Index.vue +++ b/src/layout/Index.vue @@ -1,14 +1,18 @@ \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 6e716e7..6bbbaea 100644 --- a/src/permission.js +++ b/src/permission.js @@ -3,7 +3,7 @@ import UserStore from "@/store/user" import { getToken } from '@/util/cookie' // 白名单 -const whiteList = ['/', '/mail/write']; +const whiteList = ['/', '/realName/auth']; router.beforeEach((to, from, next) => { const whiteFlag = whiteList.indexOf(to.path) !== -1; const userStore = UserStore(); @@ -14,38 +14,43 @@ router.beforeEach((to, from, next) => { return } if (!token) { - next('/'); + next('/realName/auth'); return } - // 已有用户信息 - if (userStore.user.id) { - // 判断用户是否进行了人脸认证 - if (userStore.user.idCard || to.path === '/realName/auth') { - // 判断是否是从信件页面回退到人脸认证界面的,如果是则返回首页 - if (to.path === '/realName/auth' && from.path === '/mail') { - next('/'); - return - } - next(); - return - } - next('/realName/auth'); + if (token) { + next(); return } - // 获取用户信息 - userStore.getUser().then(() => { - // 判断用户是否进行了人脸认证 - if (userStore.user.idCard || to.path === '/realName/auth') { - // 判断是否是从信件页面回退到人脸认证界面的,如果是则返回首页 - if (to.path === '/realName/auth' && from.path === '/mail') { - next('/'); - return - } - next(); - return - } - next('/realName/auth'); - }).catch((res) => { - next('/') - }) + // // 已有用户信息 + // if (userStore.user.id) { + // // 判断用户是否进行了人脸认证 + // if (userStore.user.idCard || to.path === '/realName/auth') { + // // 判断是否是从信件页面回退到人脸认证界面的,如果是则返回首页 + // if (to.path === '/realName/auth' && from.path === '/mail') { + // next('/'); + // return + // } + // next(); + // return + // } + // next('/realName/auth'); + // return + // } + // // 获取用户信息 + // userStore.getUser().then(() => { + // // 判断用户是否进行了人脸认证 + // if (userStore.user.idCard || to.path === '/realName/auth') { + // // 判断是否是从信件页面回退到人脸认证界面的,如果是则返回首页 + // if (to.path === '/realName/auth' && from.path === '/mail') { + // next('/'); + // return + // } + // next(); + // return + // } + // next('/realName/auth'); + // }).catch((res) => { + // next('/') + // }) + }) \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 99889be..8043b21 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,9 +3,10 @@ import { createRouter, createWebHistory } from 'vue-router' import Layout from '@/layout/Index.vue' import Home from '@/views/Home.vue' import Write from '@/views/Write.vue' - +import MailEvaluate from '@/views/MailEvaluate.vue' +import MailDetail from '@/views/MailDetail.vue' import NotFound from '@/views/error/404.vue' - +import RealNameAuth from '@/views/RealNameAuth.vue' const routes = [ { path: '/layout', @@ -18,7 +19,19 @@ const routes = [ { path: '/mail/write', component: Write, - } + }, + { + path: '/mail/evaluate', + component: MailEvaluate + }, + { + path: '/mail/:id', + component: MailDetail + }, + { + path: '/realName/auth', + component: RealNameAuth + }, ] }, { diff --git a/src/util/request.js b/src/util/request.js index dd540e1..d95ad86 100644 --- a/src/util/request.js +++ b/src/util/request.js @@ -47,7 +47,16 @@ export function del(url) { export function upload(data) { return post('/file/upload/base64', data) } - +export function uploadfile(url,data) { + return request(url, { + method: 'POST', + body: JSON.stringify(data), + headers: { + "Content-Type": 'multipart/form-data', + "Authorization": getToken() + } + }) +} function request(url, options) { return new Promise((resolve, reject) => { fetch(`${basePath}${url}`, { diff --git a/src/util/validator copy.js b/src/util/validator copy.js new file mode 100644 index 0000000..1dbcf14 --- /dev/null +++ b/src/util/validator copy.js @@ -0,0 +1,132 @@ +/** + * 验证身份证号码 + * @param { String } code 身份证号码 + */ +export function validatorIdCard(rule,code,callback) { + + // 身份证号前两位代表区域 + const city = { + 11: '北京', + 12: '天津', + 13: '河北', + 14: '山西', + 15: '内蒙古', + 21: '辽宁', + 22: '吉林', + 23: '黑龙江 ', + 31: '上海', + 32: '江苏', + 33: '浙江', + 34: '安徽', + 35: '福建', + 36: '江西', + 37: '山东', + 41: '河南', + 42: '湖北 ', + 43: '湖南', + 44: '广东', + 45: '广西', + 46: '海南', + 50: '重庆', + 51: '四川', + 52: '贵州', + 53: '云南', + 54: '西藏 ', + 61: '陕西', + 62: '甘肃', + 63: '青海', + 64: '宁夏', + 65: '新疆', + 71: '台湾', + 81: '香港', + 82: '澳门', + 91: '国外 ', + }; + const idCardReg = /^[1-9]\d{5}(19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i; // 身份证格式正则表达式 + // 如果身份证不满足格式正则表达式 + if (!code) { + callback(new Error('请输入身份证号码')); + + } + if (!code.match(idCardReg)) { + callback(new Error('请输入正确的身份证号码')); + + } + if (!city[code.substr(0, 2)]) { + // 区域数组中不包含需验证的身份证前两位 + callback(new Error('请输入正确的身份证号码')); + + } + if (code.length === 18) { + // 18位身份证需要验证最后一位校验位 + code = code.split(''); + // ∑(ai×Wi)(mod 11) + // 加权因子 + const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; + // 校验位 + const parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]; + let sum = 0; + let ai = 0; + let wi = 0; + for (let i = 0; i < 17; i++) { + ai = parseInt(code[i]); + wi = factor[i]; + sum += ai * wi; // 开始计算并相加 + } + const last = parity[sum % 11]; // 求余 + if (last.toString() !== code[17]) { + callback(new Error('请输入正确的身份证号码')); + } + } + return true +} + +/** + * 校验手机号 + * @param {*} phonenumber + * @returns + */ +export function validatorPhone(rule,phonenumber,callback) { + console.log("phonenumber"+phonenumber) + if (!phonenumber) { + callback(new Error('请输入手机号码')); + } + if (!/^1[3456789]\d{9}/.test(phonenumber)) { + callback(new Error('请输入正确的手机号码')); + } + return true +} + +/** + * 校验手机号 + * @param {*} phonenumber + * @returns + */ +export function Phone(phonenumber) { + if (!phonenumber) { + return '请输入手机号码'; + } + if (!/^1[3456789]\d{9}/.test(phonenumber)) { + return '请输入手机号码'; + } + return true +} + + +/** + * 校验内容长度 + * @param {*} content + * @returns + */ +export function validatorContent(rule,content,callback) { + if (!content) { + callback(new Error('请输入信件内容')); + } + if (content.length < 10) { + callback(new Error('信件内容不能少于 10 个字')); + } + if (content.length > 300) { + callback(new Error('信件内容不能多于 300 个字')); + } + return true +} \ No newline at end of file diff --git a/src/views/Home.vue b/src/views/Home.vue index 189e4e2..1afbc61 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,26 +1,30 @@ \ No newline at end of file diff --git a/src/views/MailDetail.vue b/src/views/MailDetail.vue new file mode 100644 index 0000000..39ec1dc --- /dev/null +++ b/src/views/MailDetail.vue @@ -0,0 +1,184 @@ + + + \ No newline at end of file diff --git a/src/views/MailEvaluate.vue b/src/views/MailEvaluate.vue new file mode 100644 index 0000000..6c57829 --- /dev/null +++ b/src/views/MailEvaluate.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/views/RealNameAuth.vue b/src/views/RealNameAuth.vue new file mode 100644 index 0000000..bf41cbf --- /dev/null +++ b/src/views/RealNameAuth.vue @@ -0,0 +1,46 @@ + + + \ No newline at end of file diff --git a/src/views/Write.vue b/src/views/Write.vue index d7eb11c..112f0bf 100644 --- a/src/views/Write.vue +++ b/src/views/Write.vue @@ -1,78 +1,96 @@ + + + + + + + + + + + - - \ No newline at end of file +} +const handleClickOfWrite = (name) => { + console.log(chooseTab.value) + + chooseTab.value = 'isList' + +} + +function getChildMsg(msg) { + console.log("这就是子组件传过来的msg" + msg) + chooseTab.value = 'isDetail' + message.value = msg + console.log("aaa"+message.value) + +} +function getChildWriteMsg(msg) { + // console.log("这就是子组件传过来的msg" + msg) + activeName.value = msg + // console.log("aaa"+activeName.value) +} +function getMailDraftChildMsg(msg) { + activeName.value = "first" + console.log("这就是子组件传过来的msg" + msg) + message_draft.value = msg + console.log("message_draft"+message_draft.value) +} + + \ No newline at end of file diff --git a/src/views/components/CorporateLogin.vue b/src/views/components/CorporateLogin.vue new file mode 100644 index 0000000..334fd7b --- /dev/null +++ b/src/views/components/CorporateLogin.vue @@ -0,0 +1,107 @@ + + + \ No newline at end of file diff --git a/src/views/components/MailDraft.vue b/src/views/components/MailDraft.vue new file mode 100644 index 0000000..64592db --- /dev/null +++ b/src/views/components/MailDraft.vue @@ -0,0 +1,177 @@ + + + \ No newline at end of file diff --git a/src/views/components/MyMail.vue b/src/views/components/MyMail.vue new file mode 100644 index 0000000..0d2bbbb --- /dev/null +++ b/src/views/components/MyMail.vue @@ -0,0 +1,201 @@ + + + \ No newline at end of file diff --git a/src/views/components/PersonLogin.vue b/src/views/components/PersonLogin.vue new file mode 100644 index 0000000..1b600e9 --- /dev/null +++ b/src/views/components/PersonLogin.vue @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/src/views/components/WriteInfo.vue b/src/views/components/WriteInfo.vue new file mode 100644 index 0000000..00efebd --- /dev/null +++ b/src/views/components/WriteInfo.vue @@ -0,0 +1,604 @@ + + + + + + \ No newline at end of file