create project

merge-requests/1/head
ch 3 years ago
parent 948834660f
commit b3c9b0662a

@ -0,0 +1,16 @@
{
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
}
}

@ -0,0 +1,13 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

92
.gitignore vendored

@ -0,0 +1,92 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.history/
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# Nuxt generate
dist
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE / Editor
.idea
# Service worker
sw.*
# macOS
.DS_Store
# Vim swap files
*.swp

@ -1,92 +1,69 @@
# shop-pc # shop-pc
马士兵严选pc ## Build Setup
## Getting started ```bash
# install dependencies
$ npm install
To make it easy for you to get started with GitLab, here's a list of recommended next steps. # serve with hot reload at localhost:3000
$ npm run dev
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! # build for production and launch server
$ npm run build
## Add your files $ npm run start
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
# generate static project
$ npm run generate
``` ```
cd existing_repo
git remote add origin http://internel-git.mashibing.cn/yanxuan-frontend/shop-pc.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools For detailed explanation on how things work, check out the [documentation](https://nuxtjs.org).
## Special Directories
- [ ] [Set up project integrations](http://internel-git.mashibing.cn/yanxuan-frontend/shop-pc/-/settings/integrations) You can create the following extra directories, some of which have special behaviors. Only `pages` is required; you can delete them if you don't want to use their functionality.
## Collaborate with your team ### `assets`
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) The assets directory contains your uncompiled assets such as Stylus or Sass files, images, or fonts.
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/assets).
Use the built-in continuous integration in GitLab. ### `components`
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) The components directory contains your Vue.js components. Components make up the different parts of your page and can be reused and imported into your pages, layouts and even other components.
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
*** More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/components).
# Editing this README ### `layouts`
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. Layouts are a great help when you want to change the look and feel of your Nuxt app, whether you want to include a sidebar or have distinct layouts for mobile and desktop.
## Suggestions for a good README More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/layouts).
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description ### `pages`
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges This directory contains your application views and routes. Nuxt will read all the `*.vue` files inside this directory and setup Vue Router automatically.
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/get-started/routing).
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation ### `plugins`
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage The plugins directory contains JavaScript plugins that you want to run before instantiating the root Vue.js Application. This is the place to add Vue plugins and to inject functions or constants. Every time you need to use `Vue.use()`, you should create a file in `plugins/` and add its path to plugins in `nuxt.config.js`.
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/plugins).
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap ### `static`
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing This directory contains your static files. Each file inside this directory is mapped to `/`.
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. Example: `/static/robots.txt` is mapped as `/robots.txt`.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/static).
## Authors and acknowledgment ### `store`
Show your appreciation to those who have contributed to the project.
## License This directory contains your Vuex store files. Creating a file in this directory automatically activates Vuex.
For open source projects, say how it is licensed.
## Project status More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/store).
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.

