Appearance
小程序公共 Cix
使用方式
在小程序根目录下执行 git clone 命令,将公共部分检出为子文件夹 cix 。
bash
git clone http://192.168.14.111/investoday-c/applet/common/cix.git -b dev cixgit clone http://192.168.14.111/investoday-c/applet/common/cix.git -b dev cix更新方式
任意项目中 cix 文件夹中代码修改后直接提交, 提交完成后, 其他项目执行 git pull 完成公共部分代码更新即可。
注意事项
- 由于此公共部分多个小程序共用,修改时请谨慎并考虑兼容性。
- 所有的文件都是以
微信小程序开发指南作为标准, 请注意其他小程序的兼容性及扩展性。
项目结构
- components 公共组件
- const 公共常量
- css 公共css
- pages 公共的小程序页面(主包)
- page-ix 公共小程序页面(子包)
- service 统一API调用服务
- utils 工具类
公共css
通用部分
commonAttr.less 通用属性值
less// CDN 基础path @cdnBase: "https://storage.txyun.investoday.net/storage"; // CDN Image Path @cdnImg: "@{cdnBase}/cdn/images";// CDN 基础path @cdnBase: "https://storage.txyun.investoday.net/storage"; // CDN Image Path @cdnImg: "@{cdnBase}/cdn/images";font.wxss 字体引用
GlobalCommon.less 全局通用业务属性
iconFont.wxss iconfont的图标库样式
sdInit.wxss 闪电系列初始化的引用
闪电系列通用
common.less 通用样式,业务使用经常引用
fontSize.less 闪电系列的UI字体规范
小程序的字体进行了规范化,在进行Page和Component开发时使用变量代替font-size值
less@import "../../../../cix/css/sd/common.less"; view{ font-size: @font-ex-large; }@import "../../../../cix/css/sd/common.less"; view{ font-size: @font-ex-large; }theme.wxss 主题适配
主题配置文件主要为了一键适配不同的颜色主题,规范化每个页面的颜色值,达到Applet所有页面统一颜色。在Page和Component开发时使用
颜色值变量代替colorless.search{ background-color: var(--cr-card-bg); }.search{ background-color: var(--cr-card-bg); }
公共页面注册
主包页面 pages
请在 app.json 文件中的 pages 中 增加以下路径
json
[
...,
"cix/pages/webview/webview",
"cix/pages/webview-x/webview-x",
"cix/pages/login-x/login-x",
"cix/pages/short-scene/short-scene"
][
...,
"cix/pages/webview/webview",
"cix/pages/webview-x/webview-x",
"cix/pages/login-x/login-x",
"cix/pages/short-scene/short-scene"
]请在 app.json 中的 子包 pageX 中移除以下页面
- 以
pages/setting开头的所有路径
请在 app.json 中的 subPackages 中移除 pageXI子包, 增加以下子包
json
{
"root": "cix/page-x",
"name": "page-x",
"pages":[
"pages/sd/vip/open-vip",
"pages/sd/vip/turntable-lottery/turntable-lottery",
"pages/sd/vip/vip-protocol/vip-protocol",
"pages/sd/push-set/push-set",
"pages/page-not-found/page-not-found",
"pages/sd/mine/income/income",
"pages/sd/mine/share-qrcode/share-qrcode",
"pages/sd/mine/invitor/invitor",
"pages/sd/mine/order/order",
"pages/sd/mine/coupon/coupon"
]
},{
"root": "cix/page-ix",
"name": "page-ix",
"pages": [
"pages/laboratory/laboratory",
"pages/spec-x/stock-wzb/stock-wzb",
"pages/spec-x/news/articles/articles",
"pages/spec-x/pay/demo/demo",
"pages/spec-x/skin/skin",
"pages/spec-x/lottie/lottie",
"pages/spec-x/red-packet-cover/red-packet-cover",
"pages/spec-x/become-x/become-x",
"pages/setting/storage/storage",
"pages/setting/remote-control/remote-control",
"pages/setting/developer/developer",
"pages/setting/info/info",
"pages/setting/setting",
"pages/setting/spec-setting/spec-setting",
"pages/setting/change-theme/change-theme",
"pages/setting/effect/effect",
"pages/setting/connect-x/connect-x",
"pages/setting/collect-phone/collect-phone",
"pages/review/my/my",
"pages/review/show/show"
]
}{
"root": "cix/page-x",
"name": "page-x",
"pages":[
"pages/sd/vip/open-vip",
"pages/sd/vip/turntable-lottery/turntable-lottery",
"pages/sd/vip/vip-protocol/vip-protocol",
"pages/sd/push-set/push-set",
"pages/page-not-found/page-not-found",
"pages/sd/mine/income/income",
"pages/sd/mine/share-qrcode/share-qrcode",
"pages/sd/mine/invitor/invitor",
"pages/sd/mine/order/order",
"pages/sd/mine/coupon/coupon"
]
},{
"root": "cix/page-ix",
"name": "page-ix",
"pages": [
"pages/laboratory/laboratory",
"pages/spec-x/stock-wzb/stock-wzb",
"pages/spec-x/news/articles/articles",
"pages/spec-x/pay/demo/demo",
"pages/spec-x/skin/skin",
"pages/spec-x/lottie/lottie",
"pages/spec-x/red-packet-cover/red-packet-cover",
"pages/spec-x/become-x/become-x",
"pages/setting/storage/storage",
"pages/setting/remote-control/remote-control",
"pages/setting/developer/developer",
"pages/setting/info/info",
"pages/setting/setting",
"pages/setting/spec-setting/spec-setting",
"pages/setting/change-theme/change-theme",
"pages/setting/effect/effect",
"pages/setting/connect-x/connect-x",
"pages/setting/collect-phone/collect-phone",
"pages/review/my/my",
"pages/review/show/show"
]
}请在 preloadRule 中移除 pageXI 包 (已不存在)