Skip to content

Commit

Permalink
feat: 云开发企业官网mock数据添加详情页默认数据
Browse files Browse the repository at this point in the history
  • Loading branch information
barryfli committed Jan 3, 2025
1 parent 331551e commit e3fee8a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 19 deletions.
4 changes: 2 additions & 2 deletions miniprogram/tcb-official-website/pages/detail/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<view class="detail_title">{{article.sub_title||article.title}}</view>
<view class="detail_time">{{article.time}}</view>
<view class="detail_image">
<image src="{{article.detail_pic||article.picture || article.subPic}}"></image>
<image mode="widthfix" src="{{article.detail_pic||article.picture || article.subPic}}"></image>
</view>
<rich-text class="detail_cont" nodes="{{article.header || article.content}}"></rich-text>
<rich-text class="detail_cont" nodes="{{article.header || article.content || article.description }}"></rich-text>
</view>
1 change: 1 addition & 0 deletions miniprogram/tcb-official-website/pages/detail/index.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ page {

.detail_image {
height: auto;
width: 100%;
margin: 20rpx 0;
border-radius: 20rpx;
overflow: hidden;
Expand Down
1 change: 1 addition & 0 deletions miniprogram/tcb-official-website/pages/solution/index.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
padding: 30rpx;
background-size: cover;
background-position: 0 0;
background-color: rgba(0,0,0,0.8);
}


Expand Down
2 changes: 1 addition & 1 deletion miniprogram/tcb-official-website/project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"packNpmRelationList": [],
"minifyWXSS": true
},
"appid": "wxc35ad965824811ef",
"appid": "wxca108d58cc8402c2",
"projectname": "tcb-official-website",
"libVersion": "3.7.3",
"cloudfunctionTemplateRoot": "cloudfunctionTemplate/",
Expand Down
7 changes: 7 additions & 0 deletions miniprogram/tcb-official-website/project.private.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "tcb-official-website",
"setting": {
"compileHotReLoad": true
}
}
24 changes: 18 additions & 6 deletions miniprogram/tcb-official-website/services/cloudbaseMock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ export const SceneData = [
"sub_title": "微搭教育服务",
"backgroud_pic": "https://main.qcloudimg.com/raw/a329db7230d1a9c79a0b10e096b236e8.png",
"_id": "ce6b953c676cc74d03cdc84a1b075251",
"title": "教育"
"title": "教育",
"description":"腾讯云微搭低代码 WeDa 是高效、高性能的拖拽式低代码开发平台,向上连接前端的行业业务,向下连接云计算的海量能力,助力企业垂直上云。微搭将繁琐的底层架构和基础设施抽象化为图形界面,通过行业化模板、拖放式组件和可视化配置快速构建多端应用(小程序、H5应用、Web 应用等),免去了代码编写工作,让您能够完全专注于业务场景。微搭以云开发作为底层支撑,云原生能力将应用搭建的全链路打通,提供高度开放的开发环境,且时刻为您的应用保驾护航。",
"time": "2024-12-26 11:02:36",
"detail_pic":'https://qcloudimg.tencent-cloud.cn/raw/3ea5139beeae6c4e2e98d30ad1ed7ade.png'
},
{
"sub_title": "微搭医疗服务",
"backgroud_pic": "https://main.qcloudimg.com/raw/28644f5655e9f2b5e470676d77903bcb.png",
"_id": "5e900b71676cc74d0058268f2a3d1455",
"title": "医疗"
"title": "医疗",
"description":"腾讯云微搭低代码 WeDa 是高效、高性能的拖拽式低代码开发平台,向上连接前端的行业业务,向下连接云计算的海量能力,助力企业垂直上云。微搭将繁琐的底层架构和基础设施抽象化为图形界面,通过行业化模板、拖放式组件和可视化配置快速构建多端应用(小程序、H5应用、Web 应用等),免去了代码编写工作,让您能够完全专注于业务场景。微搭以云开发作为底层支撑,云原生能力将应用搭建的全链路打通,提供高度开放的开发环境,且时刻为您的应用保驾护航。",
"time": "2024-12-26 11:02:36",
"detail_pic":'https://qcloudimg.tencent-cloud.cn/raw/3ea5139beeae6c4e2e98d30ad1ed7ade.png'
},
{
"sub_title": "微搭政务服务",
"backgroud_pic": "https://main.qcloudimg.com/raw/c920c5d7f4993e295af9faefcb24d543.png",
"_id": "4885635e676cc74d00574bce22687dab",
"title": "政务"
"title": "政务",
"description":"腾讯云微搭低代码 WeDa 是高效、高性能的拖拽式低代码开发平台,向上连接前端的行业业务,向下连接云计算的海量能力,助力企业垂直上云。微搭将繁琐的底层架构和基础设施抽象化为图形界面,通过行业化模板、拖放式组件和可视化配置快速构建多端应用(小程序、H5应用、Web 应用等),免去了代码编写工作,让您能够完全专注于业务场景。微搭以云开发作为底层支撑,云原生能力将应用搭建的全链路打通,提供高度开放的开发环境,且时刻为您的应用保驾护航。",
"time": "2024-12-26 11:02:36",
"detail_pic":'https://qcloudimg.tencent-cloud.cn/raw/3ea5139beeae6c4e2e98d30ad1ed7ade.png'
}
];