@ -0,0 +1,34 @@
* {
-webkit-box-sizing: border-box; box-sizing: border-box;
-webkit-touch-callout:none; /*系统默认菜单被禁用*/
-webkit-user-select:none; /*webkit浏览器*/
-khtml-user-select:none; /*早期浏览器*/
-moz-user-select:none;/*火狐*/
-ms-user-select:none; /*IE10*/
user-select:none;
&:after, &:before {
@extend *;
}
}
body, dl, dd, h1, h2, h3, h4, h5, p, figure, form, ul, ol { margin: 0; font-size: .16rem;}
ul, ol, input, button { padding: 0;}
ul, ol, li { list-style: none;list-style-type: none}
h1, h2, h3, h4, h5 { font-size: 100%;}
input { border: 0; margin: 0;}
img { width: 100%;}
a, button, input, optgroup, select, textarea, img { outline:none; -webkit-tap-highlight-color: rgba(0,0,0,0); }
a, img { -webkit-touch-callout: none; border: 0;}
html, body { position: absolute; min-height: 100%; height: 100%; width: 100%;}
input, textarea, img, button { vertical-align: middle; outline: none;}
body {
font-family: PingFang SC, Microsoft YaHei, Helvetica, STHeiTi, sans-serif !important;
color: #333; -webkit-font-smoothing: antialiased; font-smoothing: antialiased;
overflow-anchor: none}
table {border-collapse: collapse; border-spacing: 0;
color: #333;}
a { text-decoration:none;
color: #333;
&:hover { text-decoration:none;}
}

@ -0,0 +1,18 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:43:34
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:43:40
* @Description: file content
-->
<template>
<div>我是公共页头</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,18 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:44:29
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:44:52
* @Description: file content
-->
<template>
<div>我是金额展示组件</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,45 @@
/*
* @Author: ch
* @Date: 2022-05-05 14:40:00
* @LastEditors: ch
* @LastEditTime: 2022-05-05 15:32:20
* @Description: 根据git分支生成对应环境的环境变量
*/
const fs = require('fs');
const path = require('path');
const getRepoInfo = require('git-repo-info');
const envConfig = {
dev : {
},
test : {
base_url: 'xxx'
},
reslese : {
},
prod : {
}
}
const branch = getRepoInfo().branch; // 调用获取git信息
const argv = global.process.argv;
let curEnvConfig = {};
switch (branch){
case 'msb_test':
curEnvConfig = envConfig.test;
break;
case 'msb_beta':
curEnvConfig = envConfig.release;
break;
case 'msb_prod':
curEnvConfig = envConfig.prod;
break;
default:
curEnvConfig = envConfig.dev;
break;
}
let codeStr = `const ENV = ${JSON.stringify(curEnvConfig)}; export default ENV;`;
fs.writeFileSync(`${path.resolve(__dirname, './plugins')}/env.js`, codeStr);

@ -0,0 +1,22 @@
module.exports = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^~/(.*)$': '<rootDir>/$1',
'^vue$': 'vue/dist/vue.common.js'
},
moduleFileExtensions: [
'js',
'vue',
'json'
],
transform: {
'^.+\\.js$': 'babel-jest',
'.*\\.(vue)$': 'vue-jest'
},
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/components/**/*.vue',
'<rootDir>/pages/**/*.vue'
],
testEnvironment: 'jsdom'
}

@ -0,0 +1,17 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:56:39
* @LastEditors: ch
* @LastEditTime: 2022-05-04 21:19:27
* @Description: file content
-->
<template>
<div>
<Nuxt />
<div>我是版权</div>
</div>
</template>
<script>
export default {
}
</script>

@ -0,0 +1,80 @@
/*
* @Author: ch
* @Date: 2022-05-03 22:14:16
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:58:00
* @Description: file content
*/
export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'shop-pc',
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
router: {
extendRoutes(routes, resolve) {
routes.push({
name: 'custom',
path: '/',
component: resolve(__dirname, 'pages/index/index.vue')
})
}
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'@assets/scss/global.scss',
'element-ui/lib/theme-chalk/index.css'
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'@/plugins/element-ui',
'@/plugins/axios',
{ src: '@plugins/axiosTk.js', ssr: false },
{ src: '@plugins/storeStorage.js', ssr: false },
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
'@nuxtjs/axios',
'cookie-universal-nuxt',
['cookie-universal-nuxt', { alias: 'cookiz' }],
],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: [/^element-ui/],
},
axios: {
// 表示开启代理
proxy: true,
},
proxy: {
'/mall/': {
// target: 'http://114.55.64.39:3004', // 目标接口域名
target: 'https://you-gateway.mashibing.com/', // 目标接口域名
pathRewrite: {
changeOrigin: true, // 表示是否跨域
},
},
}
}

