Commit 3d4f3c05 by fanx

add catalog

1 parent 9a12a481
......@@ -5,16 +5,38 @@ import userRouter from './modules/user'
import memberRouter from './modules/member'
import qulificationRouter from './modules/qualification'
const APP_ENV = process.env.VUE_APP_NODE_ENV
Vue.use(VueRouter)
const routes = [{
const routes = [
{
path: '/',
meta: {
token: false,
topType: 3
},
redirect: {
name: APP_ENV == 'production' ? 'Home' : 'Catalog'
}
},
{
path: '/home',
name: 'Home',
meta: {
title: '首页'
},
component: Home
}, ].concat(userRouter, memberRouter, qulificationRouter)
},
{
path: '/catalog',
name: 'Catalog',
meta: {
title: '目录'
},
component: () => import(/* webpackChunkName: "catalog" */ '@/views/catalog/') // 首页
}
].concat(userRouter, memberRouter, qulificationRouter)
const router = new VueRouter({
routes
......
......@@ -12,16 +12,34 @@ const handlePromise = (promise) => {
})
}
// 验证手机号
const phoneRegCheck = (phoneNo) => {
const Reg = /1[3-9]\d{9}/;
return Reg.test(phoneNo);
}
// 验证邮箱
const emailRegCheck = (email) => {
const Reg = /^[A-Za-z0-9-_\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
return Reg.test(email);
}
// 复制值
const Copy = (node) => {
node = Array.isArray(node) ? node[0] : node
Object.assign(document.documentElement.style, {
webkitUserSelect: 'text', webkitTouchCallout: 'text'
})
const range = document.createRange()
range.selectNode(node)
const selection = window.getSelection()
if (selection.rangeCount > 0) selection.removeAllRanges()
selection.addRange(range)
document.execCommand('copy');
(window.Toast || alert)('复制成功')
selection.removeAllRanges()
}
export default {
handlePromise,
phoneRegCheck,
......
{
"finishDesc":"红色字体是制作完成的页面,接口已经联调完成",
"todoDesc":"蓝色字体是联调中或者制作中",
"list": [
{
"name": "范鑫",
"myselfList": [
{
"url": "/user/login/phone",
"title": "手机号登录",
"class": "block red"
},
{
"url": "/user/login/username",
"title": "账号密码登录",
"class": "block red"
},
{
"url": "/user/findPassword?type=phone",
"title": "手机号找回",
"class": "block red"
},
{
"url": "/user/findPassword?type=email",
"title": "邮箱找回",
"class": "block red"
},
{
"url": "/user/resetPassword",
"title": "重置",
"class": "block red"
},
{
"url": "/user/center",
"title": "个人中心",
"class": "block red"
},
{
"url": "/user/message",
"title": "我的消息",
"class": "block red"
},
{
"url": "/user/collect",
"title": "我的收藏",
"class": "block red"
},
{
"url": "/user/study",
"title": "我的学习",
"class": "block red"
},
{
"url": "/user/question",
"title": "常见问题",
"class": "block red"
},
{
"url": "/user/questionDetail",
"title": "常见问题详情",
"class": "block red"
},
{
"url": "/user/feedback",
"title": "意见反馈",
"class": "block red"
},
{
"url": "/user/about",
"title": "关于协会",
"class": "block red"
},
{
"url": "/user/setting",
"title": "设置",
"class": "block red"
},
{
"url": "/user/privacy",
"title": "隐私协议",
"class": "block red"
},
{
"url": "/user/service",
"title": "服务协议",
"class": "block red"
},
{
"url": "/user/person",
"title": "个人信息",
"class": "block red"
},
{
"url": "/user/commonEdit",
"title": "设置昵称",
"class": "block red"
},
{
"url": "/user/setting",
"title": "设置",
"class": "block red"
}
]
},
{
"name": "陈新",
"myselfList": [
{
"url": "/home",
"title": "首页",
"class": "block red"
}
]
},
{
"name": "李新",
"myselfList": [
{
"url": "/member/login",
"title": "会员登录",
"class": "block"
}
]
}
]
}
\ No newline at end of file
<template>
<div class="page">
<h3>{{finishDesc}}</h3>
<h3>{{todoDesc}}</h3>
<div>
<van-field v-model="userId" name="userId" label="userId" placeholder="请输入userId" class="input" ref="input" />
<van-button round block type="info" @click="modify">修改</van-button>
</div>
<hr />
<span ref="copy">测试copy</span>
<button @click="EventCopy">copy</button>
<div v-for="(item,index) in list" :key="index">
<h4>{{item.name}}</h4>
<router-link v-for="(child,Index) in item.myselfList" :key="Index" :to="child.url" :class="child.class">{{child.title}}: {{child.url}}</router-link>
<hr />
</div>
</div>
</template>
<script>
import data from './data.json'
import utils from "@/utils/";
export default {
name: 'catalog',
data() {
return {
finishDesc: '',
todoDesc: '',
list: [],
userId: ''
}
},
created() {
const { finishDesc, todoDesc, list } = data
this.finishDesc = finishDesc
this.todoDesc = todoDesc
this.list = list
},
mounted() {
this.$refs.input.focus()
},
methods: {
EventCopy() {
utils.Copy(this.$refs.copy);
},
modify() {
if (this.userId) {
this.$store.commit('user/MStoreUserId', this.userId)
window.Toast('修改完成')
} else {
window.Toast('请填写userId')
}
}
}
}
</script>
<style lang="less" scoped>
.page {
padding: 30px;
}
.block {
display: block;
line-height: 40px;
}
.red {
color: red;
}
hr {
margin: 20px 0;
}
.input {
border: 2px solid #ccc;
border-radius: 10px;
margin-bottom: 10px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!