Commit ebeaaaa7 by liimin

Merge branch 'v1.0.0' of http://192.168.3.233:8090/app/sales-assist-mobile into v1.0.0

2 parents bb8d8aa7 cc84cd4d
/**
* 查询学习任务列表,可按指派人、门店筛选
* GET /api/learn-tasks
*/
import { request } from "@/api/modules/http/http.uts";
/**
* 获取学习任务列表
* @param params { storeId?: number, pageNum?: number, pageSize?: number }
*/
export function getLearnTasksList(params: UTSJSONObject = {} as UTSJSONObject): Promise<any> {
return request("/learn-tasks", params, "GET");
}
\ No newline at end of file \ No newline at end of file
...@@ -61,6 +61,13 @@ export const HOME_FRAME_TABS: TabItem[] = [ ...@@ -61,6 +61,13 @@ export const HOME_FRAME_TABS: TabItem[] = [
iconSrcActive: "/static/images/tabbar/home-active.png", iconSrcActive: "/static/images/tabbar/home-active.png",
iconSrcInactive: "/static/images/tabbar/home.png" iconSrcInactive: "/static/images/tabbar/home.png"
}, },
{
label: "录单",
icon: "tasks",
name: "orderEntry",
iconSrcActive: "/static/images/tabbar/tasks-active.png",
iconSrcInactive: "/static/images/tabbar/tasks.png"
},
]; ];
function reLaunchPage(pagesJsonPath: string): void { function reLaunchPage(pagesJsonPath: string): void {
...@@ -108,6 +115,10 @@ export function navigateToTab(index: number, currentTabIndex: number): void { ...@@ -108,6 +115,10 @@ export function navigateToTab(index: number, currentTabIndex: number): void {
switchTabPage("pages/tasks/tasks"); switchTabPage("pages/tasks/tasks");
return; return;
} }
if (index == 3) {
switchTabPage("pages/common/orderEntry/index");
return;
}
} }
export function useHomeFrameTabbar(source: HomeFrameTabbarSource) { export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
......
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
{ {
"path": "pages/common/orderEntry/index", "path": "pages/common/orderEntry/index",
"style": { "style": {
"navigationStyle": "custom",
"navigationBarTitleText": "录单" "navigationBarTitleText": "录单"
} }
} }
...@@ -159,6 +160,12 @@ ...@@ -159,6 +160,12 @@
"text": "我的", "text": "我的",
"iconPath": "static/images/tabbar/study.png", "iconPath": "static/images/tabbar/study.png",
"selectedIconPath": "static/images/tabbar/study-active.png" "selectedIconPath": "static/images/tabbar/study-active.png"
},
{
"pagePath": "pages/common/orderEntry/index",
"text": "录单",
"iconPath": "static/images/tabbar/study.png",
"selectedIconPath": "static/images/tabbar/study-active.png"
} }
] ]
}, },
......
<template>
<view class="order-content">
<view class="order-box">
<view class="form-card">
<view class="form-item">
<text class="form-label">甲方(客户)</text>
<view class="form-select" >
<text class="form-select-text" :class="{ placeholder: contractForm.customer == '' }">
{{ contractForm.customer == "" ? "请选择" : contractForm.customer }}
</text>
<uni-icons type="down" size="12" color="#999999"></uni-icons>
</view>
</view>
<view class="form-item">
<text class="form-label">合同类型</text>
<view class="form-select" >
<text class="form-select-text" :class="{ placeholder: contractForm.contractType == '' }">
{{ contractForm.contractType == "" ? "请选择" : contractForm.contractType }}
</text>
<uni-icons type="down" size="12" color="#999999"></uni-icons>
</view>
</view>
<view class="form-item">
<text class="form-label">商品/服务</text>
<scroll-view class="product-list">
<view
v-for="product in productList"
:key="product.id"
:class="['product-item', { active: isProductSelected(product.id) }]"
@click="toggleProduct(product.id)"
>
<text class="product-name">{{ product.name }}</text>
<text class="product-price">¥{{ product.price }}</text>
</view>
</scroll-view>
</view>
<view class="form-item">
<text class="form-label">合同金额</text>
<view class="amount-input-wrap">
<text class="amount-symbol">¥</text>
<input
v-model="contractForm.contractAmount"
class="amount-input"
type="digit"
placeholder="请输入金额"
placeholder-class="form-placeholder"
/>
</view>
</view>
<view class="form-item form-item--last">
<text class="form-label">支付方式</text>
<view class="form-select" >
<text class="form-select-text" :class="{ placeholder: contractForm.paymentMethod == '' }">
{{ contractForm.paymentMethod == "" ? "请选择" : contractForm.paymentMethod }}
</text>
<uni-icons type="down" size="12" color="#999999"></uni-icons>
</view>
</view>
</view>
</view>
<view class="submit-wrap">
<view class="submit-btn" @click="submitOrder">
<view class="check-icon-box">
<text class="check-icon-text">✓</text>
</view>
<text class="submit-btn-text">提交</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from "vue";
type ContractForm = {
customer: string;
contractType: string;
selectedProductIds: string[];
contractAmount: string;
paymentMethod: string;
};
type ProductItem = {
id: string;
name: string;
desc: string;
icon: string;
price: number;
};
const contractForm = ref<ContractForm>({
customer: "",
contractType: "",
selectedProductIds: [],
contractAmount: "",
paymentMethod: ""
});
const showPaymentMethod = ref<boolean>(false);
const productList = ref<ProductItem[]>([
{ id: "1", name: "发动机延保3年", desc: "原厂保修到期后再延3年", icon: "🔧", price: 3500 },
{ id: "2", name: "变速箱延保3年", desc: "CVT/DCT/AT全系适用", icon: "⚙️", price: 2800 },
{ id: "3", name: "3M全车贴膜", desc: "陶瓷膜,UV阻隔99%", icon: "🛡️", price: 4500 },
{ id: "4", name: "4K行车记录仪", desc: "前后双录,ADAS辅助", icon: "📹", price: 999 },
{ id: "5", name: "精致洗车", desc: "手工精洗+内饰清洁", icon: "⭐", price: 98 },
{ id: "6", name: "全车打蜡", desc: "进口棕榈蜡深度养护", icon: "💎", price: 450 }
]);
function isProductSelected(id: string): boolean {
return contractForm.value.selectedProductIds.indexOf(id) >= 0;
}
function toggleProduct(id: string): void {
const ids = contractForm.value.selectedProductIds;
const idx = ids.indexOf(id);
if (idx >= 0) {
ids.splice(idx, 1);
} else {
ids.push(id);
}
}
function submitOrder(): void {
uni.showToast({ title: "提交成功", icon: "none" });
}
</script>
<style scoped lang="scss">
// 引入拆分后的样式文件
@import "../styles/common.scss";
</style>
<template>
<view class="recent-section">
<view class="recent-header">
<view class="recent-title-row">
<uni-icons type="compose" size="16" color="#1a1a1a"></uni-icons>
<text class="recent-title">最近录单</text>
</view>
<view class="recent-more" @click="goAll">
<text class="recent-more-text">全部</text>
<uni-icons type="right" size="12" color="#999999"></uni-icons>
</view>
</view>
<view v-if="recentList.length == 0" class="recent-empty">
<text class="recent-empty-text">暂无最近录单</text>
</view>
<view v-else class="recent-list">
<view
v-for="(item, idx) in recentList"
:key="idx"
:class="['recent-item', { 'recent-item--last': idx == recentList.length - 1 }]"
@click="onRecentClick(item)"
>
<view class="recent-date">
<text class="date-day">{{ item.day }}</text>
<text class="date-month">{{ item.month }}</text>
</view>
<view class="recent-info">
<text class="info-name">{{ item.name }}</text>
<text class="info-desc">{{ item.desc }}</text>
</view>
<view class="recent-amount">
<text class="amount-text">{{ item.amount }}</text>
<text class="status-text" :class="item.statusClass">{{ item.status }}</text>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from "vue";
type RecentItem = {
day: string;
month: string;
name: string;
desc: string;
amount: string;
status: string;
statusClass: string;
};
const recentList = ref<RecentItem[]>([
{
day: "10",
month: "07/10",
name: "刘先生",
desc: "发动机延保3年 · 销售单",
amount: "¥3500",
status: "已完成",
statusClass: "status-done"
},
{
day: "15",
month: "07/15",
name: "黄先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "16",
month: "07/15",
name: "先生",
desc: "4K记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "17",
month: "07/17",
name: "张先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "18",
month: "07/18",
name: "李先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "19",
month: "07/19",
name: "王先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "20",
month: "07/20",
name: "张先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "21",
month: "07/21",
name: "张先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
]);
function goAll(): void {
uni.showToast({ title: "查看全部", icon: "none" });
}
function onRecentClick(item: RecentItem): void {
uni.showToast({ title: `${item.name} ${item.desc}`, icon: "none" });
}
</script>
<style scoped lang="scss">
// 引入拆分后的样式文件
@import "../styles/common.scss";
</style>
<template>
<view class="order-content">
<view class="order-box">
<view class="form-card">
<view class="form-item">
<text class="form-label">客户</text>
<view class="form-select" >
<text class="form-select-text" :class="{ placeholder: salesForm.customer == '' }">
{{ salesForm.customer == "" ? "请选择" : salesForm.customer }}
</text>
<uni-icons type="down" size="12" color="#999999"></uni-icons>
</view>
</view>
<view class="form-item">
<text class="form-label">选择商品</text>
<scroll-view class="sales-product-list" >
<view
v-for="product in productList"
:key="product.id"
:class="['sales-product-card', { active: isSalesProductSelected(product.id) }]"
@click="toggleSalesProduct(product.id)"
>
<view class="sales-product-icon">
<text class="sales-product-icon-text">{{ product.icon }}</text>
</view>
<view class="sales-product-info">
<text class="sales-product-name">{{ product.name }}</text>
<text class="sales-product-desc">{{ product.desc }}</text>
</view>
<view class="sales-product-price-wrap">
<text class="sales-product-price">¥{{ product.price }}</text>
</view>
<view v-if="isSalesProductSelected(product.id)" class="sales-product-check">
<text class="sales-product-check-text">✓</text>
</view>
</view>
</scroll-view>
</view>
<view class="form-item form-item--last">
<view class="sales-total">
<text class="sales-total-label">合计:{{ salesTotalCount }}件</text>
<text class="sales-total-price">¥{{ salesTotalPrice }}</text>
</view>
</view>
</view>
</view>
<view class="submit-wrap">
<view class="submit-btn" @click="submitOrder">
<view class="check-icon-box">
<text class="check-icon-text">✓</text>
</view>
<text class="submit-btn-text">提交</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from "vue";
type SalesForm = {
customer: string;
selectedProductIds: string[];
remark: string;
};
type ProductItem = {
id: string;
name: string;
desc: string;
icon: string;
price: number;
};
const salesForm = ref<SalesForm>({
customer: "",
selectedProductIds: [],
remark: ""
});
const productList = ref<ProductItem[]>([
{ id: "1", name: "发动机延保3年", desc: "原厂保修到期后再延3年", icon: "🔧", price: 3500 },
{ id: "2", name: "变速箱延保3年", desc: "CVT/DCT/AT全系适用", icon: "⚙️", price: 2800 },
{ id: "3", name: "3M全车贴膜", desc: "陶瓷膜,UV阻隔99%", icon: "🛡️", price: 4500 },
{ id: "4", name: "4K行车记录仪", desc: "前后双录,ADAS辅助", icon: "📹", price: 999 },
{ id: "5", name: "精致洗车", desc: "手工精洗+内饰清洁", icon: "⭐", price: 98 },
{ id: "6", name: "全车打蜡", desc: "进口棕榈蜡深度养护", icon: "💎", price: 450 }
]);
const salesTotalCount = computed((): number => {
return salesForm.value.selectedProductIds.length;
});
const salesTotalPrice = computed((): number => {
let total = 0;
const ids = salesForm.value.selectedProductIds;
const list = productList.value;
for (let i = 0; i < ids.length; i++) {
const id = ids[i];
for (let j = 0; j < list.length; j++) {
if (list[j].id == id) {
total += list[j].price;
break;
}
}
}
return total;
});
function isSalesProductSelected(id: string): boolean {
return salesForm.value.selectedProductIds.indexOf(id) >= 0;
}
function toggleSalesProduct(id: string): void {
const ids = salesForm.value.selectedProductIds;
const idx = ids.indexOf(id);
if (idx >= 0) {
ids.splice(idx, 1);
} else {
ids.push(id);
}
}
function submitOrder(): void {
uni.showToast({ title: "提交成功", icon: "none" });
}
</script>
<style scoped lang="scss">
// 引入拆分后的样式文件
@import "../styles/common.scss";
</style>
<template>
<view class="order-content">
<view class="order-box">
<view class="form-card">
<view class="form-item">
<text class="form-label">客户</text>
<view class="form-select">
<text class="form-select-text" :class="{ placeholder: form.customer == '' }">
{{ form.customer == "" ? "请选择" : form.customer }}
</text>
<uni-icons type="down" size="12" color="#999999"></uni-icons>
</view>
</view>
<view class="form-item">
<text class="form-label">施工项目</text>
<view class="form-select">
<text class="form-select-text" :class="{ placeholder: form.project == '' }">
{{ form.project == "" ? "请选择" : form.project }}
</text>
<uni-icons type="down" size="12" color="#999999"></uni-icons>
</view>
</view>
<view class="form-item">
<text class="form-label">预约时间</text>
<view class="form-select" @click="openTimePicker">
<text class="form-select-text" :class="{ placeholder: form.appointmentTime == '' }">
{{ form.appointmentTime == "" ? "yyyy-mm日 --:--" : form.appointmentTime }}
</text>
<uni-icons type="calendar" size="14" color="#999999"></uni-icons>
</view>
</view>
<view class="form-item">
<text class="form-label">施工技师</text>
<input
v-model="form.technician"
class="form-input"
type="text"
placeholder="指派技师"
placeholder-class="form-placeholder"
/>
</view>
<view class="form-item form-item--last">
<text class="form-label">备注</text>
<textarea
v-model="form.remark"
class="form-textarea"
placeholder="施工备注..."
placeholder-class="form-placeholder"
/>
</view>
</view>
</view>
<view class="submit-wrap">
<view class="submit-btn" @click="submitOrder">
<view class="check-icon-box">
<text class="check-icon-text">✓</text>
</view>
<text class="submit-btn-text">提交</text>
</view>
</view>
<!-- 预约时间选择器 -->
<un-datetime-picker
:show="showTimePicker"
v-model="appointmentTimeValue"
mode="datetime"
title="选择预约时间"
valueFormat="YYYY-MM-DD HH:mm"
@confirm="onTimeConfirm"
@cancel="showTimePicker = false"
@close="showTimePicker = false"
/>
</view>
</template>
<script setup lang="uts">
import { ref, computed } from "vue";
type OrderForm = {
customer: string;
project: string;
appointmentTime: string;
technician: string;
remark: string;
};
const form = ref<OrderForm>({
customer: "",
project: "",
appointmentTime: "",
technician: "",
remark: ""
});
const showTimePicker = ref<boolean>(false);
const appointmentTimeValue = ref<string | number>("");
function openTimePicker(): void {
showTimePicker.value = true;
}
function onTimeConfirm(): void {
if (appointmentTimeValue.value != null && `${appointmentTimeValue.value}` != "") {
form.value.appointmentTime = `${appointmentTimeValue.value}`;
}
showTimePicker.value = false;
}
function submitOrder(): void {
uni.showToast({ title: "提交成功", icon: "none" });
}
</script>
<style scoped lang="scss">
// 引入拆分后的样式文件
@import "../styles/common.scss";
</style>
/* 施工单录入页样式:遵循 UniAppX 规范,px 单位、无 calc/伪元素、font-weight 仅 400|700 */ .order-entry-container {
display: flex;
.page-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: #f5f6f7; flex-direction: var(--order-entry-direction);
display: flex;
flex-direction: column;
padding-top: 12px;
box-sizing: border-box;
overflow-y: auto;
}
/* 顶部 Tab */ .tab-box {
.tab-bar { width: var(--order-tab-width);
height: var(--order-tab-height);
background-color: #fff;
display: flex; display: flex;
flex-direction: row; flex-direction: var(--order-tab-direction);
align-items: center;
justify-content: space-around;
width: auto;
background-color: #ffffff;
border-radius: 12px;
padding: 12px 0;
margin: 0 16px 12px;
}
.tab-item { .tab-item {
flex: 1;
display: flex; display: flex;
flex-direction: row; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative;
padding: 4px 12px;
}
.tab-item .tab-icon { .tab-text {
margin-right: 6px; color: #333;
} }
.tab-item .tab-text { .active {
font-size: 14px; color: #2c66f7;
font-weight: 400; font-weight: bold;
color: #666666; }
} }
}
.tab-item.active .tab-text { .form-box {
color: #1a1a1a; width: var(--order-form-width);
font-weight: 700; box-sizing: border-box;
padding: 16px;
flex: 1;
min-height: 0;
}
} }
.tab-item .tab-active-line { .order-box {
position: absolute; width: 100%;
bottom: -8px; border-radius: 8px;
left: 50%; background-color: #fff;
margin-left: -10px;
width: 20px;
height: 3px;
background-color: #2c66f7;
border-radius: 2px;
} }
.form-card{
/* 表单卡片 */ width: 100%;
.form-card {
width: auto;
background-color: #ffffff;
border-radius: 12px;
padding: 16px;
box-sizing: border-box; box-sizing: border-box;
margin: 0 16px 12px; padding: 16px 0;
display: flex;
flex-wrap: wrap;
flex-direction: var(--order-entry-direction);
} }
.form-item { .form-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: var(--order-form-item-width);
margin-bottom: 16px; margin-bottom: 16px;
padding: 0 16px;
} }
.form-item--last { .form-item--last {
...@@ -144,6 +127,7 @@ ...@@ -144,6 +127,7 @@
font-size: 14px; font-size: 14px;
} }
/* 商品/服务列表 */ /* 商品/服务列表 */
.product-list { .product-list {
width: 100%; width: 100%;
...@@ -325,16 +309,17 @@ ...@@ -325,16 +309,17 @@
color: #ef4444; color: #ef4444;
} }
/* 提交按钮 */ /* 提交按钮 */
.submit-wrap { .submit-wrap {
width: 100%; width: 100%;
margin-top: 20px; margin-top: 16px;
} }
.submit-btn { .submit-btn {
width: 100%; width: 100%;
height: 48px; height: 48px;
background-color: #22c55e; background-color: #2c66f7;
border-radius: 24px; border-radius: 24px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
...@@ -366,14 +351,15 @@ ...@@ -366,14 +351,15 @@
color: #ffffff; color: #ffffff;
} }
/* 最近录单 */
/**最近录单*/
.recent-section { .recent-section {
width: 100%; width: 100%;
flex: 1;
background-color: #ffffff; background-color: #ffffff;
border-radius: 12px 12px 0 0; border-radius: 12px;
padding: 16px; padding: 16px;
box-sizing: border-box; box-sizing: border-box;
margin-top: 16px;
} }
.recent-header { .recent-header {
......
// orderEntry 响应式样式配置 - 横屏时 Tab 在左、表单在右
export default { export default {
common: {}, common: {
'--order-tab-width': '100%',
'--order-form-width': '100%',
'--order-tab-height': '60px',
'--order-tab-direction': 'row',
'--order-form-item-width': '100%',
},
portrait: { portrait: {
// 竖屏布局参数 '--order-entry-direction': 'column',
'--order-form-width': '100%',
}, },
landscape: { landscape: {
// 横屏布局参数 '--order-entry-direction': 'row',
'--order-tab-width': '15%',
'--order-form-width': '85%',
'--order-tab-height': '100%',
'--order-tab-direction': 'column',
'--order-form-item-width': '50%',
},
resolutions: {
'portrait-768x1174': {
}, },
}
} }
...@@ -53,7 +53,7 @@ const navbarStyle = computed((): UTSJSONObject => { ...@@ -53,7 +53,7 @@ const navbarStyle = computed((): UTSJSONObject => {
const top = raw != null ? parseInt(`${raw}`) : 0; const top = raw != null ? parseInt(`${raw}`) : 0;
return { return {
paddingTop: `${top}px`, paddingTop: `${top}px`,
height: `${(top || 44) + 44}px` height: `${(top) + 44}px`
} as UTSJSONObject; } as UTSJSONObject;
}); });
......
<template> <template>
<view class="task-card task-placeholder-module"> <view class="review-module">
<image class="task-placeholder-module__icon" <view class="review-panel">
mode="aspectFit" <view class="review-title-row">
src="/static/images/home/setting.png" /> <text class="review-title-icon">◉</text>
<text class="task-placeholder-module__title">审阅</text> <text class="review-title">待审阅任务({{ reviewItems.length }})</text>
<text class="task-placeholder-module__desc">审阅模块内容会在这里接入。</text> </view>
<scroll-view
class="review-scroll"
scroll-y="true"
:show-scrollbar="false">
<view class="review-list">
<view v-for="(item, index) in reviewItems"
:key="index"
class="review-card">
<text class="review-card__title">{{ item.title }}</text>
<text class="review-card__desc" :lines="2">{{ item.description }}</text>
<view class="review-card__actions">
<view class="review-card__button review-card__button--pass">
<text class="review-card__button-text">通过</text>
</view>
<view class="review-card__button review-card__button--reject">
<text class="review-card__button-text">驳回</text>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
type ReviewItem = {
title: string
description: string
}
const reviewItems: ReviewItem[] = [
{
title: "李四 · 日报",
description: "07-25日报:交车2台,触客8人,意向3人,成交¥3500。备注:客户刘先生对延保有兴趣,已安排二次跟进。"
},
{
title: "李四 · 学习",
description: "“异议处理话术精讲”课程完成,考试成绩88分,申请确认。"
}
];
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
<template> <template>
<view class="task-card task-placeholder-module"> <view class="strategy-module">
<image class="task-placeholder-module__icon" <view class="strategy-panel">
mode="aspectFit" <scroll-view
src="/static/images/home/scene-change.png" /> class="strategy-scroll"
<text class="task-placeholder-module__title">策略</text> scroll-y="true"
<text class="task-placeholder-module__desc">策略模块内容会在这里接入。</text> :show-scrollbar="false">
<view class="strategy-list">
<view v-for="(item, index) in strategies"
:key="index"
class="strategy-card">
<view class="strategy-card__icon-wrap">
<un-icon color="#FFD700" size="24" name="star-fill"></un-icon>
</view>
<view class="strategy-card__body">
<view class="strategy-card__title-row">
<text class="strategy-card__title">{{ item.title }}</text>
<text class="strategy-card__status">{{ item.statusText }}</text>
</view>
<text class="strategy-card__desc">{{ item.description }}</text>
<view class="strategy-card__bottom-row">
<view class="strategy-card__actions">
<text v-for="(action, actionIndex) in item.actions"
:key="actionIndex"
class="strategy-card__action">{{ action }}</text>
</view>
<text class="strategy-card__date">{{ item.dateText }}</text>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
type StrategyItem = {
title: string
description: string
statusText: string
dateText: string
actions: string[]
}
const strategies: StrategyItem[] = [
{
title: "个人提升-异议处理强化",
description: "质检发现异议处理得分偏低,请完成对应课程和对练",
statusText: "进行中",
dateText: "07-28",
actions: ["学习课程", "完成对练"]
},
{
title: "门店-报价转化率提升",
description: "本月门店报价转化率低于目标值,请关注",
statusText: "进行中",
dateText: "07-30",
actions: ["报日报", "参与培训"]
}
];
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
<template> <template>
<view class="study-module"> <view class="study-module">
<view class="study-side-card">
<text class="study-side-card__title">我的学习时长</text>
<view class="study-duration-box">
<view class="study-duration-item">
<text class="study-duration-item__tag">累计</text>
<text class="study-duration-item__value">0.3小时</text>
</view>
<view class="study-duration-item">
<text class="study-duration-item__tag">本月</text>
<text class="study-duration-item__value">-小时</text>
</view>
</view>
<view class="study-shortcuts">
<view v-for="(item, index) in shortcuts"
:key="index"
class="study-shortcut">
<image class="study-shortcut__icon"
mode="aspectFit"
:src="item.iconSrc" />
<text class="study-shortcut__text">{{ item.label }}</text>
</view>
</view>
</view>
<view class="study-course-panel"> <view class="study-course-panel">
<view class="study-course-tabs"> <scroll-view
<view class="study-course-tab study-course-tab--active"> class="study-course-scroll"
<text class="study-course-tab__text">正在学习</text> scroll-y="true"
</view> :show-scrollbar="false"
<view class="study-course-tab"> @scrolltolower="onScrollToLower">
<text class="study-course-tab__text">全部课程</text>
</view>
</view>
<view class="study-notice">
<text class="study-notice__text">本周学习时长小时</text>
</view>
<view class="study-course-grid"> <view class="study-course-grid">
<view v-for="(item, index) in courses" <view v-for="(item, index) in courses"
:key="index" :key="index"
class="study-course-card"> class="study-course-card">
<view class="study-course-card__cover"> <view class="study-course-card__cover">
<text class="study-course-card__type">{{ item.typeText }}</text> <image
class="study-course-card__cover-image"
mode="aspectFill"
src="/static/reception/aito-warranty-upgrade-guide.png" />
</view> </view>
<view class="study-course-card__body"> <view class="study-course-card__body">
<view class="study-course-card__title-row">
<text class="study-course-card__title">{{ item.title }}</text> <text class="study-course-card__title">{{ item.title }}</text>
<text class="study-course-card__meta">课程时长 {{ item.duration }}</text> <text class="study-course-card__status"
:class="getStatusClass(item.statusText)">{{ item.statusText }}</text>
</view>
<text class="study-course-card__desc">{{ item.description }}</text>
<view class="study-progress-row"> <view class="study-progress-row">
<text class="study-course-card__meta">任务进度</text> <text class="study-course-card__meta">任务进度</text>
<view class="study-progress"> <view class="study-progress">
...@@ -56,38 +33,149 @@ ...@@ -56,38 +33,149 @@
</view> </view>
</view> </view>
</view> </view>
<view v-if="loading"
class="study-load-state">
<text class="study-load-state__text">加载中...</text>
</view>
<view v-if="!loading && courses.length == 0"
class="study-load-state">
<text class="study-load-state__text">暂无学习任务</text>
</view>
<view v-if="!loading && courses.length > 0 && !hasMore"
class="study-load-state">
<text class="study-load-state__text">没有更多了</text>
</view>
</view> </view>
</scroll-view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
type StudyShortcut = { import { onMounted, ref } from "vue";
label: string
iconSrc: string import { getLearnTasksList } from "@/api/modules/tasks.uts";
}
type StudyCourse = { type StudyCourse = {
title: string title: string
duration: string description: string
progress: number progress: number
typeText: string statusText: string
}
const DEFAULT_PAGE_NUM = 1;
const SCROLL_LOWER_INTERVAL_MS = 500;
const courses = ref<StudyCourse[]>([]);
const pageNum = ref<number>(DEFAULT_PAGE_NUM);
const loading = ref<boolean>(false);
const hasMore = ref<boolean>(true);
let lastScrollToLowerAt = 0;
function toProgress(value: any | null): number {
if (value == null) return 0;
const raw = parseFloat(`${value}`);
if (isNaN(raw)) return 0;
if (raw < 0) return 0;
if (raw > 100) return 100;
return Math.round(raw);
}
function readField(data: UTSJSONObject, keys: string[], fallback: string = ""): string {
for (let i = 0; i < keys.length; i++) {
const value = data[keys[i]];
if (value != null && `${value}` != "") {
return `${value}`;
}
}
return fallback;
}
function normalizeStatusText(data: UTSJSONObject): string {
const statusText = readField(data, ["statusText", "statusName", "learnStatusName", "taskStatusName"], "");
if (statusText != "") return statusText;
const status = readField(data, ["status", "learnStatus", "taskStatus"], "");
if (status == "finished" || status == "complete" || status == "completed" || status == "3") return "完成";
if (status == "learning" || status == "studying" || status == "2") return "学习中";
return "待开始";
}
function normalizeCourse(data: UTSJSONObject): StudyCourse {
const progress = toProgress(data["progress"] != null ? data["progress"] : data["learnProgress"]);
return {
title: readField(data, ["courseTitle", "title", "taskName", "courseName", "learnTaskName", "name"], "未命名课程"),
description: readField(data, ["description", "desc", "summary", "courseDesc", "content"], "暂无课程说明"),
progress: progress,
statusText: normalizeStatusText(data)
} as StudyCourse;
}
function normalizeCourses(items: UTSJSONObject[]): StudyCourse[] {
const result = [] as StudyCourse[];
for (let i = 0; i < items.length; i++) {
result.push(normalizeCourse(items[i]));
}
return result;
}
function resolveCourseItems(response: any): UTSJSONObject[] {
if (response == null) return [] as UTSJSONObject[];
if (Array.isArray(response)) {
return response as UTSJSONObject[];
}
return [] as UTSJSONObject[];
}
async function loadCourses(append: boolean): Promise<void> {
if (loading.value) return;
if (append && !hasMore.value) return;
loading.value = true;
if (!append) {
pageNum.value = DEFAULT_PAGE_NUM;
hasMore.value = true;
}
try {
const response = await getLearnTasksList({
pageNum: pageNum.value
} as UTSJSONObject);
const items = resolveCourseItems(response);
const nextCourses = normalizeCourses(items);
if (append) {
courses.value = courses.value.concat(nextCourses);
} else {
courses.value = nextCourses;
}
hasMore.value = items.length > 0;
if (items.length > 0) {
pageNum.value++;
}
} catch (_e) {
if (!append) {
courses.value = [] as StudyCourse[];
}
hasMore.value = false;
} finally {
loading.value = false;
}
}
function onScrollToLower(): void {
const now = Date.now();
if (now - lastScrollToLowerAt < SCROLL_LOWER_INTERVAL_MS) return;
lastScrollToLowerAt = now;
void loadCourses(true);
}
function getStatusClass(statusText: string): string {
if (statusText.indexOf("完成") >= 0) return "study-course-card__status--done";
if (statusText.indexOf("学习") >= 0) return "study-course-card__status--learning";
return "study-course-card__status--pending";
} }
const shortcuts: StudyShortcut[] = [ onMounted((): void => {
{ label: "我的课程", iconSrc: "/static/images/tabbar/study-active.png" }, void loadCourses(false);
{ label: "我的考试", iconSrc: "/static/images/tabbar/record-active.png" }, });
{ label: "我的任务", iconSrc: "/static/images/tabbar/home-active.png" },
{ label: "排行榜", iconSrc: "/static/images/home/start-btn.png" }
];
const courses: StudyCourse[] = [
{ title: "广联数科公司介绍", duration: "0min", progress: 50, typeText: "文档" },
{ title: "课程名称38420940234...", duration: "33min", progress: 0, typeText: "文档" },
{ title: "零售驻店岗管理制度-宣...", duration: "0min", progress: 50, typeText: "文档" },
{ title: "限制考试次数的课程", duration: "14.5min", progress: 50, typeText: "视频" },
{ title: "比亚迪(海豹06)-权...", duration: "5.6min", progress: 76, typeText: "视频" }
];
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -38,13 +38,77 @@ export default { ...@@ -38,13 +38,77 @@ export default {
"--tasks-daily-field-width": "48%", "--tasks-daily-field-width": "48%",
"--tasks-daily-textarea-height": "60px", "--tasks-daily-textarea-height": "60px",
"--tasks-submit-height": "50px", "--tasks-submit-height": "50px",
"--tasks-study-layout-direction": "column", "--tasks-study-panel-bg": "transparent",
"--tasks-study-side-width": "100%", "--tasks-study-panel-radius": "0px",
"--tasks-study-side-margin-right": "0px", "--tasks-study-course-padding": "0px",
"--tasks-study-side-margin-bottom": "12px", "--tasks-course-list-direction": "column",
"--tasks-study-course-padding": "12px", "--tasks-course-list-wrap": "nowrap",
"--tasks-course-list-padding": "6px 0px",
"--tasks-course-card-width": "100%", "--tasks-course-card-width": "100%",
"--tasks-course-card-min-width": "0px" "--tasks-course-card-min-width": "0px",
"--tasks-course-card-min-height": "72px",
"--tasks-course-card-direction": "row",
"--tasks-course-card-border-left": "2px solid #2f6af7",
"--tasks-course-card-radius": "9px",
"--tasks-course-card-shadow": "none",
"--tasks-course-card-margin-right": "0px",
"--tasks-course-card-margin-bottom": "8px",
"--tasks-course-card-padding": "10px 14px 10px 12px",
"--tasks-course-card-body-padding": "0px",
"--tasks-course-title-weight": "700",
"--tasks-course-cover-display": "flex",
"--tasks-course-cover-width": "66px",
"--tasks-course-cover-height": "66px",
"--tasks-course-cover-radius": "8px",
"--tasks-course-cover-margin-right": "12px",
"--tasks-course-portrait-icon-display": "none",
"--tasks-course-portrait-icon-size": "0px",
"--tasks-course-portrait-icon-margin": "0px",
"--tasks-course-status-display": "block",
"--tasks-course-desc-display": "block",
"--tasks-course-meta-display": "none",
"--tasks-course-progress-row-margin-top": "8px",
"--tasks-course-progress-width": "160px",
"--tasks-course-progress-bg": "#eeeeee",
"--tasks-course-progress-margin-left": "0px",
"--tasks-course-progress-text-color": "#202939",
"--tasks-strategy-panel-bg": "transparent",
"--tasks-strategy-panel-radius": "0px",
"--tasks-strategy-panel-padding": "0px",
"--tasks-strategy-list-direction": "column",
"--tasks-strategy-list-wrap": "nowrap",
"--tasks-strategy-list-padding": "0px 0px 12px",
"--tasks-strategy-card-width": "100%",
"--tasks-strategy-card-min-width": "0px",
"--tasks-strategy-card-min-height": "88px",
"--tasks-strategy-card-border-left": "2px solid #2f6af7",
"--tasks-strategy-card-radius": "9px",
"--tasks-strategy-card-shadow": "none",
"--tasks-strategy-card-margin-right": "0px",
"--tasks-strategy-card-margin-bottom": "8px",
"--tasks-strategy-card-padding": "12px 14px 12px 10px",
"--tasks-strategy-icon-margin": "0px 10px 0 0",
"--tasks-review-panel-bg": "transparent",
"--tasks-review-panel-radius": "0px",
"--tasks-review-panel-padding": "0px",
"--tasks-review-title-height": "28px",
"--tasks-review-title-margin-bottom": "8px",
"--tasks-review-list-direction": "column",
"--tasks-review-list-wrap": "nowrap",
"--tasks-review-list-padding": "0px 0px 12px",
"--tasks-review-card-width": "100%",
"--tasks-review-card-min-width": "0px",
"--tasks-review-card-min-height": "104px",
"--tasks-review-card-height": "auto",
"--tasks-review-card-border-left": "2px solid #2f6af7",
"--tasks-review-card-radius": "9px",
"--tasks-review-card-shadow": "none",
"--tasks-review-card-margin-right": "0px",
"--tasks-review-card-margin-bottom": "10px",
"--tasks-review-card-padding": "14px 14px 12px",
"--tasks-review-desc-max-height": "51px",
"--tasks-review-desc-line-clamp": "3",
"--tasks-review-button-height": "34px"
}, },
landscape: { landscape: {
"--content-box-padding-side": "12px", "--content-box-padding-side": "12px",
...@@ -72,13 +136,77 @@ export default { ...@@ -72,13 +136,77 @@ export default {
"--tasks-daily-field-width": "48%", "--tasks-daily-field-width": "48%",
"--tasks-daily-textarea-height": "72px", "--tasks-daily-textarea-height": "72px",
"--tasks-submit-height": "52px", "--tasks-submit-height": "52px",
"--tasks-study-layout-direction": "row", "--tasks-study-panel-bg": "#ffffff",
"--tasks-study-side-width": "276px", "--tasks-study-panel-radius": "16px",
"--tasks-study-side-margin-right": "20px",
"--tasks-study-side-margin-bottom": "0px",
"--tasks-study-course-padding": "12px 18px", "--tasks-study-course-padding": "12px 18px",
"--tasks-course-list-direction": "row",
"--tasks-course-list-wrap": "wrap",
"--tasks-course-list-padding": "0px",
"--tasks-course-card-width": "31%", "--tasks-course-card-width": "31%",
"--tasks-course-card-min-width": "156px" "--tasks-course-card-min-width": "156px",
"--tasks-course-card-min-height": "auto",
"--tasks-course-card-direction": "column",
"--tasks-course-card-border-left": "0px solid transparent",
"--tasks-course-card-radius": "8px",
"--tasks-course-card-shadow": "0 4px 14px rgba(47, 106, 247, 0.1)",
"--tasks-course-card-margin-right": "14px",
"--tasks-course-card-margin-bottom": "14px",
"--tasks-course-card-padding": "0px",
"--tasks-course-card-body-padding": "10px",
"--tasks-course-title-weight": "400",
"--tasks-course-cover-display": "flex",
"--tasks-course-cover-width": "100%",
"--tasks-course-cover-height": "78px",
"--tasks-course-cover-radius": "0px",
"--tasks-course-cover-margin-right": "0px",
"--tasks-course-portrait-icon-display": "none",
"--tasks-course-portrait-icon-size": "0px",
"--tasks-course-portrait-icon-margin": "0px",
"--tasks-course-status-display": "none",
"--tasks-course-desc-display": "none",
"--tasks-course-meta-display": "block",
"--tasks-course-progress-row-margin-top": "6px",
"--tasks-course-progress-width": "64px",
"--tasks-course-progress-bg": "#bcd2ff",
"--tasks-course-progress-margin-left": "8px",
"--tasks-course-progress-text-color": "#4b7dff",
"--tasks-strategy-panel-bg": "#ffffff",
"--tasks-strategy-panel-radius": "16px",
"--tasks-strategy-panel-padding": "12px 18px",
"--tasks-strategy-list-direction": "row",
"--tasks-strategy-list-wrap": "wrap",
"--tasks-strategy-list-padding": "0px",
"--tasks-strategy-card-width": "46%",
"--tasks-strategy-card-min-width": "220px",
"--tasks-strategy-card-min-height": "108px",
"--tasks-strategy-card-border-left": "0px solid transparent",
"--tasks-strategy-card-radius": "8px",
"--tasks-strategy-card-shadow": "0 4px 14px rgba(47, 106, 247, 0.1)",
"--tasks-strategy-card-margin-right": "14px",
"--tasks-strategy-card-margin-bottom": "14px",
"--tasks-strategy-card-padding": "14px 16px 16px 12px",
"--tasks-strategy-icon-margin": "0px 12px 0 0",
"--tasks-review-panel-bg": "#ffffff",
"--tasks-review-panel-radius": "16px",
"--tasks-review-panel-padding": "12px 18px",
"--tasks-review-title-height": "30px",
"--tasks-review-title-margin-bottom": "8px",
"--tasks-review-list-direction": "row",
"--tasks-review-list-wrap": "wrap",
"--tasks-review-list-padding": "0px",
"--tasks-review-card-width": "46%",
"--tasks-review-card-min-width": "240px",
"--tasks-review-card-min-height": "132px",
"--tasks-review-card-height": "134px",
"--tasks-review-card-border-left": "0px solid transparent",
"--tasks-review-card-radius": "8px",
"--tasks-review-card-shadow": "0 4px 14px rgba(47, 106, 247, 0.1)",
"--tasks-review-card-margin-right": "14px",
"--tasks-review-card-margin-bottom": "14px",
"--tasks-review-card-padding": "16px",
"--tasks-review-desc-max-height": "34px",
"--tasks-review-desc-line-clamp": "2",
"--tasks-review-button-height": "34px"
}, },
resolutions: { resolutions: {
"landscape-1024x768": { "landscape-1024x768": {
...@@ -92,9 +220,12 @@ export default { ...@@ -92,9 +220,12 @@ export default {
"--module-entry-grid-list-padding": "18px 10px", "--module-entry-grid-list-padding": "18px 10px",
"--module-entry-grid-item-height": "64px", "--module-entry-grid-item-height": "64px",
"--module-entry-grid-icon-size": "24px", "--module-entry-grid-icon-size": "24px",
"--tasks-study-side-width": "220px",
"--tasks-course-card-width": "46%", "--tasks-course-card-width": "46%",
"--tasks-course-card-min-width": "140px" "--tasks-course-card-min-width": "140px",
"--tasks-strategy-card-width": "100%",
"--tasks-strategy-card-min-width": "0px",
"--tasks-review-card-width": "100%",
"--tasks-review-card-min-width": "0px"
}, },
"portrait-393x816": { "portrait-393x816": {
"--tasks-layout-padding": "14px 16px 0" "--tasks-layout-padding": "14px 16px 0"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!