feat:合并

This commit is contained in:
lixg
2022-12-18 11:06:56 +08:00
5 changed files with 73 additions and 58 deletions

2
.env
View File

@@ -1,5 +1,5 @@
VITE_BASE=/fe-student VITE_BASE=/fe-student
VITE_BASE_API=/ VITE_BASE_API=
VITE_BASE_LOGIN_URL=https://u-pre.boe.com/web/ VITE_BASE_LOGIN_URL=https://u-pre.boe.com/web/
VITE_PROXY_URL=http://111.231.196.214:30001 VITE_PROXY_URL=http://111.231.196.214:30001

View File

@@ -18,6 +18,8 @@ export const PROJECT_PROCESS = '/stu/project/process'
export const ROUTER_UNCOMPLETE_LIST = '/stu/router/unCompleteTaskList post' export const ROUTER_UNCOMPLETE_LIST = '/stu/router/unCompleteTaskList post'
export const TAS_ACTIVITY_DETAIL = '/activity' export const TAS_ACTIVITY_DETAIL = '/activity'
export const TASK_ACTIVITY_SIGN = '/stu/task/activity/sign post' export const TASK_ACTIVITY_SIGN = '/stu/task/activity/sign post'
export const TASK_OFFCOURSE_NOTASK_SIGN = '/stu/task/offcourse/notask/sign post'
export const TASK_OFFCOURSE_SIGN = '/stu/task/offcourse/sign post'
export const TASK_BROADCAST_COMMIT = '/stu/task/broadcast/commit' export const TASK_BROADCAST_COMMIT = '/stu/task/broadcast/commit'
export const TASK_BROADCAST_DETAIL = '/liveBroadcast' export const TASK_BROADCAST_DETAIL = '/liveBroadcast'
export const TASK_BROADCAST_SIGN = '/stu/task/broadcast/sign post' export const TASK_BROADCAST_SIGN = '/stu/task/broadcast/sign post'

View File

@@ -1,19 +1,13 @@
<!--
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-12-11 16:57:58
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-12-17 14:51:44
* @FilePath: /fe-stu/src/components/img/UploadImg.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template> <template>
<el-upload <el-upload
:file-list="files" :file-list="files"
:action="FILE_UPLOAD" :action="FILE_UPLOAD"
method="POST" method="POST"
:show-file-list="false" :show-file-list="false"
:on-change="handleChange" :on-change="handleChange"
ref="imageRef" :limit="max"
ref="imageRef"
:on-exceed="exceed"
> >
<template #trigger> <template #trigger>
<div> <div>
@@ -23,56 +17,64 @@
</el-upload> </el-upload>
</template> </template>
<script setup> <script setup>
import { FILE_UPLOAD } from "@/api/api"; import {FILE_UPLOAD} from "@/api/api";
import { defineProps, ref } from "vue"; import {defineProps, ref, watch} from "vue";
import {ElMessage} from "element-plus";
const { modelValue = [] } = defineProps({ const props = defineProps({
modelValue: [], value: [],
}); max: {
type: Number,
default: 1
}
})
const emit = defineEmits(); const emit = defineEmits()
const files = ref(modelValue); const files = ref([])
const imageRef = ref(); const imageRef = ref()
watch(props.value, () => {
props.value.length || (files.value = props.value)
})
function exceed() {
ElMessage.error(`只能上传${props.max}个附件`);
}
function handleChange(e) { function handleChange(e) {
console.log("上传", e);
if (e.response && e.response.code === 200) { if (e.response && e.response.code === 200) {
e.url = e.response.data; e.url = e.response.data
} }
const index = files.value.findIndex((f) => f.uid === e.uid); const index = files.value.findIndex(f => f.uid === e.uid)
if (index === -1) { if (index === -1) {
files.value.unshift(e); files.value.unshift(e)
} else { } else {
files.value[index] = e; files.value[index] = e
} }
emit("update:modelValue", files); emit('update:value', files.value)
} }
function remove(i) { function remove(i) {
files.value.splice(i, 1); files.value.splice(i, 1)
} }
function reUpload(i) { function reUpload(i) {
if ( if (files.value[i].status === 'ready' || files.value[i].status === 'uploading') {
files.value[i].status === "ready" || imageRef.value.abort(files.value[i].raw)
files.value[i].status === "uploading" files.value[i].status = 'abort';
) { } else if (files.value[i].status === 'fail' || files.value[i].status === 'abort') {
imageRef.value.abort(files.value[i].raw); imageRef.value.handleStart(files.value[i].raw)
files.value[i].status = "abort"; imageRef.value.submit()
} else if (
files.value[i].status === "fail" ||
files.value[i].status === "abort"
) {
imageRef.value.handleStart(files.value[i].raw);
imageRef.value.submit();
} }
} }
function abort(i) { function abort(i) {
imageRef.value.abort(files.value[i].raw); imageRef.value.abort(files.value[i].raw)
} }
defineExpose({ reUpload, remove });
defineExpose({reUpload, remove})
</script> </script>