@ -0,0 +1,35 @@
{
"name": "shop-pc",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"test": "jest"
},
"dependencies": {
"@nuxtjs/axios": "^5.13.6",
"cookie-universal-nuxt": "^2.1.5",
"core-js": "^3.19.3",
"element-ui": "^2.15.6",
"js-util-all": "^1.0.6",
"node-sass": "^4.14.1",
"nuxt": "^2.15.8",
"sass": "^1.32.13",
"sass-loader": "^7.3.1",
"vue": "^2.6.14",
"vue-server-renderer": "^2.6.14",
"vue-template-compiler": "^2.6.14",
"webpack": "^4.46.0"
},
"devDependencies": {
"@vue/test-utils": "^1.3.0",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^27.4.4",
"git-repo-info": "^2.1.1",
"jest": "^27.4.4",
"vue-jest": "^3.0.4"
}
}

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:53:24
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:53:34
* @Description: file content
-->
<template>
<div>我是地址管理页面</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:27:37
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:27:39
* @Description: file content
-->
<template>
<div>我是个人中心首页</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:49:21
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:50:11
* @Description: file content
-->
<template>
<div>我是物流信息模块</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 00:29:39
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:50:18
* @Description: file content
-->
<template>
<div>我是消息模块</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:48:12
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:53:11
* @Description: file content
-->
<template>
<div>我是消息页面</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:52:50
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:52:59
* @Description: file content
-->
<template>
<div>我是个人资料页面</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,22 @@
<!--
* @Author: ch
* @Date: 2022-05-03 22:41:15
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:27:21
* @Description: file content
-->
<template>
<div>我是购物车</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:29:09
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:29:24
* @Description: file content
-->
<template>
<div>我是商品详情</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:28:28
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:28:48
* @Description: file content
-->
<template>
<div>我是商品列表</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,49 @@
<!--
* @Author: ch
* @Date: 2022-05-03 22:14:16
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:21:04
* @Description: file content
-->
<template>
<div>
<h1>我是首页</h1>
<Banner />
<Seckil />
<div>时间格式化方法测试{{date}}</div>
<a href="/order/list">去订单</a>
<button @click="login"></button>
</div>
</template>
<script>
import { ApiGetGoodsList } from "~/plugins/api/goods";
import { FormatDate } from "~/plugins/utils";
import Banner from "./module/Banner.vue";
import Seckil from "./module/Seckill.vue";
export default {
components: { Banner, Seckil },
data(){
return {
date : '时间'
}
},
asyncData({ $axios }) {
ApiGetGoodsList().then((res) => {
console.log(res);
});
},
mounted() {
this.date = FormatDate(new Date() , 'yyyy年MM月dd日');
// setInterval(()=>{
// location.reload();
// },50000)
},
methods: {
login() {
this.$store.commit("SET_TOKEN", "123");
},
},
};
</script>

@ -0,0 +1,24 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:50:33
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:15:26
* @Description: file content
-->
<template>
<div>我是banner模块</div>
</template>
<script>
export default {
name : 'Banner',
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,24 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:51:11
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:15:37
* @Description: file content
-->
<template>
<div>我是秒杀模块</div>
</template>
<script>
export default {
name : 'Seckill',
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,32 @@
<!--
* @Author: ch
* @Date: 2022-05-04 20:47:29
* @LastEditors: ch
* @LastEditTime: 2022-05-04 21:49:40
* @Description: file content
-->
<template>
<div>
<h1>我是订单列表</h1>
<a href="/">回首页</a>
</div>
</template>
<script>
import {ApiGetOrderList} from '~/plugins/api/order';
export default {
name: 'IndexPage',
asyncData(){
},
mounted(){
this.getData();
},
methods : {
async getData(){
const res = await ApiGetOrderList();
console.log(res);
}
}
}
</script>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:30:58
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:31:12
* @Description: file content
-->
<template>
<div>我是订单提交页</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,22 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:35:44
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:38:31
* @Description: file content
-->
<template>
<div>我是地址模块</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,23 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:36:46
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:49:58
* @Description: file content
-->
<template>
<div>我是订单商品模块</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,22 @@
<!--
* @Author: ch
* @Date: 2022-05-04 17:25:41
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:26:08
* @Description: file content
-->
<template>
<div>我是秒杀首页</div>
</template>
<script>
export default {
data(){
return {
}
}
}
</script>
<style lang="scss" scoped>
</style>

@ -0,0 +1,37 @@
/*
* @Author: ch
* @Date: 2022-05-04 18:24:03
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:43:19
* @Description: file content
*/
import {axiosTk} from "../axiosTk";
import {axios} from "../axios";
import { ToAsyncAwait } from "../utils";
const BASE_URL = '/uc';
/**
* 获取当前登录用户信息
*/
export const ApiGetCurrentUser = () =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/user/current`));
/**
* 修改用户信息
* @param {*} data
*/
export const ApiPutUser = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/user/`, data));
/**
* 登录
* @param {*} data
*/
export const ApiPostLogin = (data) => ToAsyncAwait(axios.post(`${BASE_URL}/user/login`, data));
/**
* 获取手机验证码
* @param {*} params
*/
export const ApiGetCode = (params) => ToAsyncAwait(axios.get(`${BASE_URL}/user/login/verificationCode`, params));

