提交功能

This commit is contained in:
yyhouc 2023-07-07 18:40:12 +08:00
parent 5de7ce79ae
commit 4d63084f45
7 changed files with 326 additions and 13 deletions

View File

@ -59,3 +59,35 @@ export const remove = (ids) => {
}
})
}
export const sendEmail = (email,tenantId) => {
return request({
url: '/api/' + moduleName + '/ui/administrator/sendEmailCode',
method: 'get',
params: {
email,
tenantId
}
});
}
export const checkAccountOrEmail = (email,tenantId) => {
return request({
url: '/api/' + moduleName + '/ui/administrator/checkAccountOrEmail',
method: 'get',
params: {
email,
tenantId
}
});
}
export const updatePassword = (email,newPassword,tenantId,code) => {
return request({
url: '/api/' + moduleName + '/ui/administrator/updatePassword',
method: 'put',
params: {
email,
newPassword,
tenantId,
code
}
});
}

View File

@ -84,7 +84,6 @@ export const useUserInfo = defineStore('userInfo', {
// })
});
});
},
},
});

View File

@ -2,8 +2,7 @@ import axios from 'axios';
import { ElMessage, ElMessageBox } from 'element-plus';
import qs from 'qs';
import { Session } from '/@/utils/storage';
export const moduleName = 'biz-vordm';
export const moduleName = 'yyhouc-biz-vordm';
export const crawlModule = 'vordm-crawl';
export const twitterModule = "vordm-twitter";
const service = axios.create({
@ -21,7 +20,6 @@ const service = axios.create({
service.interceptors.request.use(
(config) => {
config.headers['Authorization'] = 'Basic Vm9SRE1BZG1pbjp2b3JkbV9hZG1pbl9zZWNyZXQ=';
// 在发送请求之前做些什么 token
if (Session.getEx('token')) {
config.headers['Blade-Auth'] = `Bearer ${Session.getEx('token')}`;
}

View File

@ -146,6 +146,7 @@ const onSignIn = () => {
};
//
const signInSuccess = () => {
console.log('登录成功');
//
let currentTimeInfo = currentTime.value;
//

View File

@ -0,0 +1,230 @@
<template>
<el-form size="large" class="login-content-form" :rules="rules" :model="state.ruleForm">
<el-form-item class="login-animation1" prop="userName" >
<el-input text placeholder="Please input email," v-model="state.ruleForm.userName" clearable autocomplete="off">
<template #prefix>
<el-icon class="el-input__icon"><ele-User /></el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item class="login-animation3" prop="code">
<el-col :span="15">
<el-input text maxlength="6" placeholder="Please input validate code" v-model="state.ruleForm.code" clearable autocomplete="off">
<template #prefix>
<el-icon class="el-input__icon"><ele-Position /></el-icon>
</template>
</el-input>
</el-col>
<el-col :span="1"></el-col>
<el-col :span="8" style="width: 132px; height: 48px;margin-top: 7px;">
<el-button class="login-content-code" v-waves @Click="send" ref ="sendRef" :disabled="state.send!='Send'">{{state.send}}</el-button>
</el-col>
</el-form-item>
<el-form-item class="login-animation2" prop="password">
<el-input :type="state.isShowPassword ? 'text' : 'password'" placeholder="Please input new password" v-model="state.ruleForm.password" autocomplete="off">
<template #prefix>
<el-icon class="el-input__icon"><ele-Unlock /></el-icon>
</template>
<template #suffix>
<i
class="iconfont el-input__icon login-content-password"
:class="state.isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'"
@click="state.isShowPassword = !state.isShowPassword"
>
</i>
</template>
</el-input>
</el-form-item>
<el-form-item class="login-animation2" prop="password1">
<el-input :type="state.isShowPassword1 ? 'text' : 'password'" placeholder="Please enter a confirmation password" v-model="state.ruleForm.password1" autocomplete="off">
<template #prefix>
<el-icon class="el-input__icon"><ele-Unlock /></el-icon>
</template>
<template #suffix>
<i
class="iconfont el-input__icon login-content-password"
:class="state.isShowPassword1 ? 'icon-yincangmima' : 'icon-xianshimima'"
@click="state.isShowPassword1 = !state.isShowPassword1"
>
</i>
</template>
</el-input>
</el-form-item>
<el-form-item class="login-animation4">
<el-button type="primary" class="login-content-submit" round v-waves @click="onSignIn" :loading="state.loading.signIn">
<span>Edit</span>
</el-button>
</el-form-item>
</el-form>
</template>
<script setup name="forgotPassword">
import { reactive, computed, onMounted,ref } from 'vue';
import { ElMessage } from 'element-plus';
import { storeToRefs } from 'pinia';
import { useThemeConfig } from '/@/stores/themeConfig';
import {sendEmail,checkAccountOrEmail,updatePassword} from '/@/api/response/administrator';
//Session
import { Local as Session } from '/@/utils/storage';
//
const storesThemeConfig = useThemeConfig();
const { website } = storeToRefs(storesThemeConfig);
const sendRef = ref(null);
//
const e =defineEmits(["success"]);
const state = reactive({
isShowPassword: false,
ruleForm: {
//ID
tenantId: website.value.tenantId,
//
userName: "792163605@qq.com",
//
password: "",
//
type: "account",
//key
key: "",
//code
code: "",
},
loading: {
signIn: false,
},
send:"Send",
captchaMode: website.value.captchaMode,
//localStroage key
captchaKey: "captchaKey",
});
const rules = reactive({
userName: [
{ required: true, message: "Please enter your email", trigger: "blur" },
{ type: "email", message: "Please enter the email", trigger: "blur" },
//
{
validator: (rule, value, callback) => {
checkAccountOrEmail(value,website.value.tenantId).then((res) => {
//res.data false
if (res.data || res.data == false || res.data == "") {
//
callback(new Error("The email is not registered"));
} else {
callback();
}
});
},
trigger: "blur",
},
],
password: [
{ required: true, message: "Please enter a new password", trigger: "blur" },
{ min: 6, max: 20, message: "The password length is 6-20 characters", trigger: "blur" },
],
password1: [
{ required: true, message: "Please enter a confirmation password", trigger: "blur" },
{ min: 6, max: 20, message: "The password length is 6-20 characters", trigger: "blur" },
//password
{
validator: (rule, value, callback) => {
if (value != state.ruleForm.password) {
callback(new Error("The password is inconsistent"));
} else {
callback();
}
},
trigger: "blur",
},
],
code: [{ required: true, message: "Please enter the verification code", trigger: "blur" }],
})
onMounted(() => {
let time = Session.get(state.captchaKey);
if (time&&time>0) {
state.send = time + "s";
buttonTime(time);
}
});
const send = () => {
buttonTime(60);
const { userName } = state.ruleForm;
if (!userName) {
ElMessage.error("Please enter your email address");
return;
}
sendEmail(userName,website.value.tenantId).then((res) => {
if (res.data) {
//使
ElMessage.success("The verification code has been sent to your email");
} else {
clearInterval(timer);
ElMessage.error(res.message);
}
});
};
//
const buttonTime = (time) => {
state.send = time + "s";
let timer = setInterval(() => {
time--;
Session.set(state.captchaKey, time);
state.send = time + "s";
if (time <= 0) {
clearInterval(timer);
state.send = "Send";
}
}, 1000);
};
//
const onSignIn = () => {
updatePassword(
state.ruleForm.userName,
state.ruleForm.password,
state.ruleForm.tenantId,
state.ruleForm.code
).then((res) => {
if (res) {
ElMessage.success("Password changed successfully");
} else {
ElMessage.error(res.message);
}
});
};
</script>
<style scoped lang="scss">
.login-content-form {
margin-top: 12px;
@for $i from 1 through 4 {
.login-animation#{$i} {
opacity: 0;
animation-name: error-num;
animation-duration: 0.5s;
animation-fill-mode: forwards;
animation-delay: calc($i/10) + s;
}
}
.login-content-password {
display: inline-block;
width: 20px;
cursor: pointer;
&:hover {
color: #909399;
}
}
.login-content-code {
width: 100%;
padding: 0;
font-weight: bold;
letter-spacing: 5px;
}
.login-content-submit {
width: 100%;
letter-spacing: 2px;
font-weight: 300;
margin-top: 15px;
}
}
.el-form-item--large {
margin-bottom: 14px !important;
}
</style>

View File

@ -19,9 +19,9 @@
<el-tab-pane label="Account Login" name="account">
<Account />
</el-tab-pane>
<!-- <el-tab-pane label="手机号登录" name="mobile">
<Mobile />
</el-tab-pane> -->
<el-tab-pane label="Forgot password" name="ForgotPassword">
<ForgotPassword />
</el-tab-pane>
</el-tabs>
</div>
<!-- <Scan v-if="state.isScan" /> -->
@ -47,8 +47,7 @@ import loginBg from '/@/assets/login-bg.svg';
//
const Account = defineAsyncComponent(() => import('/@/views/login/component/account.vue'));
const Mobile = defineAsyncComponent(() => import('/@/views/login/component/mobile.vue'));
const Scan = defineAsyncComponent(() => import('/@/views/login/component/scan.vue'));
const ForgotPassword = defineAsyncComponent(() => import('/@/views/login/component/forgotPassword.vue'));
//
const storesThemeConfig = useThemeConfig();

View File

@ -420,7 +420,7 @@
<span class="dialog-footer">
<el-button @click="dialogVisible = false">Cancel</el-button>
<el-button type="danger"
@click="reviews(1)">
@click="reviewRefuse">
Reject
</el-button>
<el-button type="primary"
@ -430,19 +430,45 @@
</span>
</template>
</el-dialog>
<selectUser ref="select"
@callback="getTableData"></selectUser>
<selectUser ref="select" @callback="getTableData"></selectUser>
<el-dialog v-model="state.emailDialogVisible" title="Reason for refusal" width="60%" :before-close="handleClose">
<el-form-item label="Subject:" >
<el-input v-model="state.edit.refuseTitle" placeholder="Please enter the Subject"></el-input>
</el-form-item>
<!-- <el-form-item label="Content:" > -->
<QuillEditor ref="myQuillEditor"
theme="snow"
v-model:content="state.edit.refuseReason"
:options="state.options"
placeholder="Please enter the Content"
contentType="html"
@update:content="setValue()"
style="height:500px ;"
/>
<!-- </el-form-item> -->
<template #footer>
<span class="dialog-footer">
<el-button @click="state.emailDialogVisible = false;state.edit.refuseReason=''">Cancel</el-button>
<el-button type="primary" @click="reviews(1);state.edit.refuseReaso=''">
Send
</el-button>
</span>
</template>
</el-dialog>
</el-config-provider>
</div>
</template>
<script setup name="userResponse">
import en from 'element-plus/dist/locale/en.mjs'
import { reactive, onMounted, ref, nextTick, watchEffect, defineAsyncComponent, h } from 'vue';
import { reactive, onMounted, ref, nextTick, watchEffect, defineAsyncComponent, h ,toRaw} from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { getList, review, responseEndedDisasterInfo, deleteByIds } from '/@/api/disasterInfo/index';
import { getDictionary, getList as getListNew } from '/@/api/system/dictbiz';
import { useVariableStore } from '/@/stores/index.ts'
import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css'
//
import Map from '/@/components/Map.vue';
import { useDateFormat } from '@vueuse/shared';
@ -457,6 +483,7 @@ import { map } from 'lodash';
import * as turf from '@turf/turf'
const variableStore = useVariableStore();
const mapRef = ref();
const myQuillEditor =ref();
const activeName = ref('first');
const select = ref();
const remove = (row) => {
@ -517,6 +544,7 @@ const state = reactive({
//
dictList: [],
dialogVisible: false,
emailDialogVisible: false,
tableData: {
data: [],
total: 0,
@ -539,6 +567,24 @@ const state = reactive({
wktPoint_Poly: undefined,
passLat: false,
passLon: false,
//
options: {
modules: {
toolbar: [
['bold', 'italic', 'underline', 'strike'],
[{ 'size': ['small', false, 'large', 'huge'] }],
[{ 'font': [] }],
[{ 'align': [] }],
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
[{ 'indent': '-1' }, { 'indent': '+1' }],
[{ 'header': 1 }, { 'header': 2 }],
['image'],
[{ 'direction': 'rtl' }],
[{ 'color': [] }, { 'background': [] }]
]
},
placeholder: '请输入内容...'
},
});
//
const getTableData = () => {
@ -720,7 +766,15 @@ const mapClick = (res) => {
state.dislon = res.latlng.lng.toFixed(3)
mapRef.value.mapOperations.addInteractMarker(res.latlng.lat.toFixed(3), res.latlng.lng.toFixed(3))
}
const setValue = () => {
const text = toRaw(myQuillEditor.value).getHTML()
}
//
const reviewRefuse = () => {
state.emailDialogVisible = true;
}
const reviews = (index) => {
//state.edit.geometry
//TODO
//state.edit.geometry = map.mapOperations.getWkt();