Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-05-11 18:00:18 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b91ddf4d7af86f89995ad7f3db47d0e8a0eed968
b91ddf4d
1 parent
7042b6f2
✨ feat(快捷跳转组件): C端跳转判断访客和客户
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
19 deletions
src/components/ShortcutFixed/index.vue
src/views/client/chooseBook.vue
src/views/client/index.vue
src/views/me/index.vue
tsconfig.json
src/components/ShortcutFixed/index.vue
View file @
b91ddf4
...
...
@@ -6,6 +6,8 @@
</template>
<script setup>
import Cookies from 'js-cookie'
import icon_me from '@images/icon-my@2x.png'
import icon_home from '@images/icon-home@2x.png'
...
...
@@ -27,7 +29,7 @@ export default {
props: ['type', 'item'],
data () {
return {
userType: Cookies.get('userType') ? Cookies.get('userType') : ''
}
},
computed: {
...
...
@@ -36,7 +38,7 @@ export default {
},
isMe () {
return this.item.indexOf('me') !== -1 ? true : false
}
}
,
},
mounted () {
},
...
...
@@ -48,9 +50,24 @@ export default {
path: '/business/index'
});
} else {
this.$router.push({
path: '/client/index'
});
// C 端返回首页需要判断是否,访客或客户
switch (this.userType) {
case 'visitor':
this.$router.push({
path: '/client/chooseBook'
});
break;
case 'client':
this.$router.push({
path: '/client/chooseSchool'
});
break;
default:
this.$router.push({
path: '/client/index'
});
break;
}
}
},
toMe () {
...
...
@@ -85,4 +102,4 @@ export default {
width: 3rem;
height: 3rem;
}
</style>
\ No newline at end of file
</style>
...
...
src/views/client/chooseBook.vue
View file @
b91ddf4
...
...
@@ -40,6 +40,8 @@
</template>
<script setup>
import Cookies from 'js-cookie'
import no_image from '@images/que-shuju@2x.png'
import MyButton from '@/components/MyButton/index.vue'
...
...
@@ -58,13 +60,12 @@ const $router = useRouter();
const { kg_id, kgInfo } = bookFn($route)
// 配置快捷跳转条
const shortcutItem = ref(['home', 'me']);
// TODO: 访客是否有个人中心
// if (!$route.query.kg_id) { // 访客模式,没有个人中心
// shortcutItem.value = ['home']
// } else {
// shortcutItem.value = ['home', 'me']
// }
const shortcutItem = ref([]);
if (Cookies.get('userType') === 'client') {
shortcutItem.value = ['home', 'me']
} else {
shortcutItem.value = ['me']
}
// 自定义按钮颜色样式
const styleObject = reactive({
...
...
src/views/client/index.vue
View file @
b91ddf4
...
...
@@ -17,6 +17,8 @@
</template>
<script setup>
import Cookies from 'js-cookie'
import MyButton from '@/components/MyButton/index.vue'
import $ from 'jquery';
...
...
@@ -42,11 +44,13 @@ const goVisit = () => { // 跳转爱心书籍页面
$router.push({
path: '/client/chooseBook'
});
Cookies.set('userType', 'visitor'); // 访客标识
}
const goSchool = () => { // 跳转选择幼儿园页面
$router.push({
path: '/client/chooseSchool'
});
Cookies.set('userType', 'client'); // 客户标识
}
onMounted (() => {
...
...
@@ -100,4 +104,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
...
...
src/views/me/index.vue
View file @
b91ddf4
...
...
@@ -9,7 +9,7 @@
<van-col class="text-wrapper" span="18">
<div>
<div class="username">{{ userInfo.name }}</div>
<div class="toggle-user" @click="toggleUser">切换儿童</div>
<div
v-if="actions.length"
class="toggle-user" @click="toggleUser">切换儿童</div>
</div>
<div class="address">{{ userInfo.kg_name }}</div>
</van-col>
...
...
@@ -368,4 +368,4 @@ export default {
margin: 0 1rem;
}
}
</style>
\ No newline at end of file
</style>
...
...
tsconfig.json
View file @
b91ddf4
{
"compilerOptions"
:
{
"outDir"
:
"./"
,
"target"
:
"esnext"
,
"module"
:
"esnext"
,
"strict"
:
true
,
...
...
@@ -33,9 +34,11 @@
"src/**/*.tsx"
,
"src/**/*.vue"
,
"tests/**/*.ts"
,
"tests/**/*.tsx"
,
"src/store/index.js"
,
"src/composables/useVideoList.js"
],
"tests/**/*.tsx"
,
"src/store/index.js"
,
],
"exclude"
:
[
"node_modules"
"node_modules"
,
"dist"
]
}
...
...
Please
register
or
login
to post a comment