提交 f5e59b9a authored 作者: Yroc's avatar Yroc

'学生登录'

上级 fbe83b92
......@@ -2,7 +2,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-13 10:11:24
* @Last Modified time: 2023-03-17 18:38:05
*/
import request from '@/utils/request'
......@@ -24,9 +24,9 @@ export function login(data) {
}
//获取邮件
export function getCode(data){
export function getCode(data) {
return request({
url: 'student/mail/code',
url: '/student/mail/code',
method: 'post',
data
})
......@@ -58,7 +58,7 @@ export function getResults(params) {
}
//开始考试详情
export function getResultsData(id,params) {
export function getResultsData(id, params) {
return request({
url: `/student/test_results/${id}`,
method: 'get',
......@@ -67,15 +67,16 @@ export function getResultsData(id,params) {
}
//学员拍照上传考试结果
export function getPhotoResults(id) {
export function getPhotoResults(id, data) {
return request({
url: `/student/test_results/imageUpload/${id}`,
method: 'post',
data
})
}
//提交答题结果
export function uploadTestResults(id,data) {
export function uploadTestResults(id, data) {
return request({
url: `/student/test_results/${id}`,
method: 'put',
......@@ -91,6 +92,35 @@ export function viewExamResults(id) {
})
}
//注册
export function userLogon(data) {
return request({
url: '/student/auth/sign_up',
method: 'post',
data
})
}
//账号密码登录
export function accountLogin(data) {
return request({
url: '/student/auth/login',
method: 'post',
data
})
}
//获取省市信息
export function getCityIntfo(data) {
return request({
url: '/api/treeprovince',
method: 'post',
data
})
}
export function logout() {
return request({
url: '/vue-element-admin/user/logout',
......
......@@ -55,9 +55,5 @@ export default {
height: 100%;
}
}
.btn {
// background-color: $defaultColor;
}
}
</style>
......@@ -2,7 +2,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-07 16:07:17
* @Last Modified time: 2023-03-20 15:52:07
*/
import Vue from 'vue'
......@@ -28,9 +28,10 @@ import * as filters from './filters' // global filters
//引入加密函数,并将其封装
import {handleParams,Aesdecrypt} from '@/utils/cryptoJS';
import { handleParams, Aesdecrypt, removeProperty } from '@/utils/cryptoJS';
Vue.prototype.$handleParams = handleParams;//封装机密格式的参数
Vue.prototype.$Aesdecrypt = Aesdecrypt;//封装机密格式的参数
Vue.prototype.$removeProperty = removeProperty;//去除空值
/**
* If you don't want to use mock-server
......@@ -45,6 +46,7 @@ if (process.env.NODE_ENV === 'production') {
mockXHR()
}
Vue.use(Element, {
size: Cookies.get('size') || 'medium', // set element-ui default size
locale: enLang // 如果使用中文,无需设置,请删除
......
......@@ -2,7 +2,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-01 14:40:23
* @Last Modified time: 2023-03-17 16:45:37
*/
import router from './router'
import store from './store'
......@@ -14,9 +14,9 @@ import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login', '/auth-redirect'] // no redirect whitelist
const whiteList = ['/login', '/auth-redirect', '/login_info'] // no redirect whitelist
router.beforeEach(async(to, from, next) => {
router.beforeEach(async (to, from, next) => {
// start progress bar
NProgress.start()
......
......@@ -2,7 +2,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-14 18:19:16
* @Last Modified time: 2023-03-17 16:45:18
*/
import Vue from 'vue'
import Router from 'vue-router'
......@@ -61,6 +61,11 @@ export const constantRoutes = [
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/login_info',
component: () => import('@/views/login-info/index.vue'),
},
{
path: '/auth-redirect',
component: () => import('@/views/login/auth-redirect'),
......@@ -77,6 +82,7 @@ export const constantRoutes = [
hidden: true
},
// {
// path: '/documentation',
// component: Layout,
......@@ -127,32 +133,33 @@ export const asyncRoutes = [
path: '/',
component: Layout,
redirect: '/personal',
children:[
children: [
{
path:'personal',
name:'personal',
path: 'personal',
name: 'personal',
component: () => import('@/views/personal/index.vue'),
},
{
path:'affirm',
name:'affirm',
path: 'affirm',
name: 'affirm',
component: () => import('@/views/affirm/index.vue'),
},
{
path:'test-result',
name:'test-result',
path: 'test-result',
name: 'test-result',
component: () => import('@/views/test-result/index.vue'),
},
{
path:'upload-result',
name:'upload-result',
path: 'upload-result',
name: 'upload-result',
component: () => import('@/views/upload-result/index.vue'),
},
{
path:'analysis',
name:'analysis',
path: 'analysis',
name: 'analysis',
component: () => import('@/views/analysis/index.vue'),
},
]
},
......
......@@ -2,9 +2,9 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-07 15:00:39
* @Last Modified time: 2023-03-20 15:37:37
*/
import { login, logout, getInfo } from '@/api/user'
import { login, logout, getInfo, accountLogin } from '@/api/user'
import { getToken, setToken, removeToken } from '@/utils/auth'
import router, { resetRouter } from '@/router'
......@@ -16,12 +16,12 @@ const state = {
roles: [],
hasUser: false,
//创建一个对象
user:{},
user: {},
}
const mutations = {
//存vuex里
SET_USER:(state,user)=>{
SET_USER: (state, user) => {
state.user = user
},
SET_TOKEN: (state, token) => {
......@@ -42,7 +42,7 @@ const mutations = {
SET_HASUSER: (state, hasUser) => {
state.hasUser = hasUser
},
},
}
const actions = {
......@@ -66,6 +66,24 @@ const actions = {
})
},
// user login
AccountLogin({ commit }, userInfo) {
const { username, password } = userInfo
return new Promise((resolve, reject) => {
accountLogin(userInfo).then(response => {
// const { data } = response
//存储在vuex中
commit('SET_TOKEN', response.access_token)
//存储在Cookies中
setToken(response.access_token)
//返回继续执行then
resolve(response)
}).catch(error => {
reject(error)
})
})
},
// get user info
getInfo({ commit, state }) {
return new Promise((resolve, reject) => {
......
......@@ -2,7 +2,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-14 11:12:01
* @Last Modified time: 2023-03-17 14:58:10
*/
/**
* Created by PanJiaChen on 16/11/18.
......@@ -71,6 +71,7 @@ export function validEmail(email) {
return reg.test(email)
}
/**
* @param {string} str
* @returns {Boolean}
......
<script>
/**
* @Author: AnthonyD
* @Date: 2023-03-17 16:17:00
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-20 16:06:16
*/
</script><template>
<div class="login-container">
<img
src="/image/logo.svg"
style="width: 173px; height: 53px; margin-bottom: 50px"
/>
<div class="from_container">
<img src="/image/Group.png" class="login_image" />
<div class="login-form">
<div>
<h3 class="title">国家烟草识别培训系统账号注册</h3>
</div>
<el-form
label-width="auto"
:rules="rules"
:model="uploadData"
ref="login_from"
>
<el-row>
<el-col :span="14">
<el-form-item label="姓名" prop="name">
<el-input
placeholder="姓名"
v-model="uploadData.name"
></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="性别" prop="sex">
<el-select placeholder="请选择" v-model="uploadData.sex">
<el-option label="男" value="男"></el-option>
<el-option label="女" value="女"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- -->
<el-row>
<el-col :span="8">
<el-form-item label="年龄" prop="age">
<el-input
placeholder="年龄"
v-model="uploadData.age"
></el-input>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="电话" prop="phone">
<el-input
placeholder="电话"
v-model="uploadData.phone"
></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- -->
<el-row
><el-col :span="24">
<el-form-item label="邮箱" prop="email">
<el-input
placeholder="邮箱"
v-model="uploadData.email"
></el-input>
</el-form-item> </el-col
></el-row>
<el-row
><el-col :span="24">
<el-form-item label="身份证号" prop="idcard">
<el-input
placeholder="身份证号"
v-model="uploadData.idcard"
></el-input>
</el-form-item> </el-col
></el-row>
<!-- -->
<el-row
><el-col :span="24">
<el-form-item label="请输入密码" prop="password">
<el-input
placeholder="请输入密码"
v-model="uploadData.password"
></el-input>
</el-form-item> </el-col
></el-row>
<el-row
><el-col :span="24">
<el-form-item label="确认密码" prop="confirm_password">
<el-input
placeholder="确认密码"
v-model="uploadData.confirm_password"
></el-input>
</el-form-item> </el-col
></el-row>
<!-- -->
<el-row
><el-col :span="24">
<el-form-item label="籍贯" prop="native_place">
<el-input
type="textarea"
placeholder="籍贯"
rows="1"
resize="none"
v-model="uploadData.native_place"
></el-input>
</el-form-item> </el-col
></el-row>
<!-- -->
<el-row
><el-col :span="12">
<el-form-item label="省市区">
<div class="block">
<span class="demonstration"></span>
<el-cascader
:options="data_list"
:props="{ checkStrictly: true }"
@change="handleChange"
></el-cascader>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开始工作时间">
<el-date-picker
style="width: 100%"
placeholder="选择日期"
v-model="uploadData.start_working"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<!-- -->
<el-row
><el-col :span="24">
<el-form-item label="工作单位">
<el-input
type="textarea"
placeholder="工作单位"
rows="1"
resize="none"
v-model="work_info"
></el-input>
</el-form-item> </el-col
></el-row>
<!-- -->
<el-row v-if="false"
><el-col :span="24">
<el-form-item label="个人简介">
<el-input
type="textarea"
v-model="brief_introduction"
rows="2"
resize="none"
placeholder="个人简介"
></el-input>
</el-form-item> </el-col
></el-row>
<div class="feet_box">
<el-button type="primary" style="width: 150px" @click="uploadInfo()"
>注册</el-button
>
</div>
</el-form>
</div>
</div>
</div>
</template>
<script>
import { getCityIntfo, userLogon } from '@/api/user';
export default {
name: '',
data() {
let validatePass2 = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.uploadData.confirm_password) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return {
uploadData: {
name: '',
password: null,
confirm_password: '',
sex: '',
age: null,
phone: null,
email: '',
idcard: null,
start_working: '',
province: '',
city: '',
area: '',
native_place: '',
},
data_list: [],
work_info: '',
brief_introduction: '',
rules: {
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
sex: [{ required: true, message: '请输入性别', trigger: 'blur' }],
age: [{ required: true, message: '请输入年龄', trigger: 'blur' }],
phone: [{ required: true, message: '请输入电话', trigger: 'blur' }],
email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }],
idcard: [
{ required: true, message: '请输入身份证号', trigger: 'blur' },
],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
confirm_password: [
{ required: true, validator: validatePass2, trigger: 'blur' },
],
// native_place: [
// { required: true, message: '请输入籍贯', trigger: 'blur' },
// ],
},
};
},
mounted() {
this.cityInfo();
},
methods: {
uploadInfo() {
//login_from
this.$refs.login_from.validate((valid) => {
if (valid) {
let data = JSON.parse(JSON.stringify(this.uploadData));
delete data.confirm_password;
// if(!data.start_working)delete data.start_working;
let params = this.$removeProperty(data);
console.log(params);
userLogon(params).then((res) => {
console.log(res);
if (res.code == 200) {
this.$message.success(res.message);
this.$router.push('/login');
}
});
} else {
console.log('输入有误');
}
});
},
handleChange(value) {
// console.log(value);
let keys = ['province', 'city', 'area'];
value.forEach((item, i) => {
this.uploadData[keys[i]] = item;
});
// console.log(this.uploadData);
},
cityInfo() {
//清除空children
const removeNodeInTree = (list) => {
if (!list) return;
for (let i = 0; i < list.length; i++) {
if (list[i].children.length == 0) {
delete list[i].children;
} else {
removeNodeInTree(list[i].children);
}
}
return list;
};
getCityIntfo({ name_is_value: true }).then((res) => {
// console.log(res);
this.data_list = removeNodeInTree(res) || [];
});
},
},
};
</script>
<style lang="scss" scoped>
$bg: #283443;
$light_gray: #fff;
$cursor: black;
@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
.login-container .el-input input {
color: $cursor;
}
}
</style>
<style lang="scss" scoped>
$bg: #f2f5fc;
$dark_gray: #889aa4;
$light_gray: #eee;
.login-container {
min-height: 100%;
width: 100%;
background-color: $bg;
box-sizing: border-box;
padding: 62px 69px;
@media only screen and (max-width: 470px) {
.thirdparty-button {
display: none;
}
}
}
.from_container {
background-color: #1aa385;
width: 1200px;
height: 706px;
margin: 0 auto;
padding: 148px 116px;
box-shadow: 4px 4px 15px #c2c4c9;
border-radius: 15px;
position: relative;
.login-form {
background-color: #fff;
width: 600px;
height: 670px;
padding: 40px;
border-radius: 10px;
position: absolute;
right: 20px;
top: 18px;
}
}
.title {
font-size: 26px;
color: #303133;
margin: 0px auto 40px auto;
text-align: center;
font-weight: bold;
}
.login {
width: 100%;
background-color: #038d6e;
}
.login:hover {
opacity: 0.7;
}
.login_image {
width: 600px;
height: 580px;
position: absolute;
left: -40px;
top: 70px;
}
.feet_box {
text-align: center;
}
.el-form-item {
margin-bottom: 20px;
}
</style>
<script>
/**
* @Author: AnthonyD
* @Date: 2023-03-17 13:37:43
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-20 17:27:35
*/
</script><template>
<div>
<el-form
:model="loginForm"
:rules="loginRules"
ref="ruleForm"
class="demo-ruleForm"
>
<el-form-item prop="name">
<div>
<p style="font-weight: bold; line-height: 25px" class="pointer">
账号
</p>
<div>
<el-input
ref="account_input"
v-model="loginForm.name"
placeholder="手机号/邮箱/身份证号"
type="text"
tabindex="1"
>
</el-input>
</div>
</div>
</el-form-item>
<el-form-item prop="password">
<div>
<p style="font-weight: bold; line-height: 25px" class="pointer">
密码
</p>
<div>
<el-input
ref="password"
:key="passwordType"
:type="passwordType"
placeholder="输入密码"
v-model="loginForm.password"
name="password"
@keyup.native="checkCapslock"
@blur="capsTooltip = false"
@keyup.enter.native="handleLogin"
tabindex="2"
>
</el-input>
</div>
</div>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: '',
data() {
const validateAccount = (rule, value, callback) => {
if (!value || /[\u4E00-\u9FA5]/g.test(value) || '') {
console.log(value);
callback(new Error('请重新账号输入'));
} else {
callback();
}
};
const validatePassword = (rule, value, callback) => {
if (!value || !(value.length >= 8)) {
callback(new Error('密码错误,请重新输入'));
} else {
callback();
}
};
return {
loginForm: {
name: null,
password: null,
},
passwordType: 'password',
loginRules: {
name: [{ required: true, trigger: 'blur', validator: validateAccount }],
password: [
{ required: true, trigger: 'blur', validator: validatePassword },
],
},
};
},
mounted() {
// if (!this.loginForm.name) {
// this.$refs.account_input.focus();
// } else if (!this.loginForm.password) {
// this.$refs.password.focus();
// }
},
methods: {
checkCapslock(e) {
const { key } = e;
this.capsTooltip = key && key.length === 1 && key >= 'A' && key <= 'Z';
},
//
handleLogin() {
this.$emit('Login', null);
},
},
};
</script>
<style lang="" scoped>
</style>
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-02-22 11:31:31
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-15 11:00:55
* @Last Modified time: 2023-03-20 18:33:10
*/
</script>
<template>
......@@ -20,14 +20,94 @@
<div>
<h3 class="title">国家烟草识别培训系统</h3>
</div>
<el-form
<!-- 账号登陆 -->
<el-tabs v-model="activeName">
<el-tab-pane label="账号登陆" name="account">
<account-login
ref="user_login"
@Login="handleLogin"
></account-login>
</el-tab-pane>
<!-- 邮箱登陆 -->
<el-tab-pane label="邮箱登陆" name="email"
><el-form
:model="loginForm"
:rules="loginRules"
ref="ruleForm"
class="demo-ruleForm"
>
<el-form-item prop="email">
<div>
<p
style="font-weight: bold; line-height: 25px"
class="pointer"
>
邮箱
</p>
<div>
<el-input
ref="username"
v-model="loginForm.email"
placeholder="输入邮箱"
name="username"
type="text"
tabindex="1"
>
</el-input>
</div>
</div>
</el-form-item>
<el-form-item prop="verification_code">
<div>
<p
style="font-weight: bold; line-height: 25px"
class="pointer"
>
验证码
</p>
<div>
<el-row>
<el-col :span="15" style="padding-right: 25px">
<el-input
ref="password"
v-model="loginForm.verification_code"
placeholder="输入验证码"
:maxlength="4"
name="password"
autocomplete="off"
@keyup.native="checkCapslock"
@blur="capsTooltip = false"
@keyup.enter.native="handleLogin"
tabindex="2"
>
</el-input>
</el-col>
<el-col :span="9">
<el-button
@click="sendMessage"
type="warning"
style="background-color: #e6a23c; float: right"
:disabled="time > 0"
>
{{ timer ? '重新发送' + time + 's' : '获取验证码' }}
<i class="el-icon-loading" v-if="is_loading"></i>
</el-button>
</el-col>
</el-row>
</div>
</div>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
<!-- <el-form
:model="loginForm"
:rules="loginRules"
ref="ruleForm"
class="demo-ruleForm"
v-if="false"
>
<el-form-item prop="email">
<!-- 手机号 -->
<div>
<p style="font-weight: bold" class="pointer">邮箱</p>
<div>
......@@ -64,9 +144,6 @@
</el-input>
</el-col>
<el-col :span="8">
<!-- <button class="send_message" @click="sendMessage">
发送短信
</button> -->
<el-button
@click="sendMessage"
type="warning"
......@@ -81,10 +158,12 @@
</div>
</div>
</el-form-item>
</el-form>
</el-form> -->
<div class="login_enter_box_">
<a @click="goLogin()">没有账号?点击注册</a>
</div>
<!-- 登录按钮 -->
<div style="margin-top: 25px">
<div style="margin-top: 9px">
<el-button
:loading="loading"
type="primary"
......@@ -101,10 +180,11 @@
<script>
import { validUsername, validEmail } from '@/utils/validate';
import SocialSign from './components/SocialSignin';
import { getCode } from '@/api/user.js';
import { getCode, accountLogin } from '@/api/user.js';
import AccountLogin from './components/account';
export default {
name: 'Login',
components: { SocialSign },
components: { SocialSign, AccountLogin },
data() {
const validateUsername = (rule, value, callback) => {
console.log(value);
......@@ -116,14 +196,13 @@ export default {
};
const validatePassword = (rule, value, callback) => {
console.log(value);
if (!(value.length == 4)) {
if (!value || !(value.length == 4)) {
callback(new Error('验证码错误,请重新输入'));
} else {
callback();
}
};
return {
is_loading: false,
loginForm: {
email: null,
phone: null,
......@@ -140,7 +219,6 @@ export default {
{ required: true, trigger: 'blur', validator: validatePassword },
],
},
passwordType: 'password',
capsTooltip: false,
loading: false,
showDialog: false,
......@@ -148,6 +226,8 @@ export default {
otherQuery: {},
timer: null,
time: null,
is_loading: false,
activeName: 'account',
};
},
watch: {
......@@ -165,13 +245,7 @@ export default {
created() {
// window.addEventListener('storage', this.afterQRScan)
},
mounted() {
if (this.loginForm.username === '') {
this.$refs.username.focus();
} else if (this.loginForm.password === '') {
this.$refs.password.focus();
}
},
mounted() {},
destroyed() {
// window.removeEventListener('storage', this.afterQRScan)
},
......@@ -215,48 +289,35 @@ export default {
// .catch(() => {
// this.loading = false;
// });
console.log('11111111');
let data = {
verification_key: this.loginForm.eamil_key,
verification_code: this.loginForm.verification_code,
};
this.loading = true;
this.$store
.dispatch('user/login', data)
.then((response) => {
// this.$router.push({
// path: this.redirect || '/',
// query: this.otherQuery,
// });
console.log(response);
this.loading = false;
this.$router.push('/');
})
.catch(() => {
this.loading = false;
});
// this.$refs.loginForm.validate((valid) => {
// if (valid) {
// this.loading = true;
// this.$store
// .dispatch('user/login', this.loginForm)
// .then(() => {
// this.$router.push({
// path: this.redirect || '/',
// query: this.otherQuery,
// });
// this.loading = false;
// })
// .catch(() => {
// this.loading = false;
// });
// } else {
// console.log('error submit!!');
// return false;
// }
// });
if (this.activeName == 'account') {
this.$store
.dispatch('user/AccountLogin', this.$refs.user_login.loginForm)
.then((response) => {
console.log('登录返回值' + response);
this.loading = false;
this.$router.push('/');
});
} else if (this.activeName == 'email') {
let data = {
verification_key: this.loginForm.eamil_key,
verification_code: this.loginForm.verification_code,
};
this.loading = true;
this.$store
.dispatch('user/login', data)
.then((response) => {
// this.$router.push({
// path: this.redirect || '/',
// query: this.otherQuery,
// });
console.log('登录返回值' + response);
this.loading = false;
this.$router.push('/');
})
.catch(() => {
this.loading = false;
});
}
},
getOtherQuery(query) {
return Object.keys(query).reduce((acc, cur) => {
......@@ -286,7 +347,6 @@ export default {
// }
sendMessage() {
this.is_loading = true;
// this.$refs.retrieveForm.validateField('email', (errMsg) => {});
getCode({ email: this.loginForm.email })
.then((res) => {
this.loginForm.eamil_key = res.key || null;
......@@ -301,6 +361,11 @@ export default {
console.log('效验通过');
}
});
// this.$refs.ruleForm.validateField('email', (errMsg) => {
// });
},
goLogin() {
this.$router.push('/login_info');
},
},
};
......@@ -330,16 +395,6 @@ $light_gray: #eee;
box-sizing: border-box;
padding: 62px 69px;
.login-form {
background-color: #fff;
width: 400px;
height: 384px;
padding: 40px;
margin-top: 7px;
border-radius: 10px;
float: right;
}
.title-container {
position: relative;
......@@ -384,6 +439,27 @@ $light_gray: #eee;
box-shadow: 4px 4px 15px #c2c4c9;
border-radius: 15px;
position: relative;
.login-form {
background-color: #fff;
width: 400px;
height: 430px;
padding: 40px;
border-radius: 10px;
position: absolute;
right: 10%;
top: 18%;
.login_enter_box_ {
text-align: right;
position: absolute;
bottom: 22%;
right: 10%;
a {
font-size: 12px;
text-decoration: underline;
font-weight: bold;
}
}
}
}
.sign_container {
......
......@@ -3,7 +3,7 @@
* @Author: AnthonyD
* @Date: 2023-03-01 16:25:21
* @Last Modified by: AnthonyD
* @Last Modified time: 2023-03-14 16:18:01
* @Last Modified time: 2023-03-17 11:25:26
*/
</script>
......@@ -111,6 +111,8 @@
<h3 class="photo_header_title">上传纸质考试照片</h3>
</el-col>
<el-col :span="12" style="text-align: right">
<!-- :on-success="handleAvatarSuccess" -->
<!-- :http-request="uploadSubmit" -->
<el-upload
name="image"
v-if="test_results && test_results.test_results_image"
......@@ -118,6 +120,7 @@
:action="
IP + '/student/test_results/imageUpload/' + result_id
"
:on-progress="uploadSubmit"
:on-success="handleAvatarSuccess"
:headers="headers"
:show-file-list="false"
......@@ -138,7 +141,7 @@
</el-upload> -->
</el-col>
</el-row>
<div class="grid-content_upload">
<div class="grid-content_upload" v-loading="is_loading">
<div class="upload_btn">
<div
class="img_box"
......@@ -153,6 +156,7 @@
:action="
IP + '/student/test_results/imageUpload/' + result_id
"
:on-progress="uploadSubmit"
:on-success="handleAvatarSuccess"
:headers="headers"
drag
......@@ -198,6 +202,7 @@ export default {
imgrul: null,
test_card_info: {},
is_force: false,
is_loading: false,
};
},
created() {
......@@ -293,8 +298,19 @@ export default {
// });
// },
handleAvatarSuccess(res, file) {
// this.imageUrl = URL.createObjectURL(file.raw);
this.getTestData();
if (res.code == 200 && res.message) {
this.is_loading = false;
this.test_results.test_results_image = res.status;
for (let i in this.test_result_sub_data) {
if (res.message[this.test_result_sub_data[i].id]) {
this.test_result_sub_data[i].value =
res.message[this.test_result_sub_data[i].id];
}
}
}
},
uploadSubmit(event, file, fileList) {
this.is_loading = true;
},
},
};
......@@ -397,18 +413,18 @@ export default {
.grid-content_upload {
text-align: center;
background: #fafafa;
height: 648px;
height: 779px;
border: 2px solid #dcdfe6;
border-radius: 5px;
position: relative;
.img_box {
width: 100%;
height: 640px;
// height: 100%;
// position: absolute;
text-align: center;
img {
width: 100%;
height: 100%;
height: 775px;
}
}
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论