hookehuyr

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

......@@ -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 {
// 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 () {
......
......@@ -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({
......
......@@ -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 (() => {
......
......@@ -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>
......
{
"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"
]
}
......