微信小程序发布试用版本
This commit is contained in:
182
pages-subpackage/workspace/scene-detail.vue
Normal file
182
pages-subpackage/workspace/scene-detail.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- #ifdef APP -->
|
||||
<statusBar></statusBar>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 导航栏 -->
|
||||
<uni-nav-bar
|
||||
:fixed="true"
|
||||
:statusBar="true"
|
||||
:border="false"
|
||||
:title="sceneInfo.title"
|
||||
leftIcon="left"
|
||||
@clickLeft="goBack"
|
||||
color="#333"
|
||||
backgroundColor="#FFFFFF">
|
||||
</uni-nav-bar>
|
||||
|
||||
<view class="content">
|
||||
<view class="nav-list">
|
||||
<view
|
||||
class="nav-item"
|
||||
v-for="(item, index) in sceneInfo.navItems"
|
||||
:key="index"
|
||||
@click="navigateToPage(item)">
|
||||
<view class="nav-item-content">
|
||||
<view class="nav-item-icon">
|
||||
<uni-icons type="right" size="20" color="#CCCCCC"></uni-icons>
|
||||
</view>
|
||||
<text class="nav-item-title">{{ item.title }}</text>
|
||||
<view class="nav-item-arrow">
|
||||
<uni-icons type="right" size="16" color="#CCCCCC"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP
|
||||
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
// #ifdef APP
|
||||
components: {
|
||||
statusBar
|
||||
},
|
||||
// #endif
|
||||
data() {
|
||||
return {
|
||||
sceneInfo: {
|
||||
title: '',
|
||||
navItems: []
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.scene) {
|
||||
try {
|
||||
this.sceneInfo = JSON.parse(decodeURIComponent(options.scene));
|
||||
} catch (e) {
|
||||
console.error('解析场景信息失败:', e);
|
||||
uni.showToast({
|
||||
title: '参数错误',
|
||||
icon: 'none'
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
navigateToPage(item) {
|
||||
// 检查页面路径是否存在
|
||||
if (item.path) {
|
||||
// 判断是 tabBar 页面还是普通页面
|
||||
const tabBarPages = [
|
||||
'/pages/furniture_reception/furniture_reception',
|
||||
'/pages/furniture_customer/furniture_customer',
|
||||
'/pages/furniture_top_sales/furniture_top_sales',
|
||||
'/pages/ucenter/ucenter'
|
||||
];
|
||||
|
||||
if (tabBarPages.includes(item.path)) {
|
||||
uni.switchTab({
|
||||
url: item.path,
|
||||
fail: (err) => {
|
||||
console.error('跳转失败:', err);
|
||||
uni.showToast({
|
||||
title: '页面不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: item.path,
|
||||
fail: (err) => {
|
||||
console.error('跳转失败:', err);
|
||||
uni.showToast({
|
||||
title: '页面不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '页面路径未配置',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: 44px;
|
||||
padding: 44px 16px 20px;
|
||||
}
|
||||
|
||||
.nav-list {
|
||||
background: #FFFFFF;
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
border-bottom: 1px solid #F0F0F0;
|
||||
}
|
||||
|
||||
.nav-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.nav-item-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20px 16px;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.nav-item:active .nav-item-content {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.nav-item-icon {
|
||||
margin-right: 12px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #F5F5F5;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.nav-item-title {
|
||||
flex: 1;
|
||||
font-size: 16px;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.nav-item-arrow {
|
||||
margin-left: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user