From 83694623ce155365a08b44bd014ec1a0013feb01 Mon Sep 17 00:00:00 2001 From: Lx <935448346@qq.com> Date: Mon, 14 Apr 2025 17:11:28 +0800 Subject: [PATCH] 0414-2 --- .../courseList/assets/style/index.rpx.scss | 3 +- .../assets/style/index.rpx.scss | 29 +++-- newPages/examinationList/index.vue | 4 +- newPages/messageCenter/index.vue | 3 +- newPages/newIndex/index.vue | 102 ++++++++++++++++-- newPages/register/index.vue | 94 +++++++++++++--- newPages/schoolList/index.vue | 17 ++- pages/index/contract.vue | 2 +- utils/auth.js | 37 +++++++ 9 files changed, 249 insertions(+), 42 deletions(-) diff --git a/newPages/courseList/assets/style/index.rpx.scss b/newPages/courseList/assets/style/index.rpx.scss index 52a5851..d1d7ced 100644 --- a/newPages/courseList/assets/style/index.rpx.scss +++ b/newPages/courseList/assets/style/index.rpx.scss @@ -164,8 +164,9 @@ background-color: rgba(255, 239, 229, 1); border-radius: 2px; //height: 36rpx; - width: 52rpx; + // width: 52rpx; //margin: 48rpx 86rpx 0 -138rpx; + padding: 0 5rpx; .text_6 { width: 32rpx; height: 24rpx; diff --git a/newPages/examinationList/assets/style/index.rpx.scss b/newPages/examinationList/assets/style/index.rpx.scss index 992350a..5d4cf76 100644 --- a/newPages/examinationList/assets/style/index.rpx.scss +++ b/newPages/examinationList/assets/style/index.rpx.scss @@ -1,13 +1,15 @@ .page { background-color: rgba(242, 244, 248, 1); position: relative; - width: 750rpx; - height: 1624rpx; + width: 100%; + max-width: 100vw; + height: 100vh; overflow: hidden; .block_1 { background-color: rgba(255, 255, 255, 1); - width: 750rpx; - height: 92rpx; + width: 100%; + max-width: 100vw; + height: 92rpx; .image_1 { width: 64rpx; height: 36rpx; @@ -32,11 +34,20 @@ } } .block_2 { - width: 750rpx; - height: 1414rpx; + flex: 1; + width: 100%; + overflow: hidden; + + .scroll-view { + flex: 1; + width: 100%; + overflow: hidden; + height: 100% !important; + } .box_3 { background-color: rgba(255, 255, 255, 1); - width: 750rpx; + width: 100%; + max-width: 100vw; height: 96rpx; justify-content: flex-center; .label_1 { @@ -412,7 +423,9 @@ background-color: rgba(255, 255, 255, 1); height: 120rpx; margin-top: -2rpx; - width: 750rpx; + width: 100%; + max-width: 100vw; + flex-shrink: 0; .text-wrapper_8 { background-color: rgba(4, 78, 242, 1); border-radius: 20px; diff --git a/newPages/examinationList/index.vue b/newPages/examinationList/index.vue index 3bb516d..27eccb3 100644 --- a/newPages/examinationList/index.vue +++ b/newPages/examinationList/index.vue @@ -6,7 +6,6 @@ - - @@ -310,7 +308,7 @@ export default { // 获取屏幕高度 const screenHeight = uni.getSystemInfoSync().windowHeight; // 获取顶部区域高度 - const topHeight = 160; + const topHeight = 88; // 计算滚动区域高度 this.scrollHeight = screenHeight - topHeight; }, diff --git a/newPages/messageCenter/index.vue b/newPages/messageCenter/index.vue index 1d26b14..f2b76d2 100644 --- a/newPages/messageCenter/index.vue +++ b/newPages/messageCenter/index.vue @@ -153,7 +153,8 @@ method: "GET", params:{ pageNo:this.pageNo, - pageSize:this.pageSize + pageSize:this.pageSize, + systemCode: this.systemCode, }, tenantIdFlag:false }).then((res) => { diff --git a/newPages/newIndex/index.vue b/newPages/newIndex/index.vue index 9199a1d..9211669 100644 --- a/newPages/newIndex/index.vue +++ b/newPages/newIndex/index.vue @@ -59,9 +59,18 @@ import SchoolInfo from './SchoolInfo.vue'; import request from "@/utils/request"; import { + getCoachId, + getInviteId, getLocalUserInfo, getToken, - setLocalUserInfo + removeCoachId, + removeInviteId, + removeTenantId, + setCoachId, + setInviteId, + setLocalUserInfo, + setStaffType, + setTenantId } from '@/utils/auth' export default { components: { @@ -97,24 +106,84 @@ export default { pageSize: 10, total: 0, imageUrl: this.$imagesUrl, - textList:[] + textList:[], + qTenantId: null, + qCoachId: null, }; }, - onLoad() { - this.getList() + onLoad(query) { + // setInviteId('JLPXF1') + // this.getTenantIdByInviteId() this.getSwiperList() this.getTextList() + + const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容 + let theRequest = this.getUrlValue(q) + if(theRequest.hasOwnProperty("inviteId")){ + //扫码邀请过来的,设置邀请者code + setInviteId(theRequest['inviteId']) + this.getTenantIdByInviteId() + //先登录 + uni.reLaunch({ + url: '/pages/login/login' + }) + }else{ + removeInviteId() + removeCoachId() + removeTenantId() + /* uni.reLaunch({ + url: '/pages-home/home/home' + }) */ + } }, methods: { + getTenantIdByInviteId(){ + console.log('1122', getInviteId()) + if(!getInviteId()){ + console.log(1) + this.getList() + return + } + request({ + url: '/app-api/dl-drive-school-coach-small/getCoachByUniqueCode', + method: 'GET', + params: { + uniqueCode: getInviteId() + } + }).then(res => { + console.log(123) + if(res.data != null){ + this.qTenantId = res.data.tenantId + this.qCoachId = res.data.userId + setTenantId(res.data.tenantId) + this.getList() + if(res.data.type == 'jl'){ + setCoachId(res.data.userId) + setStaffType('02') + } + if(res.data.type == 'yg'){ + setCoachId(res.data.userId) + setStaffType('01') + } + } + }) + }, + getList() { + const params = { + pageNo: this.pageNo, + pageSize: this.pageSize, + serviceCodes: 'jiaxiao', + }; + + if (this.qTenantId) { + params.tenantId = this.qTenantId; + } + console.log('params', params) request({ url: '/userClient/base/companySmallProgram/pageNoTenantId', method: 'GET', - params: { - pageNo: this.pageNo, - pageSize: this.pageSize, - serviceCodes: 'jiaxiao' - }, + params: params, tenantIdFlag: false }).then(res => { res.data.records.forEach(item => { @@ -123,8 +192,22 @@ export default { }) this.schoolList = this.schoolList.concat(res.data.records) this.isTriggered = false + this.total = res.data.total + console.log(res) }) }, + getUrlValue(url) { + var theRequest = new Object(); + if (url.indexOf("?") != -1) { + //有参数 + var str = url.split("?")[1]; + var strs = str.split("&"); + for (var i = 0; i < strs.length; i++) { + theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]); + } + } + return theRequest + }, /** * 实时讯息 */ @@ -139,6 +222,7 @@ export default { }) // this.textList = res.data.records // 将textList中的title拼接成数组赋值给textList + this.textList = [] res.data.records.forEach(item => { this.textList.push(item.title) }) diff --git a/newPages/register/index.vue b/newPages/register/index.vue index 00e6491..d170eaf 100644 --- a/newPages/register/index.vue +++ b/newPages/register/index.vue @@ -30,10 +30,11 @@ 选择教练 - + 请选择 {{ jlName }} - + @@ -154,7 +155,7 @@ import headers from '../../components/header/headers.vue' import request from '@/utils/request.js' import tabbar from '../../components/tabbar/tabbar.vue' import upload from '@/utils/upload.js' -import {getLocalUserInfo,getToken} from '../../utils/auth' +import {getCoachId, getLocalUserInfo,getStaffType,getToken} from '../../utils/auth' export default { data() { @@ -207,6 +208,8 @@ export default { payStatus: null, oldOrderDetails: [], loading: false, + localStaffType: null, + localCoachId: null, columns: [ [{ label: '全款', @@ -233,6 +236,8 @@ export default { this.userId = option.userId, this.tenantId = option.tenantId this.userinfo = getLocalUserInfo() + this.localStaffType = getStaffType() + this.localCoachId = getCoachId() }, onShow() { this.getListAll() @@ -281,20 +286,59 @@ export default { async getListAll() { this.columnjl = [] let res = await request({ - url: '/app-api/dl-drive-school-coach-small/list', + url: '/app-api/dl-drive-school-coach-small/queryCoachByCourseId', method: 'GET', params: { - tenantId: this.tenantId, + courseId: this.courseId, }, tenantIdFlag: false }) + console.log('data',res.data) + + // 过滤数据,只保留subject为2或3的教练 + const filteredData = res.data.filter(coach => + coach.subject === '2' || coach.subject === '3' + ); + this.columnjl = [ - res.data.map(coach => ({ - label: coach.name, + filteredData.map(coach => ({ + label: coach.coachName, value: coach })) ]; + + if (this.localStaffType === '02' && this.localCoachId) { + console.log('123123',this.localStaffType) + console.log('321321', this.localCoachId) + console.log('coach', filteredData) + const defaultCoach = filteredData.find(coach => + String(coach.coachId) === String(this.localCoachId) + ); + console.log('111222333', defaultCoach) + if (defaultCoach) { + this.jlName = defaultCoach.coachName; + this.jlId = defaultCoach.coachId; + } + } }, + + /* async getListAll() { + this.columnjl = [] + let res = await request({ + url: '/app-api/dl-drive-school-coach-small/list', + method: 'GET', + params: { + tenantId: this.tenantId, + }, + tenantIdFlag: false + }) + this.columnjl = [ + res.data.map(coach => ({ + label: coach.name, + value: coach + })) + ]; + }, */ getsexindex(index) { this.sex = index }, @@ -307,6 +351,7 @@ export default { }, // 选择教练 jlconfirm(e) { + console.log('e', e) this.jlName = e.value[0].label; // 显示名称 this.jlId = e.value[0].value.userId; // 获取教练ID this.showjl = false; @@ -494,8 +539,8 @@ export default { money: this.rightInfoList.price, indent: this.identity, phone: this.phone, - time: this.getCurrentDateTime() - + time: this.getCurrentDateTime(), + endTime: this.getEndTime(), }; /* uni.navigateTo({ url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData)) @@ -781,10 +826,10 @@ export default { url: '/app-api/small-upload/common/upload', filePath: e, }).then((res) => { - this.sfzimg = this.baseUrl + '/' + res.data.url + this.sfzimg = res.data.url if (this.sfzimg) { - this.idOcr(this.sfzimg) + this.idOcr(this.baseUrl + '/' + this.sfzimg) } }) @@ -835,9 +880,14 @@ export default { }; // 如果选择了教练,添加source和sourceUserId - if (this.jlId) { + if (this.localCoachId && this.localStaffType == '01') { + studentData.source = '01'; + studentData.sourceUserId = getCoachId(); // 设置来源用户ID为员工ID + }else if (this.localCoachId && this.localStaffType == '02') { studentData.source = '02'; - studentData.sourceUserId = this.jlId; // 设置来源用户ID为教练ID + studentData.sourceUserId = getCoachId(); // 设置来源用户ID为教练ID + }else{ + studentData.source = '03'; // 自来客户 } request({ @@ -933,13 +983,29 @@ export default { money: this.payPrice, indent: this.identity, phone: this.phone, - time: this.getCurrentDateTime() + time: this.getCurrentDateTime(), + endTime: this.getEndTime(), }; uni.navigateTo({ url: '/pages/index/contract?data=' + encodeURIComponent(JSON.stringify(contractData)) }) }, + // 获取三年后的时间 + getEndTime() { + const now = new Date(); + now.setFullYear(now.getFullYear() + 3); // 加三年 + + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + const day = String(now.getDate()).padStart(2, '0'); + const hours = String(now.getHours()).padStart(2, '0'); + const minutes = String(now.getMinutes()).padStart(2, '0'); + const seconds = String(now.getSeconds()).padStart(2, '0'); + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + }, + // 获取订单状态 async getPayStatus(orderId) { const res = await request({ diff --git a/newPages/schoolList/index.vue b/newPages/schoolList/index.vue index 3c21054..90b9aad 100644 --- a/newPages/schoolList/index.vue +++ b/newPages/schoolList/index.vue @@ -18,6 +18,7 @@ import headers from "@/components/header/headers.vue"; import SchoolInfo from '../newIndex/SchoolInfo.vue'; import request from "@/utils/request"; +import { getTenantId } from "../../utils/auth"; export default { components: { @@ -43,14 +44,20 @@ export default { uni.navigateBack() }, getList() { + const params = { + pageNo: this.pageNo, + pageSize: this.pageSize, + serviceCodes: 'jiaxiao', + }; + if (getTenantId()) { + console.log(getTenantId()) + params.tenantId = getTenantId(); + } + request({ url: '/userClient/base/companySmallProgram/pageNoTenantId', method: 'GET', - params: { - pageNo: this.pageNo, - pageSize: this.pageSize, - serviceCodes: 'jiaxiao' - } + params: params, }).then(res => { res.data.records.forEach(item => { item.features = ['有接送', '规模大'] diff --git a/pages/index/contract.vue b/pages/index/contract.vue index 8f52f0d..4904ae5 100644 --- a/pages/index/contract.vue +++ b/pages/index/contract.vue @@ -140,7 +140,7 @@ export default { uni.navigateTo({ url: '/newPages/newIndex/index' }) - }, 3000); // 3000毫秒即为3秒 + }, 2600); // 3000毫秒即为3秒 // const index = e.lastIndexOf("/") // let fileName = e.substring(index + 1, e.length) diff --git a/utils/auth.js b/utils/auth.js index 8b53862..0ecae9e 100644 --- a/utils/auth.js +++ b/utils/auth.js @@ -1,6 +1,9 @@ const TokenKey = 'App-Token' const TenantIdKey = 'TENANT_ID' const userInfo = 'userInfo' +const InviteIdKey = 'INVITE_ID' +const CoachIdKey = 'COACH_ID' +const StaffTypeKey = 'STAFF_TYPE' export function getToken() { return uni.getStorageSync(TokenKey) @@ -22,6 +25,10 @@ export function getTenantId(){ return uni.getStorageSync(TenantIdKey) } +export function removeTenantId(){ + return uni.removeStorageSync(TenantIdKey) +} + export function setLocalUserInfo(userinfo){ return uni.setStorageSync(userInfo,userinfo) } @@ -30,6 +37,36 @@ export function getLocalUserInfo() { return uni.getStorageSync(userInfo) } +export function setInviteId(InviteId) { + return uni.setStorageSync(InviteIdKey, InviteId); +} +export function getInviteId(){ + return uni.getStorageSync(InviteIdKey) +} +export function removeInviteId(){ + return uni.removeStorageSync(InviteIdKey) +} + +export function setCoachId(CoachId) { + return uni.setStorageSync(CoachIdKey, CoachId); +} +export function getCoachId(){ + return uni.getStorageSync(CoachIdKey) +} +export function removeCoachId(){ + return uni.removeStorageSync(CoachIdKey) +} +// 员工为01,教练为02 +export function setStaffType(StaffType) { + return uni.setStorageSync(StaffTypeKey, StaffType); +} +export function getStaffType(){ + return uni.getStorageSync(StaffTypeKey) +} +export function removeStaffType(){ + return uni.removeStorageSync(StaffTypeKey) +} + // 设置本地存储,并设置一个过期时间(单位为秒) export function setStorageWithExpiry(key, value, ttl) { const now = new Date();