123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- <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 { 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(() => {
- })
- //跳转到注册页面的方法
- const router = useRouter()
- const registerFun = () => {
- router.push({ name: 'register' })
- }
- //轮旋切换页面的方法
- //退出页面销毁 方法
- onUnmounted(() => {
- })
- //登录方法
- 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 == '3') {
- 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 class="report_top">
- <div class="report_jt">
- <span>用户登录</span>
- </div>
- <!-- <img class="xlts_img" src="../assets/report/report_top.png" /> -->
- </div>
- </div>
- <div class="kply">
- <div class="kply_inner">
- <div style="padding: 20px 200px;">
- <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>
- </div>
- </div>
- </div>
- </template>
- <style lang="scss" scoped>
- :deep(.el-input__wrapper) {
- align-items: center;
- border-radius: 60px !important;
- border: 8px solid #B2F2D2 !important;
- padding-left: 20px;
- }
- :deep(.el-input__wrapper .is-fous) {
- box-shadow: none
- }
- :deep(.el-input__inner) {
- height: 40px;
- font-size: 20px;
- }
- .home_header_out {
- // position: relative;
- padding-bottom: 60px;
- width: 100%;
- min-width: 1200px;
- background-image: url('../assets/home/bg_ty.png');
- background-repeat: no-repeat;
- background-size: contain;
- background-color: #FAFAFA; //估计是需要动态
- //获取屏幕宽度home_header_out 这个div的宽度--然后宽度*1000再除1920即为当前div的宽度
- .home_header_inner {
- min-height: 1;
- left: 0;
- right: 0;
- margin: auto;
- // height: 100px;
- width: 1200px;
- .report_top {
- width: 860px;
- 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: 40px;
- font-weight: 700;
- letter-spacing: 3px;
- }
- }
- }
- .kply {
- width: 100%;
- margin-top: 20px;
- // background-color: #FAFAFA;
- margin-bottom: 112px;
- .kply_inner {
- // padding: 20px 20px;
- left: 0;
- right: 0;
- margin: auto;
- width: 860px;
- min-height: 500px;
- background-color: #ffffff;
- border-radius: 40px;
- .user_account {
- font-size: 24px;
- // line-height: 70px;
- margin-bottom: 10px;
- letter-spacing: 5px;
- }
- .start_button_out {
- margin-top: 60px;
- margin-bottom: 40px;
- display: flex;
- flex-direction: row;
- justify-content: center;
- .start_button_self {
- cursor: pointer;
- // width: 100px;
- border-radius: 12px;
- border: 3px solid #48D68E;
- color: #ffffff;
- background-color: #000000;
- margin-right: 20px;
- padding: 5px 80px;
- cursor: pointer;
- display: flex;
- align-items: center;
- font-size: 18px;
- }
- }
- }
- .go_register {
- text-align: right;
- margin-top: 20px;
- span {
- color: #48D68E;
- cursor: pointer;
- font-size: 20px;
- }
- }
- }
- }
- .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>
|