@ -0,0 +1,32 @@
/*
* @Author: ch
* @Date: 2022-05-04 18:24:03
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:42:08
* @Description: file content
*/
import {axiosTk} from "../axiosTk";
import { ToAsyncAwait } from "../utils";
const BASE_URL = '/mall/base';
/**
* 获取收货地址
*/
export const ApiGetAddress = () =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/receiveAddress`));
/**
* 新增收货地址
*/
export const ApiPostAddress = (data) =>
ToAsyncAwait(axiosTk.post(`${BASE_URL}/receiveAddress`, data));
/**
* 收货地址修改
*/
export const ApiPutAddress = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/receiveAddress`, data));
/**
* 收货删除
*/
export const ApiDeleteAddress = (data) =>
ToAsyncAwait(axiosTk.delete(`${BASE_URL}/receiveAddress?idList=${data.idList}`));

@ -0,0 +1,36 @@
/*
* @Author: ch
* @Date: 2022-05-04 18:24:03
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:41:25
* @Description: file content
*/
import {axiosTk} from "../axiosTk";
import { ToAsyncAwait } from "../utils";
const BASE_URL = '/mall/product';
/**
* 设置购物车数量
* @param {id,number} data
*/
export const ApiPutCartNum = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/shoppingCart/number`, data));
/**
* 往购物车中添加商品
* @param {prodcutId, productSkuId, number} data
*/
export const ApiPutAddCart = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/shoppingCart/increase`, data));
/**
* 删除购物车中的商品
* @param {idList} data
*/
export const ApiDeleteCartGoods = (data) =>
ToAsyncAwait(axiosTk.delete(`${BASE_URL}/shoppingCart?idList=${data.idList}`, data));
/**
* 获取购物车列表
*/
export const ApiGetCartList = () =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/shoppingCart`));

@ -0,0 +1,55 @@
/*
* @Author: ch
* @Date: 2022-05-04 18:24:03
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:40:26
* @Description: file content
*/
import {axios} from "../axios";
import { ToAsyncAwait } from "../utils";
const BASE_URL = '/mall/product';
/**
* 获取商品瀑布流
* @param {*} params
*/
export const ApiGetGoodsList = (params) =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/product/page`, params));
/**
* 获取推荐商品
* @param {*} params
*/
export const ApiGetRecommendedGoodsList = (params) =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/product/recommended`, params));
/**
* 获取商品详情
* @param {*} params
*/
export const ApiGetGoodsDetail = (params) =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/product/${params.id}`));
/**
* 获取商品sku信息
* @param {*} productId
*/
export const ApiGetGoodsSkus = (params) =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/product/sku`,params));
/**
* 获取首页分类导航
*/
export const ApiGetCategoryNav = () =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/product/categoryNavigation`));
/**
* 获取一级分类列表
*/
export const ApiGetCategoryOneList = () =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/productCategory/levelOne`));
/**
* 获取二级分类和商品列表
*/
export const ApiGetCategoryTwoAndGoods = (params) =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/productCategory/listCategoryAndProduct/${params.categoryId}`));

