UniApp 低代码工具的开发效率 确实可以显著提升开发速度并降低成本,尤其是在构建轻量级应用(如微官网)时。以下是具体分析,以及如何通过 UniApp 低代码工具实现“1 天内完成微官网开发,成本降低 80%”的目标:
一、UniApp 低代码工具的开发效率优势
1. 可视化开发
-
拖拽式设计:通过可视化界面设计工具,开发者可以直接拖拽组件(如轮播图、导航栏、图文列表等)构建页面,无需编写大量代码。
-
实时预览:支持实时预览功能,开发者可以即时查看页面效果,快速调整布局和样式。
2. 丰富的模板和组件
-
模板库:UniApp 提供了多种微官网模板,开发者可以直接选择并快速修改,节省设计时间。
-
组件库:内置丰富的 UI 组件(如按钮、表单、卡片等),覆盖了常见的功能需求。
3. 多平台兼容
-
一次开发,多端发布:UniApp 支持将同一套代码编译到 H5、小程序、APP 等多个平台,避免了重复开发的工作量。
-
跨平台适配:UniApp 提供了统一的 API 和组件,确保功能在不同平台上的一致性。
4. 插件市场支持
-
现成模块:UniApp 插件市场提供了大量现成的功能模块(如轮播图、导航栏、图文列表等),开发者可以直接集成,无需从零开发。
二、如何实现“1 天内完成微官网开发,成本降低 80%”
1. 选择合适的模板
-
模板库:从 UniApp 模板库中选择一个适合的微官网模板(如企业官网、产品展示官网等),直接基于模板进行开发。
-

-
快速修改:根据需求修改模板中的文字、图片和样式,快速完成页面设计。
2. 复用现有组件
-
组件库:使用 UniApp 内置的组件(如轮播图、导航栏、图文列表等),快速构建页面功能。
-

-
页面模板:从插件市场选择合适的模块(如富文本编辑器、图片懒加载等),直接集成到项目中,避免重复开发。
3. 简化开发流程
-
明确需求:在开发前与业务方充分沟通,明确微官网的功能范围和设计风格,避免开发过程中频繁调整。
-
分阶段开发:将开发过程分为多个阶段(如页面设计、功能开发、测试上线),每个阶段设定明确的目标和时间节点。
4. 自动化测试与部署
-
自动化测试:使用自动化测试工具(如 Jest)对微官网功能进行测试,确保功能的稳定性和兼容性。
-
一键部署:通过 UniApp 的云打包功能,快速将应用发布到多个平台,减少部署时间。
三、具体案例:1 天内完成企业微官网开发
1. 需求分析
-
官网目标:展示企业信息、产品服务和联系方式,提升品牌形象。
-
功能需求:首页轮播图、产品展示、关于我们、联系我们。
-

2. 开发步骤
-
第 1 步(1 小时):
-
从 UniApp 模板库中选择一个企业官网模板,导入到项目中。
-
-
第 2 步(2 小时):
-
修改首页轮播图,替换为企业宣传图片。
-

-
修改导航栏,添加“首页”、“产品”、“关于我们”、“联系我们”等菜单项。
-

-

