Authored by Rickie

完善

... ... @@ -18,7 +18,8 @@
"path" : "pages/login/login",
"style" :
{
"navigationBarTitleText" : "登录"
"navigationBarTitleText" : "登录",
"navigationStyle": "custom"
}
},
{
... ...
... ... @@ -7,13 +7,16 @@
</uv-form-item>
<uv-form-item prop="sex">
<view style="display: flex;justify-content: space-around;width: 100%;">
<view @click="state.studentInfo.sex = 0" class="select-item" :style="state.studentInfo.sex === 0 ? 'border-color:#6b75f6;' : ''">
<view @click="state.studentInfo.sex = 0" class="select-item"
:style="state.studentInfo.sex === 0 ? 'border-color:#6b75f6;' : ''">
<uv-icon name="man" color="#7175f0" size="16" style="margin-right: 10rpx;"></uv-icon>男
</view>
<view @click="state.studentInfo.sex = 1" class="select-item" :style="state.studentInfo.sex === 1 ? 'border-color:#6b75f6;' : ''">
<view @click="state.studentInfo.sex = 1" class="select-item"
:style="state.studentInfo.sex === 1 ? 'border-color:#6b75f6;' : ''">
<uv-icon name="woman" color="#ff5d5c" size="16" style="margin-right: 10rpx;"></uv-icon>女
</view>
<view @click="state.studentInfo.sex = 2" class="select-item" :style="state.studentInfo.sex === 2 ? 'border-color:#6b75f6;' : ''">
<view @click="state.studentInfo.sex = 2" class="select-item"
:style="state.studentInfo.sex === 2 ? 'border-color:#6b75f6;' : ''">
<uv-icon name="lock" color="#7175f0" size="16" style="margin-right: 10rpx;"></uv-icon>保密
</view>
</view>
... ... @@ -24,8 +27,13 @@
<uv-form-item prop="school">
<uv-input v-model="state.studentInfo.school" shape="circle" placeholder="请输入学生在读学校" />
</uv-form-item>
<uv-form-item prop="grade">
<uv-input v-model="state.studentInfo.grade" shape="circle" placeholder="请输入学生在读年级" />
<uv-form-item prop="grade" @click="showSelect">
<uv-input v-model="state.studentInfo.grade" disabled disabledColor="#ffffff" shape="circle"
placeholder="请选择学生在读年级">
<template v-slot:suffix>
<uv-icon name="arrow-down" color="#6b75f6" size="14"></uv-icon>
</template>
</uv-input>
</uv-form-item>
<uv-form-item>
<view @click="submit"
... ... @@ -34,6 +42,8 @@
</view>
</uv-form-item>
</uv-form>
<uv-picker ref="pickerRef" :columns="state.columns" @confirm="confirm"></uv-picker>
</view>
</template>
... ... @@ -42,9 +52,12 @@
reactive,
ref
} from "vue"
import { addStudentsApi } from "@/api/index.js"
import {
addStudentsApi
} from "@/api/index.js"
const formRef = ref(null)
const pickerRef = ref(null)
const state = reactive({
studentInfo: {
... ... @@ -54,6 +67,9 @@
school: "",
grade: ""
},
columns: [
["一年级", "二年级", "三年级", "四年级", "五年级", "六年级", "初一", "初二", "初三", "高一", "高二", "高三"]
],
rules: {
'name': {
type: 'string',
... ... @@ -82,12 +98,20 @@
'grade': {
type: 'string',
required: true,
message: '请输入学生在读年级',
message: '请选择学生在读年级',
trigger: ['blur', 'change']
},
}
})
const showSelect = () => {
pickerRef.value.open()
}
const confirm = e => {
state.studentInfo.grade = e.value[0]
}
const submit = async () => {
try {
await formRef.value.validate()
... ...
... ... @@ -3,7 +3,6 @@
 <uv-navbar leftIcon="" placeholder bgColor="rgba(255, 255, 255, 0)">
<template v-slot:left>
<view class="uv-nav-slot">
XXXX
</view>
</template>
</uv-navbar>
... ... @@ -15,7 +14,8 @@
style="margin-left: 6rpx;"></uv-icon>
</view>
<view @click="showAccountsPop" class="select-item">
{{ state.accounts }}<uv-icon name="arrow-down-fill" color="#7175f0" size="20" style="margin-left: 6rpx;"></uv-icon>
{{ state.accounts }}<uv-icon name="arrow-down-fill" color="#7175f0" size="20"
style="margin-left: 6rpx;"></uv-icon>
</view>
</view>
... ... @@ -23,12 +23,14 @@
<view v-for="item in state.courses" class="course-box">
<image :src="item.img" style="width: 160rpx;height: 160rpx;border-radius: 20rpx;"></image>
<view style="flex: 1;display: flex;">
<view style="flex: 1;padding: 0 20rpx;display: flex;flex-direction: column;justify-content: space-between;">
<view
style="flex: 1;padding: 0 20rpx;display: flex;flex-direction: column;justify-content: space-between;">
<view style="font-size: 30rpx;">{{ item.name }} - {{ item.subject }}</view>
<view style="color: #ff3838;font-weight: 600;">¥{{ item.price }}</view>
</view>
<view style="width: 160rpx;display: flex;align-items: center;justify-content: flex-end;">
<view @click="gotoSignUp(item.id)" style="width: 100%;;background-color: #f57c28;color: #fff;text-align: center;padding: 10rpx 0;border-radius: 9999rpx;">
<view @click="gotoSignUp(item.id)"
style="width: 100%;;background-color: #f57c28;color: #fff;text-align: center;padding: 10rpx 0;border-radius: 9999rpx;">
去报名
</view>
</view>
... ... @@ -41,7 +43,8 @@
<uv-popup ref="gradesRef" safeAreaInsetBottom closeable :round="20">
<view class="pop-box">
<view class="content-pop">
<view @click="selectGrade('全部年级')" class="pop-inner-item" style="margin: 20rpx 0;" :style="state.grade === '全部年级' ? 'border-color:#7175f0;color:#7175f0;background-color:#f6f7ff;' : ''">
<view @click="selectGrade('全部年级')" class="pop-inner-item" style="margin: 20rpx 0;"
:style="state.grade === '全部年级' ? 'border-color:#7175f0;color:#7175f0;background-color:#f6f7ff;' : ''">
全部年级
</view>
<view v-for="item in state.gradOptions" style="margin-bottom: 30rpx;">
... ... @@ -63,11 +66,13 @@
<uv-popup ref="accountsRef" safeAreaInsetBottom closeable :round="20">
<view class="pop-box">
<view class="content-pop">
<view @click="selectaccounts('全部科目')" class="pop-inner-item" style="margin: 20rpx 0;" :style="state.accounts === '全部科目' ? 'border-color:#7175f0;color:#7175f0;background-color:#f6f7ff;' : ''">
<view @click="selectaccounts('全部科目')" class="pop-inner-item" style="margin: 20rpx 0;"
:style="state.accounts === '全部科目' ? 'border-color:#7175f0;color:#7175f0;background-color:#f6f7ff;' : ''">
全部科目
</view>
<view class="pop-inner">
<view v-for="item1 in state.accountsOptions" @click="selectaccounts(item1)" class="pop-inner-item"
<view v-for="item1 in state.accountsOptions" @click="selectaccounts(item1)"
class="pop-inner-item"
:style="state.accounts === item1 ? 'border-color:#7175f0;color:#7175f0;background-color:#f6f7ff;' : ''">
{{ item1 }}
</view>
... ... @@ -81,10 +86,14 @@
<script setup>
import {
reactive,
ref,
onMounted
ref
} from 'vue';
import { courseListApi } from "@/api/index.js"
import {
onShow
} from '@dcloudio/uni-app'
import {
courseListApi
} from "@/api/index.js"
const gradesRef = ref(null)
const accountsRef = ref(null)
... ... @@ -110,7 +119,7 @@
accountsOptions: ["语文", "数学", "英语", "物理", "化学"]
})
onMounted(() => {
onShow(() => {
getCourseList()
})
... ... @@ -122,8 +131,12 @@
const getCourseList = async () => {
try {
uni.showLoading({ title: "加载中" })
const { data } = await courseListApi({
uni.showLoading({
title: "加载中"
})
const {
data
} = await courseListApi({
grade: state.grade === "全部年级" ? "" : state.grade,
subject: state.accounts === "全部科目" ? "" : state.accounts
})
... ... @@ -173,6 +186,7 @@
.course-list {
margin-top: 20rpx;
flex: 1;
.course-box {
display: flex;
justify-content: space-between;
... ...
<template>
<view class="container">
<uv-navbar leftIcon="" placeholder bgColor="rgba(255, 255, 255, 0)">
<template v-slot:center>
<view class="uv-nav-slot">
登录
</view>
</template>
</uv-navbar>
<view class="input-box">
<uv-form labelPosition="left" :model="state.userInfo" :rules="state.rules" labelWidth="60" ref="formRef"
:labelStyle="{ fontSize: '28rpx' }">
<view style="margin-bottom: 60rpx;">
欢迎登录XXXXXXXX!
欢迎登录中科九章选课系统
</view>
<uv-form-item label="姓名" prop="name" borderBottom>
<uv-input v-model="state.userInfo.name" placeholder="请输入姓名" border="none">
... ... @@ -24,7 +31,8 @@
<script setup>
import {
reactive,
ref
ref,
onMounted
} from 'vue';
import {
loginApi
... ... @@ -60,6 +68,13 @@
}
})
onMounted(() => {
const token = uni.getStorageSync("token")
if (token) uni.switchTab({
url: "/pages/index/index"
})
})
const loginHandler = async () => {
try {
await formRef.value.validate()
... ... @@ -78,7 +93,10 @@
title: '登录成功'
})
uni.setStorageSync('token', token)
uni.navigateBack()
// uni.navigateBack()
uni.switchTab({
url: "/pages/index/index"
})
} finally {
uni.hideLoading()
}
... ...
... ... @@ -12,7 +12,7 @@
{{ state.userInfo?.nickName || "未知" }}
</view>
<view class="">
{{ state.userInfo?.phonenumber ? state.userInfo?.phonenumber.slice(0, 8) + '****' : "" }}
{{ state.userInfo?.phonenumber ? `${state.userInfo?.phonenumber.slice(0, 3)}****${state.userInfo?.phonenumber.slice(7, 11)}` : "" }}
</view>
</view>
</view>
... ... @@ -22,7 +22,7 @@
<view class="">
我的孩子
</view>
<view style="display: flex;justify-content: space-between;align-items: center;color: #7175f0;">
<view @click="gotoAdd" style="display: flex;justify-content: space-between;align-items: center;color: #7175f0;">
添加<uv-icon name="arrow-right" color="#7175f0" size="14"></uv-icon>
</view>
</view>
... ... @@ -48,16 +48,16 @@
我的报名
</view>
<template v-if="state.signupList.length">
<view v-for="item in state.signupList" style="display: flex;justify-content: space-between;border-radius: 20rpx;border: 2rpx solid #bdceff;padding: 10rpx;">
<view v-for="item in state.signupList" style="display: flex;justify-content: space-between;border-radius: 20rpx;border: 2rpx solid #bdceff;padding: 10rpx;margin-bottom: 20rpx;">
<view style="background-color: #b8cfff;border-radius: 16rpx;flex-shrink: 0;width: 100rpx;height: 100rpx;">
<image v-if="item.avatar" :src="item.avatar" style="width: 100%;height: 100%;"></image>
<image v-if="item.courseImg" :src="item.courseImg" style="width: 100%;height: 100%;"></image>
</view>
<view style="flex: 1;display: flex;flex-direction: column;justify-content: space-between;margin-left: 20rpx;">
<view class="">
华地校区-四年级-数学-A+班
{{ `${item.schoolName}-${item.courseName}-${item.className}` }}
</view>
<view class="">
10-01至10-31 19:00-21:00
{{ item.courseDate }} {{ item.courseTime }}
</view>
</view>
</view>
... ... @@ -72,9 +72,11 @@
<script setup>
import {
reactive,
onMounted
reactive
} from 'vue';
import {
onShow
} from '@dcloudio/uni-app'
import { userInfoApi, myStudentsApi, userSignUpListApi } from "@/api/index.js"
const state = reactive({
... ... @@ -83,7 +85,7 @@
students: []
})
onMounted(() => {
onShow(() => {
getUserInfo()
getMyStudents()
getuserSignUpList()
... ... @@ -101,9 +103,14 @@
const getuserSignUpList = async () => {
const { data } = await userSignUpListApi()
console.log(data)
state.signupList = data.signupList
}
const gotoAdd = () => {
uni.navigateTo({
url:"/pages/addStudent/addStudent"
})
}
</script>
<style lang="scss" scoped>
... ...
... ... @@ -23,7 +23,7 @@
选择校区
</view>
<view style="display: grid;grid-template-columns: repeat(3, 1fr);gap: 20rpx;">
<view v-for="item in state.selectData.schoolArr" @click="select1(item)"
<view v-for="item in state?.selectData?.schoolArr" @click="select1(item)"
:style="state.schoolName === item.text ? 'border-color:#7175f0;color:#7175f0;background-color:#f6f7ff;' : ''"
:class="item.status === '可选' ? 'select-item' : 'select-item no-select'">
{{ item.text }}
... ... @@ -36,7 +36,7 @@
选择班型
</view>
<view style="display: grid;grid-template-columns: repeat(3, 1fr);gap: 20rpx;">
<view v-for="item in state.selectData.classArr" @click="select2(item)"
<view v-for="item in state?.selectData?.classArr" @click="select2(item)"
:style="state.className === item.text ? 'border-color:#7175f0;color:#7175f0;background-color:#f6f7ff;' : ''"
:class="item.status === '可选' ? 'select-item' : 'select-item no-select'">
{{ item.text }}
... ... @@ -49,7 +49,7 @@
选择老师
</view>
<view style="display: grid;grid-template-columns: repeat(3, 1fr);gap: 20rpx;">
<view v-for="item in state.selectData.teacherArr" @click="select3(item)"
<view v-for="item in state?.selectData?.teacherArr" @click="select3(item)"
:style="state.teacherName === item.text ? 'border-color:#7175f0;color:#7175f0;background-color:#f6f7ff;' : ''"
:class="item.status === '可选' ? 'select-item' : 'select-item no-select'">
{{ item.text }}
... ... @@ -74,12 +74,12 @@
</view>
</view>
<!-- 行 -->
<view v-for="item in state.selectData?.tableData?.y" class="body-row">
<view v-for="item in state?.selectData?.tableData?.y" class="body-row">
<!-- 列 -->
<view class="cell">
{{ item }}
</view>
<view v-for="item1 in state.selectData?.tableData?.x" @click="selectTable(item, item1)"
<view v-for="item1 in state?.selectData?.tableData?.x" @click="selectTable(item, item1)"
:class="(!!state.courseDate && !!state.courseTime && state.courseDate === item1 && state.courseTime === item) ? 'cell select-one' : 'cell'">
{{ filterCell(item, item1) }}
</view>
... ... @@ -107,7 +107,7 @@
</view>
<view @click="addStudents" class="pop-inner-item"
style="display: flex;align-items: center;justify-content: center;">
<uv-icon name="plus" size="14" style="margin-right: 10rpx;"></uv-icon> 新增学员
<uv-icon name="plus" size="14" style="margin-right: 10rpx;"></uv-icon> 添加孩子
</view>
</view>
</view>
... ... @@ -117,7 +117,6 @@
<script setup>
import {
onMounted,
reactive,
ref
} from "vue"
... ... @@ -127,7 +126,7 @@
signUpApi
} from "@/api/index.js"
import {
onLoad
onLoad, onShow
} from '@dcloudio/uni-app'
const studentsRef = ref(null)
... ... @@ -153,7 +152,7 @@
state.courseId = option?.id || null
})
onMounted(async () => {
onShow(async () => {
await getMyStudents()
getSelectCourseData()
})
... ... @@ -190,10 +189,13 @@
courseDate: state.courseDate,
courseTime: state.courseTime
})
setTimeout(() => {
uni.showToast({
icon: 'success',
title: '报名成功'
title: '报名成功',
duration: 3000
})
}, 300)
resetSelect()
} finally {
uni.hideLoading();
... ... @@ -240,9 +242,10 @@
if (state.courseTime === item && state.courseDate === item1) {
state.courseTime = ""
state.courseDate = ""
getSelectCourseData()
return
}
const arr = state.selectData?.tableData?.selectable.filter(v => (v.x === item && v.y === item1 && v.status ===
const arr = state.selectData?.tableData?.selectable.filter(v => (v.x === item1 && v.y === item && v.status ===
"可选"))
if (!arr.length) return false
state.courseTime = item
... ... @@ -251,9 +254,9 @@
}
const filterCell = (item, item1) => {
const arr = state.selectData?.tableData?.selectable.filter(v => (v.x === item && v.y === item1 && v.status ===
const arr = state.selectData?.tableData?.selectable.filter(v => (v.x === item1 && v.y === item && v.status ===
"可选"))
if (arr.length) return "可"
if (arr.length) return "可报名"
return ""
}
... ...
... ... @@ -20,6 +20,7 @@ export const request = (options) => {
},
success: (res) => {
if (res?.data.code === 401) {
uni.setStorageSync('token', "")
uni.showToast({
title: '登录过期',
icon: 'none'
... ...