@ -0,0 +1,151 @@
/*
* @Author: ch
* @Date: 2022-05-04 18:17:25
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:46:02
* @Description: file content
*/
import {axiosTk} from "../axiosTk";
const BASE_URL = '/mall/trade';
const APPID = 'wx0643970a8e86d028';
/**
* 获取订单
* @param {*} params
*/
export const ApiGetOrderList = (params) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/page`, params));
/**
* 获取立即购买预订单
* @param {*} data
*/
export const ApiGetBeforeOrder = (data) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/buyAdvanceOrder`, data));
/**
* 获取购物车预订单
* @param {*} data
*/
export const ApiGetBeforeCartOrder = (data) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/cartAdvanceOrder`, data));
/**
* 订单详情
* @param {*} id
*/
export const ApiGetOrderDetail = (id) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/${id}`));
/**
* 订单商品详情信息
* @param {*} orderProductId
*/
export const ApiGetOrderProductDetail = ({orderProductId}) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/product/${orderProductId}`));
/**
* 提交订单
* @param {*} data
*/
export const ApiGetOrderPaySatus = ({orderId}) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/payResult/${orderId}`));
/**
* 获取物流信息
* @param {*} orderId
*/
export const ApiGetOrderLogistics = ({orderId}) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/logistics/${orderId}`));
/**
* 确认收货
* @param {*} orderId
*/
export const ApiPutOrderReceive = (params) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/app/tradeOrder/receive`, params));
/**
* 提交订单
* @param {*} data
*/
export const ApiPostSubmitOrder = (data) =>
ToAsyncAwait(axiosTk.post(`${BASE_URL}/app/tradeOrder/submitOrder`, data));
/**
* 取消订单
* @param {*} data
*/
export const ApiPutCancelOrder = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/app/tradeOrder/cancel`, data));
/**
* 获取订单统计数据
*/
export const ApiGetOrderStatistics = () =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/statistics`))
/**
* 申请售后
* @param {*} data
*/
export const ApiPostApplySaleAfter = (data) =>
ToAsyncAwait(axiosTk.post(`${BASE_URL}/app/refundOrder/applyRefund`, data));
/**
* 修改售后申请
* @param {*} data
*/
export const ApiPostEditSaleAfter = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/app/refundOrder/updateRefund`, data));
/**
* 撤销售后申请
* @param {*} data
*/
export const ApiPostCancelSaleAfter = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/app/refundOrder/cancelRefund`, data));
/**
* 售后订单列表
* @param {*} data
*/
export const ApiGetSaleAfterOrderList = (params) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/refundOrder/page`, params));
/**
* 售后订单详情
* @param {*} data
*/
export const ApiGetSaleAfterOrderDetail = (params) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/refundOrder/refundInfo`, params));
/**
* 售后物流公司
* @param {*} data
*/
export const ApiGetLogisticsCompanylist = (params) =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/refundOrder/logisticsCompany`));
/**
* 售后提交物流信息
* @param {*} data
*/
export const ApiPutLogisticsInfo = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/app/refundOrder/completeRefund`, data));
/**
* 微信h5支付获取支付URL
* @param {*} data
*/
export const ApiPostWxH5Pay = (data) =>
ToAsyncAwait(axiosTk.post(`${BASE_URL}/pay/wxPay/h5`, data));

@ -0,0 +1,15 @@
/*
* @Author: ch
* @Date: 2022-05-04 18:24:03
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:40:06
* @Description: file content
*/
import {axiosTk} from "../axiosTk";
import { ToAsyncAwait } from "../utils";
const BASE_URL = '/oss/oss';
export const ApiPostGetOssConfig = (data) =>
ToAsyncAwait(axiosTk.post(`${BASE_URL}/generateOssSignature`, data));

