Skip to content
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
2 changes: 2 additions & 0 deletions ejsRender.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
const ROOT = path.join(__dirname, './');

const ejsData = {
appType: 'miniapp',
targets: ['web'],
miniappType: 'runtime',
mpa: false,
Expand Down Expand Up @@ -30,5 +31,6 @@ module.exports = {
{ target: path.join(ROOT, 'scaffolds/app-ts/'), name: 'app-ts', data: ejsData, preview: previewData },
{ target: path.join(ROOT, 'scaffolds/app-midway-faas/'), name: 'app-midway-faas', data: ejsData, preview: previewData },
{ target: path.join(ROOT, 'scaffolds/app-midway-faas/'), name: 'app-midway-ssr', data: ejsData, preview: previewData },
{ target: path.join(ROOT, 'scaffolds/app-shop/'), name: 'app-shop', data: ejsData, preview: previewData },
],
};
3 changes: 3 additions & 0 deletions scaffolds/app-shop/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["iceworks-team.iceworks"]
}
15 changes: 15 additions & 0 deletions scaffolds/app-shop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# rax-materials-basic-app

## Getting Started

### `npm run start`

Runs the app in development mode.

Open [http://localhost:3333](http://localhost:3333) to view it in the browser.

The page will reload if you make edits.

### `npm run build`

Builds the app for production to the `build` folder.
8 changes: 8 additions & 0 deletions scaffolds/app-shop/_eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
lib/
dist/
build/
coverage/
demo/
es/
.rax/
8 changes: 8 additions & 0 deletions scaffolds/app-shop/_eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { getESLintConfig } = require('@iceworks/spec');

// https://www.npmjs.com/package/@iceworks/spec
module.exports = getESLintConfig('rax-ts', {
rules: {
'react/no-array-index-key': 'off',
},
});
18 changes: 18 additions & 0 deletions scaffolds/app-shop/_gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

*~
*.swp
*.log

.DS_Store
.idea/
.temp/

build/
dist/
lib/
coverage/
node_modules/
.rax/

template.yml
8 changes: 8 additions & 0 deletions scaffolds/app-shop/_prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
lib/
dist/
build/
coverage/
demo/
es/
.rax/
3 changes: 3 additions & 0 deletions scaffolds/app-shop/_prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { getPrettierConfig } = require('@iceworks/spec');

module.exports = getPrettierConfig('rax');
8 changes: 8 additions & 0 deletions scaffolds/app-shop/_stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
lib/
dist/
build/
coverage/
demo/
es/
.rax/
3 changes: 3 additions & 0 deletions scaffolds/app-shop/_stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { getStylelintConfig } = require('@iceworks/spec');

module.exports = getStylelintConfig('rax');
14 changes: 14 additions & 0 deletions scaffolds/app-shop/build.json.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{<%_ if ( appType === 'web-mpa' ) { -%>
"targets": [
"web"
],
"web": {
"mpa": true
}
<%_ } else { %>
"targets": [
"web",
"miniapp",
"wechat-miniprogram"
]
<%_ } %>}
6 changes: 6 additions & 0 deletions scaffolds/app-shop/mini.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"miniprogramRoot": "build/miniapp",
"scripts": {
"beforeUpload": "npm run build"
}
}
50 changes: 50 additions & 0 deletions scaffolds/app-shop/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@rax-materials/scaffolds-app-shop",
"author": "rax",
"description": "Rax 无线跨端商城应用工程,使用 TypeScript。",
"version": "0.2.0",
"scripts": {
"start": "rax-app start",
"build": "rax-app build",
"eslint": "eslint --ext .js,.jsx,.tsx,.ts ./",
"stylelint": "stylelint \"**/*.{css,scss,less}\"",
"prettier": "prettier **/* --write",
"lint": "npm run eslint && npm run stylelint"
},
"scaffoldConfig": {
"supportAppType": [
"web-mpa",
"miniapp"
],
"title": "Rax App Pro - Shop",
"category": "Industry",
"screenshot": "https://img.alicdn.com/imgextra/i2/O1CN01LtylNw1gobofXxEdL_!!6000000004189-2-tps-558-998.png",
"name": "Rax App Pro - Shop"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@uni/element": "^1.0.6",
"@uni/env": "^1.0.7",
"@uni/system-info": "^1.0.5",
"lodash.throttle": "^4.1.1",
"rax": "^1.1.0",
"rax-document": "^0.1.0",
"rax-image": "^2.0.0",
"rax-link": "^1.0.1",
"rax-recyclerview": "^1.3.6",
"rax-scrollview": "^3.6.1",
"rax-slider": "^3.1.2",
"rax-text": "^2.0.0",
"rax-view": "^2.0.0"
},
"devDependencies": {
"rax-app": "^3.0.0",
"@iceworks/spec": "^1.0.0",
"@types/rax": "^1.0.0",
"eslint": "^6.8.0",
"prettier": "^2.1.2",
"stylelint": "^13.7.2"
}
}
Binary file added scaffolds/app-shop/public/icons/cart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scaffolds/app-shop/public/icons/cart_active.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scaffolds/app-shop/public/icons/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scaffolds/app-shop/public/icons/home_active.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scaffolds/app-shop/public/icons/mine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scaffolds/app-shop/public/icons/mine_active.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions scaffolds/app-shop/src/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"routes": [{
"path": "/",
"source": "pages/Home/index"
},{
"path": "/cart",
"source": "pages/Cart/index"
},
{
"path": "/mine",
"source": "pages/Mine/index"
},
{
"path": "/detail",
"source": "pages/Detail/index"
}
],
"window": {
"title": "手机淘宝"
},
"tabBar": {
"textColor": "#999",
"selectedColor": "#666",
"backgroundColor": "#f8f8f8",
"items": [{
"pageName": "/",
"text": "首页",
"icon": "./icons/home.png",
"activeIcon": "./icons/home_active.png"
},
{
"pageName": "/cart",
"text": "购物车",
"icon": "./icons/cart.png",
"activeIcon": "./icons/cart_active.png"
},
{
"pageName": "/mine",
"text": "我的淘宝",
"icon": "./icons/mine.png",
"activeIcon": "./icons/mine_active.png"
}
]
}
}
5 changes: 5 additions & 0 deletions scaffolds/app-shop/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// MPA 模式下该文件无效
import { runApp, IAppConfig } from 'rax-app';