View File

@@ -228,7 +228,12 @@
import { computed, reactive, toRefs, watch, onUnmounted } from "vue"; import { computed, reactive, toRefs, watch, onUnmounted } from "vue";
import FileTypeImg from "@/components/FileTypeImg.vue"; import FileTypeImg from "@/components/FileTypeImg.vue";
import { request, useRequest } from "@/api/request"; import { request, useRequest } from "@/api/request";
import { STU_OFFCOURSE_DETAIL, TASK_BROADCAST_SIGN } from "@/api/api"; import {
STU_OFFCOURSE_DETAIL,
TASK_OFFCOURSE_NOTASK_SIGN,
TASK_OFFCOURSE_SIGN,
TASK_BROADCAST_SIGN,
} from "@/api/api";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useUserInfo } from "@/api/utils"; import { useUserInfo } from "@/api/utils";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
@@ -321,10 +326,15 @@ const signClick = () => {
ElMessage.info("未在签到范围内"); ElMessage.info("未在签到范围内");
return; return;
} }
2;
data.value.signFlag = 1; data.value.signFlag = 1;
ElMessage.info("签到成功"); ElMessage.info("签到成功");
console.log("courseId", courseId, taskId, type);
request(TASK_BROADCAST_SIGN, { courseId: courseId, taskId, type }); if (taskId) {
request(TASK_OFFCOURSE_SIGN, { courseId: courseId, taskId, type });
} else {
request(TASK_OFFCOURSE_NOTASK_SIGN, { courseId: courseId });
}
}; };
function toSurvery() { function toSurvery() {

View File

@@ -57,12 +57,10 @@
</div> </div>
</div> </div>
</div> </div>
<UploadImg v-model="fileList" ref="uploadRef"> <UploadImg v-model:value="fileList" ref="uploadRef">
<button <button
class="shangchuan" class="shangchuan"
style="cursor: pointer" style="cursor: pointer"
@mousemove="showFileList = 1"
@mouseout="showFileList = 0"
> >
上传 上传
</button> </button>
@@ -70,8 +68,6 @@
<div <div
class="uploadDetail" class="uploadDetail"
:style="{ display: showFileList ? 'block' : 'none' }" :style="{ display: showFileList ? 'block' : 'none' }"
@mousemove="showFileList = 1"
@mouseout="showFileList = 0"
style="padding-top: 60px" style="padding-top: 60px"
> >
<div class="triangle"></div> <div class="triangle"></div>
@@ -192,6 +188,9 @@
" "
> >
{{ value.workUploadContent }} {{ value.workUploadContent }}
<span style="margin-left: 10px">
<el-link target="_blank" type="primary" :href="value.workUploadAddress?.split(',')[0] || ''">{{value.workUploadAddress?.split(',')[0].split('/').at(-1)|| ''}}</el-link>
</span>
</div> </div>
</div> </div>
</div> </div>
@@ -255,7 +254,7 @@
</template> </template>
<script setup> <script setup>
import { reactive, ref, toRefs } from "vue"; import {computed, reactive, ref, toRefs} from "vue";
import { request, useRequest } from "@/api/request"; import { request, useRequest } from "@/api/request";
import { import {
TASK_WORK_COMMIT, TASK_WORK_COMMIT,
@@ -271,7 +270,6 @@ import { useRoute } from "vue-router/dist/vue-router";
const fileList = ref([]); const fileList = ref([]);
const uploadRef = ref(); const uploadRef = ref();
const showFileList = ref(0);
const sbValue = ref({ const sbValue = ref({
content: "", content: "",
attach: "", attach: "",
@@ -290,9 +288,11 @@ const { data: submitList } = useRequest(TASK_WORK_SUBMIT_LIST, {
workerId: workId, workerId: workId,
}); });
const showFileList = computed(()=>{
return fileList.value.length
})
const handleClick = () => { const handleClick = () => {
console.log(sbValue.value);
console.log(fileList);
request(TASK_WORK_COMMIT, { request(TASK_WORK_COMMIT, {
projectOrRouterLogo: type, projectOrRouterLogo: type,
workUploadContent: sbValue.value.content, workUploadContent: sbValue.value.content,
@@ -304,6 +304,7 @@ const handleClick = () => {
submitList.value.unshift(res.data); submitList.value.unshift(res.data);
}); });
sbValue.value.content = ""; sbValue.value.content = "";
fileList.value = [];
}; };
function remove(i) { function remove(i) {
@@ -452,8 +453,8 @@ function reUpload(i) {
} }
.square { .square {
width: 475px; padding-bottom: 40px;
height: 243px; width: 600px;
background: #ffffff; background: #ffffff;
box-shadow: 0px 1px 24px 0px rgba(0, 0, 0, 0.11); box-shadow: 0px 1px 24px 0px rgba(0, 0, 0, 0.11);
border-radius: 8px; border-radius: 8px;