-
<template> <view class="container container333638"> <view class="flex flex-wrap diygw-col-24 items-center flex13-clz"> <view class="flex flex-wrap diygw-col-0 flex-direction-column flex14-clz"> <text class="diygw-col-0 text7-clz"> 最新 </text> <text class="diygw-col-0"> 公告 </text> </view> <view class="flex diygw-col-0 noticebar-clz"> <diy-noticebar class="flex1 diy-notice-bar" :remote="true" :list="notices.rows" color="#00d6b9" bgColor="#fff" :speed="120" leftIcon="diy-icon-notification"> <block v-slot:content> <text class="diy-notice-item" v-for="(item, index) in notices.rows" :key="index"> {{ item.title }} </text> </block> </diy-noticebar> </view> </view> <view class="flex diygw-col-24 swiper-clz"> <swiper :current="swiperIndex" class="swiper" @change="changeSwiper" indicator-color="rgba(51, 51, 51, 0.39)" indicator-active-color="#fff" indicator-dots="true" autoplay interval="3000" circular="true" style="height: 300rpx"> <swiper-item v-for="(item, index) in swipers.rows" :key="index" @tap="navigateTo" data-type="openFunction" :data-path="item.path" class="diygw-swiper-item"> <view class="diygw-swiper-item-wrap"> <image :src="item.img" class="diygw-swiper-image"></image> <view class="diygw-swiper-item-title swiper-title"> {{ item.title }} </view> </view> </swiper-item> </swiper> </view> <view class="flex flex-wrap diygw-col-24 items-end flex15-clz"> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex16-clz" @tap="navigateTo" data-type="page" data-url="/pages/article" data-id="1"> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center"> <image src="/static/gy.png" class="image5-size diygw-image diygw-col-0" mode="widthFix"></image> </view> <text class="diygw-text-line1 diygw-col-0"> 关于我们 </text> </view> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex18-clz" @tap="navigateTo" data-type="page" data-url="/pages/products"> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center"> <image src="/static/cp.png" class="image7-size diygw-image diygw-col-0" mode="widthFix"></image> </view> <text class="diygw-text-line1 diygw-col-0"> 产品展示 </text> </view> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex22-clz" @tap="navigateTo" data-type="page" data-url="/pages/articles"> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center"> <text class="diygw-text-line1 diygw-col-0 animate__animated animate__heartBeat animate__infinite text12-clz"> </text> <image src="/static/xw.png" class="image10-size diygw-image diygw-col-0" mode="widthFix"></image> </view> <text class="diygw-text-line1 diygw-col-0"> 新闻资讯 </text> </view> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex25-clz" @tap="navigateTo" data-type="page" data-url="/pages/article" data-id="2"> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center"> <image src="/static/ys.png" class="image11-size diygw-image diygw-col-0" mode="widthFix"></image> </view> <text class="diygw-text-line1 diygw-col-0"> 案例演示 </text> </view> </view> <view class="flex diygw-col-24 items-end flex-wrap flex21-clz"> <view class="flex flex-wrap diygw-col-24 justify-between items-center flex27-clz"> <text class="diygw-text-line1 diygw-col-0"> 公司位置 </text> <view class="flex flex-wrap diygw-col-0 justify-between items-center"> <text class="diygw-text-line1 diygw-col-0"> 查看全部 </text> <text class="flex icon diygw-col-0 diy-icon-right"></text> </view> </view> <view class="flex flex-wrap diygw-col-24 items-center flex28-clz"> <image src="/static/gy.png" class="image9-size diygw-image diygw-col-0" mode="widthFix"></image> <view class="flex flex-wrap diygw-col-0 flex-direction-column flex29-clz" @tap="navigateTo" data-type="page" data-url="/pages/articles"> <text class="diygw-text-line1 diygw-col-0 text16-clz"> 志丰科技有限公司 </text> <text class="diygw-text-line1 diygw-col-0 text21-clz"> 中山市某某某某某某某某某某地言 </text> </view> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center flex31-clz" @tap="navigateTo" data-type="phone" data-phone="15913132246"> <image src="/static/dh.png" class="image13-size diygw-image diygw-col-0" mode="widthFix"></image> <text class="diygw-text-line1 diygw-col-0"> 拨打电话 </text> </view> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center flex30-clz" @tap="navigateTo" data-type="daohang" data-address="广东省中山市中山市中山四路88号" data-lat="22.51084" data-lng="113.402465"> <image src="/static/dz.png" class="image12-size diygw-image diygw-col-0" mode="widthFix"></image> <text class="diygw-text-line1 diygw-col-0"> 查看位置 </text> </view> </view> </view> <view class="flex flex-wrap diygw-col-24 justify-between items-center flex32-clz"> <view class="flex flex-wrap diygw-col-0 items-center"> <view class="flex flex-wrap diygw-col-0 flex-direction-column"> <text class="diygw-col-0 text19-clz"> </text> <text class="diygw-col-0 text24-clz"> </text> <text class="diygw-text-line1 diygw-col-0 text26-clz"> 产品服务 </text> </view> <text class="diygw-text-line1 diygw-col-0 text27-clz"> 个性化产品服务 </text> </view> <view class="flex flex-wrap diygw-col-0 items-center"> <text class="diygw-col-0 text44-clz"> 查看更多 </text> <text class="flex icon1 diygw-col-0 icon1-clz diy-icon-right"></text> </view> </view> <view v-if="products.total > 0" class="flex flex-wrap diygw-col-24 flex-direction-column"> <view v-for="(item, index) in products.rows" :key="index" class="flex flex-wrap diygw-col-24 flex-direction-column items-stretch flex6-clz" @tap="navigateTo" data-type="page" data-url="/pages/product" :data-id="item.id"> <view class="flex flex-wrap diygw-col-24 items-center"> <image :src="item.img" class="response diygw-col-24" mode="widthFix"></image> </view> <view class="flex flex-wrap diygw-col-0 items-center flex20-clz"> <view class="flex flex-wrap diygw-col-0 flex-direction-column flex35-clz"> <text class="diygw-col-0 text22-clz"> {{ item.title }} </text> <text class="diygw-text-line1 diygw-col-0"> {{ item.remark }} </text> </view> <text class="diygw-text-line3 diygw-col-0 text20-clz"> ¥{{ item.price }} </text> </view> </view> </view> <view v-if="globalData.isshow && products.code == 200 && products.total == 0" class="flex flex-wrap diygw-col-24 flex-direction-column items-center flex1-clz"> <image src="/static/zwjl.png" class="image1-size diygw-image diygw-col-0" mode="widthFix"></image> <text class="diygw-col-0 text-clz"> 未找到任何数据 </text> </view> <view class="flex flex-wrap diygw-col-24 items-end diygw-bottom flex2-clz"> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex8-clz"> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center"> <image src="/static/sy.png" class="image2-size diygw-image diygw-col-0" mode="widthFix"></image> </view> <text class="diygw-text-line1 diygw-col-0 text3-clz"> 首页 </text> </view> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex4-clz" @tap="navigateTo" data-type="page" data-url="/pages/products"> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center"> <image src="/static/cp1.png" class="image3-size diygw-image diygw-col-0" mode="widthFix"></image> </view> <text class="diygw-text-line1 diygw-col-0"> 产品 </text> </view> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex9-clz" @tap="navigateTo" data-type="page" data-url="/pages/msg/edit"> <image src="/static/fb.png" class="image6-size diygw-image diygw-col-0 image6-clz" mode="widthFix"></image> <text class="diygw-text-line1 diygw-col-0 text2-clz"> 在线预约 </text> </view> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex11-clz" @tap="navigateTo" data-type="page" data-url="/pages/articles"> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center"> <text class="diygw-text-line1 diygw-col-0 animate__animated animate__heartBeat animate__infinite text15-clz"> </text> <image src="/static/xw1.png" class="image8-size diygw-image diygw-col-0" mode="widthFix"></image> </view> <text class="diygw-text-line1 diygw-col-0"> 新闻资讯 </text> </view> <view class="flex flex-wrap diygw-col-6 flex-direction-column items-center flex12-clz" @tap="navigateTo" data-type="page" data-url="/pages/user"> <view class="flex flex-wrap diygw-col-0 flex-direction-column items-center"> <image src="/static/wd.png" class="image4-size diygw-image diygw-col-0" mode="widthFix"></image> </view> <text class="diygw-text-line1 diygw-col-0"> 我的 </text> </view> </view> <view class="clearfix"></view> </view> </template> <script> export default { data() { return { //用户全局信息 userInfo: {}, //页面传参 globalOption: {}, //自定义全局变量 globalData: { isshow: false }, swipersNum: 1, swipers: { rows: [ { id: 0, title: '', remark: '', img: '', path: null, userId: 0, createTime: '', updateTime: '', deleteTime: null } ], total: 0, code: 0, msg: '' }, noticesNum: 1, notices: { rows: [ { id: 0, title: '', remark: '', userId: 0, createTime: '', updateTime: '', deleteTime: null } ], total: 0, code: 0, msg: '' }, productsNum: 1, products: { rows: [ { id: 0, title: '', remark: '', img: '', price: '', content: '', cateId: null, userId: 0, createTime: '', updateTime: '', deleteTime: null } ], total: 0, code: 0, msg: '' }, swiperIndex: 0 }; }, onShow() { this.setCurrentPage(this); }, onLoad(option) { this.setCurrentPage(this); if (option) { this.setData({ globalOption: this.getOption(option) }); } this.init(); }, methods: { async init() { this.swipersApi(); this.noticesApi(); await this.productsApi(); }, // 轮播数据 API请求方法 async swipersApi(param) { let thiz = this; param = param || {}; //请求地址及请求数据,可以在加载前执行上面增加自己的代码逻辑 let http_url = '/cms/api.swiper/list'; let http_data = { pageNum: this.swipersNum, pageSize: 10, pageSize: param.pageSize || '5' }; let http_header = {}; let swipers = await this.$http.post(http_url, http_data, http_header, 'json'); this.swipers = swipers; this.globalData.isshow = true; }, // 公告数据 API请求方法 async noticesApi(param) { let thiz = this; param = param || {}; //请求地址及请求数据,可以在加载前执行上面增加自己的代码逻辑 let http_url = '/cms/api.notice/list'; let http_data = { pageNum: this.noticesNum, pageSize: 10, pageSize: param.pageSize || '5' }; let http_header = {}; let notices = await this.$http.post(http_url, http_data, http_header, 'json'); this.notices = notices; }, // 产品数据 API请求方法 async productsApi(param) { let thiz = this; param = param || {}; //如果请求要重置页面,请配置点击附加参数refresh=1 增加判断如输入框回调param不是对象 if (param.refresh || typeof param != 'object') { this.productsNum = 1; } //请求地址及请求数据,可以在加载前执行上面增加自己的代码逻辑 let http_url = '/cms/api.product/list'; let http_data = { pageNum: this.productsNum, pageSize: 10 }; let http_header = {}; let products = await this.$http.post(http_url, http_data, http_header, 'json'); let datarows = products.rows; if (http_data.pageNum == 1) { this.products = products; } else if (datarows) { let rows = this.products.rows.concat(datarows); products.rows = rows; this.products = Object.assign(this.products, products); } if (datarows && datarows.length > 0) { this.productsNum = this.productsNum + 1; } this.globalData.isshow = true; }, // 打开链接 自定义方法 async openFunction(param) { let thiz = this; let path = param && (param.path || param.path == 0) ? param.path : thiz.item.path || ''; if (path) { this.navigateTo({ type: 'page', url: path }); } }, changeSwiper(evt) { let swiperIndex = evt.detail.current; this.setData({ swiperIndex }); } }, onPullDownRefresh() { // 产品数据 API请求方法 this.productsNum = 1; this.productsApi(); uni.stopPullDownRefresh(); }, onReachBottom() { // 产品数据 API请求方法 this.productsApi(); } }; </script> <style lang="scss" scoped> .flex13-clz { padding-top: 6rpx; border-bottom-left-radius: 12rpx; padding-left: 0rpx; padding-bottom: 6rpx; border-top-right-radius: 12rpx; margin-right: 20rpx; background-color: #ffffff; margin-left: 20rpx; box-shadow: 0rpx 0rpx 12rpx 2px rgba(219, 219, 219, 0.31); overflow: hidden; width: calc(100% - 20rpx - 20rpx) !important; border-top-left-radius: 12rpx; margin-top: 10rpx; border-bottom-right-radius: 12rpx; margin-bottom: 10rpx; padding-right: 0rpx; } .flex14-clz { margin-left: 10rpx; padding-top: 0rpx; z-index: 1; font-weight: bold; letter-spacing: 4rpx !important; padding-left: 10rpx; padding-bottom: 0rpx; margin-top: 0rpx; font-style: italic; margin-bottom: 0rpx; margin-right: -20rpx; padding-right: 10rpx; } .text7-clz { color: #00d6b9; } .noticebar-clz { flex: 1; } .swiper-clz { background-color: #ffffff; margin-left: 20rpx; border-bottom-left-radius: 12rpx; box-shadow: 0rpx 0rpx 12rpx 2px rgba(219, 219, 219, 0.31); overflow: hidden; width: calc(100% - 20rpx - 20rpx) !important; border-top-left-radius: 12rpx; margin-top: 10rpx; border-top-right-radius: 12rpx; border-bottom-right-radius: 12rpx; margin-bottom: 10rpx; margin-right: 20rpx; } .swiper-title { background-color: rgba(0, 0, 0, 0.281); color: #e6e6e6; } .flex15-clz { padding-top: 24rpx; border-bottom-left-radius: 12rpx; padding-left: 10rpx; padding-bottom: 24rpx; border-top-right-radius: 12rpx; margin-right: 20rpx; background-color: #ffffff; margin-left: 20rpx; box-shadow: 0rpx 0rpx 12rpx 2px rgba(219, 219, 219, 0.31); overflow: hidden; width: calc(100% - 20rpx - 20rpx) !important; border-top-left-radius: 12rpx; margin-top: 10rpx; border-bottom-right-radius: 12rpx; margin-bottom: 10rpx; padding-right: 10rpx; } .flex16-clz { flex: 1; } .image5-size { height: 72rpx !important; width: 72rpx !important; } .flex18-clz { flex: 1; } .image7-size { height: 72rpx !important; width: 72rpx !important; } .flex22-clz { flex: 1; } .text12-clz { border: 2rpx solid #eee; border-bottom-left-radius: 40rpx; -webkit-animation-duration: 5000ms; color: #ffffff; animation-delay: 1000ms; -webkit-animation-delay: 1000ms; border-top-right-radius: 40rpx; right: -8rpx; background-color: rgba(255, 17, 17, 0.91); animation-duration: 5000ms; flex-shrink: 0; overflow: hidden; top: -8rpx; width: 16rpx !important; border-top-left-radius: 40rpx; border-bottom-right-radius: 40rpx; position: absolute; height: 16rpx !important; } .image10-size { height: 72rpx !important; width: 72rpx !important; } .flex25-clz { flex: 1; } .image11-size { height: 72rpx !important; width: 72rpx !important; } .flex21-clz { background-color: #ffffff; margin-left: 20rpx; border-bottom-left-radius: 12rpx; box-shadow: 0rpx 0rpx 12rpx 2px rgba(219, 219, 219, 0.31); overflow: hidden; width: calc(100% - 20rpx - 20rpx) !important; border-top-left-radius: 12rpx; margin-top: 10rpx; border-top-right-radius: 12rpx; border-bottom-right-radius: 12rpx; margin-bottom: 10rpx; margin-right: 20rpx; } .flex27-clz { padding-top: 20rpx; color: #fffefe; padding-left: 20rpx; padding-bottom: 20rpx; background-image: linear-gradient(180deg, rgba(43, 103, 253, 1) 0%, rgba(80, 129, 251, 1) 100%); padding-right: 20rpx; } .icon { font-size: 24rpx; } .flex28-clz { padding-top: 10rpx; padding-left: 20rpx; padding-bottom: 10rpx; padding-right: 20rpx; } .image9-size { height: 96rpx !important; width: 96rpx !important; } .flex29-clz { flex: 1; } .text16-clz { margin-left: 10rpx; font-weight: bold; font-size: 28rpx !important; margin-top: 10rpx; margin-bottom: 10rpx; margin-right: 10rpx; } .text21-clz { margin-left: 10rpx; margin-top: 10rpx; margin-bottom: 10rpx; margin-right: 10rpx; } .flex31-clz { padding-top: 10rpx; padding-left: 10rpx; padding-bottom: 10rpx; padding-right: 10rpx; } .image13-size { height: 72rpx !important; width: 72rpx !important; } .flex30-clz { padding-top: 10rpx; padding-left: 10rpx; padding-bottom: 10rpx; padding-right: 10rpx; } .image12-size { height: 72rpx !important; width: 72rpx !important; } .flex32-clz { margin-left: 20rpx; padding-top: 10rpx; padding-left: 10rpx; width: calc(100% - 20rpx - 20rpx) !important; padding-bottom: 10rpx; margin-top: 10rpx; margin-bottom: 10rpx; margin-right: 20rpx; padding-right: 10rpx; } .text19-clz { background-color: #7feadb; flex-shrink: 0; transform: translate(0rpx, 0rpx) skew(-9deg, 0deg); top: -4rpx; width: 24rpx !important; position: absolute; right: -10rpx; height: 24rpx !important; } .text24-clz { background-color: #7feadb; flex-shrink: 0; transform: translate(0rpx, 0rpx) skew(-9deg, 0deg); left: -10rpx; bottom: -4rpx; width: 24rpx !important; position: absolute; height: 24rpx !important; } .text26-clz { padding-top: 0rpx; font-weight: bold; flex: 1; padding-left: 0rpx; font-size: 32rpx !important; padding-bottom: 0rpx; padding-right: 0rpx; } .text27-clz { margin-left: 30rpx; color: #b3b2b2; margin-top: 0rpx; margin-bottom: 0rpx; margin-right: 0rpx; } .text44-clz { color: #666666; text-align: right; } .icon1-clz { color: #666666; } .icon1 { font-size: 24rpx; } .flex6-clz { background-color: #ffffff; margin-left: 20rpx; border-bottom-left-radius: 12rpx; box-shadow: 0rpx 0rpx 12rpx 2px rgba(219, 219, 219, 0.31); overflow: hidden; width: calc(100% - 20rpx - 20rpx) !important; border-top-left-radius: 12rpx; margin-top: 10rpx; border-top-right-radius: 12rpx; border-bottom-right-radius: 12rpx; margin-bottom: 10rpx; margin-right: 20rpx; } .flex20-clz { padding-top: 10rpx; flex: 1; padding-left: 10rpx; padding-bottom: 10rpx; padding-right: 10rpx; } .flex35-clz { padding-top: 10rpx; flex: 1; padding-left: 10rpx; padding-bottom: 10rpx; padding-right: 10rpx; } .text22-clz { font-weight: bold; font-size: 28rpx !important; } .text20-clz { padding-top: 10rpx; font-weight: bold; padding-left: 10rpx; font-size: 28rpx !important; padding-bottom: 10rpx; padding-right: 10rpx; } .flex1-clz { padding-top: 20rpx; padding-left: 20rpx; padding-bottom: 20rpx; padding-right: 20rpx; } .image1-size { height: 400rpx !important; width: 400rpx !important; } .text-clz { color: #969696; font-size: 28rpx !important; } .flex2-clz { border-top: 2rpx solid #e4e4e4; padding-top: 16rpx; border-bottom-left-radius: 0rpx; bottom: 0rpx; padding-left: 16rpx; padding-bottom: 16rpx; border-top-right-radius: 24rpx; background-color: #ffffff; box-shadow: 0rpx 4rpx 12rpx rgba(31, 31, 31, 0.16); overflow: visible; left: 0rpx; border-top-left-radius: 24rpx; border-bottom-right-radius: 0rpx; padding-right: 16rpx; } .flex8-clz { flex: 1; } .image2-size { height: 48rpx !important; width: 48rpx !important; } .text3-clz { color: #031aeb; } .flex4-clz { flex: 1; } .image3-size { height: 48rpx !important; width: 48rpx !important; } .flex9-clz { margin-left: 0rpx; flex: 1; width: calc(25% - 0rpx - 0rpx) !important; margin-top: -100rpx; margin-bottom: 0rpx; margin-right: 0rpx; } .image6-clz { border-bottom-left-radius: 120rpx; box-shadow: 0rpx 2rpx 10rpx 1px rgba(31, 31, 31, 0.16); overflow: hidden; border-top-left-radius: 120rpx; border-top-right-radius: 120rpx; border-bottom-right-radius: 120rpx; } .image6-size { height: 80rpx !important; width: 80rpx !important; } .text2-clz { margin-left: 0rpx; margin-top: 16rpx; margin-bottom: 0rpx; margin-right: 0rpx; } .flex11-clz { flex: 1; } .text15-clz { border: 2rpx solid #eee; border-bottom-left-radius: 40rpx; -webkit-animation-duration: 5000ms; color: #ffffff; animation-delay: 1000ms; -webkit-animation-delay: 1000ms; border-top-right-radius: 40rpx; right: -8rpx; background-color: rgba(255, 17, 17, 0.91); animation-duration: 5000ms; flex-shrink: 0; overflow: hidden; top: -8rpx; width: 16rpx !important; border-top-left-radius: 40rpx; border-bottom-right-radius: 40rpx; position: absolute; height: 16rpx !important; } .image8-size { height: 48rpx !important; width: 48rpx !important; } .flex12-clz { flex: 1; } .image4-size { height: 48rpx !important; width: 48rpx !important; } .container333638 { padding-bottom: 160rpx; background-color: #f5f5f5; background-image: url(/static/loginbg.png); background-size: cover; background-repeat: no-repeat; } </style>
-
-
第 3 步(3 小时):
-
开发产品展示页面,使用图文列表组件展示产品信息。
-
开发关于我们页面,使用富文本编辑器添加企业介绍。
-