const appConfig: IAppConfig = {};
runApp(appConfig);
24 changes: 24 additions & 0 deletions scaffolds/app-shop/src/components/GoGtop/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.container {
position: fixed;
right: 20rpx;
bottom: 140rpx;
z-index: 1000;
color: #bbb;
background-color: #fff;
border: 2rpx solid #ccc;
text-align: center;
border-radius: 50%;
width: 88rpx;
height: 88rpx;
}

.image {
margin: 3rpx auto;
width: 44rpx;
height: 44rpx;
}

.text {
line-height: 24rpx;
font-size: 24rpx;
}
17 changes: 17 additions & 0 deletions scaffolds/app-shop/src/components/GoGtop/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { createElement } from 'rax';
import View from 'rax-view';
import Text from 'rax-text';
import Image from 'rax-image';

import styles from './index.module.css';

function GoTop(props) {
return (
<View {...props} className={styles.container} >
<Image className={styles.image} source={{ uri: 'https://gw.alicdn.com/imgextra/i3/O1CN01n2f0AC1epPGxAnq8d_!!6000000003920-2-tps-200-200.png' }} />
<Text className={styles.text}>顶部</Text>
</View>
);
}

export default GoTop;
33 changes: 33 additions & 0 deletions scaffolds/app-shop/src/components/ItemList/Card.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.container {
margin: 18rpx 9rpx 0;
background: #fff;
width: 342rpx;
}

.image {
width: 342rpx;
height: 342rpx;
}

.name {
padding: 20rpx;
font-size: 26rpx;
color: #333;
}

.info {
padding: 0 20rpx 20rpx;
flex-direction: row;
align-items: baseline;
}

.price {
color: #f50;
font-size: 28rpx;
}

.extra {
margin-left: 18rpx;
color: #999;
font-size: 22rpx;
}
32 changes: 32 additions & 0 deletions scaffolds/app-shop/src/components/ItemList/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { createElement } from 'rax';
import View from 'rax-view';
import Text from 'rax-text';
import Image from 'rax-image';
import Link from '@/components/Link';

import styles from './Card.module.css';

