提交 8d606fe5 authored 作者: 龙菲's avatar 龙菲

优化路由间切换从顶部开始;优化列表页的搜索;优化登录流程

上级 35b0c198
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
<router-view v-if="$route.meta.keepAlive"></router-view> <router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive> </keep-alive>
<router-view v-if="!$route.meta.keepAlive"></router-view> --> <router-view v-if="!$route.meta.keepAlive"></router-view> -->
<el-backtop :bottom="100" :right="80"></el-backtop> <el-backtop :bottom="100" :right="80">
<svg-icon icon-class="backToTop"></svg-icon>
</el-backtop>
<Footer /> <Footer />
</div> </div>
</template> </template>
......
...@@ -59,7 +59,13 @@ ...@@ -59,7 +59,13 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog :visible.sync="loginVisible" append-to-body> <el-dialog
:visible.sync="loginVisible"
append-to-body
v-loading="loading"
element-loading-background="rgba(0, 0, 0, 0.5)"
:element-loading-text="loadingText"
>
<div slot="title" class="login-title"> <div slot="title" class="login-title">
<div <div
:class="['title-item', isLoginByUsername ? 'active' : '']" :class="['title-item', isLoginByUsername ? 'active' : '']"
...@@ -135,7 +141,6 @@ ...@@ -135,7 +141,6 @@
round round
@click="handleLoginSubmit" @click="handleLoginSubmit"
size="small" size="small"
:loading="loading"
class="loginBtn" class="loginBtn"
>登 陆</el-button >登 陆</el-button
> >
...@@ -193,8 +198,8 @@ export default { ...@@ -193,8 +198,8 @@ export default {
if (value.params.themeType) { if (value.params.themeType) {
this.$store.commit("app/CHANGE_NAV_COLOR", value.params.themeType); this.$store.commit("app/CHANGE_NAV_COLOR", value.params.themeType);
}else{ } else {
this.$store.commit("app/CHANGE_NAV_COLOR", '1'); this.$store.commit("app/CHANGE_NAV_COLOR", "1");
} }
}, },
immediate: true, immediate: true,
...@@ -282,6 +287,7 @@ export default { ...@@ -282,6 +287,7 @@ export default {
captcha: [{ required: true, trigger: "blur", message: "请输入验证码" }], captcha: [{ required: true, trigger: "blur", message: "请输入验证码" }],
}, },
isLoginByUsername: true, isLoginByUsername: true,
loadingText: "",
}; };
}, },
mounted() { mounted() {
...@@ -340,6 +346,7 @@ export default { ...@@ -340,6 +346,7 @@ export default {
if (valid) { if (valid) {
// debugger // debugger
this.loading = true; this.loading = true;
this.loadingText = "正在登陆";
const { account, password, captcha } = this.loginForm; const { account, password, captcha } = this.loginForm;
const params = { const params = {
captcha, captcha,
...@@ -362,6 +369,7 @@ export default { ...@@ -362,6 +369,7 @@ export default {
} }
} }
this.loading = false; this.loading = false;
this.$message.success("登录成功");
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
...@@ -377,7 +385,7 @@ export default { ...@@ -377,7 +385,7 @@ export default {
handleCloseLogin() { handleCloseLogin() {
this.loginVisible = false; this.loginVisible = false;
this.$refs["loginForm"].resetFields; this.$refs["loginForm"].resetFields;
}, },
handleGetCaptcha() { handleGetCaptcha() {
this.currdatetime = new Date().getTime(); this.currdatetime = new Date().getTime();
...@@ -453,7 +461,7 @@ export default { ...@@ -453,7 +461,7 @@ export default {
.logo-container { .logo-container {
width: 380px; width: 380px;
height: 74px; height: 74px;
img{ img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
...@@ -529,7 +537,7 @@ export default { ...@@ -529,7 +537,7 @@ export default {
} }
} }
::v-deep .el-button.is-round{ ::v-deep .el-button.is-round {
padding: 8px 20px; padding: 8px 20px;
} }
.el-dropdown-menu { .el-dropdown-menu {
......
...@@ -70,5 +70,6 @@ export default { ...@@ -70,5 +70,6 @@ export default {
} }
.searchButton{ .searchButton{
width: 300px; width: 300px;
} }
</style> </style>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1665301449218" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3204" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M832 64H192c-17.6 0-32 14.4-32 32s14.4 32 32 32h640c17.6 0 32-14.4 32-32s-14.4-32-32-32zM852.484 519.469L538.592 205.577a30.79 30.79 0 0 0-3.693-4.476c-6.241-6.241-14.556-9.258-22.899-9.09-8.343-0.168-16.658 2.849-22.899 9.09a30.778 30.778 0 0 0-3.693 4.476L171.419 519.566C164.449 525.448 160 534.228 160 544c0 0.058 0.004 0.115 0.004 0.172-0.124 8.285 2.899 16.529 9.096 22.727 6.202 6.202 14.453 9.224 22.743 9.096 0.066 0 0.131 0.005 0.197 0.005H352v320c0 35.2 28.8 64 64 64h192c35.2 0 64-28.8 64-64V576h160c0.058 0 0.115-0.004 0.172-0.004 8.285 0.124 16.529-2.899 22.727-9.096 6.198-6.198 9.22-14.442 9.096-22.727 0-0.058 0.004-0.115 0.004-0.172 0.001-9.826-4.489-18.65-11.515-24.532z" p-id="3205"></path></svg>
\ No newline at end of file
...@@ -128,7 +128,13 @@ const routes = [ ...@@ -128,7 +128,13 @@ const routes = [
] ]
const router = new VueRouter({ const router = new VueRouter({
routes routes,
scrollBehavior(to, from, savePosition) {
// return 期望滚动到哪个的位置
return {
y: 0
}
}
}) })
export default router export default router
...@@ -427,10 +427,11 @@ export default { ...@@ -427,10 +427,11 @@ export default {
} }
}, },
handleToDetail(crId) { handleToDetail(crId) {
const newPage = this.$router.resolve({ // const newPage = this.$router.resolve({
path: `culturalReli/${crId}`, // path: `culturalReli/${crId}`,
}); // });
window.open(newPage.href, "_blank"); // window.open(newPage.href, "_blank");
this.$router.push(`culturalRelic/${crId}`)
}, },
// 点击音频 // 点击音频
handleClickAudio() { handleClickAudio() {
...@@ -466,10 +467,11 @@ export default { ...@@ -466,10 +467,11 @@ export default {
handleToCr(item) { handleToCr(item) {
const { crId } = item; const { crId } = item;
const newPage = this.$router.resolve({ // const newPage = this.$router.resolve({
path: "/culturalRelic/" + crId, // path: "/culturalRelic/" + crId,
}); // });
window.open(newPage.href, "_blank"); // window.open(newPage.href, "_blank");
this.$router.push(`culturalRelic/${crId}`)
}, },
}, },
}; };
...@@ -681,7 +683,7 @@ $blue: #2069c4; ...@@ -681,7 +683,7 @@ $blue: #2069c4;
.basic-info { .basic-info {
.body-item { .body-item {
display: flex; display: flex;
align-items: center; align-items: flex-start;
margin-bottom: 10px; margin-bottom: 10px;
.label { .label {
display: flex; display: flex;
......
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
this.culturalRelicYears = res.culturalRelicYears; this.culturalRelicYears = res.culturalRelicYears;
traveseYears(this.culturalRelicYears); traveseYears(this.culturalRelicYears);
function traveseYears(arr) { function traveseYears(arr) {
if (arr &&arr.length > 0) { if (arr && arr.length > 0) {
arr.map((item) => { arr.map((item) => {
if (item.children && item.children.length == 0) { if (item.children && item.children.length == 0) {
delete item.children; delete item.children;
...@@ -286,10 +286,11 @@ export default { ...@@ -286,10 +286,11 @@ export default {
handleClick(item) { handleClick(item) {
const { crId } = item; const { crId } = item;
const newPage = this.$router.resolve({ // const newPage = this.$router.resolve({
path: "culturalRelic/" + crId, // path: "culturalRelic/" + crId,
}); // });
window.open(newPage.href, "_blank"); // window.open(newPage.href, "_blank");
this.$router.push(`culturalRelic/${crId}`);
}, },
handleClickThreeD() { handleClickThreeD() {
this.onlyShow3d = !this.onlyShow3d; this.onlyShow3d = !this.onlyShow3d;
...@@ -300,6 +301,7 @@ export default { ...@@ -300,6 +301,7 @@ export default {
handleTypeChange(value) { handleTypeChange(value) {
this.type = value; this.type = value;
this.list.current = 1;
this.loadData(); this.loadData();
}, },
handleYearsChange(value) { handleYearsChange(value) {
...@@ -308,6 +310,7 @@ export default { ...@@ -308,6 +310,7 @@ export default {
} else { } else {
this.years = value; this.years = value;
} }
this.list.current = 1;
this.loadData(); this.loadData();
this.$refs.years.dropDownVisible = false; this.$refs.years.dropDownVisible = false;
}, },
...@@ -410,7 +413,7 @@ $text-indent: 16px; ...@@ -410,7 +413,7 @@ $text-indent: 16px;
background: url("@/assets/imgs/list/search-button-bg.png") transparent; background: url("@/assets/imgs/list/search-button-bg.png") transparent;
background-size: 100% 100%; background-size: 100% 100%;
color: #444; color: #444;
font-size: 14px; font-size: 16px;
transition: all 0.2s ease; transition: all 0.2s ease;
&:hover { &:hover {
...@@ -606,6 +609,7 @@ $text-indent: 16px; ...@@ -606,6 +609,7 @@ $text-indent: 16px;
&::placeholder { &::placeholder {
text-indent: 10px; text-indent: 10px;
color: #999; color: #999;
font-size: 16px;
} }
} }
} }
......
...@@ -243,10 +243,11 @@ export default { ...@@ -243,10 +243,11 @@ export default {
handleClick(item) { handleClick(item) {
const { themeType, exhibitionId } = item; const { themeType, exhibitionId } = item;
const newPage = this.$router.resolve({ // const newPage = this.$router.resolve({
path: `display/${themeType}/${exhibitionId}`, // path: `display/${themeType}/${exhibitionId}`,
}); // });
window.open(newPage.href, "_blank"); // window.open(newPage.href, "_blank");
this.$router.push(`display/${themeType}/${exhibitionId}`);
}, },
defImg(e) { defImg(e) {
e.target.src = require("@/assets/404_images/no-pic.png"); e.target.src = require("@/assets/404_images/no-pic.png");
...@@ -254,6 +255,7 @@ export default { ...@@ -254,6 +255,7 @@ export default {
handleTypeChange(value) { handleTypeChange(value) {
this.type = value; this.type = value;
this.list.current = 1;
this.loadData(); this.loadData();
}, },
// handleKeyWordChange(value) { // handleKeyWordChange(value) {
...@@ -264,6 +266,7 @@ export default { ...@@ -264,6 +266,7 @@ export default {
handleRegionChange(value) { handleRegionChange(value) {
this.regionCode = value; this.regionCode = value;
this.$refs.region.dropDownVisible = false; this.$refs.region.dropDownVisible = false;
this.list.current = 1;
this.loadData(); this.loadData();
}, },
...@@ -345,7 +348,7 @@ $text-indent: 16px; ...@@ -345,7 +348,7 @@ $text-indent: 16px;
background: url("@/assets/imgs/list/search-button-bg.png"); background: url("@/assets/imgs/list/search-button-bg.png");
background-size: 100% 100%; background-size: 100% 100%;
color: #444; color: #444;
font-size: 14px; font-size: 16px;
width: 156px; width: 156px;
height: 54px; height: 54px;
&:hover { &:hover {
...@@ -441,7 +444,7 @@ $text-indent: 16px; ...@@ -441,7 +444,7 @@ $text-indent: 16px;
padding: 36px 30px; padding: 36px 30px;
transition: all 0.5s ease; transition: all 0.5s ease;
background: #fff; background: #fff;
.name { .name {
font-size: 22px; font-size: 22px;
font-weight: bold; font-weight: bold;
color: #2069c4; color: #2069c4;
...@@ -516,6 +519,7 @@ $text-indent: 16px; ...@@ -516,6 +519,7 @@ $text-indent: 16px;
&::placeholder { &::placeholder {
text-indent: 10px; text-indent: 10px;
color: #999; color: #999;
font-size: 16px;
} }
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="boutique"> <div class="boutique">
<el-carousel class="slider" autoplay arrow="nerver"> <el-carousel class="slider" autoplay arrow="nerver">
<el-carousel-item> <el-carousel-item>
<div> <div class="img-container">
<img src="@/assets/imgs/boutique/1.jpg" width="100%" /> <img src="@/assets/imgs/boutique/1.jpg" width="100%" />
</div> </div>
</el-carousel-item> </el-carousel-item>
...@@ -28,4 +28,13 @@ export default { ...@@ -28,4 +28,13 @@ export default {
height: 100vh; height: 100vh;
width: 100%; width: 100%;
} }
.img-container{
width: 100%;
height: 100%;
img{
width: 100%;
height: 100%;
object-fit: cover;
}
}
</style>> </style>>
\ No newline at end of file
...@@ -88,9 +88,11 @@ export default { ...@@ -88,9 +88,11 @@ export default {
}, },
handleClick(item) { handleClick(item) {
const { crId } = item; const { crId } = item;
this.$router.push({ // const newPage = this.$router.resolve({
path: "culturalRelic/" + crId, // path: `culturalRelic/${crId}`,
}); // });
// window.open(newPage.href, "_blank");
this.$router.push(`culturalRelic/${crId}`)
}, },
}, },
}; };
...@@ -178,7 +180,11 @@ $blue: #2069c4; ...@@ -178,7 +180,11 @@ $blue: #2069c4;
width: 100%; width: 100%;
padding: 16px; padding: 16px;
// background-color: rgba($color: #000000, $alpha: 0.2); // background-color: rgba($color: #000000, $alpha: 0.2);
background-image: linear-gradient(to top,rgba(0,0,0,0.5),rgba(0,0,0,0.2)); background-image: linear-gradient(
to top,
rgba(0, 0, 0, 0.5),
rgba(0, 0, 0, 0.2)
);
color: #fff; color: #fff;
transform: translateY(100px); transform: translateY(100px);
text-align: right; text-align: right;
......
...@@ -81,11 +81,12 @@ export default { ...@@ -81,11 +81,12 @@ export default {
console.log(-this.currentIndex * this.sliderItemWidth); console.log(-this.currentIndex * this.sliderItemWidth);
}, },
handleClick(item) { handleClick(item) {
console.log(item); const { exhibitionId, themeType } = item;
const { exhibitionId } = item; // const newPage = this.$router.resolve({
this.$router.push({ // path: `display/${themeType}/${exhibitionId}`,
path: "display/" + exhibitionId, // });
}); // window.open(newPage.href, "_blank");
this.$router.push(`display/${themeType}/${exhibitionId}`);
}, },
getSlideItemWidth() { getSlideItemWidth() {
setTimeout(() => { setTimeout(() => {
......
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
<div class="wrapper"> <div class="wrapper">
<div class="content wow animate__animated animate__fadeIn"> <div class="content wow animate__animated animate__fadeIn">
<div class="name">{{ curMuseum.name }}</div> <div class="name">{{ curMuseum.name }}</div>
<div class="intro" v-html="curMuseum.intro"> <div class="intro" v-html="curMuseum.intro"></div>
</div>
<!-- <div <!-- <div
class="entrance" class="entrance"
@click="handleClick(curMuseum)" @click="handleClick(curMuseum)"
...@@ -18,13 +16,16 @@ ...@@ -18,13 +16,16 @@
<span class="entrance-text">点击进入</span> <span class="entrance-text">点击进入</span>
<img src="@/assets/imgs/home/entrance-black.png" alt="" /> <img src="@/assets/imgs/home/entrance-black.png" alt="" />
</div> --> </div> -->
<EntranceIcon color="#000" @click.native="handleClick(curMuseum)"/> <EntranceIcon color="#000" @click.native="handleClick(curMuseum)" />
</div> </div>
<div class="map wow animate__animated animate__fadeInRight"> <div class="map wow animate__animated animate__fadeInRight">
<div id="map"></div> <div id="map"></div>
<transition enter-active-class="animate__animated animate__fadeInLeftBig" leave-active-class="animate__animated animate__fadeOutLeftBig"> <transition
enter-active-class="animate__animated animate__fadeInLeftBig"
leave-active-class="animate__animated animate__fadeOutLeftBig"
>
<div class="chart-refresh" v-if="regionName !== 'guizhou'"> <div class="chart-refresh" v-if="regionName !== 'guizhou'">
<i class="el-icon-refresh-left" @click="initChart()"></i> <i class="el-icon-refresh-left" @click="initChart()"></i>
</div> </div>
...@@ -106,7 +107,7 @@ export default { ...@@ -106,7 +107,7 @@ export default {
}); });
} }
}, },
initChart(data = this.museumList, name = 'guizhou', hasClick = true) { initChart(data = this.museumList, name = "guizhou", hasClick = true) {
let that = this; let that = this;
this.regionName = name; this.regionName = name;
...@@ -320,9 +321,13 @@ export default { ...@@ -320,9 +321,13 @@ export default {
}, },
handleClick(item) { handleClick(item) {
const { id } = item; const { id } = item;
// const newPage = this.$router.resolve({
// path: `museum/${id}`,
// });
// window.open(newPage.href, "_blank");
this.$router.push({ this.$router.push({
path: "museum/" + id, path: `museum/${id}`,
}); })
}, },
/* init() { /* init() {
echarts.registerMap("guizhou", guizhou); echarts.registerMap("guizhou", guizhou);
...@@ -404,6 +409,11 @@ export default { ...@@ -404,6 +409,11 @@ export default {
font-size: 14px; font-size: 14px;
font-weight: 300; font-weight: 300;
margin-bottom: 85px; margin-bottom: 85px;
overflow: hidden;
-webkit-line-clamp: 20;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
} }
.entrance { .entrance {
font-size: 16px; font-size: 16px;
......
...@@ -69,7 +69,11 @@ export default { ...@@ -69,7 +69,11 @@ export default {
} }
}, },
handleClick(item) { handleClick(item) {
window.open(item.url); this.$message(`即将打开${item.name}虚拟展厅...`)
setTimeout(()=>{
window.open(item.url);
},1000)
}, },
}, },
}; };
...@@ -92,7 +96,7 @@ $blue: #2069c4; ...@@ -92,7 +96,7 @@ $blue: #2069c4;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding: 60px 0 80px 0; padding: 100px 0 80px 0;
font-family: "Alibaba PuHuiTi"; font-family: "Alibaba PuHuiTi";
.ch { .ch {
font-size: 30px; font-size: 30px;
...@@ -123,7 +127,7 @@ $blue: #2069c4; ...@@ -123,7 +127,7 @@ $blue: #2069c4;
margin-bottom: 60px; margin-bottom: 60px;
width: 258px; width: 258px;
overflow: hidden; overflow: hidden;
-webkit-line-clamp: 3; -webkit-line-clamp: 4;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
</template> </template>
<script> <script>
// import NavBar from "@/components/NavBar";
// import Footer from "@/components/Footer";
import Boutique from "./components/Boutique.vue"; import Boutique from "./components/Boutique.vue";
import MuseumMap from "./components/MuseumMap.vue"; import MuseumMap from "./components/MuseumMap.vue";
import Virtural from "./components/Virtural.vue"; import Virtural from "./components/Virtural.vue";
...@@ -19,20 +17,12 @@ import CulturalRelic from "./components/CulturalRelic.vue"; ...@@ -19,20 +17,12 @@ import CulturalRelic from "./components/CulturalRelic.vue";
export default { export default {
name: "Home", name: "Home",
components: { components: {
// NavBar,
// Footer,
MuseumMap, MuseumMap,
Boutique, Boutique,
Virtural, Virtural,
Display, Display,
CulturalRelic, CulturalRelic,
}, },
// data() {
// return {
// headerFixed: false,
// };
// },
}; };
</script> </script>
......
<!-- --> <!-- -->
<template> <template>
<div class="display-detail"> <div class="museum-detail">
<div class="wrapper"> <div class="wrapper">
<div class="back" @click="handleBack"> <!-- <div class="back" @click="handleBack">
<svg-icon icon-class="mz-fh"></svg-icon> <svg-icon icon-class="mz-fh"></svg-icon>
<span>返回上页 </span> <span>返回上页 </span>
</div> </div> -->
<el-row class="detail-container" :gutter="10"> <el-row class="detail-container" :gutter="10">
<el-col class="cr-images" :span="24"> <el-col class="cr-images" :span="24">
<el-image <el-image
style="width: 100%; height:600px" style="width: 100%; height: 600px"
:src="$getFullUrl(museumDetail.faceImagePressUrl || museumDetail.faceImageUrl)" :src="
$getFullUrl(
museumDetail.faceImagePressUrl || museumDetail.faceImageUrl
)
"
fit="contain" fit="contain"
></el-image> ></el-image>
<div class="enlarge" @click="handelPreviewImages"> <div class="enlarge" @click="handelPreviewImages">
...@@ -29,7 +33,7 @@ ...@@ -29,7 +33,7 @@
<h2> <h2>
{{ museumDetail.name }} {{ museumDetail.name }}
</h2> </h2>
<!-- <span> <!-- <span>
<svg-icon <svg-icon
icon-class="view" icon-class="view"
...@@ -127,8 +131,8 @@ export default { ...@@ -127,8 +131,8 @@ export default {
}, },
handleBack() { handleBack() {
// this.$router.go(-1); this.$router.go(-1);
this.$router.push({path:'/museum'}) // this.$router.push({path:'/museum'})
}, },
closeImgViewer() { closeImgViewer() {
...@@ -139,7 +143,6 @@ export default { ...@@ -139,7 +143,6 @@ export default {
this.imgViewerVisible = true; this.imgViewerVisible = true;
this.imgList = [this.$getFullUrl(this.museumDetail.faceImageUrl)]; this.imgList = [this.$getFullUrl(this.museumDetail.faceImageUrl)];
}, },
}, },
}; };
</script> </script>
...@@ -149,16 +152,17 @@ export default { ...@@ -149,16 +152,17 @@ export default {
margin-right: 20px; margin-right: 20px;
} }
$label: #9f9c9a; $label: #9f9c9a;
.search {
width: 1200px; .museum-detail {
margin: auto; padding: 40px 13%;
margin-bottom: 32px;
} }
.wrapper { .wrapper {
width: 1200px; width: 100%;
margin: 60px auto; margin: 60px auto;
background-color: #fff; background-color: #fff;
padding: 40px; padding: 40px;
box-shadow: 6px 7px 6px 3px rgb(0 0 0 / 4%);
.back { .back {
font-size: 18px; font-size: 18px;
display: flex; display: flex;
...@@ -174,7 +178,7 @@ $label: #9f9c9a; ...@@ -174,7 +178,7 @@ $label: #9f9c9a;
} }
} }
.detail-container { .detail-container {
margin: 32px 0; margin: 32px 0;
// display: flex; // display: flex;
img { img {
max-width: 100%; max-width: 100%;
...@@ -237,7 +241,7 @@ $label: #9f9c9a; ...@@ -237,7 +241,7 @@ $label: #9f9c9a;
} }
} }
.intro{ .intro {
text-indent: 32px; text-indent: 32px;
} }
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
v-for="(item, index) in list.records" v-for="(item, index) in list.records"
:key="index" :key="index"
> >
<!-- id为1 的是文旅厅 --> <!-- id为1 的是文旅厅 -->
<div <div
class="container wow animate__animated animate__fadeInUp" class="container wow animate__animated animate__fadeInUp"
v-if="item.status == 1 && item.id != '1'" v-if="item.status == 1 && item.id != '1'"
...@@ -209,10 +209,13 @@ export default { ...@@ -209,10 +209,13 @@ export default {
}, },
handleClick(item) { handleClick(item) {
const { id } = item; const { id } = item;
const newPage = this.$router.resolve({ // const newPage = this.$router.resolve({
// path: `museum/${id}`,
// });
// window.open(newPage.href, "_blank");
this.$router.push({
path: `museum/${id}`, path: `museum/${id}`,
}); });
window.open(newPage.href, "_blank");
}, },
handleTypeChange(value) { handleTypeChange(value) {
...@@ -292,7 +295,7 @@ $text-indent: 16px; ...@@ -292,7 +295,7 @@ $text-indent: 16px;
background: url("@/assets/imgs/list/search-button-bg.png"); background: url("@/assets/imgs/list/search-button-bg.png");
background-size: 100% 100%; background-size: 100% 100%;
color: #444; color: #444;
font-size: 14px; font-size: 16px;
.svg-icon { .svg-icon {
margin-right: 4px; margin-right: 4px;
} }
...@@ -429,6 +432,7 @@ $text-indent: 16px; ...@@ -429,6 +432,7 @@ $text-indent: 16px;
&::placeholder { &::placeholder {
text-indent: 10px; text-indent: 10px;
color: #999; color: #999;
font-size: 16px;
} }
} }
} }
......
<template> <template>
<div class="personal-info"> <div class="personal-info">
<div class="name">个人信息</div> <div class="name">个人信息</div>
<div class="info-item"> <el-form
<div class="label">用户名</div> :model="userInfoForm"
<el-input :rules="userInfoRules"
size="small" label-width="100px"
v-if="isEditing" class="userInfoForm"
v-model="userInfoForm.username" ref="userInfoForm"
style="width: 300px" >
></el-input> <el-form-item label="用户名" prop="username">
<div class="value" v-else>{{ userInfoForm.username || "暂未填写" }}</div> <el-input
</div> size="small"
<div class="info-item"> v-if="isEditing"
<div class="label">昵称</div> v-model="userInfoForm.username"
<el-input ></el-input>
size="small" <div class="value" v-else>
v-if="isEditing" {{ userInfoForm.username || "暂未填写" }}
v-model="userInfoForm.nickName" </div>
style="width: 300px" </el-form-item>
></el-input> <el-form-item label="昵称" prop="nickName">
<div class="value" v-else>{{ userInfoForm.nickName || "暂未填写" }}</div> <el-input
</div> size="small"
<div class="info-item"> v-if="isEditing"
<div class="label">手机号</div> v-model="userInfoForm.nickName"
<el-input ></el-input>
size="small" <div class="value" v-else>
v-if="isEditing" {{ userInfoForm.nickName || "暂未填写" }}
v-model="userInfoForm.phone" </div>
style="width: 300px" </el-form-item>
></el-input> <el-form-item label="手机号" prop="phone">
<div class="value" v-else>{{ userInfoForm.phone || "暂未填写" }}</div> <el-input
</div> size="small"
<div class="buttons"> v-if="isEditing"
<div v-model="userInfoForm.phone"
class="edit-button" ></el-input>
v-if="!isEditing" <div class="value" v-else>
@click="handleEdit('userInfo')" {{ userInfoForm.phone || "暂未填写" }}
> </div>
修改个人信息 </el-form-item>
</div> <el-form-item>
<div class="edit-button" v-if="!isEditing" @click="handleEdit('pwd')"> <el-button
修改密码 class="edit-button"
</div> v-if="!isEditing"
<div class="edit-button" v-if="isEditing" @click="handleReSet"> @click.native="handleEdit('userInfo')"
取消修改 >
</div> 修改个人信息
<div class="edit-button" v-if="isEditing" @click="handleSubmit">保存</div> </el-button>
</div> <el-button
class="edit-button"
v-if="!isEditing"
@click.native="handleEdit('pwd')"
>
修改密码
</el-button>
<el-button
class="edit-button"
v-if="isEditing"
@click.native="handleCancelUserInfo"
>
取消修改
</el-button>
<el-button
class="edit-button"
v-if="isEditing"
@click.native="handleSubmit"
>
保存
</el-button>
</el-form-item>
</el-form>
<el-dialog <el-dialog
title="修改密码" title="修改密码"
:visible="dialogFormVisible" :visible="dialogFormVisible"
...@@ -72,7 +94,7 @@ ...@@ -72,7 +94,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button> <el-button @click="handleCancelPwd">取 消</el-button>
<el-button type="primary" @click="handleChangePwd">确 定</el-button> <el-button type="primary" @click="handleChangePwd">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -134,6 +156,29 @@ export default { ...@@ -134,6 +156,29 @@ export default {
{ validator: validatePass2, trigger: "blur", required: true }, { validator: validatePass2, trigger: "blur", required: true },
], ],
}, },
userInfoRules: {
username: [
{
required: true,
message: "请填写用户名",
trigger: "blur",
},
],
nickName: [
{
required: true,
message: "请填写昵称",
trigger: "blur",
},
],
phone: [
{
required: true,
message: "请填写手机号",
trigger: "blur",
},
],
},
}; };
}, },
computed: { computed: {
...@@ -158,41 +203,58 @@ export default { ...@@ -158,41 +203,58 @@ export default {
} }
}, },
async handleSubmit(type) { handleSubmit(type) {
let res = await editUserInfo(this.userInfoForm); this.$refs.userInfoForm.validate(async (valid) => {
if (res.code == "0") { if (valid) {
this.$message.success("修改成功!"); let res = await editUserInfo(this.userInfoForm);
this.$store.commit("user/SET_USERINFO", this.userInfoForm); if (res.code == "0") {
setUserInfo(this.userInfoForm); this.$message.success("修改成功!");
} this.$store.commit("user/SET_USERINFO", this.userInfoForm);
this.isEditing = false; setUserInfo(this.userInfoForm);
}
this.isEditing = false;
}
});
}, },
handleReSet() { handleCancelUserInfo() {
this.isEditing = false; this.isEditing = false;
this.userInfoForm = this.userInfo; this.userInfoForm = this.userInfo;
this.$refs.userInfoForm.resetFields();
}, },
async handleChangePwd() { async handleChangePwd() {
const { newPwd, oldPwd } = this.pwdForm; this.$refs.pwdForm.validate(async (valid) => {
const params = { if (valid) {
newPwd, const { newPwd, oldPwd } = this.pwdForm;
oldPwd, const params = {
}; newPwd,
let res = await editUserPwd(params); oldPwd,
if (res.code == "0") { };
let path = this.$route.fullPath; let res = await editUserPwd(params);
if (path.indexOf("/personal") != -1) { if (res.code == "0") {
this.$router.push("/"); let path = this.$route.fullPath;
if (path.indexOf("/personal") != -1) {
this.$router.push("/");
}
this.$message.success("修改成功,请重新登录!");
setTimeout(async () => {
await this.$store.dispatch("user/logout");
this.$store.commit("app/OPEN_LOGIN_DIALOG", true);
}, 2000);
}
} }
this.$message.success("修改成功,请重新登录!"); });
this.$store.commit("app/OPEN_LOGIN_DIALOG", true);
}
}, },
handleCloseChangePwd() { handleCloseChangePwd() {
this.dialogFormVisible = false; this.dialogFormVisible = false;
}, },
handleCancelPwd() {
this.dialogFormVisible = false;
this.$refs.pwdForm.resetFields();
},
}, },
}; };
</script> </script>
...@@ -208,6 +270,12 @@ export default { ...@@ -208,6 +270,12 @@ export default {
} }
} }
::v-deep .el-dialog__body {
padding: 30px 40px 10px 20px;
}
.userInfoForm {
width: 400px;
}
.personal-info { .personal-info {
margin-left: 40px; margin-left: 40px;
.name { .name {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
></el-empty> ></el-empty>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div class="pagination" v-if="list.records.length>0"> <div class="pagination" v-if="list.records.length > 0">
<el-pagination <el-pagination
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<script> <script>
import Card from "./Card"; import Card from "./Card";
// import CulturalRelicCard from "@/components/CulturalRelicCard"; import { mapGetters } from "vuex";
import { getLikeList } from "@/api/user"; import { getLikeList } from "@/api/user";
export default { export default {
name: "Like", name: "Like",
...@@ -94,9 +94,14 @@ export default { ...@@ -94,9 +94,14 @@ export default {
this.loadList(name); this.loadList(name);
}, },
}, },
computed: {
...mapGetters(["userInfo"]),
},
mounted() { mounted() {
let type = "biz_cultural_relic"; let type = "biz_cultural_relic";
this.loadList(type); if (this.userInfo && this.userInfo.username && this.userInfo.nickName) {
this.loadList(type);
}
}, },
methods: { methods: {
async loadList(type) { async loadList(type) {
......
<template> <template>
<div class="personal"> <div class="personal">
<div class="content-wrapper"> <div class="content-wrapper">
<div class="title wow animate__animated animate__fadeInLeft">个人中心</div> <div class="title wow animate__animated animate__fadeInLeft">
个人中心
</div>
<div class="bottom-line wow animate__animated animate__fadeInLeft"></div> <div class="bottom-line wow animate__animated animate__fadeInLeft"></div>
<div class="main"> <div class="main">
<el-tabs :tab-position="'left'" type="card" class="wrapper"> <el-tabs :tab-position="'left'" type="card" class="wrapper">
...@@ -53,17 +55,15 @@ export default { ...@@ -53,17 +55,15 @@ export default {
<style lang='scss' scoped> <style lang='scss' scoped>
$blue: #2069c4; $blue: #2069c4;
.personal { .personal {
// width: 1200px; padding: 40px 0;
padding-bottom: 100px;
display: flex;
justify-content: center;
background-color: #fff; background-color: #fff;
min-height: calc(100vh - 300px);
.content-wrapper { .content-wrapper {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: flex-start; align-items: flex-start;
padding: 60px 0; padding: 60px 13% 0 13%;
width: 1200px; width: 100%;
.title { .title {
font-family: KaiTi; font-family: KaiTi;
......
...@@ -313,7 +313,7 @@ $text-indent: 16px; ...@@ -313,7 +313,7 @@ $text-indent: 16px;
background: url("@/assets/imgs/list/search-button-bg.png"); background: url("@/assets/imgs/list/search-button-bg.png");
background-size: 100% 100%; background-size: 100% 100%;
color: #444; color: #444;
font-size: 14px; font-size: 16px;
&:hover { &:hover {
-webkit-box-reflect: below 2px -webkit-box-reflect: below 2px
linear-gradient(transparent, rgba(0, 0, 0, 0.3)); linear-gradient(transparent, rgba(0, 0, 0, 0.3));
...@@ -458,6 +458,7 @@ $text-indent: 16px; ...@@ -458,6 +458,7 @@ $text-indent: 16px;
&::placeholder { &::placeholder {
text-indent: 10px; text-indent: 10px;
color: #999; color: #999;
font-size: 16px;
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论