@ -0,0 +1,26 @@
/*
* @Author: ch
* @Date: 2022-05-04 18:24:03
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:44:12
* @Description: file content
*/
import {axios} from "../axios";
import { ToAsyncAwait } from "../utils";
const BASE_URL = '/mall/marketing';
export const ApiGetHomeSeckill = () =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/home`));
/**
* 获取当天秒杀时段
*/
export const ApiGetSeckillTimes = () =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/time`));
/**
* 获取当天秒杀时段
*/
export const ApiGetSeckillGoods = (params) =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/product`, params));

@ -0,0 +1,31 @@
/*
* @Author: ch
* @Date: 2022-05-03 23:04:45
* @LastEditors: ch
* @LastEditTime: 2022-05-04 18:32:54
* @Description: file content
*/
let axios = null
export default function({app, $axios, req}) {
// if(req){
// let str = 'Safari'
// if(req.headers['user-agent'].includes('Chrome')){
// str = 'Chrome'
// }
// console.log(str, req.headers['cookie'].split('token')[1]);
// }
// export default function ({app, $axios}) {
$axios.onRequest(()=>{
})
$axios.onResponse(res => {
if (res.data.code === 200) {
return res.data.result;
} else {
return Promise.reject(res.data.error);
}
});
axios = $axios;
}
export { axios }

@ -0,0 +1,22 @@
/*
* @Author: ch
* @Date: 2022-05-04 17:11:07
* @LastEditors: ch
* @LastEditTime: 2022-05-04 21:50:14
* @Description: file content
*/
let axiosTk = null;
export default function ({$axios, store}, inject) {
const $axiosTk = $axios.create();
$axiosTk.onRequest( config =>{
if(!store.state.token){
return Promise.reject({message : '要先登录才能操作哦~'});
}
config.headers.Authorization = store.state.token;
return config;
});
inject('$axiosTk', $axiosTk);
axiosTk = $axiosTk;
}
export {axiosTk}

@ -0,0 +1,9 @@
/*
* @Author: ch
* @Date: 2022-05-04 21:02:38
* @LastEditors: ch
* @LastEditTime: 2022-05-04 21:03:14
* @Description: file content
*/
const LOCAL_BASE = 'msbPc:';
export const TOKEN = `${LOCAL_BASE}tk`;

@ -0,0 +1,5 @@
import Vue from 'vue'
import Element from 'element-ui'
import locale from 'element-ui/lib/locale/lang/en'
Vue.use(Element, { locale })

@ -0,0 +1 @@
const ENV = {"base_url":"xxx"}; export default ENV;

@ -0,0 +1,14 @@
/*
* @Author: ch
* @Date: 2022-05-04 21:15:17
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:05:15
* @Description: 服务端没有localStorage对象在Sotre中不能直接取值在plugins中统一为state做一次初始取值处理
*/
import { TOKEN } from "./config/localKey";
export default ({store})=>{
// 获取storage中的token
store.commit('SET_TOKEN',localStorage.getItem(TOKEN));
}

@ -0,0 +1,13 @@
/*
* @Author: ch
* @Date: 2022-05-04 20:29:55
* @LastEditors: ch
* @LastEditTime: 2022-05-04 21:58:02
* @Description: file content
*/
import * as other from './other';
export * from './other';
export default { ...other}

@ -0,0 +1,53 @@
/*
* @Author: ch
* @Date: 2022-05-04 21:57:26
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:24:07
* @Description: file content
*/
import {
toAsyncAwait as ToAsyncAwait,
isPhone as IsPhone,
formatDate as FormatDate,
createUUID as CreateUUID,
toSearchJson as ToSearchJson
} from "js-util-all"
/**
* 首次运行时把定时器赋值给一个变量 第二次执行时
* 如果间隔没超过定时器设定的时间则会清除掉定时器
* 重新设定定时器 依次反复 当我们停止下来时
* 没有执行清除定时器 超过一定时间后触发回调函数
*/
const Debounce = (fn, delay) => {
let timer
return function () {
const that = this
const _args = arguments // 存一下传入的参数
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(function () {
fn.apply(that, _args)
}, delay)
}
}
// 工具类的文件需要把文件提供的工具类统一放最下方做一个统一输出
export {
// async await 标识结果处理
ToAsyncAwait,
// 判断是否为手机号
IsPhone,
// 时间格式化
FormatDate,
// 创建UUID
CreateUUID,
// 请求Search参数转化为JSON格式
ToSearchJson,
// 防抖函数
Debounce
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

@ -0,0 +1,10 @@
# STORE
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your Vuex Store files.
Vuex Store option is implemented in the Nuxt.js framework.
Creating a file in this directory automatically activates the option in the framework.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).

@ -0,0 +1,20 @@
/*
* @Author: ch
* @Date: 2022-05-04 20:35:20
* @LastEditors: ch
* @LastEditTime: 2022-05-04 21:39:42
* @Description: file content
*/
import { TOKEN } from "../plugins/config/localKey";
export const state = () => ({
token: ''
})
export const mutations = {
SET_TOKEN (state, token = ''){
state.token = token;
token ? localStorage.setItem(TOKEN, token) : localStorage.removeItem(TOKEN);
}
}

@ -0,0 +1,9 @@
import { mount } from '@vue/test-utils'
import NuxtLogo from '@/components/NuxtLogo.vue'
describe('NuxtLogo', () => {
test('is a Vue instance', () => {
const wrapper = mount(NuxtLogo)
expect(wrapper.vm).toBeTruthy()
})
})
Loading…
Cancel
Save