feat(main): 优化首页和服务页面功能
- 在 main.js 中引入 Popup 和 Dialog 组件 - 优化 home 页面逻辑,增加用户类型和权限控制 - 改进 service-info 页面,增加申请链接的空值检查和提示
This commit is contained in:
14
src/main.js
14
src/main.js
@@ -16,25 +16,16 @@ import 'vant/lib/index.css'
|
||||
import 'viewerjs/dist/viewer.css'
|
||||
import 'quill/dist/quill.snow.css'
|
||||
import Bus from '@utils/bus'
|
||||
import { Toast, Form, Loading, Lazyload, Notify, Image, NavBar, Icon, Card, Field, Button } from 'vant'
|
||||
import { Toast, Form, Loading, Lazyload, Notify, Image, NavBar, Icon, Card, Field, Button, Popup, Dialog } from 'vant'
|
||||
import generatedFormat from '@/assets/js/generatedFormat/index'
|
||||
// import generatedApi from '@/api/generatedApi/index'
|
||||
import generatedComponents from './generatedComponents'
|
||||
import { fetchToken } from './api/user/token'
|
||||
import { hasLogin } from './assets/js/utils/user-login'
|
||||
//权限控制
|
||||
import { permission } from '@/assets/js/utils/permission'
|
||||
import { getParamsFromUrl } from './assets/js/utils/get-url'
|
||||
|
||||
for (let item in generatedComponents) {
|
||||
Vue.component(item, generatedComponents[item])
|
||||
}
|
||||
|
||||
const params = getParamsFromUrl(globalThis.location.href)
|
||||
const token = params.get('token')
|
||||
console.log(params)
|
||||
token && globalThis.localStorage.setItem('token', token)
|
||||
|
||||
Vue.use(Image)
|
||||
.use(Toast)
|
||||
.use(Form)
|
||||
@@ -49,11 +40,12 @@ Vue.use(Image)
|
||||
.use(Card)
|
||||
.use(Field)
|
||||
.use(Button)
|
||||
.use(Popup)
|
||||
.use(Dialog)
|
||||
|
||||
//router or bridge jump
|
||||
Vue.prototype.$bus = new Bus()
|
||||
Vue.prototype.$generatedFormat = generatedFormat
|
||||
// Vue.prototype.$generatedApi = generatedApi
|
||||
Vue.prototype.$generatedDictList = generatedFormat.formatList
|
||||
Vue.prototype.$validatorItem = { ...validatorItem }
|
||||
Vue.prototype.$computeNumber = function computeNumber(a, type, b) {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script>
|
||||
import { Image as VanImage, Icon } from 'vant';
|
||||
import { Image as VanImage, Icon, Dialog } from 'vant';
|
||||
import Swiper from './components/swiper/swiper.vue';
|
||||
import { getEcosystem } from '@/assets/js/utils/ecosystem'
|
||||
import { fetchUserInfo } from '@/api/user/token'
|
||||
import { getParamsFromUrl } from '@/assets/js/utils/get-url'
|
||||
|
||||
export default {
|
||||
name: "home",
|
||||
@@ -23,20 +24,23 @@ export default {
|
||||
],
|
||||
name: "",
|
||||
sex: "",
|
||||
type: "",
|
||||
permission: {
|
||||
goNext: true
|
||||
},
|
||||
titleSrc: "http://ncc.ebiz-digits.com:39527/gsc/IHRHN5/7b/04/63/7b0463aa135f4a1f922b5171bcec1d14/images/主页/u26.png",
|
||||
bannerSrc: "http://ncc.ebiz-digits.com:39527/gsc/IHRHN5/7b/04/63/7b0463aa135f4a1f922b5171bcec1d14/images/主页/u44.svg",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
if (!this.name) return "欢迎使用幸福人寿生态系统!"
|
||||
if (!this.type) return "欢迎使用幸福人寿生态系统!"
|
||||
return `亲爱的${this.name}${this.sex == 1 ? '女士' : '先生'}!`
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goEcosystem(ecosystem, swe) {
|
||||
|
||||
this.$router.push({
|
||||
this.permission.goNext && this.$router.push({
|
||||
name: 'service',
|
||||
params: {
|
||||
ecosystem: getEcosystem(ecosystem)
|
||||
@@ -48,11 +52,21 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
fetchUserInfo().then(res => {
|
||||
const {content} = res.content
|
||||
|
||||
this.name = content.name
|
||||
this.sex = content.sex
|
||||
const params = getParamsFromUrl(globalThis.location.href)
|
||||
const token = params.get('token')
|
||||
if (token) {
|
||||
globalThis.localStorage.setItem('token', token)
|
||||
fetchUserInfo().then(res => {
|
||||
const { content } = res.content
|
||||
this.name = content.name
|
||||
this.sex = content.sex
|
||||
this.type = content.type
|
||||
})
|
||||
}
|
||||
else Dialog({
|
||||
message: '页面访问有误,请重试',
|
||||
}).then(() => {
|
||||
this.$router.go(-1)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import { ecosystem } from "../js/status"
|
||||
import { Button, Icon } from 'vant'
|
||||
import { Button, Icon, Toast } from 'vant'
|
||||
|
||||
export default {
|
||||
name: "service-info",
|
||||
@@ -88,7 +88,15 @@ export default {
|
||||
}
|
||||
},
|
||||
handleApplyClick() {
|
||||
globalThis.location.href = ecosystem.active.url
|
||||
const url = ecosystem.active.url
|
||||
if (!url) {
|
||||
Toast({
|
||||
message: "请联系您的业务员或致电95560",
|
||||
position: "bottom"
|
||||
})
|
||||
return
|
||||
}
|
||||
globalThis.location.href = url
|
||||
},
|
||||
handleNavigator(position) {
|
||||
this.$router.replace({
|
||||
|
||||
Reference in New Issue
Block a user