HC小区文档

HC社区商城用户端代码部署

这里主要以部署H5代码为主,商城用户端就是业主端中的商圈选项中的内容,本项目是以uni-app 方式开发,需要用到Hbuildx 工具
如果不了解uni-app,请先学习后再来部署;

1.0 修改配置

用Hbuildx 打开 MallApp项目,打开conf 目录下的config.js 文件,目录如下:

MallApp
   conf
      config.js

文件内容如下:

/**
 * HC小区商城配置文件
 * 
 * 本项目只有这里修改相应配置信息,如果不是二次开发 请不要修改其他文件内容
 * 
 * @website http://www.homecommunity.cn/
 * @author 吴学文
 * @QQ 928255095
 */

// #ifdef H5
// 服务器域名 公众号时,配置为 / 就可以
const baseUrl = '/';
// #endif

// #ifndef H5
//服务器域名 小程序 或者 app 时 后端地址
const baseUrl = 'https://mall.huilinwan.cn/';
// #endif

//const commonBaseUrl = 'http://mall.homecommunity.cn/';
const commonBaseUrl = 'https://mall.huilinwan.cn/';

// APP 或者 公众号  appId
const wAppId = ""; //微信AppId

//app支付时这里需要填写支付秘钥
const appPayKey = "";

const logLevel = "DEBUG"; // 日志级别

/**
 * 应用信息,主要是用来和后端服务交互时的时候用
 */

// HC平台分配 应用ID
const appId = "992021051843980190";
const appSecurity = "";



export default {
	baseUrl: baseUrl,
	commonBaseUrl: commonBaseUrl,
	wAppId: wAppId,
	logLevel: logLevel,
	appPayKey: appPayKey,
	appId: appId,
	appSecurity: appSecurity
}

需要修改commonBaseUrl 地址为商城pc 域名,其他的保持不变

2.0 编译

点击Hbuildx 的发行按钮,找到网站-PC选项,填写网站域名,例如 http://mallapp.homecommunity.cn(替换为自己的),点击发行,就会出现如下的日志:

[HBuilder] 02:21:33.979 asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
[HBuilder] 02:21:33.979 This can impact web performance.
[HBuilder] 02:21:33.979 Assets: 
[HBuilder] 02:21:33.980   static/js/index.56e75f39.js (282 KiB)
[HBuilder] 02:21:33.980 entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
[HBuilder] 02:21:33.980 Entrypoints:
[HBuilder] 02:21:33.980   index (282 KiB)
[HBuilder] 02:21:33.980       static/js/index.56e75f39.js
[HBuilder] 02:21:33.980 项目 MallApp 编译成功。
[HBuilder] 02:21:34.039 项目 MallApp 导出Web成功,路径为:D:\project\hc\MallApp\unpackage\dist\build\web
[HBuilder] 02:21:34.040 注意请部署到web服务器使用,不要使用资源管理器直接打开,除非进行相对路径配置,具体参考:https://ask.dcloud.net.cn/article/37432。

打开编译后路劲 比如 D:\project\hc\MallApp\unpackage\dist\build\web,目录下存在如下文件

assets
static
index.html

将目录和文件上传到梓豪平台下的/home/data/web/mallApp 下(如果此目录下有内容请删除后上传)

3.0 配置nginx

nginx需要配置 商城用户端,这里nginx复用HC小区管理系统的nginx

商城用户端nginx配置

server {
	listen       80;
	server_name  mallapp.homecommunity.cn;

	location / {
	    root   /home/data/web/mallApp;
	}
	location /mall
	{
	  add_header 'Access-Control-Allow-Origin' '*';
	  proxy_pass   http://dev.api.java110.com:8015;
	}
	location /app
	{

	  add_header 'Access-Control-Allow-Origin' '*';
	  proxy_pass  http://dev.api.java110.com:8015;
	}
}

将mallapp.homecommunity.cn 修改为自己的域名,在梓豪应用中重启nginx即可

4.0 将业主端 注释的商圈打开

用HBuildx 打开WechatOwnerService项目下的pages.json,打开商圈注释

"list": [{
				"pagePath": "pages/index/index",
				"text": "首页",
				"iconPath": "static/images/home.png",
				"selectedIconPath": "static/images/home-selected.png"
			},
			{
				"pagePath": "pages/homemaking/homemaking",
				"text": "服务",
				"iconPath": "static/images/rent.png",
				"selectedIconPath": "static/images/rent-selected.png"
			},
			
			
			{
				"pagePath": "pages/mall/mall",
				"text": "商圈",
				"iconPath": "static/images/market.png",
				"selectedIconPath": "static/images/market-selected.png"
			},
			
			{
				"pagePath": "pages/my/my",
				"text": "我的",
				"iconPath": "static/images/my.png",
				"selectedIconPath": "static/images/mySelected.png"
			}
		]

打开pages/homemaking/homemaking.vue 文件,将service-homemaking 标签打开

<template>
	<view>
		<service-property></service-property>
		<service-homemaking></service-homemaking>
	</view>
</template>

打开 components/my/my-menu.vue文件,将我的订单部分的注解删掉,如下

<template>
	<view>
		<view class="serve_box">
			<view class="serve_title">基础服务</view>
			<view class="serve_list">
				<view class="list">
					<view class="item" v-for="(item,index) in serve_list" :key="index" @tap="to_serve(item)">
						<image :src="item.src"></image>
						<view class="text">{{item.name}}</view>
					</view>
				</view>
			</view>
		</view>

		<view class="order_box">
			<view class="order_title">我的订单</view>
			<view class="order_list">
				<view class="list">
					<view class="item" v-for="(item,index) in order_list" :key="index" @tap="toMallOrders()">
						<image :src="item.src"></image>
						<view class="text">{{item.name}}</view>
					</view>
				</view>
			</view>
		</view>

		<auth-owner-dialog ref="authOwnerDialogRef"></auth-owner-dialog>
	</view>
</template>

重新编译发布业主端