动态标题设置,须知改为单页面

main
xuechunyuan 3 years ago
parent 864b245a57
commit 101a864339
  1. 4
      public/index.html
  2. 1
      src/App.vue
  3. 17
      src/router/index.js
  4. 15
      src/store/index.js
  5. 1
      src/utils/aisdapp.js
  6. 6
      src/utils/index.js
  7. 127
      src/views/Guidance.vue
  8. 16
      src/views/HomeView.vue

@ -6,9 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title> <title>体检预约</title>
<%= htmlWebpackPlugin.options.title %>
</title>
<style> <style>
* { * {
padding: 0; padding: 0;

@ -3,6 +3,7 @@
<router-view /> <router-view />
</div> </div>
</template> </template>
<script>
<style lang="scss"> <style lang="scss">
#app { #app {

@ -1,6 +1,7 @@
import Vue from "vue"; import Vue from "vue";
import VueRouter from "vue-router"; import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue"; import HomeView from "../views/HomeView.vue";
import Guidance from "../views/Guidance.vue";
Vue.use(VueRouter); Vue.use(VueRouter);
@ -9,6 +10,17 @@ const routes = [
path: "/", path: "/",
name: "home", name: "home",
component: HomeView, component: HomeView,
meta: {
title: "选择医院",
}
},
{
path: "/guidance",
name: "guidance",
component: Guidance,
meta: {
title: "预约须知",
}
}, },
{ {
path: "/about", path: "/about",
@ -24,5 +36,8 @@ const routes = [
const router = new VueRouter({ const router = new VueRouter({
routes, routes,
}); });
router.beforeEach((to, from, next) => {
to.meta.title?document.title = to.meta.title:document.title ='体检预约'
next()
})
export default router; export default router;

@ -4,9 +4,14 @@ import Vuex from "vuex";
Vue.use(Vuex); Vue.use(Vuex);
export default new Vuex.Store({ export default new Vuex.Store({
state: {}, modules: {
getters: {}, state: {
mutations: {}, userInfo: sessionStorage.getItem('userInfo') || null
actions: {}, }
modules: {}, },
mutations: {
setUserInfo(state,userInfo){
state.userInfo = userInfo;
}
},
}); });

@ -112,6 +112,7 @@ export const getUserInfoByToken = (userToken) => {
if (data.retcode == "000000") { if (data.retcode == "000000") {
const userInfo = data.data const userInfo = data.data
sessionStorage.setItem('userInfo',userInfo); sessionStorage.setItem('userInfo',userInfo);
location.reload();
// const userObj = JSON.parse(userInfo); // const userObj = JSON.parse(userInfo);
// lightAppJssdk.notification.alert({ // lightAppJssdk.notification.alert({
// title: "提示", //可传空 // title: "提示", //可传空

@ -0,0 +1,6 @@
/**
* 判断是否为手机端
*/
export const isMobile = () => {
return navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) ? true : false;
}

@ -0,0 +1,127 @@
<template>
<div class="guidance">
<div class="guide_title">海慈医院体检预约须知</div>
<div class="guide_contant" ref="scrollView" id="scroll-view" @scroll="scroll">
<p>尊敬的驾驶员</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
<p> 海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知海慈医院体检预约须知</p>
</div>
<div class="guide_btn">
<div class="guide_actBtn" @click="doCancel">取消</div>
<div class="guide_actBtn blue" @click="doRead">已阅读</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
isFlag: false,//
}
},
mounted() {
console.log(this.$route.query);
},
methods: {
//
doCancel() {
this.$router.go(-1);
},
//
doRead() {
if (!this.isFlag) {
//
lightAppJssdk.notification.alert({
message: "须知未完全阅读,请滑动屏幕完成阅读",
title: "提示",//
buttonName: "继续阅读",
success: function (data) {
//onSuccessbutton
/*回调*/
},
fail: function (data) { //
}
});
}
else {
//
this.$router.push({ name: '', params: {} })
}
},
//
scroll(e) {
if (this.isFlag) {
return;
}
const { scrollTop, clientHeight, scrollHeight } = e.target;
if (scrollTop + clientHeight === scrollHeight) {
this.isFlag = true;
console.log('阅读完成')
}
},
}
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.guidance {
height:100%;
background-color: #fff;
.guide_title {
color: #333333;
line-height: 0.5rem;
font-size: 0.36rem;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
text-align: center;
margin: 0.72rem 0 0;
}
.guide_contant {
height: 6rem;
color: #333333;
font-size: 0.26rem;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
overflow-y: auto;
margin: 0.93rem 0.4rem 0 0;
padding: 0 0.4rem;
}
.guide_btn {
margin: 0.86rem 0.4rem 0;
.guide_actBtn {
float:left;
display: inline-block;
width: 3rem;
color: #999999;
font-size: 0.3rem;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
line-height: 0.98rem;
text-align: center;
background: #FFFFFF;
border-radius: 0.08rem;
border: 0.02rem solid #E1E1E1;
&.blue {
float:right;
color: #fff;
background: #1677FF;
border-color: #1677FF;
}
}
}
}
</style>

@ -41,12 +41,13 @@
<div @click="testAlert" class="act_btn">我的预约</div> <div @click="testAlert" class="act_btn">我的预约</div>
</div> </div>
<!-- 阅读须知 --> <!-- 阅读须知 -->
<GuidanceVue @doCancelGuide="doCancelGuide" v-if="guideShow"></GuidanceVue> <!-- <GuidanceVue @doCancelGuide="doCancelGuide" v-if="guideShow"></GuidanceVue> -->
</div> </div>
</template> </template>
<script> <script>
import GuidanceVue from '@/components/Guidance.vue'; import GuidanceVue from '@/components/Guidance.vue';
import { getUserInfo } from '@/utils/aisdapp'; import { getUserInfo } from '@/utils/aisdapp';
import { isMobile } from '@/utils';
export default { export default {
name: "HomeView", name: "HomeView",
components: { components: {
@ -59,6 +60,7 @@ export default {
} }
}, },
mounted() { mounted() {
if (isMobile()) {
let userInfo = sessionStorage.getItem('userInfo') ? JSON.parse(sessionStorage.getItem('userInfo')) : null; let userInfo = sessionStorage.getItem('userInfo') ? JSON.parse(sessionStorage.getItem('userInfo')) : null;
console.log(userInfo); console.log(userInfo);
if (userInfo == null) { if (userInfo == null) {
@ -67,6 +69,9 @@ export default {
else { else {
this.userInfo = userInfo; this.userInfo = userInfo;
} }
} else {
return false // alert('PC')
}
}, },
methods: { methods: {
testAlert() { testAlert() {
@ -88,7 +93,8 @@ export default {
}, },
// //
doGuidance() { doGuidance() {
this.guideShow = true; // this.guideShow = true;
this.$router.push({name:'guidance',query:{deptId:1}})
}, },
} }
}; };
@ -110,18 +116,22 @@ export default {
text-align: center; text-align: center;
padding: 0.12rem 0; padding: 0.12rem 0;
margin-bottom: 0.3rem; margin-bottom: 0.3rem;
&.active { &.active {
background: #FFFFFF; background: #FFFFFF;
border-color: #1677FF; border-color: #1677FF;
} }
img { img {
width: 0.6rem; width: 0.6rem;
height: 0.6rem; height: 0.6rem;
margin-right: 0.24rem; margin-right: 0.24rem;
} }
.hospital_info { .hospital_info {
display: inline-block; display: inline-block;
text-align: left; text-align: left;
.hospital_name { .hospital_name {
color: #333333; color: #333333;
font-size: 0.34rem; font-size: 0.34rem;
@ -129,6 +139,7 @@ export default {
font-weight: 400; font-weight: 400;
line-height: 0.48rem; line-height: 0.48rem;
} }
.hospital_addr { .hospital_addr {
color: #999999; color: #999999;
line-height: 0.45rem; line-height: 0.45rem;
@ -147,6 +158,7 @@ export default {
bottom: 0; bottom: 0;
padding: 0.24rem; padding: 0.24rem;
background: #fff; background: #fff;
.act_btn { .act_btn {
color: #FFFFFF; color: #FFFFFF;
font-size: 0.3rem; font-size: 0.3rem;

Loading…
Cancel
Save