hookehuyr

✨ feat(快捷跳转组件): C端跳转判断访客和客户

...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
6 </template> 6 </template>
7 7
8 <script setup> 8 <script setup>
9 +import Cookies from 'js-cookie'
10 +
9 import icon_me from '@images/icon-my@2x.png' 11 import icon_me from '@images/icon-my@2x.png'
10 import icon_home from '@images/icon-home@2x.png' 12 import icon_home from '@images/icon-home@2x.png'
11 13
...@@ -27,7 +29,7 @@ export default { ...@@ -27,7 +29,7 @@ export default {
27 props: ['type', 'item'], 29 props: ['type', 'item'],
28 data () { 30 data () {
29 return { 31 return {
30 - 32 + userType: Cookies.get('userType') ? Cookies.get('userType') : ''
31 } 33 }
32 }, 34 },
33 computed: { 35 computed: {
...@@ -36,7 +38,7 @@ export default { ...@@ -36,7 +38,7 @@ export default {
36 }, 38 },
37 isMe () { 39 isMe () {
38 return this.item.indexOf('me') !== -1 ? true : false 40 return this.item.indexOf('me') !== -1 ? true : false
39 - } 41 + },
40 }, 42 },
41 mounted () { 43 mounted () {
42 }, 44 },
...@@ -48,9 +50,24 @@ export default { ...@@ -48,9 +50,24 @@ export default {
48 path: '/business/index' 50 path: '/business/index'
49 }); 51 });
50 } else { 52 } else {
51 - this.$router.push({ 53 + // C 端返回首页需要判断是否,访客或客户
52 - path: '/client/index' 54 + switch (this.userType) {
53 - }); 55 + case 'visitor':
56 + this.$router.push({
57 + path: '/client/chooseBook'
58 + });
59 + break;
60 + case 'client':
61 + this.$router.push({
62 + path: '/client/chooseSchool'
63 + });
64 + break;
65 + default:
66 + this.$router.push({
67 + path: '/client/index'
68 + });
69 + break;
70 + }
54 } 71 }
55 }, 72 },
56 toMe () { 73 toMe () {
...@@ -85,4 +102,4 @@ export default { ...@@ -85,4 +102,4 @@ export default {
85 width: 3rem; 102 width: 3rem;
86 height: 3rem; 103 height: 3rem;
87 } 104 }
88 -</style>
...\ No newline at end of file ...\ No newline at end of file
105 +</style>
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
40 </template> 40 </template>
41 41
42 <script setup> 42 <script setup>
43 +import Cookies from 'js-cookie'
44 +
43 import no_image from '@images/que-shuju@2x.png' 45 import no_image from '@images/que-shuju@2x.png'
44 46
45 import MyButton from '@/components/MyButton/index.vue' 47 import MyButton from '@/components/MyButton/index.vue'
...@@ -58,13 +60,12 @@ const $router = useRouter(); ...@@ -58,13 +60,12 @@ const $router = useRouter();
58 const { kg_id, kgInfo } = bookFn($route) 60 const { kg_id, kgInfo } = bookFn($route)
59 61
60 // 配置快捷跳转条 62 // 配置快捷跳转条
61 -const shortcutItem = ref(['home', 'me']); 63 +const shortcutItem = ref([]);
62 -// TODO: 访客是否有个人中心 64 +if (Cookies.get('userType') === 'client') {
63 -// if (!$route.query.kg_id) { // 访客模式,没有个人中心 65 + shortcutItem.value = ['home', 'me']
64 -// shortcutItem.value = ['home'] 66 +} else {
65 -// } else { 67 + shortcutItem.value = ['me']
66 -// shortcutItem.value = ['home', 'me'] 68 +}
67 -// }
68 69
69 // 自定义按钮颜色样式 70 // 自定义按钮颜色样式
70 const styleObject = reactive({ 71 const styleObject = reactive({
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
17 </template> 17 </template>
18 18
19 <script setup> 19 <script setup>
20 +import Cookies from 'js-cookie'
21 +
20 import MyButton from '@/components/MyButton/index.vue' 22 import MyButton from '@/components/MyButton/index.vue'
21 23
22 import $ from 'jquery'; 24 import $ from 'jquery';
...@@ -42,11 +44,13 @@ const goVisit = () => { // 跳转爱心书籍页面 ...@@ -42,11 +44,13 @@ const goVisit = () => { // 跳转爱心书籍页面
42 $router.push({ 44 $router.push({
43 path: '/client/chooseBook' 45 path: '/client/chooseBook'
44 }); 46 });
47 + Cookies.set('userType', 'visitor'); // 访客标识
45 } 48 }
46 const goSchool = () => { // 跳转选择幼儿园页面 49 const goSchool = () => { // 跳转选择幼儿园页面
47 $router.push({ 50 $router.push({
48 path: '/client/chooseSchool' 51 path: '/client/chooseSchool'
49 }); 52 });
53 + Cookies.set('userType', 'client'); // 客户标识
50 } 54 }
51 55
52 onMounted (() => { 56 onMounted (() => {
...@@ -100,4 +104,4 @@ export default { ...@@ -100,4 +104,4 @@ export default {
100 } 104 }
101 } 105 }
102 } 106 }
103 -</style>
...\ No newline at end of file ...\ No newline at end of file
107 +</style>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
9 <van-col class="text-wrapper" span="18"> 9 <van-col class="text-wrapper" span="18">
10 <div> 10 <div>
11 <div class="username">{{ userInfo.name }}</div> 11 <div class="username">{{ userInfo.name }}</div>
12 - <div class="toggle-user" @click="toggleUser">切换儿童</div> 12 + <div v-if="actions.length" class="toggle-user" @click="toggleUser">切换儿童</div>
13 </div> 13 </div>
14 <div class="address">{{ userInfo.kg_name }}</div> 14 <div class="address">{{ userInfo.kg_name }}</div>
15 </van-col> 15 </van-col>
...@@ -368,4 +368,4 @@ export default { ...@@ -368,4 +368,4 @@ export default {
368 margin: 0 1rem; 368 margin: 0 1rem;
369 } 369 }
370 } 370 }
371 -</style>
...\ No newline at end of file ...\ No newline at end of file
371 +</style>
......
1 { 1 {
2 "compilerOptions": { 2 "compilerOptions": {
3 + "outDir": "./",
3 "target": "esnext", 4 "target": "esnext",
4 "module": "esnext", 5 "module": "esnext",
5 "strict": true, 6 "strict": true,
...@@ -33,9 +34,11 @@ ...@@ -33,9 +34,11 @@
33 "src/**/*.tsx", 34 "src/**/*.tsx",
34 "src/**/*.vue", 35 "src/**/*.vue",
35 "tests/**/*.ts", 36 "tests/**/*.ts",
36 - "tests/**/*.tsx" 37 + "tests/**/*.tsx",
37 -, "src/store/index.js", "src/composables/useVideoList.js"], 38 + "src/store/index.js",
39 + ],
38 "exclude": [ 40 "exclude": [
39 - "node_modules" 41 + "node_modules",
42 + "dist"
40 ] 43 ]
41 } 44 }
......