任务提交
This commit is contained in:
parent
b004356582
commit
6c73c78473
@ -1,67 +1,79 @@
|
||||
// 参数接口
|
||||
|
||||
// 响应接口
|
||||
import { get, post } from "@/utils/request";
|
||||
import {get, post} from "@/utils/request";
|
||||
|
||||
/**
|
||||
* 获取服务器时间
|
||||
*/
|
||||
export const xqgwFindAllApi = async () => {
|
||||
return await get("/api/xqgw/findAll");
|
||||
return await get("/api/xqgw/findAll");
|
||||
};
|
||||
export const xqxjFindAllApi = async () => {
|
||||
return await get("/api/xqxj/findAll");
|
||||
return await get("/api/xqxj/findAll");
|
||||
};
|
||||
export const findAllNjBjTreeApi = async () => {
|
||||
return await get("/api/nj/findAllNjBjTree");
|
||||
return await get("/api/nj/findAllNjBjTree");
|
||||
};
|
||||
export const kmFindAllApi = async () => {
|
||||
return await get("/api/km/findAll");
|
||||
return await get("/api/km/findAll");
|
||||
};
|
||||
export const findAllXxXqNjTree = async () => {
|
||||
return await get("/api/nj/findAllXxXqNjTree");
|
||||
return await get("/api/nj/findAllXxXqNjTree");
|
||||
};
|
||||
export const findAllNjBjTree = async () => {
|
||||
return await get("/api/nj/findAllNjBjTree");
|
||||
return await get("/api/nj/findAllNjBjTree");
|
||||
};
|
||||
export const jsConfirmJsDataApi = async (params: any) => {
|
||||
return await post("/api/js/confirmJsData", params);
|
||||
return await post("/api/js/confirmJsData", params);
|
||||
};
|
||||
export const jsdFindPageTaskApi = async (params: any) => {
|
||||
return await get("/api/jsd/findPageTask", params);
|
||||
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"
|
||||
);
|
||||
return await get(
|
||||
"/api/fractionRule/findAllByItemId?itemId=CDFDED2A704F46E2A4D7E8816968BD23"
|
||||
);
|
||||
};
|
||||
export const fractionRuleApi1 = async () => {
|
||||
return await get(
|
||||
"/api/fractionRule/findAllByItemId?itemId=B96A0FA22C414F71A3E1CDCA7E206B10"
|
||||
);
|
||||
return await get(
|
||||
"/api/fractionRule/findAllByItemId?itemId=B96A0FA22C414F71A3E1CDCA7E206B10"
|
||||
);
|
||||
};
|
||||
|
||||
// 查询教师信息
|
||||
export const jsdfindJsByPhoneApi = async (params: any) => {
|
||||
return await get("/api/js/findJsByPhone", params);
|
||||
return await get("/api/js/findJsByPhone", params);
|
||||
};
|
||||
|
||||
// 选课列表
|
||||
export const jsdXkListApi = async (params: any) => {
|
||||
return await get("/mobile/js/xk/list", params);
|
||||
return await get("/mobile/js/xk/list", params);
|
||||
};
|
||||
|
||||
// 选课列表
|
||||
export const jsdXkkcSaveApi = async (params: any) => {
|
||||
return await post("/api/xkkc/save", params);
|
||||
return await post("/api/xkkc/save", params);
|
||||
};
|
||||
|
||||
// 选课学生列表
|
||||
export const jsdXkXsListApi = async (params: any) => {
|
||||
return await get("/mobile/js/xkxs/list", params);
|
||||
return await get("/mobile/js/xkxs/list", params);
|
||||
};
|
||||
|
||||
// 提交点名信息
|
||||
export const jsdXkdmListApi = async (params: any) => {
|
||||
return await post("/mobile/js/xkdm/add", params);
|
||||
};
|
||||
return await post("/mobile/js/xkdm/add", params);
|
||||
};
|
||||
|
||||
@ -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
|
||||
@ -154,4 +155,4 @@ export function useForm(options: FormOptions): UseForm {
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 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()
|
||||
|
||||
onLoad((options) => {
|
||||
// Assume the identifier is passed as 'id' query parameter
|
||||
// If you pass the whole object, you can parse it here
|
||||
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()
|
||||
}
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options && options.id) {
|
||||
messageId.value = decodeURIComponent(options.id); // Decode if necessary
|
||||
fetchMessageDetail();
|
||||
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' });
|
||||
uni.showToast({title: '加载失败,缺少信息', icon: 'none'});
|
||||
}
|
||||
});
|
||||
|
||||
// 模拟获取消息详情数据
|
||||
const fetchMessageDetail = async () => {
|
||||
console.log(`Fetching details for message ID: ${messageId.value}`);
|
||||
isLoading.value = true;
|
||||
await new Promise(resolve => setTimeout(resolve, 300));
|
||||
|
||||
// --- 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 || '消息详情'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@ -119,10 +176,10 @@ const fetchMessageDetail = async () => {
|
||||
margin-bottom: 20px;
|
||||
|
||||
.title-tag-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start; // Align items to the top
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start; // Align items to the top
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.detail-title {
|
||||
@ -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;
|
||||
@ -176,16 +246,16 @@ const fetchMessageDetail = async () => {
|
||||
|
||||
// Style for the action button
|
||||
.action-button {
|
||||
width: 100%; // Make button full width
|
||||
height: 44px; // Standard button height
|
||||
line-height: 44px; // Match height for vertical centering
|
||||
font-size: 16px; // Slightly larger font
|
||||
font-weight: 500; // Medium weight
|
||||
border-radius: 8px; // Consistent border radius
|
||||
margin-top: 20px; // Add space above the button
|
||||
// Ensure primary color is applied correctly (uni-app default should work)
|
||||
// background-color: #447ade;
|
||||
// color: #ffffff;
|
||||
width: 100%; // Make button full width
|
||||
height: 44px; // Standard button height
|
||||
line-height: 44px; // Match height for vertical centering
|
||||
font-size: 16px; // Slightly larger font
|
||||
font-weight: 500; // Medium weight
|
||||
border-radius: 8px; // Consistent border radius
|
||||
margin-top: 20px; // Add space above the button
|
||||
// Ensure primary color is applied correctly (uni-app default should work)
|
||||
// background-color: #447ade;
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -2,34 +2,34 @@
|
||||
<view class="register-container p-30">
|
||||
<!-- 顶部 Logo -->
|
||||
<image
|
||||
class="logo"
|
||||
src="@/static/system/login/logo.png"
|
||||
mode="aspectFit"
|
||||
class="logo"
|
||||
src="@/static/system/login/logo.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
|
||||
<!-- 表单区域 -->
|
||||
<view class="form-card">
|
||||
<!-- 头像和标题 -->
|
||||
<view
|
||||
class="wi-180 he-240 mx-auto r-md mb-20"
|
||||
style="border: 1px solid #cccccc"
|
||||
class="wi-180 he-240 mx-auto r-md mb-20"
|
||||
style="border: 1px solid #cccccc"
|
||||
>
|
||||
<CustomUpload @select="afterRead" :sourceType="['camera']">
|
||||
<view class="wh-full flex-col-center">
|
||||
<svg
|
||||
t="1729656215869"
|
||||
class="icon"
|
||||
viewBox="0 0 1024 1024"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="5302"
|
||||
width="32"
|
||||
height="32"
|
||||
t="1729656215869"
|
||||
class="icon"
|
||||
viewBox="0 0 1024 1024"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="5302"
|
||||
width="32"
|
||||
height="32"
|
||||
>
|
||||
<path
|
||||
d="M851.552 890.88 172.448 890.88c-74.592 0-135.296-60.672-135.296-135.296L37.152 370.752c0-74.624 60.672-135.328 135.296-135.328l132.16 0L302.912 195.904c0-34.624 28.192-62.816 62.816-62.816l302.016 0c29.408 0 53.312 23.904 53.312 53.312l0 49.024 130.464 0c74.592 0 135.296 60.672 135.296 135.328l0 384.832C986.816 830.208 926.144 890.88 851.552 890.88zM172.448 283.456c-48.128 0-87.296 39.168-87.296 87.328l0 384.832c0 48.128 39.168 87.296 87.296 87.296l679.104 0c48.128 0 87.296-39.168 87.296-87.296L938.848 370.752c0-48.16-39.168-87.328-87.296-87.328L716.8 283.424c-24.096 0-43.712-19.616-43.712-43.712L673.088 186.4c0-2.944-2.368-5.312-5.312-5.312l-302.016 0c-8.16 0-14.816 6.656-14.816 14.816L350.944 237.12c0 25.536-20.768 46.304-46.304 46.304L172.448 283.424zM512 755.84c-107.04 0-194.08-87.072-194.08-194.08S404.992 367.68 512 367.68s194.08 87.072 194.08 194.08S619.04 755.84 512 755.84zM512 415.68c-80.576 0-146.08 65.536-146.08 146.08S431.456 707.84 512 707.84s146.08-65.536 146.08-146.08S592.576 415.68 512 415.68zM816.8 438.016c-25.568 0-46.336-20.768-46.336-46.336s20.768-46.336 46.336-46.336 46.336 20.768 46.336 46.336S842.368 438.016 816.8 438.016zM816.8 390.016l-1.664 1.664c0 0.896 0.736 1.664 1.664 1.664L816.8 390.016z"
|
||||
fill="#cdcdcd"
|
||||
p-id="5303"
|
||||
d="M851.552 890.88 172.448 890.88c-74.592 0-135.296-60.672-135.296-135.296L37.152 370.752c0-74.624 60.672-135.328 135.296-135.328l132.16 0L302.912 195.904c0-34.624 28.192-62.816 62.816-62.816l302.016 0c29.408 0 53.312 23.904 53.312 53.312l0 49.024 130.464 0c74.592 0 135.296 60.672 135.296 135.328l0 384.832C986.816 830.208 926.144 890.88 851.552 890.88zM172.448 283.456c-48.128 0-87.296 39.168-87.296 87.328l0 384.832c0 48.128 39.168 87.296 87.296 87.296l679.104 0c48.128 0 87.296-39.168 87.296-87.296L938.848 370.752c0-48.16-39.168-87.328-87.296-87.328L716.8 283.424c-24.096 0-43.712-19.616-43.712-43.712L673.088 186.4c0-2.944-2.368-5.312-5.312-5.312l-302.016 0c-8.16 0-14.816 6.656-14.816 14.816L350.944 237.12c0 25.536-20.768 46.304-46.304 46.304L172.448 283.424zM512 755.84c-107.04 0-194.08-87.072-194.08-194.08S404.992 367.68 512 367.68s194.08 87.072 194.08 194.08S619.04 755.84 512 755.84zM512 415.68c-80.576 0-146.08 65.536-146.08 146.08S431.456 707.84 512 707.84s146.08-65.536 146.08-146.08S592.576 415.68 512 415.68zM816.8 438.016c-25.568 0-46.336-20.768-46.336-46.336s20.768-46.336 46.336-46.336 46.336 20.768 46.336 46.336S842.368 438.016 816.8 438.016zM816.8 390.016l-1.664 1.664c0 0.896 0.736 1.664 1.664 1.664L816.8 390.016z"
|
||||
fill="#cdcdcd"
|
||||
p-id="5303"
|
||||
></path>
|
||||
</svg>
|
||||
</view>
|
||||
@ -40,37 +40,46 @@
|
||||
<!-- 输入框 -->
|
||||
<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"
|
||||
v-model="formData.loginName"
|
||||
placeholder="请输入姓名"
|
||||
class="input-field"
|
||||
type="text"
|
||||
v-model="formData.loginName"
|
||||
placeholder="请输入姓名"
|
||||
/>
|
||||
</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"
|
||||
v-model="formData.phone"
|
||||
placeholder="请输入手机号码"
|
||||
maxlength="11"
|
||||
class="input-field"
|
||||
type="number"
|
||||
v-model="formData.phone"
|
||||
placeholder="请输入手机号码"
|
||||
maxlength="11"
|
||||
/>
|
||||
</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"
|
||||
v-model="formData.code"
|
||||
placeholder="请输入验证码"
|
||||
maxlength="6"
|
||||
class="input-field verification-code-input"
|
||||
type="number"
|
||||
v-model="formData.code"
|
||||
placeholder="请输入验证码"
|
||||
maxlength="6"
|
||||
/>
|
||||
<button
|
||||
class="get-code-btn"
|
||||
:disabled="isCountingDown"
|
||||
@click="handleGetCode"
|
||||
class="get-code-btn"
|
||||
:disabled="isCountingDown"
|
||||
@click="handleGetCode"
|
||||
>
|
||||
{{ countdownText }}
|
||||
</button>
|
||||
@ -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.loginName ||
|
||||
!formData.phone ||
|
||||
!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