任务提交
This commit is contained in:
parent
b004356582
commit
6c73c78473
@ -1,7 +1,7 @@
|
||||
// 参数接口
|
||||
|
||||
// 响应接口
|
||||
import { get, post } from "@/utils/request";
|
||||
import {get, post} from "@/utils/request";
|
||||
|
||||
/**
|
||||
* 获取服务器时间
|
||||
@ -30,6 +30,18 @@ export const jsConfirmJsDataApi = async (params: any) => {
|
||||
export const jsdFindPageTaskApi = async (params: any) => {
|
||||
return await get("/api/jsd/findPageTask", params);
|
||||
};
|
||||
export const rwflFindRwlxsByRwId = async (params: any) => {
|
||||
return await get("/api/rwlx/findRwlxsByRwId", params);
|
||||
}
|
||||
export const rwzxSaveApi = async (params: any) => {
|
||||
return await post("/api/rwzx/save", params);
|
||||
};
|
||||
|
||||
|
||||
export const rwFindInfoByRwId = async (params: any) => {
|
||||
return await get("/api/rw/findInfoByRwId", params);
|
||||
}
|
||||
|
||||
export const fractionRuleApi = async () => {
|
||||
return await get(
|
||||
"/api/fractionRule/findAllByItemId?itemId=CDFDED2A704F46E2A4D7E8816968BD23"
|
||||
|
||||
@ -87,6 +87,7 @@ export function useForm(options: FormOptions): UseForm {
|
||||
function algorithm(schemaItem: FormsSchema) {
|
||||
let upSchemaList: FormsSchema = options.schema.filter(item => item.field === schemaItem.field)[0]
|
||||
for (const key in schemaItem) {
|
||||
//console.log(11,key,schemaItem[key],typeof schemaItem[key])
|
||||
// @ts-ignore
|
||||
if (typeof schemaItem[key] === 'object') {
|
||||
// @ts-ignore
|
||||
|
||||
@ -2,32 +2,37 @@
|
||||
<template>
|
||||
<view class="message-detail-page">
|
||||
<view v-if="isLoading" class="loading-indicator">加载中...</view>
|
||||
<view v-else-if="messageDetail" class="detail-content">
|
||||
<view v-else class="detail-content">
|
||||
<view class="detail-header">
|
||||
<view class="title-tag-row">
|
||||
<text class="detail-title">{{ messageDetail.title }}</text>
|
||||
<text class="detail-title">{{ rw.rwmc }}</text>
|
||||
<view class="tag" :class="messageDetail.tagType">{{ messageDetail.tagText }}</view>
|
||||
</view>
|
||||
<view class="detail-meta">
|
||||
<text>{{ messageDetail.date }}</text>
|
||||
<text>{{ messageDetail.timeAgo }}</text>
|
||||
<text>{{ rw.rwkstime }}</text>
|
||||
<!-- <text>{{ messageDetail.timeAgo }}</text>-->
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-body">
|
||||
<text class="detail-desc">{{ messageDetail.desc }}</text>
|
||||
<!-- Add more detailed content here as needed -->
|
||||
<BasicForm :schema="schema" v-model="formData">
|
||||
|
||||
</BasicForm>
|
||||
</view>
|
||||
<view class="detail-footer">
|
||||
<button type="primary" class="action-button">处理</button>
|
||||
<button type="primary" class="action-button" @click="saveRwZx">处理</button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="empty-state">消息详情未找到</view>
|
||||
<!-- <view v-else class="empty-state">消息详情未找到</view>-->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import {ref} from 'vue';
|
||||
import {onLoad} from '@dcloudio/uni-app';
|
||||
import {rwFindInfoByRwId, rwflFindRwlxsByRwId, rwzxSaveApi} from "@/api/base/server";
|
||||
import {useForm} from "@/components/BasicForm/hooks/useForm";
|
||||
import {navigateBack, showToast} from "@/utils/uniapp";
|
||||
import {useUserStore} from "@/store/modules/user";
|
||||
|
||||
interface MessageDetail {
|
||||
id: string; // Assuming an ID is passed or can be derived
|
||||
@ -40,54 +45,106 @@ interface MessageDetail {
|
||||
// Add other fields as necessary
|
||||
}
|
||||
|
||||
const formData = ref({})
|
||||
const messageId = ref<string>('');
|
||||
const messageDetail = ref<MessageDetail | null>(null);
|
||||
const isLoading = ref(false);
|
||||
|
||||
onLoad((options) => {
|
||||
// Assume the identifier is passed as 'id' query parameter
|
||||
// If you pass the whole object, you can parse it here
|
||||
if (options && options.id) {
|
||||
messageId.value = decodeURIComponent(options.id); // Decode if necessary
|
||||
fetchMessageDetail();
|
||||
} else {
|
||||
console.error('Message ID/Data is missing!');
|
||||
uni.showToast({ title: '加载失败,缺少信息', icon: 'none' });
|
||||
}
|
||||
const messageDetail = ref<MessageDetail | null>({
|
||||
id: 'todo1',
|
||||
title: '教务通知 (待办)',
|
||||
desc: '学校召开期初教学准备会议暨首次教学工作例会. 会议强调了新学期的教学重点和要求,请各位老师认真准备。',
|
||||
date: '2025-02-17',
|
||||
timeAgo: '8 mins 前',
|
||||
tagText: '通知',
|
||||
tagType: 'notice',
|
||||
likes: 6,
|
||||
comments: 12
|
||||
});
|
||||
const isLoading = ref(false);
|
||||
const rwflx: any = ref([])
|
||||
const rw = ref({})
|
||||
const schema = reactive<FormsSchema[]>([])
|
||||
const {getUser} = useUserStore()
|
||||
|
||||
// 模拟获取消息详情数据
|
||||
const fetchMessageDetail = async () => {
|
||||
console.log(`Fetching details for message ID: ${messageId.value}`);
|
||||
isLoading.value = true;
|
||||
await new Promise(resolve => setTimeout(resolve, 300));
|
||||
async function saveRwZx() {
|
||||
console.log(222, formData.value)
|
||||
const result = [];
|
||||
for (let i = 0; i < rwflx.value.length; i++) {
|
||||
console.log(44, rwflx.value[i].id, formData.value[rwflx.value[i].id])
|
||||
if (rwflx.value[i].rwbs && (!formData.value[rwflx.value[i].id] || formData.value[rwflx.value[i].id] == "")) {
|
||||
showToast("请填写必填项!")
|
||||
return;
|
||||
}
|
||||
result.push({
|
||||
rwlxId: rwflx.value[i].id,
|
||||
rwzxqdtx: formData.value[rwflx.value[i].id],
|
||||
})
|
||||
}
|
||||
await rwzxSaveApi({
|
||||
mobile: getUser.mobile,
|
||||
rwId: rw.value.id,
|
||||
rwzxqdDtos: result
|
||||
})
|
||||
showToast("操作成功!");
|
||||
navigateBack()
|
||||
}
|
||||
|
||||
// --- Replace with actual API call using messageId.value ---
|
||||
|
||||
// Find the mock data based on the passed identifier (using title as ID for now)
|
||||
const mockTodoList = [
|
||||
{ id: 'todo1', title: '教务通知 (待办)', desc: '学校召开期初教学准备会议暨首次教学工作例会. 会议强调了新学期的教学重点和要求,请各位老师认真准备。', date: '2025-02-17', timeAgo: '8 mins 前', tagText: '通知', tagType: 'notice', likes: 6, comments: 12 },
|
||||
{ id: 'todo2', title: '教学日志 (待办)', desc: '请于2025年3月15日前上传教学日志,确保内容详实、准确。日志系统入口已在办公平台开放。', date: '2025-02-17', timeAgo: '8 mins 前', tagText: '任务', tagType: 'task', likes: 6, comments: 12 },
|
||||
// Add mock data for '已办' if needed, or handle different types
|
||||
{ id: 'done1', title: '审批完成 (已办)', desc: '您的请假申请已审批通过。', date: '2025-02-16', timeAgo: '1 天前', tagText: '审批', tagType: 'approval', likes: 0, comments: 0 },
|
||||
];
|
||||
|
||||
// Find based on ID (or title if ID is not directly available)
|
||||
messageDetail.value = mockTodoList.find(item => item.id === messageId.value || item.title === messageId.value) || null;
|
||||
|
||||
isLoading.value = false;
|
||||
|
||||
if (!messageDetail.value) {
|
||||
console.error(`Details not found for message ID: ${messageId.value}`);
|
||||
uni.showToast({ title: '未找到消息详情', icon: 'none' });
|
||||
} else {
|
||||
// Set navigation bar title dynamically
|
||||
uni.setNavigationBarTitle({
|
||||
title: messageDetail.value.tagText || '消息详情'
|
||||
onLoad(async (options) => {
|
||||
if (options && options.id) {
|
||||
const {result} = await rwFindInfoByRwId({
|
||||
rwId: options.id
|
||||
});
|
||||
rwflx.value = result.rwlxes;
|
||||
rw.value = result;
|
||||
for (let i = 0; i < rwflx.value.length; i++) {
|
||||
if (rwflx.value[i].rwfl == "sctp" || rwflx.value[i].rwfl == "scsp" || rwflx.value[i].rwfl == "scwd") {
|
||||
schema.push({
|
||||
field: `${rwflx.value[i].id}`,
|
||||
label: `${rwflx.value[i].rwbt}`,
|
||||
component: "BasicUpload",
|
||||
required: rwflx.value[i].rwbs,
|
||||
componentProps: {}
|
||||
})
|
||||
} else if (rwflx.value[i].rwfl == "text") {
|
||||
schema.push({
|
||||
field: `${rwflx.value[i].id}`,
|
||||
label: `${rwflx.value[i].rwbt}`,
|
||||
component: "BasicInput",
|
||||
required: rwflx.value[i].rwbs,
|
||||
itemProps: {
|
||||
labelPosition: "top",
|
||||
},
|
||||
componentProps: {
|
||||
type: "textarea",
|
||||
},
|
||||
})
|
||||
} else if (rwflx.value[i].rwfl == "dxsx" || rwflx.value[i].rwfl == "dxxz") {
|
||||
let options = rwflx.value[i].remark.split(";");
|
||||
let range = [];
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
range.push({
|
||||
name: options[i]
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
schema.push({
|
||||
field: `${rwflx.value[i].id}`,
|
||||
label: `${rwflx.value[i].rwbt}`,
|
||||
component: "BasicPicker",
|
||||
required: rwflx.value[i].rwbs,
|
||||
itemProps: {
|
||||
labelPosition: "top",
|
||||
},
|
||||
componentProps: {
|
||||
range: range,
|
||||
rangeKey: "name",
|
||||
savaKey: "name",
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.error('Message ID/Data is missing!');
|
||||
uni.showToast({title: '加载失败,缺少信息', icon: 'none'});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@ -143,16 +200,28 @@ const fetchMessageDetail = async () => {
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0; // Prevent tag from shrinking
|
||||
|
||||
&.notice { background-color: #447ade; }
|
||||
&.task { background-color: #19be6b; }
|
||||
&.approval { background-color: #ff9f0a; }
|
||||
&.submit { background-color: #8e8e93; }
|
||||
&.notice {
|
||||
background-color: #447ade;
|
||||
}
|
||||
|
||||
&.task {
|
||||
background-color: #19be6b;
|
||||
}
|
||||
|
||||
&.approval {
|
||||
background-color: #ff9f0a;
|
||||
}
|
||||
|
||||
&.submit {
|
||||
background-color: #8e8e93;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.detail-meta {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
|
||||
text {
|
||||
margin-right: 15px;
|
||||
}
|
||||
@ -161,6 +230,7 @@ const fetchMessageDetail = async () => {
|
||||
|
||||
.detail-body {
|
||||
margin-bottom: 40px;
|
||||
|
||||
.detail-desc {
|
||||
font-size: 15px;
|
||||
color: #555;
|
||||
|
||||
@ -113,12 +113,21 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
const goToDetail = (data: any) => {
|
||||
if (currentTab.value != 1) {
|
||||
return;
|
||||
}
|
||||
// if(true){
|
||||
// const encodedTitle = encodeURIComponent("教学日志 (待办)");
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/base/message/detail?id=${encodedTitle}`
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// Ensure data and data.id exist before navigating
|
||||
if (data && data.id) {
|
||||
// Encode the ID in case it contains special characters
|
||||
const encodedId = encodeURIComponent(data.id);
|
||||
uni.navigateTo({
|
||||
url: `/pages/base/message/detail?id=${encodedId}`
|
||||
url: `/pages/base/message/detail?id=${data.id}`
|
||||
});
|
||||
} else if (data && data.rwmc) {
|
||||
// Fallback: use title if id is missing (less reliable)
|
||||
|
||||
@ -40,7 +40,10 @@
|
||||
<!-- 输入框 -->
|
||||
<view class="input-group">
|
||||
<view class="input-item">
|
||||
<text class="label"><text class="required">*</text>姓名:</text>
|
||||
<text class="label">
|
||||
<text class="required">*</text>
|
||||
姓名:
|
||||
</text>
|
||||
<input
|
||||
class="input-field"
|
||||
type="text"
|
||||
@ -49,7 +52,10 @@
|
||||
/>
|
||||
</view>
|
||||
<view class="input-item">
|
||||
<text class="label"><text class="required">*</text>手机号码:</text>
|
||||
<text class="label">
|
||||
<text class="required">*</text>
|
||||
手机号码:
|
||||
</text>
|
||||
<input
|
||||
class="input-field"
|
||||
type="number"
|
||||
@ -59,7 +65,10 @@
|
||||
/>
|
||||
</view>
|
||||
<view class="input-item verification-code-item">
|
||||
<text class="label"><text class="required">*</text>验证码:</text>
|
||||
<text class="label">
|
||||
<text class="required">*</text>
|
||||
验证码:
|
||||
</text>
|
||||
<input
|
||||
class="input-field verification-code-input"
|
||||
type="number"
|
||||
@ -84,19 +93,20 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, computed } from "vue";
|
||||
import {ref, reactive, computed} from "vue";
|
||||
import CustomUpload from "/src/components/BasicUpload/CustomUpload.vue";
|
||||
import { onUnmounted } from "vue";
|
||||
import { hideLoading, isTabBar, showLoading } from "@/utils/uniapp";
|
||||
import { attachmentUpload } from "@/api/system/upload";
|
||||
import { useDataStore } from "@/store/modules/data";
|
||||
import {onUnmounted} from "vue";
|
||||
import {hideLoading, isTabBar, showLoading} from "@/utils/uniapp";
|
||||
import {attachmentUpload} from "@/api/system/upload";
|
||||
import {useDataStore} from "@/store/modules/data";
|
||||
import {
|
||||
findJsByPhoneApi,
|
||||
sendCodeApi,
|
||||
updateUserApi,
|
||||
} from "@/api/system/login";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
const { getGlobal } = useDataStore();
|
||||
import {useUserStore} from "@/store/modules/user";
|
||||
|
||||
const {getGlobal} = useDataStore();
|
||||
const formData = reactive({
|
||||
loginName: "",
|
||||
phone: "",
|
||||
@ -118,7 +128,7 @@ const handleGetCode = async () => {
|
||||
return;
|
||||
}
|
||||
if (!formData.phone) {
|
||||
uni.showToast({ title: "请输入手机号码", icon: "none" });
|
||||
uni.showToast({title: "请输入手机号码", icon: "none"});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -127,9 +137,9 @@ const handleGetCode = async () => {
|
||||
phone: formData.phone,
|
||||
});
|
||||
if (result.resultCode == 1) {
|
||||
uni.showToast({ title: "验证码发送成功", icon: "success" });
|
||||
uni.showToast({title: "验证码发送成功", icon: "success"});
|
||||
} else {
|
||||
uni.showToast({ title: "验证码发送失败", icon: "none" });
|
||||
uni.showToast({title: "验证码发送失败", icon: "none"});
|
||||
}
|
||||
isCountingDown.value = true;
|
||||
countdown.value = 60; // 重置倒计时
|
||||
@ -156,17 +166,17 @@ function toHome(data: any) {
|
||||
}
|
||||
}
|
||||
|
||||
const { afterLoginAction } = useUserStore();
|
||||
const { setFile } = useDataStore();
|
||||
const {afterLoginAction} = useUserStore();
|
||||
const {setFile} = useDataStore();
|
||||
|
||||
const handleVerify = async () => {
|
||||
if (
|
||||
!formData.loginName ||
|
||||
!formData.phone ||
|
||||
!formData.code ||
|
||||
!formData.avatarUrl
|
||||
!formData.code
|
||||
// || !formData.avatarUrl
|
||||
) {
|
||||
uni.showToast({ title: "请填写完整的验证信息", icon: "none" });
|
||||
uni.showToast({title: "请填写完整的验证信息", icon: "none"});
|
||||
return;
|
||||
}
|
||||
const result = await updateUserApi({
|
||||
@ -180,7 +190,7 @@ const handleVerify = async () => {
|
||||
if (result.resultCode == 1) {
|
||||
if (result.result) {
|
||||
afterLoginAction(result.result);
|
||||
uni.showToast({ title: "验证成功", icon: "success" });
|
||||
uni.showToast({title: "验证成功", icon: "success"});
|
||||
if (getGlobal.type == 1) {
|
||||
toHome(getGlobal);
|
||||
} else {
|
||||
@ -205,16 +215,16 @@ const handleVerify = async () => {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
uni.showToast({ title: result.message || "验证失败", icon: "none" });
|
||||
uni.showToast({title: result.message || "验证失败", icon: "none"});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({ title: result.message || "验证失败", icon: "none" });
|
||||
uni.showToast({title: result.message || "验证失败", icon: "none"});
|
||||
}
|
||||
};
|
||||
|
||||
async function afterRead(event: any) {
|
||||
showLoading({ title: "上传中" });
|
||||
const { result } = await attachmentUpload(event.tempFilePaths[0]);
|
||||
showLoading({title: "上传中"});
|
||||
const {result} = await attachmentUpload(event.tempFilePaths[0]);
|
||||
hideLoading();
|
||||
formData.avatarUrl = result[0].filePath;
|
||||
}
|
||||
@ -346,6 +356,7 @@ onUnmounted(() => {
|
||||
color: #cccccc;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
|
||||
// 移除按钮默认的边框伪元素
|
||||
.get-code-btn::after {
|
||||
border: none;
|
||||
@ -363,6 +374,7 @@ onUnmounted(() => {
|
||||
border: none; // 移除默认边框
|
||||
box-shadow: 0 2px 5px rgba(255, 100, 100, 0.3); // 添加阴影
|
||||
}
|
||||
|
||||
// 移除按钮默认的边框伪元素
|
||||
.verify-btn::after {
|
||||
border: none;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user