-

-
-
第 4 步(2 小时):
-
开发联系我们页面,添加地图组件和联系方式表单。
-

-

-
<template> <view class="container container333638"> <u-form :model="form" :rules="formRules" :errorType="['message', 'toast']" ref="formRef" class="flex diygw-form diygw-col-24 form-clz"> <u-form-item class="diygw-col-24" :required="true" label="预约事项" prop="title"> <u-input :focus="formData.titleFocus" placeholder="请输入预约事项" v-model="form.title"></u-input> </u-form-item> <u-form-item class="diygw-col-24" :required="true" label="手机号" prop="phone"> <u-input :focus="formData.phoneFocus" placeholder="请输入手机号" v-model="form.phone"></u-input> </u-form-item> <u-form-item class="diygw-col-24" label="备注" prop="remark"> <u-input maxlength="200" height="60px" class="" placeholder="请输入提示信息" v-model="form.remark" type="textarea"></u-input> </u-form-item> </u-form> <view class="flex flex-wrap diygw-col-24 justify-start diygw-bottom flex3-clz"> <view class="flex flex-wrap diygw-col-24 justify-center items-center green flex20-clz" @click="submitForm"> <text class="flex icon2 diygw-col-0 diy-icon-post"></text> <text class="diygw-col-0"> 保存 </text> </view> </view> <view class="clearfix"></view> </view> </template> <script> export default { data() { return { //用户全局信息 userInfo: {}, //页面传参 globalOption: {}, //自定义全局变量 globalData: { isshow: false }, formRules: { title: [ { trigger: ['change', 'blur'], required: true, message: '预约事项不能为空' } ], phone: [ { trigger: ['change', 'blur'], required: true, message: '手机号不能为空' }, { trigger: ['change', 'blur'], message: '请输入11位的手机号码', pattern: /^1[3-9]\d{9}$/ } ] }, form: { title: '', phone: '', remark: '' }, formData: { titleFocus: false, phoneFocus: false } }; }, onShow() { this.setCurrentPage(this); }, onLoad(option) { this.setCurrentPage(this); if (option) { this.setData({ globalOption: this.getOption(option) }); } this.init(); }, onReady() { this.$refs.formRef?.setRules(this.formRules); }, methods: { async init() { await this.initResetform(); }, initResetform() { this.initform = JSON.stringify(this.form); //如果想给表单默认初始值,其中row为某一行数据也可能是API返回的结果集,然后给到this.form //this.form = this.$tools.changeRowToForm(row,this.form) }, resetForm() { this.form = JSON.parse(this.initform); }, async submitForm(e) { this.$refs.formRef?.setRules(this.formRules); this.$nextTick(async () => { let valid = await this.$refs.formRef.validate(); if (valid) { //保存数据 let param = this.form; let header = {}; let url = '/cms/msg/add'; if (this.form.id) { url = ' /cms/msg/update'; } uni.showLoading({ title: '正在保存...' }); let res = await this.$http.post(url, param, header, 'json'); uni.hideLoading(); if (res.code == 200) { this.showToast('发布成功'); this.navigateTo({ type: 'page', redirect: '1', url: 'msg/index' }); } else { this.showModal(res.msg, '提示', false); } } else { console.log('验证失败'); } }); } } }; </script> <style lang="scss" scoped> .form-clz { padding-top: 10rpx; border-bottom-left-radius: 12rpx; padding-left: 10rpx; padding-bottom: 10rpx; border-top-right-radius: 12rpx; margin-right: 20rpx; background-color: #ffffff; margin-left: 20rpx; overflow: hidden; width: calc(100% - 20rpx - 20rpx) !important; border-top-left-radius: 12rpx; margin-top: 10rpx; border-bottom-right-radius: 12rpx; margin-bottom: 10rpx; padding-right: 10rpx; } .flex3-clz { padding-top: 16rpx; border-bottom-left-radius: 0rpx; color: #747474; bottom: 0rpx; padding-left: 16rpx; padding-bottom: 16rpx; border-top-right-radius: 20rpx; background-color: #ffffff; overflow: hidden; left: 0rpx; border-top-left-radius: 20rpx; border-bottom-right-radius: 0rpx; padding-right: 16rpx; } .flex20-clz { padding-top: 16rpx; border-bottom-left-radius: 200rpx; overflow: hidden; font-weight: bold; padding-left: 10rpx; font-size: 28rpx !important; padding-bottom: 16rpx; border-top-left-radius: 200rpx; border-top-right-radius: 200rpx; border-bottom-right-radius: 200rpx; padding-right: 10rpx; } .icon2 { font-size: 40rpx; } .container333638 { background-color: #f5f5f5; } </style>
-
-
第 5 步(2 小时):
-
进行测试和优化,确保功能稳定性和用户体验。
-

-
-
第 6 步(1 小时):
-
使用 UniApp 云打包功能,将微官网发布到 H5 和小程序平台。
-

-
3. 成本降低 80% 的实现
-
减少开发时间:通过低代码工具和模板库,开发时间从传统的 1-2 周缩短至 1 天。
-
降低人力成本:无需雇佣大量开发人员,1 名开发者即可完成任务。
-
减少维护成本:通过模块化设计和热更新功能,降低后期维护成本。
四、总结
通过 UniApp 低代码工具,开发者可以充分利用可视化设计、丰富模板和组件库、多平台兼容等优势,快速完成微官网开发。结合复用现有组件、简化开发流程、自动化测试与部署等策略,能够在 1 天内完成微官网开发,并将成本降低 80%。这种高效、低成本的开发模式,特别适合中小企业和创业团队,能够快速响应市场需求,提升竞争力。
975

被折叠的 条评论
为什么被折叠?



