diff --git a/.gitignore b/.gitignore index 15d0189..ee0a644 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,27 @@ -.hbuilderx -.history -.idea + +.DS_Store +node_modules/ +unpackage/ +dist/ +.history/ env.js -node_moudel -package-lock.json \ No newline at end of file +yarn.lock + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.project +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw* diff --git a/App.vue b/App.vue deleted file mode 100644 index ce2bac1..0000000 --- a/App.vue +++ /dev/null @@ -1,42 +0,0 @@ - - - - \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 99c049b..0000000 --- a/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM nginx -COPY unpackage/dist/build/h5 /usr/share/nginx/html -COPY nginx.conf /etc/nginx/conf.d/default.conf -EXPOSE 80 diff --git a/README.md b/README.md index 4a83697..857a408 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-17 11:30:06 * @LastEditors: ch - * @LastEditTime: 2022-03-22 18:07:54 + * @LastEditTime: 2022-05-23 21:18:34 * @Description: file content --> # shopping-app diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..dc4690a --- /dev/null +++ b/babel.config.js @@ -0,0 +1,63 @@ +const plugins = [] + +if (process.env.UNI_OPT_TREESHAKINGNG) { + plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js')) +} + +if ( + ( + process.env.UNI_PLATFORM === 'app-plus' && + process.env.UNI_USING_V8 + ) || + ( + process.env.UNI_PLATFORM === 'h5' && + process.env.UNI_H5_BROWSER === 'builtin' + ) +) { + const path = require('path') + + const isWin = /^win/.test(process.platform) + + const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path) + + const input = normalizePath(process.env.UNI_INPUT_DIR) + try { + plugins.push([ + require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'), + { + file (file) { + file = normalizePath(file) + if (file.indexOf(input) === 0) { + return path.relative(input, file) + } + return false + } + } + ]) + } catch (e) {} +} + +process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui'] +process.UNI_LIBRARIES.forEach(libraryName => { + plugins.push([ + 'import', + { + 'libraryName': libraryName, + 'customName': (name) => { + return `${libraryName}/lib/${name}/${name}` + } + } + ]) +}) +module.exports = { + presets: [ + [ + '@vue/app', + { + modules: 'commonjs', + useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry' + } + ] + ], + plugins +} diff --git a/deploy.yaml b/deploy.yaml deleted file mode 100644 index 81bd20c..0000000 --- a/deploy.yaml +++ /dev/null @@ -1,54 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - labels: - app: $IMAGES - name: $IMAGES - namespace: yanxuan -spec: - progressDeadlineSeconds: 600 - replicas: 1 - selector: - matchLabels: - app: $IMAGES - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 25% - maxSurge: 25% - template: - metadata: - labels: - app: $IMAGES - spec: - imagePullSecrets: - - name: aliyun-docker-hub - containers: - - image: '$REGISTRY/$DOCKERHUB_NAMESPACE/$IMAGES:$BUILD_NUMBER' - name: app - ports: - - containerPort: $JAR_PORD - protocol: TCP - resources: - limits: - cpu: '0.5' - memory: 500Mi - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - dnsPolicy: ClusterFirst - restartPolicy: Always - terminationGracePeriodSeconds: 30 ---- -kind: Service -apiVersion: v1 -metadata: - name: $IMAGES - namespace: yanxuan -spec: - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - app: $IMAGES - type: ClusterIP diff --git a/env.config.js b/env.config.js index 3551c41..4efb30a 100644 --- a/env.config.js +++ b/env.config.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-05-05 14:40:00 * @LastEditors: ch - * @LastEditTime: 2022-05-23 15:31:49 + * @LastEditTime: 2022-05-23 21:15:35 * @Description: 根据git分支生成对应环境的环境变量 * 开发时如果环境变量换了,可以不用重启服务,直接运行node env.config.js即可 */ @@ -38,5 +38,5 @@ for(key in envConfig){ if(!curEnvConfig){ curEnvConfig = envConfig.dev; } -fs.writeFileSync(`${path.resolve(__dirname, './common/config')}/env.js`, +fs.writeFileSync(`${path.resolve(__dirname, './src/common/config')}/env.js`, `const ENV = ${JSON.stringify(curEnvConfig)}; export default ENV;`); diff --git a/index.html b/index.html deleted file mode 100644 index 43a3529..0000000 --- a/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - -
- - - diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 64b8037..0000000 --- a/nginx.conf +++ /dev/null @@ -1,26 +0,0 @@ -server { - listen 80; - listen [::]:80; - server_name localhost default_server; - client_max_body_size 200m; - - location / { - if ($request_filename ~* .*\.(?:htm|html)$) { - add_header Cache-Control "no-store"; - } - root /usr/share/nginx/html; - try_files $uri @index ; - } - - - - - location @index { - add_header Cache-Control "no-store" ; - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri/index.html /index.html; - } - - error_page 405 =200 $uri; -} diff --git a/package.json b/package.json index 2c561a2..b1c170d 100644 --- a/package.json +++ b/package.json @@ -1,30 +1,112 @@ { - "name": "shopping-app", - "version": "1.0.0", - "description": "严选", - "main": "main.js", + "name": "shop-app", + "version": "0.1.0", + "private": true, "scripts": { - "build:test": "node env.config.js --ENV:test", - "build:beta": "node env.config.js --ENV:beta", - "build:prod": "node env.config.js --ENV:prod" + "serve": "npm run dev:h5", + "build": "npm run build:h5", + "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build", + "build:custom": "cross-env NODE_ENV=production uniapp-cli custom", + "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build", + "build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build", + "build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build", + "build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build", + "build:mp-jd": "cross-env NODE_ENV=production UNI_PLATFORM=mp-jd vue-cli-service uni-build", + "build:mp-kuaishou": "cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build", + "build:mp-lark": "cross-env NODE_ENV=production UNI_PLATFORM=mp-lark vue-cli-service uni-build", + "build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build", + "build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build", + "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build", + "build:mp-xhs": "cross-env NODE_ENV=production UNI_PLATFORM=mp-xhs vue-cli-service uni-build", + "build:quickapp-native": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build", + "build:quickapp-webview": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build", + "build:quickapp-webview-huawei": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build", + "build:quickapp-webview-union": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build", + "dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch", + "dev:custom": "cross-env NODE_ENV=development uniapp-cli custom", + "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve", + "dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch", + "dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch", + "dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch", + "dev:mp-jd": "cross-env NODE_ENV=development UNI_PLATFORM=mp-jd vue-cli-service uni-build --watch", + "dev:mp-kuaishou": "cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build --watch", + "dev:mp-lark": "cross-env NODE_ENV=development UNI_PLATFORM=mp-lark vue-cli-service uni-build --watch", + "dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch", + "dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch", + "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch", + "dev:mp-xhs": "cross-env NODE_ENV=development UNI_PLATFORM=mp-xhs vue-cli-service uni-build --watch", + "dev:quickapp-native": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch", + "dev:quickapp-webview": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch", + "dev:quickapp-webview-huawei": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build --watch", + "dev:quickapp-webview-union": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build --watch", + "info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js", + "serve:quickapp-native": "node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js", + "test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i", + "test:h5": "cross-env UNI_PLATFORM=h5 jest -i", + "test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i", + "test:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu jest -i", + "test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i" }, - "repository": { - "type": "git", - "url": "http://internel-git.mashibing.cn/chenhui/shopping-app.git" - }, - "keywords": [], - "author": "", - "license": "ISC", "dependencies": { + "@dcloudio/uni-app-plus": "^2.0.1-34720220422002", + "@dcloudio/uni-h5": "^2.0.1-34720220422002", + "@dcloudio/uni-helper-json": "*", + "@dcloudio/uni-i18n": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-360": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-alipay": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-baidu": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-jd": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-kuaishou": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-lark": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-qq": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-toutiao": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-vue": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-weixin": "^2.0.1-34720220422002", + "@dcloudio/uni-mp-xhs": "^2.0.1-34720220422002", + "@dcloudio/uni-quickapp-native": "^2.0.1-34720220422002", + "@dcloudio/uni-quickapp-webview": "^2.0.1-34720220422002", + "@dcloudio/uni-stat": "^2.0.1-34720220422002", + "@vue/shared": "^3.0.0", + "core-js": "^3.6.5", + "flyio": "^0.6.2", + "regenerator-runtime": "^0.12.1", + "vue": "^2.6.11", + "vuex": "^3.2.0", "js-util-all": "^1.0.6", "mp-html": "^2.2.2", "uni-read-pages": "^1.0.5", "uni-simple-router": "^2.0.7", - "uview-ui": "^2.0.29", - "vuex": "^3.6.2" + "uview-ui": "^2.0.29" }, "devDependencies": { - "@dcloudio/uni-helper-json": "^1.0.13", - "git-repo-info": "^2.1.1" + "@babel/runtime": "~7.12.0", + "@dcloudio/types": "^2.6.7", + "@dcloudio/uni-automator": "^2.0.1-34720220422002", + "@dcloudio/uni-cli-i18n": "^2.0.1-34720220422002", + "@dcloudio/uni-cli-shared": "^2.0.1-34720220422002", + "@dcloudio/uni-migration": "^2.0.1-34720220422002", + "@dcloudio/uni-template-compiler": "^2.0.1-34720220422002", + "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.1-34720220422002", + "@dcloudio/vue-cli-plugin-uni": "^2.0.1-34720220422002", + "@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.1-34720220422002", + "@dcloudio/webpack-uni-mp-loader": "^2.0.1-34720220422002", + "@dcloudio/webpack-uni-pages-loader": "^2.0.1-34720220422002", + "@vue/cli-plugin-babel": "~4.5.15", + "@vue/cli-service": "~4.5.15", + "babel-plugin-import": "^1.11.0", + "cross-env": "^7.0.2", + "jest": "^25.4.0", + "mini-types": "*", + "miniprogram-api-typings": "*", + "postcss-comment": "^2.0.0", + "sass": "^1.52.1", + "vue-template-compiler": "^2.6.11" + }, + "browserslist": [ + "Android >= 4.4", + "ios >= 9" + ], + "uni-app": { + "scripts": {} } } diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..136478b --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,22 @@ +const path = require('path') +module.exports = { + parser: require('postcss-comment'), + plugins: [ + require('postcss-import')({ + resolve (id, basedir, importOptions) { + if (id.startsWith('~@/')) { + return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3)) + } else if (id.startsWith('@/')) { + return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2)) + } else if (id.startsWith('/') && !id.startsWith('//')) { + return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1)) + } + return id + } + }), + require('autoprefixer')({ + remove: process.env.UNI_PLATFORM !== 'h5' + }), + require('@dcloudio/vue-cli-plugin-uni/packages/postcss') + ] +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..ff730ce --- /dev/null +++ b/public/index.html @@ -0,0 +1,25 @@ + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + + + + + +
+ + + + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..4efbe61 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,25 @@ + + + + diff --git a/common/api/account.js b/src/common/api/account.js similarity index 100% rename from common/api/account.js rename to src/common/api/account.js diff --git a/common/api/base.js b/src/common/api/base.js similarity index 100% rename from common/api/base.js rename to src/common/api/base.js diff --git a/common/api/cart.js b/src/common/api/cart.js similarity index 100% rename from common/api/cart.js rename to src/common/api/cart.js diff --git a/common/api/goods.js b/src/common/api/goods.js similarity index 100% rename from common/api/goods.js rename to src/common/api/goods.js diff --git a/common/api/im.js b/src/common/api/im.js similarity index 100% rename from common/api/im.js rename to src/common/api/im.js diff --git a/common/api/index.js b/src/common/api/index.js similarity index 100% rename from common/api/index.js rename to src/common/api/index.js diff --git a/common/api/order.js b/src/common/api/order.js similarity index 100% rename from common/api/order.js rename to src/common/api/order.js diff --git a/common/api/oss.js b/src/common/api/oss.js similarity index 100% rename from common/api/oss.js rename to src/common/api/oss.js diff --git a/common/api/seckill.js b/src/common/api/seckill.js similarity index 100% rename from common/api/seckill.js rename to src/common/api/seckill.js diff --git a/common/api/wx.js b/src/common/api/wx.js similarity index 100% rename from common/api/wx.js rename to src/common/api/wx.js diff --git a/common/dicts/area.json b/src/common/dicts/area.json similarity index 100% rename from common/dicts/area.json rename to src/common/dicts/area.json diff --git a/common/dicts/im.js b/src/common/dicts/im.js similarity index 100% rename from common/dicts/im.js rename to src/common/dicts/im.js diff --git a/common/plugins/emoji.js b/src/common/plugins/emoji.js similarity index 100% rename from common/plugins/emoji.js rename to src/common/plugins/emoji.js diff --git a/common/plugins/msbIm.js b/src/common/plugins/msbIm.js similarity index 100% rename from common/plugins/msbIm.js rename to src/common/plugins/msbIm.js diff --git a/common/plugins/msbUniRequest.js b/src/common/plugins/msbUniRequest.js similarity index 100% rename from common/plugins/msbUniRequest.js rename to src/common/plugins/msbUniRequest.js diff --git a/common/router/index.js b/src/common/router/index.js similarity index 100% rename from common/router/index.js rename to src/common/router/index.js diff --git a/common/store/index.js b/src/common/store/index.js similarity index 100% rename from common/store/index.js rename to src/common/store/index.js diff --git a/common/utils/im.js b/src/common/utils/im.js similarity index 100% rename from common/utils/im.js rename to src/common/utils/im.js diff --git a/common/utils/index.js b/src/common/utils/index.js similarity index 100% rename from common/utils/index.js rename to src/common/utils/index.js diff --git a/common/utils/pay.js b/src/common/utils/pay.js similarity index 100% rename from common/utils/pay.js rename to src/common/utils/pay.js diff --git a/common/utils/requset.js b/src/common/utils/requset.js similarity index 100% rename from common/utils/requset.js rename to src/common/utils/requset.js diff --git a/common/utils/utils.js b/src/common/utils/utils.js similarity index 100% rename from common/utils/utils.js rename to src/common/utils/utils.js diff --git a/common/utils/wxpay.js b/src/common/utils/wxpay.js similarity index 100% rename from common/utils/wxpay.js rename to src/common/utils/wxpay.js diff --git a/components/BsChoiceGoods.vue b/src/components/BsChoiceGoods.vue similarity index 100% rename from components/BsChoiceGoods.vue rename to src/components/BsChoiceGoods.vue diff --git a/components/BsEmpty.vue b/src/components/BsEmpty.vue similarity index 100% rename from components/BsEmpty.vue rename to src/components/BsEmpty.vue diff --git a/components/BsPay.vue b/src/components/BsPay.vue similarity index 100% rename from components/BsPay.vue rename to src/components/BsPay.vue diff --git a/components/BsSelectCity.vue b/src/components/BsSelectCity.vue similarity index 100% rename from components/BsSelectCity.vue rename to src/components/BsSelectCity.vue diff --git a/components/UiButton.vue b/src/components/UiButton.vue similarity index 100% rename from components/UiButton.vue rename to src/components/UiButton.vue diff --git a/components/UiCell.vue b/src/components/UiCell.vue similarity index 100% rename from components/UiCell.vue rename to src/components/UiCell.vue diff --git a/components/UiConfirm.vue b/src/components/UiConfirm.vue similarity index 100% rename from components/UiConfirm.vue rename to src/components/UiConfirm.vue diff --git a/components/UiCopy.vue b/src/components/UiCopy.vue similarity index 100% rename from components/UiCopy.vue rename to src/components/UiCopy.vue diff --git a/components/UiGoodsGroup.vue b/src/components/UiGoodsGroup.vue similarity index 98% rename from components/UiGoodsGroup.vue rename to src/components/UiGoodsGroup.vue index f3f2e2e..e124f8a 100644 --- a/components/UiGoodsGroup.vue +++ b/src/components/UiGoodsGroup.vue @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-04-07 17:22:44 * @LastEditors: ch - * @LastEditTime: 2022-05-07 19:46:04 + * @LastEditTime: 2022-05-23 18:17:28 * @Description: file content --> @@ -175,7 +175,7 @@ export default { } } } -/deep/ { +::deep { .goods-item--pirce{ text{ font-size: $font-size-lg; diff --git a/components/UiGoodsInfo.vue b/src/components/UiGoodsInfo.vue similarity index 97% rename from components/UiGoodsInfo.vue rename to src/components/UiGoodsInfo.vue index 0fa7f12..d942509 100644 --- a/components/UiGoodsInfo.vue +++ b/src/components/UiGoodsInfo.vue @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-31 14:49:33 * @LastEditors: ch - * @LastEditTime: 2022-04-22 18:24:57 + * @LastEditTime: 2022-05-23 18:17:30 * @Description: file content -->