interface IProps {
image: string;
name: string;
price: string;
extra: string;
}

function Card(props: IProps) {
const { image, name, price, extra } = props;
return (
<View className={styles.container}>
<Link href="/detail">
<Image className={styles.image} source={{ uri: image }} />
<Text className={styles.name}>{name}</Text>
<View className={styles.info}>
<Text className={styles.price}>¥ {price}</Text>
<Text className={styles.extra}>{extra}</Text>
</View>
</Link>
</View>
);
}

export default Card;
62 changes: 62 additions & 0 deletions scaffolds/app-shop/src/components/ItemList/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"recExc": "21人已购买",
"price": "20",
"picUrl": "https://img.alicdn.com/bao/uploaded/i1/683495160/O1CN013Xsm0l1nzKJZiST6h_!!683495160-0-lubanu-s.jpg",
"title": "TransArt 变形玩具金刚 滑板猩猩 队长 TA 猛兽侠BW系列野兽战争"
},
{
"recExc": "275人已购买",
"price": "9.99",
"picUrl": "https://img.alicdn.com/bao/uploaded/i4/718056489/O1CN01qwETEb1xo0cze4wXs_!!0-item_pic.jpg",
"title": "羽毛球钥匙扣挂件创意个性可爱汽车锁匙链圈环男士女款书包包挂饰"
},
{
"recExc": "45人已购买",
"price": "76",
"picUrl": "https://img.alicdn.com/bao/uploaded/i1/3060442778/O1CN01gUOOPF1WOMwElCF8B_!!0-item_pic.jpg",
"title": "马克杯陶瓷日式带盖过滤办公室大容量定制logo茶水分离杯子泡茶杯"
},
{
"recExc": "72人已购买",
"price": "98",
"picUrl": "https://img.alicdn.com/bao/uploaded/i1/4082440896/O1CN01uSxhka1IUPVoMfxej_!!4082440896.jpg",
"title": "「官方直营」育胶乐园 AMAZING EXIA MG惊异能天使GK改件 YJL"
},
{
"recExc": "278人已购买",
"price": "1,690",
"picUrl": "https://img.alicdn.com/bao/uploaded/i4/2208902963218/O1CN01ME1x6K1ZdtEZoh4mu_!!2208902963218.jpg",
"title": "西藏那曲冬虫夏草旗舰店干虫草正品4根/克40根10克礼盒装天然干货"
},
{
"recExc": "66人已购买",
"price": "68",
"picUrl": "https://img.alicdn.com/bao/uploaded/i1/3011877565/O1CN012BGE9b25koqoUPZGy_!!0-item_pic.jpg",
"title": "优比熊汽车窗帘遮阳挡板防晒隔热磁吸轨道侧窗遮光磁铁卡通遮阳帘"
},
{
"recExc": "1人已购买",
"price": "388",
"picUrl": "https://img.alicdn.com/bao/uploaded/i2/76787924/O1CN01BM8uDj28PF2uRyCTo_!!76787924-0-lubanu-s.jpg",
"title": "现货 吉模神金牛 合金圣衣斗士神话EX2.0 EX神金牛座 阿鲁迪巴"
},
{
"recExc": "197人已购买",
"price": "98",
"picUrl": "https://img.alicdn.com/bao/uploaded/i4/2206853744565/O1CN01o9Gnem1jaoefuTmvj_!!0-item_pic.jpg",
"title": "中国红瓷器姓氏马克杯陶瓷茶杯办公室泡茶家用咖啡杯带盖礼品礼物"
},
{
"recExc": "186人已购买",
"price": "263",
"picUrl": "https://img.alicdn.com/bao/uploaded/i1/2206561920712/O1CN01JgyEP41H88ftIDoKu_!!0-item_pic.jpg",
"title": "福建建阳蓝麒麟建盏杯茶杯纯手工男主人杯单杯女茶碗高端茶盏建窑"
},
{
"recExc": "103人已购买",
"price": "28.9",
"picUrl": "https://img.alicdn.com/bao/uploaded/i1/6000000004494/O1CN01Sigvvm1j4IcFnhbKd_!!6000000004494-0-picassoopen.jpg",
"title": "生龙迷你型佬米酒桂花味500g冲调米酒儿童宝宝婴儿米零食饮料"
}
]
Loading