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_API=/
VITE_BASE_API=
VITE_BASE_LOGIN_URL=https://u-pre.boe.com/web/
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 TAS_ACTIVITY_DETAIL = '/activity'
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_DETAIL = '/liveBroadcast'
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>
<el-upload
:file-list="files"
:action="FILE_UPLOAD"
method="POST"
:show-file-list="false"
:on-change="handleChange"
ref="imageRef"
:file-list="files"
:action="FILE_UPLOAD"
method="POST"
:show-file-list="false"
:on-change="handleChange"
:limit="max"
ref="imageRef"
:on-exceed="exceed"
>
<template #trigger>
<div>
@@ -23,56 +17,64 @@
</el-upload>
</template>
<script setup>
import { FILE_UPLOAD } from "@/api/api";
import { defineProps, ref } from "vue";
import {FILE_UPLOAD} from "@/api/api";
import {defineProps, ref, watch} from "vue";
import {ElMessage} from "element-plus";
const { modelValue = [] } = defineProps({
modelValue: [],
});
const props = defineProps({
value: [],
max: {
type: Number,
default: 1
}
})
const emit = defineEmits();
const emit = defineEmits()
const files = ref(modelValue);
const imageRef = ref();
const files = ref([])
const imageRef = ref()
watch(props.value, () => {
props.value.length || (files.value = props.value)
})
function exceed() {
ElMessage.error(`只能上传${props.max}个附件`);
}
function handleChange(e) {
console.log("上传", e);
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) {
files.value.unshift(e);
files.value.unshift(e)
} else {
files.value[index] = e;
files.value[index] = e
}
emit("update:modelValue", files);
emit('update:value', files.value)
}
function remove(i) {
files.value.splice(i, 1);
files.value.splice(i, 1)
}
function reUpload(i) {
if (
files.value[i].status === "ready" ||
files.value[i].status === "uploading"
) {
imageRef.value.abort(files.value[i].raw);
files.value[i].status = "abort";
} else if (
files.value[i].status === "fail" ||
files.value[i].status === "abort"
) {
imageRef.value.handleStart(files.value[i].raw);
imageRef.value.submit();
if (files.value[i].status === 'ready' || files.value[i].status === 'uploading') {
imageRef.value.abort(files.value[i].raw)
files.value[i].status = 'abort';
} 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) {
imageRef.value.abort(files.value[i].raw);
imageRef.value.abort(files.value[i].raw)
}
defineExpose({ reUpload, remove });
defineExpose({reUpload, remove})
</script>

View File

@@ -228,7 +228,12 @@
import { computed, reactive, toRefs, watch, onUnmounted } from "vue";
import FileTypeImg from "@/components/FileTypeImg.vue";
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 { useUserInfo } from "@/api/utils";
import { ElMessage } from "element-plus";
@@ -321,10 +326,15 @@ const signClick = () => {
ElMessage.info("未在签到范围内");
return;
}
2;
data.value.signFlag = 1;
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() {

View File

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