yujialong 2 weeks ago
parent 66b4c21343
commit fe4a1b7900
  1. 27
      src/components/upload/config.js
  2. 25
      src/views/Login.vue
  3. 318
      src/views/serve/projectAdd.vue

@ -1,32 +1,11 @@
/** /**
* 阿里云oss配置 * 阿里云oss配置
* */ * */
import { get } from '@/utils/http'
import api from '@/utils/api'
import CryptoJS from 'crypto-js'
import JSEncrypt from 'jsencrypt'
const A = (key, encryptedData) => {
const keyHex = CryptoJS.enc.Base64.parse(key)
const decrypted = CryptoJS.AES.decrypt(encryptedData, keyHex, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
})
return decrypted.toString(CryptoJS.enc.Utf8)
}
const R = (encryptedKey, privateKey) => {
const decrypt = new JSEncrypt()
decrypt.setPrivateKey(privateKey)
const decryptedKey = decrypt.decrypt(encryptedKey)
return decryptedKey
}
export default async function () { export default async function () {
try { try {
const res = await get(api.encrypt) const RE = localStorage.getItem('osc')
const RE = A(R(res.encryptedKey, res.privateKey), res.encryptedData).split('/') return RE ? {
return {
// oss账号信息 // oss账号信息
config: { config: {
region: 'oss-cn-shenzhen', region: 'oss-cn-shenzhen',
@ -36,6 +15,6 @@ export default async function () {
}, },
// 上传成功url前置部分(成功回调没有返回url) // 上传成功url前置部分(成功回调没有返回url)
preUrl: 'https://huoran.oss-cn-shenzhen.aliyuncs.com/' preUrl: 'https://huoran.oss-cn-shenzhen.aliyuncs.com/'
} } : {}
} catch (e) { } } catch (e) { }
} }

@ -103,6 +103,8 @@
import vFooter from '../components/Footer' import vFooter from '../components/Footer'
import Setting from '@/setting' import Setting from '@/setting'
import addRoutes from '@/libs/route/addRoutes' import addRoutes from '@/libs/route/addRoutes'
import CryptoJS from 'crypto-js'
import JSEncrypt from 'jsencrypt'
export default { export default {
data: function () { data: function () {
var regPhoneOrEmail = (rule, value, callback) => {// var regPhoneOrEmail = (rule, value, callback) => {//
@ -201,6 +203,7 @@ export default {
this.$post(this.api.logins, param).then(({ status, data, message }) => { this.$post(this.api.logins, param).then(({ status, data, message }) => {
localStorage.removeItem('examPath') localStorage.removeItem('examPath')
localStorage.removeItem('reviewPath') localStorage.removeItem('reviewPath')
this.getOss()
if (status == 200) { if (status == 200) {
const accounts = data.userAccounts const accounts = data.userAccounts
// //
@ -229,6 +232,28 @@ export default {
} }
}); });
}, },
// oss
async getOss () {
const A = (key, encryptedData) => {
const keyHex = CryptoJS.enc.Base64.parse(key)
const decrypted = CryptoJS.AES.decrypt(encryptedData, keyHex, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
})
return decrypted.toString(CryptoJS.enc.Utf8)
}
const R = (encryptedKey, privateKey) => {
const decrypt = new JSEncrypt()
decrypt.setPrivateKey(privateKey)
const decryptedKey = decrypt.decrypt(encryptedKey)
return decryptedKey
}
const res = await this.$get(this.api.encrypt)
const RE = A(R(res.encryptedKey, res.privateKey), res.encryptedData).split('/')
localStorage.setItem('osc', JSON.stringify(RE))
},
// //
chooseUser (user) { chooseUser (user) {
user.isEnable && this.$post(`${this.api.getToken}?id=${user.id}`).then(({ data }) => { user.isEnable && this.$post(`${this.api.getToken}?id=${user.id}`).then(({ data }) => {

@ -1,28 +1,20 @@
<template> <template>
<div ref="main" <div ref="main" class="main" v-loading="loading">
class="main"
v-loading="loading">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="24"> <el-col :span="24">
<el-card shadow="hover" <el-card shadow="hover" class="mgb20">
class="mgb20">
<div class="flex-between"> <div class="flex-between">
<el-page-header @back="back" <el-page-header @back="back" content="项目配置"></el-page-header>
content="项目配置"></el-page-header>
<div v-if="!isDetail"> <div v-if="!isDetail">
<el-button type="success" <el-button type="success" :loading="submiting === 0"
:loading="submiting === 0" @click="handleSubmit(0, projectManage.isOpen = 1, projectManage.ztOpen = 1)">保存为草稿
@click="handleSubmit(0,projectManage.isOpen=1,projectManage.ztOpen = 1)">保存为草稿
</el-button> </el-button>
<el-button type="primary" <el-button type="primary" :loading="submiting === 1" @click="handleSubmit(1)">确定并发布</el-button>
:loading="submiting === 1"
@click="handleSubmit(1)">确定并发布</el-button>
</div> </div>
</div> </div>
</el-card> </el-card>
<el-card shadow="hover" <el-card shadow="hover" class="mgb20">
class="mgb20">
<div class="flex-center mgb20"> <div class="flex-center mgb20">
<p class="addhr_tag"></p> <p class="addhr_tag"></p>
<span>课程信息</span> <span>课程信息</span>
@ -33,26 +25,18 @@
<el-form label-width="80px"> <el-form label-width="80px">
<div style="display: flex"> <div style="display: flex">
<el-form-item label="项目名称"> <el-form-item label="项目名称">
<el-input :disabled="isDetail" <el-input :disabled="isDetail" v-model.trim="projectManage.projectName" placeholder="20个字符以内"
v-model.trim="projectManage.projectName" @blur="projectNameExistis"></el-input>
placeholder="20个字符以内"
@blur="projectNameExistis"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model.trim="projectManage.remark" <el-input v-model.trim="projectManage.remark" placeholder="20个字符以内"></el-input>
placeholder="20个字符以内"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="项目用途"> <el-form-item label="项目用途">
<el-select :disabled="isDetail" <el-select :disabled="isDetail" v-model="projectManage.permissions" placeholder="请选择"
v-model="projectManage.permissions" @change="permissionChange">
placeholder="请选择" <el-option label="练习" :value="0"></el-option>
@change="permissionChange"> <el-option label="考核" :value="1"></el-option>
<el-option label="练习" <el-option label="竞赛" :value="2"></el-option>
:value="0"></el-option>
<el-option label="考核"
:value="1"></el-option>
<el-option label="竞赛"
:value="2"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</div> </div>
@ -60,8 +44,7 @@
</div> </div>
</el-card> </el-card>
<el-card shadow="hover" <el-card shadow="hover" class="mgb20">
class="mgb20">
<div class="flex-center mgb20"> <div class="flex-center mgb20">
<p class="addhr_tag"></p> <p class="addhr_tag"></p>
<span>实验目标</span> <span>实验目标</span>
@ -70,20 +53,14 @@
<div> <div>
<el-form label-width="0"> <el-form label-width="0">
<el-form-item> <el-form-item>
<quill :border="true" <quill :border="true" :readonly="isDetail" v-model="projectManage.experimentTarget"
:readonly="isDetail" :type.sync="projectManage.experimentTargetType" radio :minHeight="150" :height="150" />
v-model="projectManage.experimentTarget"
:type.sync="projectManage.experimentTargetType"
radio
:minHeight="150"
:height="150" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</el-card> </el-card>
<el-card shadow="hover" <el-card shadow="hover" class="mgb20">
class="mgb20">
<div class="flex-center mgb20"> <div class="flex-center mgb20">
<p class="addhr_tag"></p> <p class="addhr_tag"></p>
<span>项目背景</span> <span>项目背景</span>
@ -92,30 +69,22 @@
<div> <div>
<el-form label-width="0"> <el-form label-width="0">
<el-form-item> <el-form-item>
<quill :border="true" <quill :border="true" :readonly="isDetail" v-model="projectManage.experimentDescription"
:readonly="isDetail" :type.sync="projectManage.experimentDescriptionType" radio :minHeight="150" :height="150"
v-model="projectManage.experimentDescription" :index="1" />
:type.sync="projectManage.experimentDescriptionType"
radio
:minHeight="150"
:height="150"
:index="1" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</el-card> </el-card>
<el-card shadow="hover" <el-card shadow="hover" class="mgb20">
class="mgb20">
<div class="flex-between mgb20"> <div class="flex-between mgb20">
<div class="flex-center"> <div class="flex-center">
<p class="addhr_tag"></p> <p class="addhr_tag"></p>
<span>实验任务</span> <span>实验任务</span>
</div> </div>
<div> <div>
<el-button :disabled="isDetail" <el-button :disabled="isDetail" type="primary" @click="toJudgePoint('home')">进入判分点
type="primary"
@click="toJudgePoint('home')">进入判分点
</el-button> </el-button>
</div> </div>
</div> </div>
@ -123,120 +92,67 @@
<div class="mgb20 flex-between"> <div class="mgb20 flex-between">
<div class="flex-center"> <div class="flex-center">
<div class="m-r-20" <div class="m-r-20" style="color: #f00">项目总分值100</div>
style="color: #f00">项目总分值100</div>
<!-- <div>权重&emsp;<div class="dib"><el-input></el-input></div></div> --> <!-- <div>权重&emsp;<div class="dib"><el-input></el-input></div></div> -->
</div> </div>
<div> <div>
<el-button :disabled="isDetail" <el-button :disabled="isDetail" class="m-r-20" type="text" @click="avgDistributionScore">
class="m-r-20"
type="text"
@click="avgDistributionScore">
平均分配分值 平均分配分值
</el-button> </el-button>
<el-button :disabled="isDetail" <el-button :disabled="isDetail" class="m-r-20" type="text" @click="manualDistributionScore">
class="m-r-20"
type="text"
@click="manualDistributionScore">
手动分配分值 手动分配分值
</el-button> </el-button>
<span>(待分配分值: {{ handDistributionScore }}/100)</span> <span>(待分配分值: {{ handDistributionScore }}/100)</span>
</div> </div>
</div> </div>
<el-button :disabled="isDetail" <el-button :disabled="isDetail" type="primary" icon="el-icon-plus" round @click="handleAddJudgment"
type="primary" style="margin-bottom: 10px">判分点
icon="el-icon-plus"
round
@click="handleAddJudgment"
style="margin-bottom: 10px">判分点
</el-button> </el-button>
<el-button :disabled="isDetail" <el-button :disabled="isDetail" type="primary" icon="el-icon-delete" round @click="batchDeleteProjectJudgment"
type="primary" style="margin-bottom: 10px">批量删除
icon="el-icon-delete"
round
@click="batchDeleteProjectJudgment"
style="margin-bottom: 10px">批量删除
</el-button> </el-button>
<div class="draggable"> <div class="draggable">
<u-table ref="projectJudgementTable" <el-table ref="projectJudgementTable" :data="projectJudgmentData" class="table" stripe header-align="center"
:data="projectJudgmentData" :use-virtual="isLc" :max-height="600" :row-height="60" :border="false"
class="table" @selection-change="handleSelectionProjectJudgment" row-key="judgmentId" v-loading="listLoading">
stripe <el-table-column type="selection" width="55" align="center"></el-table-column>
header-align="center" <el-table-column prop="sort" label="序号" width="80" align="center">
:use-virtual="isLc"
:max-height="600"
:row-height="60"
:border="false"
@selection-change="handleSelectionProjectJudgment"
row-key="judgmentId"
v-loading="listLoading">
<u-table-column type="selection"
width="55"
align="center"></u-table-column>
<u-table-column prop="sort"
label="序号"
width="80"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.sort }} {{ scope.row.sort }}
</template> </template>
</u-table-column> </el-table-column>
<u-table-column prop="name" <el-table-column prop="name" label="判分指标" align="center" show-overflow-tooltip
label="判分指标" min-width="140"></el-table-column>
align="center" <el-table-column prop="name" label="判分点名称" align="center" show-overflow-tooltip
show-overflow-tooltip min-width="140"></el-table-column>
min-width="140"></u-table-column> <el-table-column label="实验要求" align="center" width="600">
<u-table-column prop="name"
label="判分点名称"
align="center"
show-overflow-tooltip
min-width="140"></u-table-column>
<u-table-column label="实验要求"
align="center"
width="600">
<template slot-scope="scope"> <template slot-scope="scope">
<quill :readonly="true" <quill :readonly="true" elseRead="true" v-model="scope.row.experimentalRequirements" :index="2" />
elseRead="true"
v-model="scope.row.experimentalRequirements"
:index="2" />
</template> </template>
</u-table-column> </el-table-column>
<u-table-column prop="score" <el-table-column prop="score" label="分数" align="center" width="120">
label="分数"
align="center"
width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input :disabled="isDetail" <el-input :disabled="isDetail" :key="scope.$index" type="number" step="0.1"
:key="scope.$index" v-model.trim="scope.row.score"></el-input>
type="number"
step="0.1"
v-model.trim="scope.row.score"></el-input>
<!-- <!--
@input="scoreChange(scope.row, scope.$index)" --> @input="scoreChange(scope.row, scope.$index)" -->
</template> </template>
</u-table-column> </el-table-column>
<u-table-column label="操作" <el-table-column label="操作" width="140" align="center">
width="140"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button :disabled="isDetail" <el-button :disabled="isDetail" type="text" style="margin-right: 10px"
type="text" @click="toJudgePoint('edit', scope.row)">自定义</el-button>
style="margin-right: 10px" <el-button :disabled="isDetail" type="text" @click="delJudgePoint(scope.$index)">
@click="toJudgePoint('edit', scope.row)">自定义</el-button>
<el-button :disabled="isDetail"
type="text"
@click="delJudgePoint(scope.$index)">
删除 删除
</el-button> </el-button>
</template> </template>
</u-table-column> </el-table-column>
</u-table> </el-table>
</div> </div>
</el-card> </el-card>
<el-card shadow="hover" <el-card shadow="hover" class="mgb20">
class="mgb20">
<div class="flex-between mgb20"> <div class="flex-between mgb20">
<div class="flex-center"> <div class="flex-center">
<p class="addhr_tag"></p> <p class="addhr_tag"></p>
@ -244,25 +160,16 @@
</div> </div>
<div> <div>
启用 启用
<el-switch :disabled="isDetail" <el-switch :disabled="isDetail" :active-value="0" :inactive-value="1"
:active-value="0" v-model="projectManage.hintOpen"></el-switch>
:inactive-value="1"
v-model="projectManage.hintOpen"></el-switch>
</div> </div>
</div> </div>
<div class="border-b-dashed"></div> <div class="border-b-dashed"></div>
<div> <div>
<el-form label-width="0"> <el-form label-width="0">
<el-form-item prop="tips" <el-form-item prop="tips" label="">
label=""> <quill :border="true" :readonly="isDetail" v-model="projectManage.experimentHint"
<quill :border="true" :type.sync="projectManage.experimentHintType" radio :minHeight="150" :height="400" :index="3" />
:readonly="isDetail"
v-model="projectManage.experimentHint"
:type.sync="projectManage.experimentHintType"
radio
:minHeight="150"
:height="400"
:index="3" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -271,62 +178,34 @@
</el-row> </el-row>
<!--选择判分点对话框--> <!--选择判分点对话框-->
<el-dialog title="添加判分点" <el-dialog title="添加判分点" :visible.sync="dialogVisible" width="40%" :close-on-click-modal="false"
:visible.sync="dialogVisible" @close="closeJudgment">
width="40%"
:close-on-click-modal="false"
@close="closeJudgment">
<div class="text-right mgb10"> <div class="text-right mgb10">
<div> <div>
<el-input placeholder="请输入需要查找的判分点" <el-input placeholder="请输入需要查找的判分点" prefix-icon="el-icon-search" v-model.trim="judgementpointsquery"
prefix-icon="el-icon-search" clearable></el-input>
v-model.trim="judgementpointsquery"
clearable></el-input>
</div> </div>
</div> </div>
<u-table v-loading="visibleLoading" <el-table v-loading="visibleLoading" :data="judgementData" ref="judgementTable" class="table" stripe
:data="judgementData" header-align="center" use-virtual :row-height="45" :max-height="400" :border="false"
ref="judgementTable" @selection-change="handleSelectionJudgment" :row-key="rowKey">
class="table" <el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
stripe <el-table-column prop="id" label="序号" align="center" width="100">
header-align="center"
use-virtual
:row-height="45"
:max-height="400"
:border="false"
@selection-change="handleSelectionJudgment"
:row-key="rowKey">
<u-table-column type="selection"
width="55"
align="center"
:reserve-selection="true"></u-table-column>
<u-table-column prop="id"
label="序号"
align="center"
width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.$index + 1 }} {{ scope.$index + 1 }}
</template> </template>
</u-table-column> </el-table-column>
<u-table-column prop="name" <el-table-column prop="name" label="判分点名称" align="center"></el-table-column>
label="判分点名称" <el-table-column label="操作" align="center" width="100">
align="center"></u-table-column>
<u-table-column label="操作"
align="center"
width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" <el-button size="mini" @click="toJudgePoint('view', scope.row)">查看</el-button>
@click="toJudgePoint('view', scope.row)">查看</el-button>
</template> </template>
</u-table-column> </el-table-column>
</u-table> </el-table>
<div slot="footer" <div slot="footer" class="dialog-footer">
class="dialog-footer">
<el-button @click="closeJudgment"> </el-button> <el-button @click="closeJudgment"> </el-button>
<el-button type="primary" <el-button type="primary" :loading="savingJud" @click="saveJudgment"> </el-button>
:loading="savingJud"
@click="saveJudgment"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -440,6 +319,8 @@ export default {
if (this.$route.query.projectId) { if (this.$route.query.projectId) {
this.projectId = this.$route.query.projectId; this.projectId = this.$route.query.projectId;
this.getInfoData(); this.getInfoData();
} else {
this.rowDrop()
} }
// //
if (JSON.stringify(this.projectFields) != "{}") { if (JSON.stringify(this.projectFields) != "{}") {
@ -447,7 +328,6 @@ export default {
this.projectManage = projectManage; this.projectManage = projectManage;
this.projectJudgmentData = projectJudgmentData; this.projectJudgmentData = projectJudgmentData;
} }
this.rowDrop();
this.$refs.main.scrollTop = 0; this.$refs.main.scrollTop = 0;
}, },
beforeDestroy () { beforeDestroy () {
@ -482,6 +362,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.updateTime = 0 this.updateTime = 0
this.$refs.main.scrollTop = 0; this.$refs.main.scrollTop = 0;
this.rowDrop();
}); });
}).catch(err => { }).catch(err => {
this.loading = false this.loading = false
@ -785,24 +666,16 @@ export default {
// //
rowDrop () { rowDrop () {
// //
const tbody = document.querySelector(".draggable .el-table__body-wrapper tbody"); const tbody = document.querySelector(".el-table__body tbody");
const _this = this; const that = this;
Sortable.create(tbody, { this.$refs.projectJudgementTable && Sortable.create(tbody, {
// //
draggable: ".draggable .el-table__row", // draggable: ".draggable .el-table__row",
onEnd ({ newIndex, oldIndex }) { onUpdate ({ newIndex, oldIndex }) {
// : vue$nextTick console.log("🚀 ~ onEnd ~ newIndex, oldIndex:", newIndex, oldIndex)
_this.projectJudgmentData.splice(newIndex, 0, _this.projectJudgmentData.splice(oldIndex, 1)[0]); if (newIndex == oldIndex) return false
let newArray = _this.projectJudgmentData.slice(0); const currentRow = that.projectJudgmentData.splice(oldIndex, 1)[0]
_this.projectJudgmentData = []; that.projectJudgmentData.splice(newIndex, 0, currentRow)
_this.$nextTick(function () {
newArray.forEach((e, i) => {
_this.$set(e, "sort", i + 1);//
_this.$set(e, "name", e.name + "?");
_this.$set(e, "name", e.name.slice(0, e.name.length - 1)); //
});
_this.projectJudgmentData = newArray;
});
} }
}); });
}, },
@ -911,13 +784,14 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .readonly .ql-toolbar { /deep/ .readonly .ql-toolbar {
height: 0; height: 0;
padding: 0; padding: 0;
border-bottom: 0; border-bottom: 0;
} }
.main { .main {
overflow: auto; overflow: auto;
overflow-x: hidden; overflow-x: hidden;
height: calc(100vh - 161px); height: calc(100vh - 161px);
} }
</style> </style>
Loading…
Cancel
Save