Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base Taro 3.0.15 #62

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"react/no-unused-state": 0,
"no-unused-vars": ["error", { "varsIgnorePattern": "Taro" }],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }]
},
"parser": "babel-eslint"
}
}
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

215 changes: 35 additions & 180 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,195 +1,50 @@
# 前言
##多端适配的电子商城

**Taro** 是一套遵循 [React](https://reactjs.org/) 语法规范的 **多端开发** 解决方案。现如今市面上端的形态多种多样,Web、React-Native、微信小程序等各种端大行其道,当业务要求同时在不同的端都要求有所表现的时候,针对不同的端去编写多套代码的成本显然非常高,这时候只编写一套代码就能够适配到多端的能力就显得极为需要。
> 技术栈:React + Taro + Hox + Sass + ES6/ES7+ TS

使用 **Taro**,我们可以只书写一套代码,再通过 **Taro** 的编译工具,将源代码分别编译出可以在不同端(微信/百度/支付宝/字节跳动小程序、H5、React-Native 等)运行的代码。
<hr />

该项目基于Taro,构建了一个时装衣橱的项目演示,涉及了一个电商平台完整的业务逻辑和功能点,如果这个项目能驾驭的了,相信大部分公司的其他React项目也就不在话下。
#### 注意事项

如遇网络不佳,请移步[国内镜像加速节点](https://gitee.com/easytuan/taro-msparis)
**目前已将`taro`的版本升级到最新版本`3.0.15`,确保你本地的`taro-cli`的版本也是这个版本,可以通过`taro info`查看版本号,如果不是最新的话,可以通过执行`taro update self`(`mac`或者`linux`前面需要加上`sudo`)以及`taro update project`进行`cli`与项目依赖的更新保持一致,否则将会导致项目无法正常运行,了解更多详情可查看[Taro 环境及依赖检测](http://taro-docs.jd.com/taro/docs/GETTING-STARTED.html#%E7%8E%AF%E5%A2%83%E5%8F%8A%E4%BE%9D%E8%B5%96%E6%A3%80%E6%B5%8B)**

# 效果演示
### 功能列表

[查看demo请戳这里](http://ms.caibowen.net/)(请用chrome手机模式预览)
- [x] 首页
- [x] 滚动到底部加载
- [x] 自定义 tabBar
- [x] 登录页
- [x] 首页
- [x] 商品详情页
- [x] 评论多图显示

### H5版 && 微信小程序版
### 目录结构

<img src="screenshots/qr-code.png" width="250"/> <img src="screenshots/weapp-code.jpg" width="250"/>


# 技术栈

React + Taro + Dva + Sass + ES6/ES7

## 项目运行

```

git clone [email protected]:EasyTuan/taro-msparis.git

# 国内镜像加速节点:[email protected]:easytuan/taro-msparis.git

cd taro-msparis

# 全局安装taro脚手架
npm install -g @tarojs/[email protected]

# 项目依赖为1.2.2版本,如要升级,请同时升级项目依赖
# 如用1.2.2版本,请忽略这句
taro update project

# 安装项目依赖
npm install

# 微信小程序
npm run dev:weapp

# 支付宝小程序
npm run dev:alipay

# 百度小程序
npm run dev:swan

# 字节跳动小程序
npm run dev:tt

# H5
npm run dev:h5

# React Native
npm run dev:rn

# pages模版快速生成
npm run tep `文件名`

```

## 休闲一刻

<img src="screenshots/gh_a896d27a50a3_430.jpg" width="250"/> <img src="screenshots/gh_44a51ea2dd08_430.jpg" width="250"/>

## 项目说明

**git分支说明:**

init:框架整体结构,不涉及任何业务逻辑

master:项目的稳定版本

feature:项目开发分支


## 适配进度

- [x] H5 -- 完美适配
- [x] 微信小程序 -- 完美适配
- [x] 支付宝小程序 -- 95%适配
- [x] 百度小程序 -- 95%适配
- [ ] 字节跳动小程序 -- 适配中
- [ ] React Native -- 适配中
- [ ] 快应用 -- 适配中

## 目标功能

- [x] 美衣列表 -- 完成
- [x] 美衣详情 -- 完成
- [x] 登录、注册 -- 完成
- [x] 个人中心 -- 完成
- [x] 优惠券 -- 完成
- [x] 衣袋(购物车) -- 完成
- [x] 收货地址 -- 完成
- [ ] 会员中心 -- 开发中

# 业务介绍

目录结构

├── .temp // H5编译结果目录
├── .rn_temp // RN编译结果目录
├── dist // 小程序编译结果目录
├── config // Taro配置目录
│ ├── dev.js // 开发时配置
│ ├── index.js // 默认配置
│ └── prod.js // 打包时配置
├── screenshots // 项目截图,和项目开发无关
├── site // H5静态文件(打包文件)
│ ├── dev.js // 开发时配置
│ ├── index.js // 默认配置
│ └── prod.js // 打包时配置
├── dist // 小程序编译结果目录
├── screenshot // 功能截图
├── src // 源码目录
│ ├── components // 组件
│ ├── config // 项目开发配置
│ ├── images // 图片文件
│ ├── models // redux models
│ ├── pages // 页面文件目录
│ ├── actions // 异步操作
│ ├── constants // 常量
│ ├── images // 图片资源
│ ├── models // hox相关模块
│ ├── pages // 页面文件目录
│ │ └── home
│ │ ├── index.js // 页面逻辑
│ │ ├── index.scss // 页面样式
│ │ ├── model.js // 页面models
│ │ └── service.js // 页面api
│ ├── styles // 样式文件
│ ├── utils // 常用工具类
│ ├── app.js // 入口文件
│ └── index.html
│ │ ├── index.tsx // 页面逻辑
│ │ ├── index.scss // 页面样式
│ │ └── index.config.ts // 页面配置
│ ├── service // 请求web服务
│ ├── utils // 通用方法
│ ├── app.config.ts // 入口配置文件
│ ├── app.scss // 入口样式文件
│ ├── app.tsx // 入口文件
│ └── index.html // 入口页面
├── package.json
└── template.js // pages模版快速生成脚本,执行命令 npm run tep `文件名`

## 部分截图展示

### 首页 && 商品详情

<img src="screenshots/1.png" width="375px" height="667px" /> <img src="screenshots/2.png" width="375px" height="667px" />

### 衣袋 && 我的

<img src="screenshots/3.png" width="375px" height="667px" /> <img src="screenshots/4.png" width="375px" height="667px" />

### 登录 && 优惠券

<img src="screenshots/5.png" width="375px" height="667px" /> <img src="screenshots/6.png" width="375px" height="667px" />


# 说明

> 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^

> 或者您可以 "follow" 一下,我会不断开源更多的有趣的项目

> 如有问题请直接在 Issues 中提,或者您发现问题并有非常好的解决方案,欢迎 PR 👍


# 文档

### Taro开发文档

> https://nervjs.github.io/taro/docs/README.html

### dva开发文档地址

> https://dvajs.com/

### 微信小程序官方文档

> https://mp.weixin.qq.com/debug/wxadoc/dev/

### 百度智能小程序官方文档

> https://smartprogram.baidu.com/docs/introduction/register/index.html

### 支付宝小程序官方文档

> https://docs.alipay.com/mini/developer/getting-started

### 字节跳动小程序官方文档

> https://microapp.bytedance.com/


# 赞助

如有帮助,欢迎赞助

收到赞助款后,我会及时更新[赞助墙](https://caibowen.net/sponsor)

<img src="screenshots/wechat.jpg" width="200px" /> <img src="screenshots/alipay.jpg" width="200px" />

# License
### 功能截图

[MIT](LICENSE)
<image width='100' src="https://raw.githubusercontent.com/wussss/taro-msparis/master/src/screenshots/1.png"/> <image width='100' src="https://raw.githubusercontent.com/wussss/taro-msparis/master/src/screenshots/2.png"/> <image width='100' src="https://raw.githubusercontent.com/wussss/taro-msparis/master/src/screenshots/3.png"/> <image width='100' src="https://raw.githubusercontent.com/wussss/taro-msparis/master/src/screenshots/4.png"/>
10 changes: 10 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
['taro', {
framework: 'react',
ts: true
}]
]
}
11 changes: 2 additions & 9 deletions config/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ module.exports = {
},
defineConstants: {
},
weapp: {},
h5: {
devServer: {
host: 'localhost', // 如需局域网(如手机)访问,请更换为0.0.0.0
// host: '0.0.0.0', // 如需局域网(如手机)访问,请更换为0.0.0.0
port: 8088,
https: false
}
}
mini: {},
h5: {}
}
80 changes: 46 additions & 34 deletions config/index.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,61 @@
const config = {
projectName: 'taro-msparis',
date: '2018-9-27',
// 设计稿尺寸
projectName: 'mymarket',
date: '2020-12-14',
designWidth: 750,
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2
},
sourceRoot: 'src',
outputRoot: 'dist',
// 通用插件配置
plugins: {
babel: {
sourceMap: true,
presets: [
'env'
],
plugins: [
'transform-class-properties',
'transform-decorators-legacy',
'transform-object-rest-spread'
]
},
plugins: [],
defineConstants: {
},
copy: {
patterns: [
],
options: {
}
},
// 全局变量设置
defineConstants: {},
// 小程序端专用配置
weapp: {
module: {
postcss: {
autoprefixer: {
enable: true
},
// 小程序端样式引用本地资源内联配置
url: {
enable: true,
limit: 10240
framework: 'react',
mini: {
postcss: {
pxtransform: {
enable: true,
config: {

}
},
url: {
enable: true,
config: {
limit: 1024 // 设定转换尺寸上限
}
},
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
}
},
// H5 端专用配置
h5: {
publicPath: '/',
staticDirectory: 'static',
module: {
postcss: {
autoprefixer: {
enable: true
postcss: {
autoprefixer: {
enable: true,
config: {
}
},
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
}
Expand Down
Loading