| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- <template>
- <view class="container">
- <!-- logo区域 -->
- <image class="logo" src="/static/logo.png" mode="aspectFill"></image>
- <!-- 标题区域 -->
- <view class="title" v-if="pageValue == 1">信息采集迎新系统</view>
- <view class="title" v-if="pageValue == 2">宿舍选取迎新系统</view>
- <view class="title" v-if="pageValue == 3">访客预约迎新系统</view>
- <!-- 录取号区域 -->
- <view class="box">
- <view class="box_text">录取号</view>
- <view class="box_input">
- <input class="input" type="text" placeholder="请输入录取号" placeholder-style="color:#CCCCCC;font-size:28rpx" v-model="admissNum" />
- </view>
- </view>
- <!-- 身份证号区域 -->
- <view class="box">
- <view class="box_text">身份证号</view>
- <view class="box_input">
- <input class="input" type="text" placeholder="请输入身份证号" placeholder-style="color:#CCCCCC;font-size:28rpx" v-model="cardId" />
- </view>
- </view>
- <!-- 登录按钮区域 -->
- <view class="btn" :class="{ active: admissNum && cardId }" @click="handleLogin">授权登录</view>
- <!-- 背景图片区域 -->
- <image class="logo_bg" src="/static/logo-bg.png" mode="aspectFill"></image>
- <!-- 弹窗区域 -->
- <uni-popup ref="popup" :is-mask-click="false">
- <view class="pop">
- <image class="pop_img" src="/static/3.png" mode="aspectFill"></image>
- <!-- 关闭图标 -->
- <uni-icons class="pop_close" type="closeempty" color="#808080" size="20" @click="handleClose"></uni-icons>
- <view class="pop_title">温馨提示</view>
- <view class="pop_text" v-if="pageValue == 2">{{ tips.chooseDormitory }}</view>
- <view class="pop_text" v-if="pageValue == 3">{{ tips.carOrder }}</view>
- <view class="pop_btn" @click="handleFinish">下一步</view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script setup>
- import { onLoad } from '@dcloudio/uni-app'
- import { ref } from 'vue'
- import { loginReq } from '@/api/index.js'
- import { getSettingsInfoReq } from '@/api/index.js'
- // 页面类型
- const pageValue = ref()
- // 录取号
- const admissNum = ref()
- // 身份证号
- const cardId = ref()
- const popup = ref()
- const tips = ref({})
- onLoad((options) => {
- pageValue.value = options.pageValue
- // 获取设置数据
- getSettingsInfo()
- })
- // 获取设置数据
- const getSettingsInfo = async () => {
- const res = await getSettingsInfoReq()
- // console.log(res)
- if (res.code == 200) {
- tips.value = res.data
- }
- }
- // 授权登录按钮回调
- const handleLogin = async () => {
- if (!admissNum.value) {
- uni.showToast({
- title: '请输入录取号',
- icon: 'none'
- })
- return
- }
- if (!cardId.value) {
- uni.showToast({
- title: '请输入身份证号',
- icon: 'none'
- })
- return
- }
- let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
- if (!reg.test(cardId.value)) {
- uni.showToast({
- title: '身份证号格式错误',
- icon: 'none'
- })
- return
- }
- const res = await loginReq({
- admissNum: admissNum.value,
- cardId: cardId.value
- })
- // console.log(res)
- if (res.code == 200) {
- uni.setStorageSync('studentInfo', res.data)
- uni.setStorageSync('TOKEN', res.data.token)
- if (pageValue.value == 1) {
- const studentInfo = uni.getStorageSync('studentInfo')
- if (studentInfo.fillStatus == '已填报') {
- uni.reLaunch({
- url: '/pages/myMsg/myMsg'
- })
- } else {
- uni.reLaunch({
- url: '/pages/read/read'
- })
- }
- } else if (pageValue.value == 2 || pageValue.value == 3) {
- let { isPay } = res.data
- // console.log(isPay)
- if (isPay == 0) {
- popup.value.open()
- } else if (isPay == 1) {
- if (pageValue.value == 2) {
- uni.reLaunch({
- url: '/pages/select/select'
- })
- } else {
- uni.reLaunch({
- url: '/pages/subscribe/subscribe'
- })
- }
- } else {
- uni.showToast({
- title: '暂无缴费信息',
- icon: 'none'
- })
- }
- } else {
- uni.setStorageSync('token', '')
- uni.reLaunch({
- url: '/pages/404/404?message=暂无页面'
- })
- }
- }
- }
- // 弹窗关闭图标回调
- const handleClose = () => {
- popup.value.close()
- }
- // 去完成缴费回调
- const handleFinish = () => {
- window.location.href = `https://pay.ncjti.edu.cn`
- }
- </script>
- <style lang="scss" scoped>
- .container {
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: center;
- box-sizing: border-box;
- padding: 0 20rpx;
- width: 100%;
- min-height: 100vh;
- background: linear-gradient(180deg, rgba(242, 247, 255, 1) 0%, rgba(242, 247, 255, 0) 100%);
- overflow: hidden;
- .logo {
- margin-top: 80rpx;
- width: 143rpx;
- height: 143rpx;
- }
- .title {
- margin-top: 28rpx;
- font-size: 40rpx;
- font-weight: bold;
- }
- .box {
- margin-bottom: 40rpx;
- width: 100%;
- .box_text {
- margin-left: 30rpx;
- font-size: 28rpx;
- }
- .box_input {
- padding: 0 40rpx;
- margin-top: 10rpx;
- height: 100rpx;
- border-radius: 8rpx;
- background-color: #fff;
- .input {
- height: 100%;
- }
- }
- }
- .btn {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-top: 260rpx;
- width: 100%;
- height: 100rpx;
- border-radius: 8rpx;
- font-size: 32rpx;
- color: #fff;
- background-color: #ccc;
- }
- .active {
- background-color: #0061ff;
- }
- .logo_bg {
- position: absolute;
- top: -50rpx;
- right: -45rpx;
- width: 589rpx;
- height: 320rpx;
- }
- .pop {
- position: relative;
- box-sizing: border-box;
- padding: 150rpx 20rpx 50rpx;
- width: 659rpx;
- height: 728rpx;
- border-radius: 15rpx;
- background: linear-gradient(180deg, #ebf2ff 0%, #ffffff 100%);
- .pop_img {
- position: absolute;
- top: -103rpx;
- left: 227rpx;
- width: 206rpx;
- height: 206rpx;
- }
- .pop_close {
- position: absolute;
- top: 19rpx;
- right: 29rpx;
- }
- .pop_title {
- margin-bottom: 28rpx;
- font-size: 32rpx;
- font-weight: bold;
- }
- .pop_text {
- font-size: 28rpx;
- line-height: 50rpx;
- }
- .pop_btn {
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 90rpx auto 0;
- width: 543rpx;
- height: 100rpx;
- color: #fff;
- font-size: 32rpx;
- border-radius: 8rpx;
- background-color: #0061ff;
- }
- }
- }
- </style>
|