123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505 |
- <script setup lang="ts">
- import { md5 } from 'js-md5'
- import CpmdHeader from '@/components/CpmdHeader.vue';
- import { ElMessage } from 'element-plus';
- import { onMounted, onUnmounted, reactive, ref } from 'vue'
- import { useRoute, useRouter } from 'vue-router'
- import { loginTestApi, userLoginApi } from '@/api/login';
- import { userInfoStore } from '@/stores'
- const userInfo = userInfoStore()
- //定义账号
- const account = ref<string>('')
- //定义密码
- const password = ref<string>('')
- //此处应该是唯一的报告ID
- const id = ref<string>('')
- //持久化设置 菜单状态
- //刚进入页面就将高度设置为页面需要的
- onMounted(async () => {
- //调用查看是否是演示版的接口
- const res: any = await loginTestApi()
- if (res.code == 200) {
- if (res.msg == 'test') {
- isTest.value = true
- } else {
- isTest.value = false
- }
- } else {
- ElMessage({ message: `${res.msg}`, type: 'error' })
- }
- })
- //跳转到注册页面的方法
- const router = useRouter()
- const registerFun = () => {
- router.push({ name: 'register' })
- }
- const isTest = ref<boolean>(false)
- //轮旋切换页面的方法
- //退出页面销毁 方法
- onUnmounted(async () => {
- })
- const loginTest = async () => {
- let params = {
- userNo: '20250126386',
- password: md5('123456')
- }
- const res: any = await userLoginApi(params)
- if (res.code == 200) {
- if (res.data.type == '1' || res.data.type == '2') {
- userInfo.saveToken(res.data.token)
- userInfo.saveUserInfo(res.data.user)
- ElMessage({ message: `${res.msg}`, type: 'success' })
- //跳转到首页
- router.push({ name: 'homeView' })
- } else {
- ElMessage({ message: `请使用普通账户登录`, type: 'error' })
- }
- //登录成功后将信息存入缓存
- } else {
- ElMessage({ message: `${res.msg}`, type: 'error' })
- }
- //登录成功后将信息存入缓存
- }
- //登录方法
- const loginFun = async () => {
- //先判断是否是字段都填写了
- if (account.value == '') {
- ElMessage({
- message: '账号不能为空',
- type: 'warning'
- })
- return
- }
- if (password.value == '') {
- ElMessage({
- message: '密码不能为空',
- type: 'warning'
- })
- return
- } else if (password.value.length < 6) {
- ElMessage({
- message: '密码最少6位',
- type: 'warning'
- })
- return
- }
- let params = {
- userNo: account.value,
- password: md5(password.value)
- }
- const res: any = await userLoginApi(params)
- if (res.code == 200) {
- if (res.data.type == '1' || res.data.type == '2') {
- userInfo.saveToken(res.data.token)
- userInfo.saveUserInfo(res.data.user)
- ElMessage({ message: `${res.msg}`, type: 'success' })
- //跳转到首页
- router.push({ name: 'homeView' })
- } else {
- ElMessage({ message: `请使用普通账户登录`, type: 'error' })
- }
- //登录成功后将信息存入缓存
- } else {
- ElMessage({ message: `${res.msg}`, type: 'error' })
- }
- }
- </script>
- <template>
- <div class="home_header_out">
- <div class=" home_header_inner">
- <CpmdHeader />
- </div>
- <div class="leave_message">
- <!-- <img class="img" src="../assets/zs/community.png" alt=""> -->
- <div class="font_blue"> 用户登录 </div>
- </div>
- <div class="kply">
- <div class="kply_inner">
- <div class="login_top">
- <span class="des">用户登录</span>
- </div>
- <div style="padding: 20px 50px;">
- <div style="margin-top:10px">
- <div class="user_account">账号:</div>
- <div class="input_cus"> <el-input v-model="account" style="width: 100%" placeholder="请输入账号" />
- </div>
- </div>
- <div style="margin-top:10px">
- <div class="user_account">密码:</div>
- <div><el-input v-model="password" type="password" style="width: 100%" placeholder="请输入密码"
- show-password />
- </div>
- </div>
- <div class="go_register">
- <span @click="registerFun">
- 没有账号,去注册
- </span>
- </div>
- <div class="start_button_out">
- <div @click="loginFun" class="start_button_self">登录</div>
- </div>
- <div v-show="isTest">
- <el-divider>
- 演示账号一键登录
- </el-divider>
- </div>
- <div style="text-align: center;" v-show="isTest">
- <el-button size="small" @click="loginTest">演示账号一键登录</el-button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <style lang="scss" scoped>
- :deep(.el-input__wrapper) {
- align-items: center;
- border-radius: 0px !important;
- border: 1px solid #00DE7E !important;
- padding-left: 20px;
- box-shadow: none
- }
- :deep(.el-input__wrapper.is-focus) {
- box-shadow: none
- }
- :deep(.el-input__inner) {
- height: 36px;
- font-size: 16px;
- }
- .home_header_out {
- scroll-snap-align: start;
- // position: relative;
- padding-bottom: 60px;
- width: 100%;
- min-width: 1200px;
- // background-image: url('../assets/home/bg_ty.png');
- background-repeat: no-repeat;
- background-size: 100% auto;
- // background-size: auto 100%;
- // background-color: #B3F1DA; //估计是需要动态
- flex: 1;
- //获取屏幕宽度home_header_out 这个div的宽度--然后宽度*1000再除1920即为当前div的宽度
- .home_header_inner {
- min-height: 1;
- left: 0;
- right: 0;
- margin: auto;
- // height: 100px;
- width: 100%;
- .report_top {
- width: 650px;
- margin-left: 285px;
- margin-top: 20px;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- // margin-left: 170px;
- .xlts_img {
- width: 200px;
- }
- .report_jt {
- display: flex;
- flex-direction: column;
- font-size: 20px;
- font-weight: 700;
- letter-spacing: 3px;
- margin: auto;
- }
- }
- }
- .leave_message {
- left: 0;
- right: 0;
- margin: auto;
- width: 650px;
- margin-bottom: 20px;
- margin-top: 20px;
- .font_blue {
- position: relative;
- color: #00DE7E;
- font-weight: 700;
- font-size: 22px;
- font-family: 'Rammetto One-Regular';
- padding-top: 30px;
- z-index: 10;
- background: url(../assets/zs/login_text1.png) no-repeat;
- background-size: auto 50px;
- }
- }
- .kply {
- width: 100%;
- margin-top: 20px;
- // background-color: #FAFAFA;
- // margin-bottom: 112px;
- .kply_inner {
- left: 0;
- right: 0;
- margin: auto;
- width: 650px;
- min-height: 360px;
- background-color: #ffffff;
- border-radius: 5px;
- box-shadow: 0px 4px 32px 0px rgba(0, 0, 0, 0.17);
- .login_top {
- background-color: #3B3B3B;
- line-height: 50px;
- .des {
- color: #ffffff;
- font-weight: 700;
- margin-left: 50px;
- background-image: url('../assets/zs/login_line.png');
- background-repeat: no-repeat;
- background-size: contain;
- padding-bottom: 6px;
- background-position: bottom;
- }
- }
- .user_account {
- font-size: 18px;
- // line-height: 70px;
- margin-bottom: 10px;
- letter-spacing: 5px;
- }
- .start_button_out {
- margin-top: 40px;
- margin-bottom: 20px;
- display: flex;
- flex-direction: row;
- justify-content: center;
- .start_button_self {
- cursor: pointer;
- // width: 100px;
- border-radius: 4px;
- border: 1px solid #48D68E;
- color: #ffffff;
- background-color: #3B3B3B;
- margin-right: 20px;
- padding: 5px 50px;
- cursor: pointer;
- display: flex;
- align-items: center;
- font-size: 16px;
- }
- }
- }
- .go_register {
- text-align: right;
- margin-top: 20px;
- span {
- font-weight: 700;
- color: #00DE7E;
- cursor: pointer;
- font-size: 16px;
- }
- }
- }
- }
- .home_mid {
- // background-color: blanchedalmond;
- width: 1200px;
- left: 0;
- right: 0;
- margin: auto;
- margin-top: 40px;
- // position: relative;
- .kepu_title {
- text-align: center;
- font-size: 50px;
- color: #111111;
- line-height: 95px;
- // width: 100%;
- // left: 0;
- // right: 0;
- // margin: auto
- }
- .kepu_title_sub {
- margin-top: 30px;
- text-align: center;
- font-size: 28px;
- color: #48D68E;
- line-height: 26px;
- }
- .man1_group {
- margin-top: 60px;
- height: 100%;
- display: flex;
- .man1 {
- position: relative;
- width: 327px;
- // height: 100%;
- // height: 100%
- .man1_img {
- position: absolute;
- bottom: 0;
- /* bottom: 0px; */
- /* height: auto; */
- width: 100%;
- left: 100px
- }
- }
- .des {
- border: #48D68E solid 5px;
- border-radius: 40px;
- padding: 20px;
- letter-spacing: 6px;
- flex: 1;
- .des_inner {
- border: 1px dashed #48D68E;
- border-radius: 40px;
- padding-bottom: 40px;
- padding-top: 30px;
- padding-left: 100px;
- padding-right: 20px;
- letter-spacing: 6px;
- font-weight: normal;
- font-size: 24px;
- color: #333333;
- line-height: 40px;
- }
- }
- }
- .man2_group {
- margin-top: 60px;
- height: 100%;
- display: flex;
- .man2 {
- position: relative;
- width: 327px;
- // height: 100%;
- // height: 100%
- .man2_img {
- position: absolute;
- bottom: 0;
- /* bottom: 0px; */
- /* height: auto; */
- width: 100%;
- left: -100px
- }
- }
- .des2 {
- border: #48D68E solid 5px;
- border-radius: 40px;
- padding: 20px;
- letter-spacing: 6px;
- flex: 1;
- .des2_inner {
- border: 1px dashed #48D68E;
- border-radius: 40px;
- padding-bottom: 40px;
- padding-top: 30px;
- padding-left: 20px;
- padding-right: 100px;
- letter-spacing: 6px;
- font-weight: normal;
- font-size: 24px;
- color: #333333;
- line-height: 40px;
- }
- }
- }
- .get_more {
- text-align: center;
- img {
- width: 300px;
- margin-top: 60px;
- margin-bottom: 60px;
- }
- }
- }
- // .home_footer_out {
- // width: 100%;
- // background-color: #000000;
- // }</style>
|