|
@@ -13,7 +13,14 @@
|
|
|
<div class="carousel">
|
|
|
<el-carousel height="395px" ref="carousel">
|
|
|
<el-carousel-item v-for="(item, index) in srcData" :key="index" @click="router.push({ name: 'tpxwDetails', params: { id: item.id } })">
|
|
|
- <img :src="item.url" class="topImg" />
|
|
|
+ <!-- <img :src="item.url" class="topImg" /> -->
|
|
|
+ <el-image class="topImg" :src="item.url" fit="scale-down">
|
|
|
+ <template #error>
|
|
|
+ <div class="image-slot">
|
|
|
+ <el-icon><icon-picture /></el-icon>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-image>
|
|
|
<div class="carousel_footer" :title="item.bt">
|
|
|
<div class="carousel_title title_overflow">{{ item.bt }}</div>
|
|
|
</div>
|
|
@@ -139,7 +146,7 @@
|
|
|
<el-tabs v-model="activeName2">
|
|
|
<el-tab-pane v-for="(item, indexd) in XZ094" :label="item.label" :name="item.value">
|
|
|
<div class="flex_column" style="height: 100%" v-if="changZcData(bsData, activeName2).length > 0">
|
|
|
- <div @click="router.push({name:'bsznDetails',params:{ id: item.id } })" class="flex bor_bt" v-for="(item, index) in changZcData(bsData, activeName2).slice(0, 5)" :key="index">
|
|
|
+ <div @click="router.push({ name: 'bsznDetails', params: { id: item.id } })" class="flex bor_bt" v-for="(item, index) in changZcData(bsData, activeName2).slice(0, 5)" :key="index">
|
|
|
<div class="flex" style="width: 100%" v-if="indexd === 0">
|
|
|
<div class="title_type gr" v-if="item.sfl === '1'">个人</div>
|
|
|
<div class="title_type jg" v-else-if="item.sfl === '2'">机构</div>
|
|
@@ -205,7 +212,7 @@
|
|
|
<div class="rd_title">用户中心</div>
|
|
|
</div>
|
|
|
<div class="rd_center flex_row">
|
|
|
- <div class="user_big">
|
|
|
+ <!-- <div class="user_big">
|
|
|
<img src="../../assets/images/addUser.png" style="width: 31px; height: 29px" />
|
|
|
<el-link :href="hrefLogin" :underline="false" class="zl_title" target="_blank">新用户注册</el-link>
|
|
|
</div>
|
|
@@ -216,18 +223,66 @@
|
|
|
<div class="user_login">
|
|
|
<img src="../../assets/images/adminLogin.png" style="width: 31px; height: 31px" />
|
|
|
<el-link :href="hrefLogin" :underline="false" class="zl_title" target="_blank">管理员登录</el-link>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
+ <el-form ref="loginFormRef" :model="loginForm" :rules="loginRules" label-width="120px" class="demo-ruleForm" :size="formSize" status-icon>
|
|
|
+ <el-form-item prop="username">
|
|
|
+ <el-input v-model="loginForm.username" placeholder="账号" type="text">
|
|
|
+ <template v-slot:prefix>
|
|
|
+ <div style="font-size: 20px">
|
|
|
+ <!-- 由于SVG图标默认不携带任何属性 -->
|
|
|
+ <!-- 你需要直接提供它们 -->
|
|
|
+ <User style="width: 0.8em; height: 0.8em; margin-right: 5px" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="password">
|
|
|
+ <el-input v-model="loginForm.password" placeholder="密码" type="password">
|
|
|
+ <template v-slot:prefix>
|
|
|
+ <div style="font-size: 20px">
|
|
|
+ <!-- 由于SVG图标默认不携带任何属性 -->
|
|
|
+ <!-- 你需要直接提供它们 -->
|
|
|
+ <Lock style="width: 0.8em; height: 0.8em; margin-right: 5px" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="code">
|
|
|
+ <el-input v-model="loginForm.code" placeholder="验证码" style="width: 50%">
|
|
|
+ <template v-slot:prefix>
|
|
|
+ <div style="font-size: 20px">
|
|
|
+ <Setting style="width: 0.8em; height: 0.8em; margin-right: 5px" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ <div class="login-code">
|
|
|
+ <img :src="codeUrl" @click="getCode" class="login-code-img" />
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-checkbox v-model="loginForm.rememberMe" style="margin: 0px 0px 15px 0px">记住密码</el-checkbox>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="danger" @click.prevent="handleLogin(loginFormRef)">登录</el-button>
|
|
|
+ <!-- <el-link :href="hrefLogin" :underline="false" class="zl_title" target="_blank" @click.prevent="handleLogin(loginFormRef)">普通用户登录</el-link> -->
|
|
|
+ <el-link :href="hrefLogin" :underline="false" class="zl_title" target="_blank">管理员登录</el-link>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
-import { ref, onMounted } from 'vue'
|
|
|
-import { useRouter } from 'vue-router'
|
|
|
+<script setup >
|
|
|
+import { ref, onMounted, reactive, getCurrentInstance, watch } from 'vue'
|
|
|
+import { useRouter,useRoute } from 'vue-router'
|
|
|
+import { Picture as IconPicture } from '@element-plus/icons-vue'
|
|
|
+import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
|
+import { useStore } from "vuex"
|
|
|
+import Cookies from 'js-cookie'
|
|
|
let router = useRouter()
|
|
|
-import { lbList, rdList, ttList, zcList, wlList, bsList } from '@/api/home'
|
|
|
+let route = useRoute()
|
|
|
+let store = useStore()
|
|
|
+import { lbList, rdList, ttList, zcList, wlList, bsList, getCodeImg } from '@/api/home'
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
const { XZ085, XZ086, XZ093, XZ094 } = proxy.useDict('XZ085', 'XZ086', 'XZ093', 'XZ094')
|
|
|
const hrefLogin = ref('http://mz.tshe.cn:801/login')
|
|
@@ -243,21 +298,99 @@ const jgData = ref([
|
|
|
{ src: new URL('../../assets/images/jg5.png', import.meta.url).href, label: '助餐服务点' },
|
|
|
{ src: new URL('../../assets/images/jg6.png', import.meta.url).href, label: '护理院/站' }
|
|
|
])
|
|
|
+let loading = ref(false)
|
|
|
const xwData = ref([])
|
|
|
const bsData = ref([])
|
|
|
const srcData = ref([])
|
|
|
const zcData = ref([])
|
|
|
const rdData = ref([])
|
|
|
-const carousel = ref(null);
|
|
|
+const carousel = ref(null)
|
|
|
+let redirect = ref(undefined)
|
|
|
+const loginForm = reactive({
|
|
|
+ username: '',
|
|
|
+ password: '',
|
|
|
+ code: '',
|
|
|
+ uuid: '',
|
|
|
+ rememberMe: false
|
|
|
+})
|
|
|
+const formSize = ref('default')
|
|
|
+const loginFormRef = ref(null)
|
|
|
+const loginRules = reactive({
|
|
|
+ username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
|
|
+ password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
|
|
|
+ code: [{ required: true, message: '请输入验证码', trigger: 'blur' }]
|
|
|
+})
|
|
|
+
|
|
|
+let codeUrl = ref('')
|
|
|
+let captchaOnOff = ref(true)
|
|
|
+
|
|
|
+function getCookie() {
|
|
|
+ const username = Cookies.get('username')
|
|
|
+ const password = Cookies.get('password')
|
|
|
+ const rememberMe = Cookies.get('rememberMe')
|
|
|
+ loginForm = {
|
|
|
+ username: username === undefined ? loginForm.username : username,
|
|
|
+ password: password === undefined ? loginForm.password : decrypt(password),
|
|
|
+ rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+watch( route, (newVal) => {
|
|
|
+ console.log(newVal,'route');
|
|
|
+ redirect.value = route.query && route.query.redirect;
|
|
|
+ console.log(redirect.value,'redirect.value');
|
|
|
+
|
|
|
+},{ immediate: true, deep: true } )
|
|
|
+
|
|
|
+const handleLogin = async () => {
|
|
|
+ if (!loginFormRef) return
|
|
|
+ await loginFormRef.value.validate( (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ loading.value = true
|
|
|
+ if (loginForm.rememberMe) {
|
|
|
+ Cookies.set('username', loginForm.username, { expires: 30 })
|
|
|
+ Cookies.set('password', encrypt(loginForm.password), { expires: 30 })
|
|
|
+ Cookies.set('rememberMe', loginForm.rememberMe, { expires: 30 })
|
|
|
+ } else {
|
|
|
+ Cookies.remove('username')
|
|
|
+ Cookies.remove('password')
|
|
|
+ Cookies.remove('rememberMe')
|
|
|
+ }
|
|
|
+ store
|
|
|
+ .dispatch('Login', loginForm)
|
|
|
+ .then((res) => {
|
|
|
+ console.log('吃了吗');
|
|
|
+ console.log(res,'res');
|
|
|
+ // router.push({ path: redirect.value || '/' }).catch(() => {})
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ loading.value = false
|
|
|
+ if (captchaOnOff.value) {
|
|
|
+ getCode()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function getCode() {
|
|
|
+ getCodeImg().then((res) => {
|
|
|
+ captchaOnOff.value = res.captchaOnOff === undefined ? true : res.captchaOnOff
|
|
|
+ if (captchaOnOff.value) {
|
|
|
+ codeUrl.value = 'data:image/gif;base64,' + res.img
|
|
|
+ loginForm.uuid = res.uuid
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
// 图片新闻
|
|
|
function getLbList() {
|
|
|
lbList().then((res) => {
|
|
|
srcData.value = res.rows
|
|
|
//处理刚开始显示空白页
|
|
|
- setTimeout(()=>{
|
|
|
+ setTimeout(() => {
|
|
|
carousel.value.setActiveItem(0)
|
|
|
- },500)
|
|
|
+ }, 500)
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -354,6 +487,7 @@ onMounted(() => {
|
|
|
getZcList()
|
|
|
getWlList()
|
|
|
getBsList()
|
|
|
+ getCode()
|
|
|
})
|
|
|
</script>
|
|
|
<style></style>
|
|
@@ -792,4 +926,47 @@ onMounted(() => {
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
}
|
|
|
+
|
|
|
+.image-slot {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background: var(--el-fill-color-light);
|
|
|
+ color: var(--el-text-color-secondary);
|
|
|
+ font-size: 50px;
|
|
|
+}
|
|
|
+.image-slot .el-icon {
|
|
|
+ font-size: 50px;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-form) {
|
|
|
+ width: 80%;
|
|
|
+}
|
|
|
+:deep(.el-form-item) {
|
|
|
+ margin-bottom: 16px;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-form-item__content) {
|
|
|
+ margin-left: 0px !important;
|
|
|
+}
|
|
|
+
|
|
|
+.login-code {
|
|
|
+ width: 33%;
|
|
|
+ height: 38px;
|
|
|
+ float: right;
|
|
|
+ margin-left: 15px;
|
|
|
+}
|
|
|
+.login-code img {
|
|
|
+ cursor: pointer;
|
|
|
+ vertical-align: middle;
|
|
|
+}
|
|
|
+.login-code-img {
|
|
|
+ height: 38px;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-form-item__content){
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
</style>
|