├── static ├── .gitkeep └── images │ ├── home.png │ ├── profile.png │ ├── home-actived.png │ └── profile-actived.png ├── config ├── prod.env.js ├── dev.env.js └── index.js ├── screenshots ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.jpg ├── 6.jpg └── mywechatpay.jpg ├── src ├── pages │ ├── free │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── my │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── index │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── express │ │ ├── main.js │ │ ├── main.json │ │ └── index.vue │ ├── item │ │ ├── main.js │ │ ├── main.json │ │ └── index.vue │ ├── orders │ │ ├── main.js │ │ ├── main.json │ │ └── index.vue │ └── transactions │ │ ├── main.js │ │ ├── main.json │ │ └── index.vue ├── main.js ├── common │ ├── card.vue │ ├── imgitem.vue │ ├── listitems.vue │ ├── xlistitem.vue │ ├── xorder.vue │ └── tools │ │ └── index.js ├── app.json └── App.vue ├── .postcssrc.js ├── .editorconfig ├── .gitignore ├── package.swan.json ├── index.html ├── .babelrc ├── project.config.json ├── README.md └── package.json /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/screenshots/1.png -------------------------------------------------------------------------------- /screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/screenshots/2.png -------------------------------------------------------------------------------- /screenshots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/screenshots/3.png -------------------------------------------------------------------------------- /screenshots/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/screenshots/4.png -------------------------------------------------------------------------------- /screenshots/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/screenshots/5.jpg -------------------------------------------------------------------------------- /screenshots/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/screenshots/6.jpg -------------------------------------------------------------------------------- /static/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/static/images/home.png -------------------------------------------------------------------------------- /static/images/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/static/images/profile.png -------------------------------------------------------------------------------- /screenshots/mywechatpay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/screenshots/mywechatpay.jpg -------------------------------------------------------------------------------- /src/pages/free/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "肋力免费拿", 3 | 4 | "usingComponents": 5 | { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/my/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": " 我的", 3 | 4 | "usingComponents": 5 | { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /static/images/home-actived.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/static/images/home-actived.png -------------------------------------------------------------------------------- /src/pages/index/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "首页", 3 | 4 | "usingComponents": 5 | { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/pages/my/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /static/images/profile-actived.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinhe9527/nwei_shopv2/HEAD/static/images/profile-actived.png -------------------------------------------------------------------------------- /src/pages/express/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /src/pages/free/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /src/pages/index/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /src/pages/item/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /src/pages/orders/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /src/pages/orders/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "我的订单", 3 | 4 | "usingComponents": 5 | { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/pages/transactions/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /src/pages/transactions/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "我的订单", 3 | 4 | "usingComponents": 5 | { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/pages/express/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "宝贝详情", 3 | "enablePullDownRefresh": false, 4 | "usingComponents": 5 | { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/pages/item/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "宝贝详情", 3 | "enablePullDownRefresh": false, 4 | "usingComponents": 5 | { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-mpvue-wxss": {} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | *.suo 11 | *.ntvs* 12 | *.njsproj 13 | *.sln 14 | -------------------------------------------------------------------------------- /package.swan.json: -------------------------------------------------------------------------------- 1 | { 2 | "appid": "touristappid", 3 | "setting": { 4 | "urlCheck": false 5 | }, 6 | "condition": { 7 | "swan": { 8 | "current": -1, 9 | "list": [] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | import t from 't' 4 | 5 | // import 'mpvue-weui/src/style/weui.css'; 6 | Vue.config.productionTip = false 7 | App.mpType = 'app' 8 | const app = new Vue(App) 9 | app.$mount() 10 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | my-project 6 | 7 | 8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/common/card.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 20 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env","es2015", "stage-2"], 15 | "plugins": ["istanbul"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件。", 3 | "setting": { 4 | "urlCheck": true, 5 | "es6": true, 6 | "postcss": true, 7 | "minified": true, 8 | "newFeature": true, 9 | "autoAudits": false 10 | }, 11 | "miniprogramRoot": "dist/wx/", 12 | "compileType": "miniprogram", 13 | "appid": "wx2bd88c7b6569830a", 14 | "projectname": "nwei_shopv2", 15 | "simulatorType": "wechat", 16 | "simulatorPluginLibVersion": {}, 17 | "condition": { 18 | "search": { 19 | "current": -1, 20 | "list": [] 21 | }, 22 | "conversation": { 23 | "current": -1, 24 | "list": [] 25 | }, 26 | "game": { 27 | "currentL": -1, 28 | "list": [] 29 | }, 30 | "miniprogram": { 31 | "current": -1, 32 | "list": [] 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/common/imgitem.vue: -------------------------------------------------------------------------------- 1 | 9 | 27 | 43 | -------------------------------------------------------------------------------- /src/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/main", 4 | "pages/my/main", 5 | "pages/orders/main", 6 | "pages/item/main", 7 | "pages/transactions/main", 8 | "pages/free/main" 9 | ], 10 | "permission": 11 | { 12 | "scope.userLocation": 13 | { 14 | "desc": "为给您推荐更合适的券,需获取您的位置" 15 | } 16 | }, 17 | "window": 18 | { 19 | "backgroundTextStyle": "light", 20 | "navigationBarBackgroundColor": "#ad3735", 21 | "navigationBarTitleText": "出奇蛋", 22 | "navigationBarTextStyle": "white" 23 | }, 24 | "tabBar": 25 | { 26 | "color": "#a9b7b7", 27 | "selectedColor": "#ad3735", 28 | "borderStyle": "black", 29 | "list": [ 30 | { 31 | "pagePath": "pages/index/main", 32 | "iconPath": "static/images/home.png", 33 | "selectedIconPath": "static/images/home-actived.png", 34 | "text": "首页" 35 | }, 36 | { 37 | "pagePath": "pages/my/main", 38 | "iconPath": "static/images/profile.png", 39 | "selectedIconPath": "static/images/profile-actived.png", 40 | "text": "我的" 41 | }] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nwei_shopv2 [![GitHub license](https://img.shields.io/badge/license-BSD-lightgrey.svg)](LICENSE) [![Build Status](https://travis-ci.org/facebook/WebDriverAgent.svg?branch=master)](https://travis-ci.org/facebook/WebDriverAgent) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 2 | 3 | nwei_shopv2 is for free. 4 | 5 | 6 | ## Archiving 7 | 8 | under coding.. 9 | 10 | * [Project on GitHub](https://github.com/yulinho/nwei_shopv2) 11 | 12 | 13 | ## Overview 14 | 15 | 免费开源的小程序商城,适用于便利店,水果店等常见零售。 16 | 稳定可靠,已用于公司多个上线项目。 17 | 18 | 19 | ## Features 20 | * power by Mpvue 21 | 22 | 23 | 24 | 25 | 运行预览: 26 | ## 27 | ## 28 | ## 29 | ## 30 | ## 31 | ## 32 | 33 | 34 | ## Getting Started 35 | To get the project set up just run by command: 36 | ``` 37 | yarn dev 38 | ``` 39 | It will: 40 | * pack all your codes to 小程序开发工具 41 | 42 | After it is finished you can simply open `小程序开发工具` and `自动运行` 43 | 44 | 45 | ## Known Issues 46 | not yet 47 | 48 | ## For Contributors 49 | If you want to help us out, you are more than welcome to. However please make sure you have followed the guidelines in [CONTRIBUTING](CONTRIBUTING.md). 50 | 51 | ## License 52 | 53 | [`nwei_shopv2` is BSD-licensed](LICENSE). We also provide an additional [patent grant](PATENTS). 54 | 55 | Have fun! 56 | 57 | ## 送作者一杯茶 58 | - 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | var fileExtConfig = { 4 | swan: { 5 | template: 'swan', 6 | script: 'js', 7 | style: 'css', 8 | platform: 'swan' 9 | }, 10 | wx: { 11 | template: 'wxml', 12 | script: 'js', 13 | style: 'wxss', 14 | platform: 'wx' 15 | } 16 | } 17 | var fileExt = fileExtConfig[process.env.PLATFORM] 18 | 19 | module.exports = { 20 | build: { 21 | env: require('./prod.env'), 22 | index: path.resolve(__dirname, `../dist/${fileExt.platform}/index.html`), 23 | assetsRoot: path.resolve(__dirname, `../dist/${fileExt.platform}`), 24 | assetsSubDirectory: '', 25 | assetsPublicPath: '/', 26 | productionSourceMap: false, 27 | // Gzip off by default as many popular static hosts such as 28 | // Surge or Netlify already gzip all static assets for you. 29 | // Before setting to `true`, make sure to: 30 | // npm install --save-dev compression-webpack-plugin 31 | productionGzip: false, 32 | productionGzipExtensions: ['js', 'css'], 33 | // Run the build command with an extra argument to 34 | // View the bundle analyzer report after build finishes: 35 | // `npm run build --report` 36 | // Set to `true` or `false` to always turn it on or off 37 | bundleAnalyzerReport: process.env.npm_config_report, 38 | fileExt: fileExt 39 | }, 40 | dev: { 41 | env: require('./dev.env'), 42 | port: 8080, 43 | // 在小程序开发者工具中不需要自动打开浏览器 44 | autoOpenBrowser: false, 45 | assetsSubDirectory: '', 46 | assetsPublicPath: '/', 47 | proxyTable: {}, 48 | // CSS Sourcemaps off by default because relative paths are "buggy" 49 | // with this option, according to the CSS-Loader README 50 | // (https://github.com/webpack/css-loader#sourcemaps) 51 | // In our experience, they generally work as expected, 52 | // just be aware of this issue when enabling this option. 53 | cssSourceMap: false, 54 | fileExt: fileExt 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Hmbb", 3 | "version": "1.0.0", 4 | "mpvueTemplateProjectVersion": "0.0.1", 5 | "description": "A Mpvue project", 6 | "author": "Blake", 7 | "private": true, 8 | "scripts": { 9 | "git": "git add -A&&git commit -m 一周工作80小时s以上&&git push --set-upstream origin master", 10 | "dev:wx": "node build/dev-server.js wx", 11 | "start:wx": "npm run dev:wx", 12 | "build:wx": "node build/build.js wx", 13 | "dev:swan": "node build/dev-server.js swan", 14 | "start:swan": "npm run dev:swan", 15 | "build:swan": "node build/build.js swan", 16 | "dev": "node build/dev-server.js wx", 17 | "start": "npm run dev", 18 | "build": "node build/build.js wx" 19 | }, 20 | "dependencies": { 21 | "await-sleep": "^0.0.1", 22 | "lerp": "^1.0.3", 23 | "less": "^3.9.0", 24 | "less-loader": "^4.1.0", 25 | "moment": "^2.23.0", 26 | "mpvue": "^1.0.11", 27 | "mpvue-weui": "^1.0.4", 28 | "mpvue-zanui": "^1.0.3", 29 | "raf": "^3.4.1", 30 | "siriwave": "^1.2.4", 31 | "vuex": "^3.0.1" 32 | }, 33 | "devDependencies": { 34 | "babel-core": "^6.22.1", 35 | "babel-loader": "^7.1.1", 36 | "babel-plugin-transform-runtime": "^6.22.0", 37 | "babel-preset-env": "^1.3.2", 38 | "babel-preset-stage-2": "^6.22.0", 39 | "babel-register": "^6.22.0", 40 | "chalk": "^2.4.0", 41 | "connect-history-api-fallback": "^1.3.0", 42 | "copy-webpack-plugin": "^4.5.1", 43 | "css-loader": "^0.28.11", 44 | "cssnano": "^3.10.0", 45 | "eventsource-polyfill": "^0.9.6", 46 | "express": "^4.17.3", 47 | "extract-text-webpack-plugin": "^3.0.2", 48 | "file-loader": "^1.1.11", 49 | "friendly-errors-webpack-plugin": "^1.7.0", 50 | "glob": "^7.1.2", 51 | "html-webpack-plugin": "^3.2.0", 52 | "http-proxy-middleware": "^0.18.0", 53 | "mpvue-loader": "^1.1.2", 54 | "mpvue-template-compiler": "^1.0.11", 55 | "mpvue-webpack-target": "^1.0.3", 56 | "optimize-css-assets-webpack-plugin": "^3.2.0", 57 | "ora": "^2.0.0", 58 | "portfinder": "^1.0.13", 59 | "postcss-loader": "^2.1.4", 60 | "postcss-mpvue-wxss": "^1.0.0", 61 | "prettier": "~1.12.1", 62 | "px2rpx-loader": "^0.1.10", 63 | "relative": "^3.0.2", 64 | "rimraf": "^2.6.0", 65 | "semver": "^5.3.0", 66 | "shelljs": "^0.8.1", 67 | "uglifyjs-webpack-plugin": "^1.2.5", 68 | "url-loader": "^1.0.1", 69 | "vue-style-loader": "^4.1.0", 70 | "webpack": "^3.11.0", 71 | "webpack-bundle-analyzer": "^2.2.1", 72 | "webpack-dev-middleware-hard-disk": "^1.12.0", 73 | "webpack-merge": "^4.1.0", 74 | "webpack-mpvue-asset-plugin": "^0.1.2", 75 | "webpack-mpvue-vendor-plugin": "^0.0.1" 76 | }, 77 | "engines": { 78 | "node": ">= 4.0.0", 79 | "npm": ">= 3.0.0" 80 | }, 81 | "browserslist": [ 82 | "> 1%", 83 | "last 2 versions", 84 | "not ie <= 8" 85 | ] 86 | } 87 | -------------------------------------------------------------------------------- /src/common/listitems.vue: -------------------------------------------------------------------------------- 1 | 20 | 66 | 101 | -------------------------------------------------------------------------------- /src/common/xlistitem.vue: -------------------------------------------------------------------------------- 1 | 19 | 48 | 132 | -------------------------------------------------------------------------------- /src/pages/transactions/index.vue: -------------------------------------------------------------------------------- 1 | 11 | 172 | 180 | -------------------------------------------------------------------------------- /src/pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 33 | 112 | 233 | -------------------------------------------------------------------------------- /src/pages/orders/index.vue: -------------------------------------------------------------------------------- 1 | 11 | 198 | 206 | -------------------------------------------------------------------------------- /src/common/xorder.vue: -------------------------------------------------------------------------------- 1 | 53 | 82 | 255 | -------------------------------------------------------------------------------- /src/common/tools/index.js: -------------------------------------------------------------------------------- 1 | const timeFormat = 'YYYY-MM-DD HH:mm:ss'; 2 | const dateFormat = 'YYYY-MM-DD'; 3 | const Tools = { 4 | wxpay: async (args) => { 5 | return new Promise(async (resolve) => { 6 | console.log(`###$pay####`); 7 | let { amt, openid, tid, title } = args 8 | let nsp = 'wxpaypre_get' 9 | let res = await Tools.v2dispatch({ 10 | type: 'v2chuqidanopen', 11 | payload: { 12 | // stype, 13 | // item: item, 14 | // user_id, 15 | // stype: this.stype, 16 | // page_no, 17 | // q, 18 | title, 19 | tid, 20 | openid, 21 | amt, 22 | nsp, 23 | t: Math.random(), 24 | }, 25 | }) 26 | // console.log(res); 27 | if (!res) { 28 | Tools.toast('支付失败') 29 | } 30 | // let payargs = res[`${nsp}_response`].payargs 31 | let payargs = res.data 32 | // console.log(payargs); 33 | wx.requestPayment({ 34 | // timeStamp: '', 35 | // nonceStr: '', 36 | // package: '', 37 | // signType: 'MD5', 38 | // paySign: '', 39 | ...payargs, 40 | success(res) { 41 | console.log(res); 42 | Tools.toast('支付成功') 43 | // Tools.toast(res) 44 | resolve(true) 45 | }, 46 | fail(res) { 47 | console.log(res); 48 | resolve(false) 49 | } 50 | }) 51 | }) 52 | 53 | // console.log(quanmaobrands); 54 | // this.quanmaobrands = quanmaobrands 55 | }, 56 | sleep: async (args) => { 57 | return new Promise(async (resolve) => { 58 | setTimeout(function() { 59 | resolve({ 60 | success: true, 61 | }) 62 | }, args) 63 | }) 64 | }, 65 | fetch: async (args) => { 66 | return new Promise(async (resolve) => { 67 | // that.setState(state, resolve) 68 | let { method, payload, url, header } = args 69 | if (!method) { 70 | method = 'GET' 71 | } 72 | // let body = queryString.stringify(payload) 73 | // let data = queryString.stringify(payload) 74 | // console.log(payload); 75 | wx.request({ 76 | url, 77 | method, 78 | data: payload, 79 | header: { 80 | // 'content-type': 'application/json' , 81 | 'Content-Type': 'application/x-www-form-urlencoded', 82 | ...header, 83 | }, 84 | success(res) { 85 | // console.log(res.data) 86 | resolve({ 87 | data: res.data, 88 | }) 89 | }, 90 | fail(res) { 91 | // console.log(res.data) 92 | console.log(`###$fail####`); 93 | 94 | resolve({ 95 | data: false, 96 | }) 97 | }, 98 | complete(res) { 99 | // console.log(`###$complete####`); 100 | } 101 | }) 102 | 103 | 104 | }); 105 | }, 106 | v2dispatch: async (args) => { 107 | let { type, payload, header } = args 108 | let { nsp } = payload 109 | let url 110 | // let access_token = await Tools.getItem(`pro__${ACCESS_TOKEN}`) 111 | // console.log(`###$v2dispatch####`); 112 | const regexopen = /(.*)open/gm; 113 | const regexauth = /(.*)auth/gm; 114 | switch (true) { 115 | case regexopen.exec(type): 116 | //statement1; 117 | break; 118 | case regexauth.exec(type): 119 | //statement2; 120 | header = { 121 | ...header, 122 | // 'Content-Type': 'application/x-www-form-urlencoded' 123 | 'Authorization': `Bearer ${access_token.value}` 124 | } 125 | break; 126 | default: 127 | // to do 128 | } 129 | url = `https://eggd.heyulin.com/${type}.jobs` 130 | 131 | let method = 'POST' 132 | url = `${url}?nsp=${nsp}` 133 | header = { 134 | 'content-type': 'application/json', 135 | ...header, 136 | } 137 | let res = await Tools.fetch({ 138 | header, 139 | url, 140 | method, 141 | payload, 142 | }) 143 | // console.log(res); 144 | return res.data 145 | }, 146 | setItem: async (key, data) => { 147 | //value 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象。 148 | return new Promise(async (resolve) => { 149 | wx.setStorage({ 150 | key, 151 | data, 152 | success: () => { 153 | resolve(true) 154 | }, 155 | fail: () => { 156 | resolve(false) 157 | } 158 | }) 159 | }) 160 | }, 161 | getItem: async (key) => { 162 | 163 | return new Promise(async (resolve) => { 164 | wx.getStorage({ 165 | key, 166 | success: (res) => { 167 | resolve(res.data) 168 | }, 169 | fail: () => { 170 | resolve(false) 171 | } 172 | }) 173 | }) 174 | }, 175 | open: (args = {}) => { 176 | // let { url } = args 177 | if (typeof(args) == 'string') { 178 | args = { 179 | url: args, 180 | } 181 | } 182 | wx.navigateTo(args) 183 | }, 184 | back: (args = {}) => { 185 | // let { url } = args 186 | // if (typeof(args) == 'string') { 187 | // args = { 188 | // url: args, 189 | // } 190 | // } 191 | args || (args = { 192 | delta: 1, 193 | }) 194 | wx.navigateBack(args) 195 | }, 196 | alert: async (arg1, args) => { 197 | args || (args = {}) 198 | let { duration, icon } = args 199 | icon || (icon = 'none') 200 | duration || (duration = 2000) 201 | let message = 'unknow' 202 | if (typeof(arg1) === 'string' || typeof(arg1) === 'number' || typeof(arg1) === 'boolean') { 203 | message = arg1 204 | } else if (typeof(arg1) === 'object') { 205 | message = JSON.stringify(arg1) 206 | } else { 207 | message = typeof(arg1) 208 | } 209 | wx.showModal({ 210 | title: '提示', 211 | content: message, 212 | showCancel: false 213 | // icon, 214 | // duration, 215 | // icon: `success` 216 | }) 217 | }, 218 | toast: async (arg1, args) => { 219 | args || (args = {}) 220 | let { duration, icon } = args 221 | icon || (icon = 'none') 222 | duration || (duration = 2000) 223 | let message = 'unknow' 224 | if (typeof(arg1) === 'string' || typeof(arg1) === 'number' || typeof(arg1) === 'boolean') { 225 | message = arg1 226 | } else if (typeof(arg1) === 'object') { 227 | message = JSON.stringify(arg1) 228 | } else { 229 | message = typeof(arg1) 230 | } 231 | wx.showToast({ 232 | title: message, 233 | icon, 234 | duration, 235 | }) 236 | }, 237 | wait: async (arg1, args) => { 238 | args || (args = {}) 239 | let { duration, icon } = args 240 | icon || (icon = 'none') 241 | arg1 || (arg1 = '加载中') 242 | duration || (duration = 2000) 243 | let message = 'unknow' 244 | if (typeof(arg1) === 'string' || typeof(arg1) === 'number' || typeof(arg1) === 'boolean') { 245 | message = arg1 246 | } else if (typeof(arg1) === 'object') { 247 | message = JSON.stringify(arg1) 248 | } else { 249 | message = typeof(arg1) 250 | } 251 | wx.showLoading({ 252 | title: arg1, 253 | }) 254 | }, 255 | ok: async (arg1, args) => { 256 | args || (args = {}) 257 | let { duration, icon } = args 258 | icon || (icon = 'none') 259 | arg1 || (arg1 = '加载中') 260 | duration || (duration = 2000) 261 | let message = 'unknow' 262 | if (typeof(arg1) === 'string' || typeof(arg1) === 'number' || typeof(arg1) === 'boolean') { 263 | message = arg1 264 | } else if (typeof(arg1) === 'object') { 265 | message = JSON.stringify(arg1) 266 | } else { 267 | message = typeof(arg1) 268 | } 269 | wx.hideLoading() 270 | }, 271 | } 272 | export default Tools; 273 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 104 | 341 | -------------------------------------------------------------------------------- /src/pages/my/index.vue: -------------------------------------------------------------------------------- 1 | 71 | 209 | 305 | -------------------------------------------------------------------------------- /src/pages/express/index.vue: -------------------------------------------------------------------------------- 1 | 79 | 204 | 356 | -------------------------------------------------------------------------------- /src/pages/item/index.vue: -------------------------------------------------------------------------------- 1 | 79 | 235 | 390 | -------------------------------------------------------------------------------- /src/pages/free/index.vue: -------------------------------------------------------------------------------- 1 | 67 | 295 | 452 | --------------------------------------------------------------------------------