Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
dyq086 committed Jul 24, 2017
0 parents commit e04803f
Show file tree
Hide file tree
Showing 97 changed files with 13,251 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/*
src/*
29 changes: 29 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.wpy files
plugins: [
'html'
],
settings: {
'html/html-extensions': ['.html', '.wpy']
},
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'space-before-function-paren': 0
}
}
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ---> Yii
assets/*
!assets/.gitignore
runtime/*
!runtime/.gitignore
web/assets/*
tests/
.settings/
.buildpath
.project
.idea
node_modules
test.js
npm-debug.log
dist
node_modules


# idea ignore
.idea/
*.ipr
*.iml
*.iws

*.wepycache
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#安装(更新) wepy 命令行工具。
cnpm install wepy-cli -g

#安装依赖包
cnpm install

#开发实时编译。
npm run dev

#生产
npm run build

#开发使用说明

使用微信开发者工具新建项目,本地开发选择dist目录。
微信开发者工具 --> 项目 --> 关闭ES6转ES5。
本地项目根目录运行npm run dev,开启实时编译。

#wepy开发文档地址
https://wepyjs.github.io/wepy/#/

##小程序开发文档
http://mp.weixin.qq.com/debug/wxadoc/dev/
40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "test",
"version": "1.2.8",
"description": "",
"main": "dist/app.js",
"scripts": {
"dev": "wepy build --watch",
"build": "cross-env NODE_ENV=production wepy build --no-cache",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"promise-polyfill": "^6.0.2",
"wepy": "^1.5.7",
"wepy-async-function": "^1.4.4",
"wepy-com-toast": "^1.0.2"
},
"devDependencies": {
"babel-eslint": "^7.2.1",
"babel-plugin-syntax-export-extensions": "^6.13.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"cross-env": "^4.0.0",
"eslint": "^3.18.0",
"eslint-config-standard": "^7.1.0",
"eslint-friendly-formatter": "^2.0.7",
"eslint-plugin-html": "^2.0.1",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^2.0.1",
"wepy-compiler-babel": "^1.5.1",
"wepy-compiler-less": "^1.3.10",
"wepy-compiler-sass": "^1.3.7",
"wepy-eslint": "^1.5.2",
"wepy-plugin-imagemin": "^1.5.2",
"wepy-plugin-uglifyjs": "^1.3.6"
}
}
90 changes: 90 additions & 0 deletions src/api/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import {
wxRequest
} from '../utils/wxRequest';

let env = "-test" //-dev 或者 -test
const apiMall = 'https://api.tangxinmao.com'
const apiPassport = 'https://api-mall' + env + '.etcchebao.com'

/**
* 获取发现好商品接口
* @param {[type]} params [description]
* @return {[type]} [description]
*/
const getDiscoverList = (params) => wxRequest(params, apiMall + '/goods/list?cateidOne=1&cateidTwo=0&price=0&sales=2');

//微信的jscode换取sessionKey
const wxJsCode2Session = (params) => wxRequest(params, apiMall + "/api/wechat/jscode2session");
const user2session = (params) => wxRequest(params, apiMall + "/api/wechat/user2session?jsoncallback=?");

//商品接口---begin
//首页发现商品接口
const hostGoodsList = (params) => wxRequest(params, apiMall + '/api/home/hostGoodsList');
//查询商品列表
const getGoodsList = (params) => wxRequest(params, apiMall + '/api/mall/searchGoodsList');
//查询商品详情
const getGoodsDetail = (params) => wxRequest(params, apiPassport + '/goods/detail');
//查询商品详情信息
const goodsDetail = (params) => wxRequest(params, apiMall + '/api/mall/goods');
//商品加入购物车
const addCart = (params) => wxRequest(params, apiMall + '/api/mall/goodsCart/add');
//用户的购物车商品列表
const cartList = (params) => wxRequest(params, apiMall + '/api/mall/goodsCart/list');
//购物车的商品选中状态
const cartCheck = (params) => wxRequest(params, apiMall + '/api/mall/goodsCart/check');
//购物车的商品删除
const cartDel = (params) => wxRequest(params, apiMall + '/api/mall/goodsCart/delete');
//购物车的商品数量更新
const cartUpdateNum = (params) => wxRequest(params, apiMall + '/api/mall/goodsCart/updateNum');
//直接购买商品
const preOrder = (params) => wxRequest(params, apiMall + '/api/mall/goodsOrder/commitData');
//商品接口---end

//用户相关信息--begin
//用户的当天签到信息
const userSginInfo = (params) => wxRequest(params, apiMall + '/api/userSign/signInfo');
const doSign = (params) => wxRequest(params, apiMall + '/api/userSign/doSign');

//用户积分信息
const pointInfo = (params) => wxRequest(params, apiMall + '/api/userPoint/pointInfo');

//用户足迹信息
const browseInfo = (params) => wxRequest(params, apiMall + '/api/userBrowse/browseInfo');

//用户收藏的商品
const favoriteInfo = (params) => wxRequest(params, apiMall + '/api/goodsFavorite/favoriteInfo');

//用户消息
const messageInfo = (params) => wxRequest(params, apiMall + '/api/systemMessage/messageInfo');

//用户手机绑定
const registerUser = (params) => wxRequest(params, apiMall + '/api/userCenter/register');

//用户是否绑定手机号
const getUserInfo = (params) => wxRequest(params, apiMall + '/api/userCenter/getUserInfo');

//用户收货地址
const getUserAddress = (params) => wxRequest(params, apiMall + '/api/userAddress/getUserAddress');

//用户相关信息--end

module.exports = {
hostGoodsList,
getGoodsDetail,
getDiscoverList,
getGoodsList,
goodsDetail,
wxJsCode2Session,
user2session,
userSginInfo,
doSign,
addCart,cartList,cartCheck,cartDel,cartUpdateNum,
preOrder,
pointInfo,
browseInfo,
favoriteInfo,
messageInfo,
registerUser,
getUserInfo,
getUserAddress
}
Loading

0 comments on commit e04803f

Please sign in to comment.