Expand Down Expand Up @@ -76,21 +85,24 @@ export const NewsData = [
"_id": "c69c6e4c676cc74d00583c0f7c327139",
"title": "腾讯云微搭低代码全面开启商业合作,有合作意向的看这里",
"picture": "https://main.qcloudimg.com/raw/ab3f1ec0c39c16b3b0d2fc0405f92635.png",
"updatedAt": 1735182157922
"updatedAt": 1735182157922,
"content":'腾讯云微搭低代码 WeDa 是高效、高性能的拖拽式低代码开发平台,向上连接前端的行业业务,向下连接云计算的海量能力,助力企业垂直上云。微搭将繁琐的底层架构和基础设施抽象化为图形界面,通过行业化模板、拖放式组件和可视化配置快速构建多端应用(小程序、H5应用、Web 应用等),免去了代码编写工作,让您能够完全专注于业务场景。微搭以云开发作为底层支撑,云原生能力将应用搭建的全链路打通,提供高度开放的开发环境,且时刻为您的应用保驾护航'
},
{
"time": "2024-12-26 11:02:37",
"_id": "c69c6e4c676cc74d00583c0e4ffdbdf0",
"title": "功能更新要点:新增流程引擎功能,新增编辑器实现预览模式...",
"picture": "https://main.qcloudimg.com/raw/d33eff8124507051de9170ea09b64100.png",
"updatedAt": 1735182157663
"updatedAt": 1735182157663,
"content":'腾讯云微搭低代码 WeDa 是高效、高性能的拖拽式低代码开发平台,向上连接前端的行业业务,向下连接云计算的海量能力,助力企业垂直上云。微搭将繁琐的底层架构和基础设施抽象化为图形界面,通过行业化模板、拖放式组件和可视化配置快速构建多端应用(小程序、H5应用、Web 应用等),免去了代码编写工作,让您能够完全专注于业务场景。微搭以云开发作为底层支撑,云原生能力将应用搭建的全链路打通,提供高度开放的开发环境,且时刻为您的应用保驾护航'
},
{
"time": "2024-12-26 11:02:37",
"_id": "b834edac676cc74d0056f01c0d71f9fa",
"title": "腾讯云微搭低代码模版大赛即将开启",
"picture": "https://main.qcloudimg.com/raw/8095b2fca30cc740fdae71b50324b6d4.png",
"updatedAt": 1735182157776
"updatedAt": 1735182157776,
"content":'腾讯云微搭低代码 WeDa 是高效、高性能的拖拽式低代码开发平台,向上连接前端的行业业务,向下连接云计算的海量能力,助力企业垂直上云。微搭将繁琐的底层架构和基础设施抽象化为图形界面,通过行业化模板、拖放式组件和可视化配置快速构建多端应用(小程序、H5应用、Web 应用等),免去了代码编写工作,让您能够完全专注于业务场景。微搭以云开发作为底层支撑,云原生能力将应用搭建的全链路打通,提供高度开放的开发环境,且时刻为您的应用保驾护航'
}
];

Expand Down
19 changes: 9 additions & 10 deletions miniprogram/tcb-official-website/services/scene/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getAll, getOne } from '../_utils/model';
import { cloudbaseTemplateConfig } from '../../config/index';
import {SceneData} from '../cloudbaseMock/index'
import {SceneData, SolutionData, NewsData} from '../cloudbaseMock/index'
import { DATA_MODEL_KEY } from '../../config/model'

/** 获取应用场景数据 */
Expand All @@ -10,14 +10,7 @@ export async function fetchSceneData(params) {
return SceneData;
}
return await getAll({
name: DATA_MODEL_KEY.SCENE_LIST,
select: {
_id: true,
title: true,
sub_title: true,
backgroud_pic: true,
updatedAt: true,
},
name: DATA_MODEL_KEY.SCENE_LIST
});
}

Expand All @@ -30,7 +23,13 @@ export async function fetchSceneDetail(id,type) {
}
if (cloudbaseTemplateConfig.useMock) {
/** 返回应用场景 mock数据 */
return SceneData;
if(type === 'news'){
return NewsData.find((item)=> item?._id === id);
}else if(type === 'scene'){
return SceneData.find((item)=> item?._id === id);
}else if(type === 'solution'){
return SolutionData.find((item)=> item?._id === id);
}
}
return await getOne({
name: NAMES[type],
Expand Down

0 comments on commit e3fee8a

Please sign in to comment.