[A]add recipe frontend

This commit is contained in:
Ching 2021-09-06 01:36:39 +08:00
parent 558065a8f1
commit 0ebbbe8f0e
24 changed files with 35662 additions and 12 deletions

19
.eslintrc.json Normal file
View File

@ -0,0 +1,19 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:vue/essential",
"google"
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"vue"
],
"rules": {
}
}

120
.gitignore vendored
View File

@ -102,3 +102,123 @@ venv.bak/
# mypy # mypy
.mypy_cache/ .mypy_cache/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# 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
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://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/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env.production
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

2
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,2 @@
{
}

View File

@ -4,5 +4,39 @@ REST_FRAMEWORK = {
'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.SessionAuthentication',
), ),
'PAGE_SIZE': 10
} }
ALLOWED_HOSTS = ['*']
CORS_ALLOW_CREDENTIALS = True # 允许携带cookie
# CORS_ALLOW_ALL_ORIGINS = True # If this is used then `CORS_ALLOWED_ORIGINS` will not have any effect
CORS_ALLOWED_ORIGINS = [
'http://localhost:8080',
'http://127.0.0.1:8080',
'http://192.168.1.101:8080'
]
CORS_ALLOW_METHODS = [
"DELETE",
"GET",
"OPTIONS",
"PATCH",
"POST",
"PUT",
]
CORS_ALLOW_HEADERS = [
"accept",
"accept-encoding",
"authorization",
"content-type",
"dnt",
"origin",
"user-agent",
"x-csrftoken",
"x-requested-with",
]
CORS_ALLOW_HEADERS = ('*')

View File

@ -40,6 +40,7 @@ INSTALLED_APPS = [
# third party # third party
'corsheaders',
'rest_framework', 'rest_framework',
'rest_framework.authtoken', 'rest_framework.authtoken',
@ -49,9 +50,10 @@ INSTALLED_APPS = [
] ]
MIDDLEWARE = [ MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
@ -139,3 +141,12 @@ REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 10 'PAGE_SIZE': 10
} }
# CORS
# CORS_ALLOWED_ORIGINS = (
# 'http://127.0.0.1:8080',
# 'http://localhost:8080',
# )
CORS_ALLOWED_ORIGINS = []
CORS_ALLOW_CREDENTIALS = True # 允许携带cookie
# CORS_ALLOW_ALL_ORIGINS = False # If this is used then `CORS_ALLOWED_ORIGINS` will not have any effect

23
frontend/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
frontend/README.md Normal file
View File

@ -0,0 +1,24 @@
# frontend
## Project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn serve
```
### Compiles and minifies for production
```
yarn build
```
### Lints and fixes files
```
yarn lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
frontend/babel.config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

25786
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

51
frontend/package.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"description": "## Project setup ``` yarn install ```",
"author": "",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"main": "babel.config.js",
"dependencies": {
"axios": "^0.21.2",
"core-js": "^3.6.5",
"element-plus": "^1.0.2-beta.28",
"vue": "^3.0.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-vue": "^7.17.0",
"vue-cli-plugin-element-plus": "~0.0.13"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
],
"keywords": [],
"license": "ISC"
}

BIN
frontend/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

119
frontend/src/App.vue Normal file
View File

@ -0,0 +1,119 @@
<template>
<el-row justify="center">
<el-col :span="18">
<el-table :data="recipes" max-height="500" class="recipe-table">
<el-table-column prop="name" label="名字"> </el-table-column>
<el-table-column
prop="recipe_type"
label="类型"
:formatter="formatRecipeType"
:filters="[
{ text: '青菜', value: 'vegetable' },
{ text: '肉', value: 'meat' },
{ text: '汤', value: 'soup' },
]"
:filter-method="filterRecipeType"
>
</el-table-column>
<el-table-column
prop="difficulty"
label="难度"
:formatter="formatDifficulty"
sortable
>
</el-table-column>
<el-table-column
prop="rate"
label="评分"
:formatter="formatRate"
sortable
>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-row justify="center">
<el-col :span="18"> <input_recipe></input_recipe> </el-col>
</el-row>
</template>
<script>
import axios from 'axios';
import input_recipe from './components/input_recipe.vue';
// const api_root = 'localhost:8000'
const type_map = {
vegetable: '青菜',
meat: '肉',
soup: '汤',
};
const rate_map = {
1: '🍚',
2: '🍚 🍚',
3: '🍚 🍚 🍚',
4: '🍚 🍚 🍚 🍚',
5: '🍚 🍚 🍚 🍚 🍚',
};
const difficulty_map = {
1: '⭐',
2: '⭐ ⭐',
3: '⭐ ⭐ ⭐',
4: '⭐ ⭐ ⭐ ⭐',
5: '⭐ ⭐ ⭐ ⭐ ⭐',
};
function formatRecipeType(row) {
return type_map[row.recipe_type];
}
function formatRate(row) {
return rate_map[row.rate];
}
function formatDifficulty(row) {
return difficulty_map[row.difficulty];
}
export default {
components: { input_recipe },
name: 'App',
provide() {
return {
reload: this.reload,
};
},
methods: {
reload() {
this.isRouterAlive = false;
this.$nextTick(function() {
this.isRouterAlive = true;
});
},
filterRecipeType(value, row) {
return row.recipe_type === value;
},
},
data: function() {
return {
recipes: '',
formatRecipeType,
formatRate,
formatDifficulty,
isRouterAlive: true,
};
},
mounted() {
axios
.get('//localhost:8000/recipe/recipe/')
.then(console.log('hihhihih'))
.then((response) => (this.recipes = response.data));
},
};
</script>
<style>
.el-row {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
.el-col {
border-radius: 4px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,58 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@ -0,0 +1,102 @@
<template>
<el-row justify="left">
<el-col>
<el-form :rules="rules" ref="form" :model="form" label-position="left">
<el-form-item label="名字" prop="name">
<el-input v-model="form.name" placeholder="鱼香茄子......"></el-input>
</el-form-item>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="类型">
<el-select
v-model="form.recipe_type"
placeholder="选择类型"
style="width: 100%"
>
<el-option label="肉" value="meat"></el-option>
<el-option label="菜" value="vegetable"></el-option>
<el-option label="汤" value="soup"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="评分">
<el-select
v-model="form.rate"
placeholder="选择评分"
style="width: 100%"
>
<el-option label="再也不吃了" value="1"></el-option>
<el-option label="难吃,再练练" value="2"></el-option>
<el-option label="还行" value="3"></el-option>
<el-option label="好吃" value="4"></el-option>
<el-option label="上天了" value="5"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="难度">
<el-select
v-model="form.difficulty"
placeholder="选择难度"
style="width: 100%"
>
<el-option label="无脑做" value="1"></el-option>
<el-option label="还行" value="2"></el-option>
<el-option label="有点麻烦" value="3"></el-option>
<el-option label="要花心机" value="4"></el-option>
<el-option label="做不来做不来" value="5"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注">
<el-input type="textarea" v-model="form.note"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">提交</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</template>
<script>
import axios from 'axios';
export default {
inject: ['reload'],
data: function() {
return {
form: {
name: '',
recipe_type: 'meat',
difficulty: '1',
rate: '1',
note: null,
},
rules: {
name: [{ required: true, trigger: 'blur', message: '输入菜名' }],
},
};
},
methods: {
onSubmit() {
let data = {
name: this.form.name,
recipe_type: this.form.recipe_type,
difficulty: this.form.difficulty,
rate: this.form.rate,
note: this.form.note,
};
axios
.post('//localhost:8000/recipe/recipe/', data)
.then(function() {
location.reload();
})
.catch(function(error) {
console.log(error);
});
},
},
};
</script>

9
frontend/src/main.js Normal file
View File

@ -0,0 +1,9 @@
import { createApp } from 'vue'
import App from './App.vue'
import installElementPlus from './plugins/element'
import ElementPlus from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'
const app = createApp(App)
installElementPlus(app)
app.use(ElementPlus).mount('#app')

View File

@ -0,0 +1,7 @@
import ElementPlus from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn'
export default (app) => {
app.use(ElementPlus, { locale })
}

View File

@ -0,0 +1,5 @@
module.exports = {
RECIPE_TYPE_VEGETABLE: 'vegetable',
RECIPE_TYPE_META: 'meat',
RECIPE_TYPE_SOUP: 'soup',
}

8799
frontend/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

381
package-lock.json generated Normal file
View File

@ -0,0 +1,381 @@
{
"name": "dsite",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "dsite",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"element-plus": "^1.1.0-beta.8"
}
},
"node_modules/@babel/helper-validator-identifier": {
"version": "7.14.9",
"resolved": "https://registry.nlark.com/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.14.9.tgz?cache=0&sync_timestamp=1627804430461&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fhelper-validator-identifier%2Fdownload%2F%40babel%2Fhelper-validator-identifier-7.14.9.tgz",
"integrity": "sha1-ZlTRcbICT22O4VG/JQlpmRkTHUg=",
"peer": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/parser": {
"version": "7.15.5",
"resolved": "https://registry.nlark.com/@babel/parser/download/@babel/parser-7.15.5.tgz?cache=0&sync_timestamp=1630746008183&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fparser%2Fdownload%2F%40babel%2Fparser-7.15.5.tgz",
"integrity": "sha1-0zpYymn6zAWyat/kq+v+1WwcLaw=",
"peer": true,
"bin": {
"parser": "bin/babel-parser.js"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@babel/types": {
"version": "7.15.4",
"resolved": "https://registry.nlark.com/@babel/types/download/@babel/types-7.15.4.tgz?cache=0&sync_timestamp=1630618915456&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Ftypes%2Fdownload%2F%40babel%2Ftypes-7.15.4.tgz",
"integrity": "sha1-dO64bb1nSNJ0E5ZVe5hg5X/OCg0=",
"peer": true,
"dependencies": {
"@babel/helper-validator-identifier": "^7.14.9",
"to-fast-properties": "^2.0.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@element-plus/icons": {
"version": "0.0.11",
"resolved": "https://registry.nlark.com/@element-plus/icons/download/@element-plus/icons-0.0.11.tgz",
"integrity": "sha1-mxh8ACd0VIuRGFDRf6X8L5pRX1c="
},
"node_modules/@popperjs/core": {
"version": "2.10.1",
"resolved": "https://registry.nlark.com/@popperjs/core/download/@popperjs/core-2.10.1.tgz?cache=0&sync_timestamp=1630646750615&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40popperjs%2Fcore%2Fdownload%2F%40popperjs%2Fcore-2.10.1.tgz",
"integrity": "sha1-co7NlasgequKmk5CHwQi2zKSMr4="
},
"node_modules/@vue/compiler-core": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/compiler-core/download/@vue/compiler-core-3.2.8.tgz",
"integrity": "sha1-E7I4a9sDRVyfbGry80aFYaWuWx0=",
"peer": true,
"dependencies": {
"@babel/parser": "^7.15.0",
"@babel/types": "^7.15.0",
"@vue/shared": "3.2.8",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"node_modules/@vue/compiler-dom": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/compiler-dom/download/@vue/compiler-dom-3.2.8.tgz",
"integrity": "sha1-abyeCJKKEilcMSmQZ/GNhzAZgak=",
"peer": true,
"dependencies": {
"@vue/compiler-core": "3.2.8",
"@vue/shared": "3.2.8"
}
},
"node_modules/@vue/reactivity": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/reactivity/download/@vue/reactivity-3.2.8.tgz",
"integrity": "sha1-snIAzPqgbzEqxGexKjgWE3fFV+0=",
"peer": true,
"dependencies": {
"@vue/shared": "3.2.8"
}
},
"node_modules/@vue/runtime-core": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/runtime-core/download/@vue/runtime-core-3.2.8.tgz",
"integrity": "sha1-iiNCwLqg/uGS+BmjvcGVR9dDC4g=",
"peer": true,
"dependencies": {
"@vue/reactivity": "3.2.8",
"@vue/shared": "3.2.8"
}
},
"node_modules/@vue/runtime-dom": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/runtime-dom/download/@vue/runtime-dom-3.2.8.tgz",
"integrity": "sha1-xmMbUHBJ05hEsENOgd8ap578xss=",
"peer": true,
"dependencies": {
"@vue/runtime-core": "3.2.8",
"@vue/shared": "3.2.8",
"csstype": "^2.6.8"
}
},
"node_modules/@vue/shared": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/shared/download/@vue/shared-3.2.8.tgz",
"integrity": "sha1-L5GOMwrrP1arEDHKYKWzBnJRJFc=",
"peer": true
},
"node_modules/async-validator": {
"version": "3.5.2",
"resolved": "https://registry.nlark.com/async-validator/download/async-validator-3.5.2.tgz?cache=0&sync_timestamp=1630393256517&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fasync-validator%2Fdownload%2Fasync-validator-3.5.2.tgz",
"integrity": "sha1-aOhmqWgk6LJpT/eoMcGiXETV5QA="
},
"node_modules/csstype": {
"version": "2.6.17",
"resolved": "https://registry.nlark.com/csstype/download/csstype-2.6.17.tgz",
"integrity": "sha1-TPMOuH4dGgBdi2UQ+VKSQT9qHA4=",
"peer": true
},
"node_modules/dayjs": {
"version": "1.10.6",
"resolved": "https://registry.nlark.com/dayjs/download/dayjs-1.10.6.tgz?cache=0&sync_timestamp=1625557417200&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdayjs%2Fdownload%2Fdayjs-1.10.6.tgz",
"integrity": "sha1-KIsqqC8thBimydTfWJjAc3rQKmM="
},
"node_modules/element-plus": {
"version": "1.1.0-beta.8",
"resolved": "https://registry.nlark.com/element-plus/download/element-plus-1.1.0-beta.8.tgz?cache=0&sync_timestamp=1630404987049&other_urls=https%3A%2F%2Fregistry.nlark.com%2Felement-plus%2Fdownload%2Felement-plus-1.1.0-beta.8.tgz",
"integrity": "sha1-5AorR2fMvuH/mqbU7ShIY60kbhw=",
"dependencies": {
"@element-plus/icons": "^0.0.11",
"@popperjs/core": "^2.4.4",
"async-validator": "^3.4.0",
"dayjs": "1.x",
"lodash": "^4.17.20",
"mitt": "^2.1.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.1"
},
"peerDependencies": {
"vue": "^3.2.0"
}
},
"node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/estree-walker/download/estree-walker-2.0.2.tgz?cache=0&sync_timestamp=1611956983677&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Festree-walker%2Fdownload%2Festree-walker-2.0.2.tgz",
"integrity": "sha1-UvAQF4wqTBF6d1fP6UKtt9LaTKw=",
"peer": true
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.nlark.com/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1624543041613&other_urls=https%3A%2F%2Fregistry.nlark.com%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"node_modules/mitt": {
"version": "2.1.0",
"resolved": "https://registry.nlark.com/mitt/download/mitt-2.1.0.tgz?cache=0&sync_timestamp=1624483449786&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fmitt%2Fdownload%2Fmitt-2.1.0.tgz",
"integrity": "sha1-90BXfCMXbGIFsSGylzUU6t4bIjA="
},
"node_modules/normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"node_modules/resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha1-DpAg3T0hAkRY1OvSfiPkAmmBBGQ="
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz",
"integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/to-fast-properties": {
"version": "2.0.0",
"resolved": "https://registry.nlark.com/to-fast-properties/download/to-fast-properties-2.0.0.tgz?cache=0&sync_timestamp=1628418855671&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fto-fast-properties%2Fdownload%2Fto-fast-properties-2.0.0.tgz",
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
"peer": true,
"engines": {
"node": ">=4"
}
},
"node_modules/vue": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/vue/download/vue-3.2.8.tgz?cache=0&sync_timestamp=1630608473072&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue%2Fdownload%2Fvue-3.2.8.tgz",
"integrity": "sha1-kSTkwx68nFkrK58pPfXJqIp46UQ=",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.2.8",
"@vue/runtime-dom": "3.2.8",
"@vue/shared": "3.2.8"
}
}
},
"dependencies": {
"@babel/helper-validator-identifier": {
"version": "7.14.9",
"resolved": "https://registry.nlark.com/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.14.9.tgz?cache=0&sync_timestamp=1627804430461&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fhelper-validator-identifier%2Fdownload%2F%40babel%2Fhelper-validator-identifier-7.14.9.tgz",
"integrity": "sha1-ZlTRcbICT22O4VG/JQlpmRkTHUg=",
"peer": true
},
"@babel/parser": {
"version": "7.15.5",
"resolved": "https://registry.nlark.com/@babel/parser/download/@babel/parser-7.15.5.tgz?cache=0&sync_timestamp=1630746008183&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fparser%2Fdownload%2F%40babel%2Fparser-7.15.5.tgz",
"integrity": "sha1-0zpYymn6zAWyat/kq+v+1WwcLaw=",
"peer": true
},
"@babel/types": {
"version": "7.15.4",
"resolved": "https://registry.nlark.com/@babel/types/download/@babel/types-7.15.4.tgz?cache=0&sync_timestamp=1630618915456&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Ftypes%2Fdownload%2F%40babel%2Ftypes-7.15.4.tgz",
"integrity": "sha1-dO64bb1nSNJ0E5ZVe5hg5X/OCg0=",
"peer": true,
"requires": {
"@babel/helper-validator-identifier": "^7.14.9",
"to-fast-properties": "^2.0.0"
}
},
"@element-plus/icons": {
"version": "0.0.11",
"resolved": "https://registry.nlark.com/@element-plus/icons/download/@element-plus/icons-0.0.11.tgz",
"integrity": "sha1-mxh8ACd0VIuRGFDRf6X8L5pRX1c="
},
"@popperjs/core": {
"version": "2.10.1",
"resolved": "https://registry.nlark.com/@popperjs/core/download/@popperjs/core-2.10.1.tgz?cache=0&sync_timestamp=1630646750615&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40popperjs%2Fcore%2Fdownload%2F%40popperjs%2Fcore-2.10.1.tgz",
"integrity": "sha1-co7NlasgequKmk5CHwQi2zKSMr4="
},
"@vue/compiler-core": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/compiler-core/download/@vue/compiler-core-3.2.8.tgz",
"integrity": "sha1-E7I4a9sDRVyfbGry80aFYaWuWx0=",
"peer": true,
"requires": {
"@babel/parser": "^7.15.0",
"@babel/types": "^7.15.0",
"@vue/shared": "3.2.8",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"@vue/compiler-dom": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/compiler-dom/download/@vue/compiler-dom-3.2.8.tgz",
"integrity": "sha1-abyeCJKKEilcMSmQZ/GNhzAZgak=",
"peer": true,
"requires": {
"@vue/compiler-core": "3.2.8",
"@vue/shared": "3.2.8"
}
},
"@vue/reactivity": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/reactivity/download/@vue/reactivity-3.2.8.tgz",
"integrity": "sha1-snIAzPqgbzEqxGexKjgWE3fFV+0=",
"peer": true,
"requires": {
"@vue/shared": "3.2.8"
}
},
"@vue/runtime-core": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/runtime-core/download/@vue/runtime-core-3.2.8.tgz",
"integrity": "sha1-iiNCwLqg/uGS+BmjvcGVR9dDC4g=",
"peer": true,
"requires": {
"@vue/reactivity": "3.2.8",
"@vue/shared": "3.2.8"
}
},
"@vue/runtime-dom": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/runtime-dom/download/@vue/runtime-dom-3.2.8.tgz",
"integrity": "sha1-xmMbUHBJ05hEsENOgd8ap578xss=",
"peer": true,
"requires": {
"@vue/runtime-core": "3.2.8",
"@vue/shared": "3.2.8",
"csstype": "^2.6.8"
}
},
"@vue/shared": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/@vue/shared/download/@vue/shared-3.2.8.tgz",
"integrity": "sha1-L5GOMwrrP1arEDHKYKWzBnJRJFc=",
"peer": true
},
"async-validator": {
"version": "3.5.2",
"resolved": "https://registry.nlark.com/async-validator/download/async-validator-3.5.2.tgz?cache=0&sync_timestamp=1630393256517&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fasync-validator%2Fdownload%2Fasync-validator-3.5.2.tgz",
"integrity": "sha1-aOhmqWgk6LJpT/eoMcGiXETV5QA="
},
"csstype": {
"version": "2.6.17",
"resolved": "https://registry.nlark.com/csstype/download/csstype-2.6.17.tgz",
"integrity": "sha1-TPMOuH4dGgBdi2UQ+VKSQT9qHA4=",
"peer": true
},
"dayjs": {
"version": "1.10.6",
"resolved": "https://registry.nlark.com/dayjs/download/dayjs-1.10.6.tgz?cache=0&sync_timestamp=1625557417200&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdayjs%2Fdownload%2Fdayjs-1.10.6.tgz",
"integrity": "sha1-KIsqqC8thBimydTfWJjAc3rQKmM="
},
"element-plus": {
"version": "1.1.0-beta.8",
"resolved": "https://registry.nlark.com/element-plus/download/element-plus-1.1.0-beta.8.tgz?cache=0&sync_timestamp=1630404987049&other_urls=https%3A%2F%2Fregistry.nlark.com%2Felement-plus%2Fdownload%2Felement-plus-1.1.0-beta.8.tgz",
"integrity": "sha1-5AorR2fMvuH/mqbU7ShIY60kbhw=",
"requires": {
"@element-plus/icons": "^0.0.11",
"@popperjs/core": "^2.4.4",
"async-validator": "^3.4.0",
"dayjs": "1.x",
"lodash": "^4.17.20",
"mitt": "^2.1.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.1"
}
},
"estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/estree-walker/download/estree-walker-2.0.2.tgz?cache=0&sync_timestamp=1611956983677&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Festree-walker%2Fdownload%2Festree-walker-2.0.2.tgz",
"integrity": "sha1-UvAQF4wqTBF6d1fP6UKtt9LaTKw=",
"peer": true
},
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.nlark.com/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1624543041613&other_urls=https%3A%2F%2Fregistry.nlark.com%2Flodash%2Fdownload%2Flodash-4.17.21.tgz",
"integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw="
},
"mitt": {
"version": "2.1.0",
"resolved": "https://registry.nlark.com/mitt/download/mitt-2.1.0.tgz?cache=0&sync_timestamp=1624483449786&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fmitt%2Fdownload%2Fmitt-2.1.0.tgz",
"integrity": "sha1-90BXfCMXbGIFsSGylzUU6t4bIjA="
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha1-DpAg3T0hAkRY1OvSfiPkAmmBBGQ="
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz",
"integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
"peer": true
},
"to-fast-properties": {
"version": "2.0.0",
"resolved": "https://registry.nlark.com/to-fast-properties/download/to-fast-properties-2.0.0.tgz?cache=0&sync_timestamp=1628418855671&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fto-fast-properties%2Fdownload%2Fto-fast-properties-2.0.0.tgz",
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
"peer": true
},
"vue": {
"version": "3.2.8",
"resolved": "https://registry.nlark.com/vue/download/vue-3.2.8.tgz?cache=0&sync_timestamp=1630608473072&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue%2Fdownload%2Fvue-3.2.8.tgz",
"integrity": "sha1-kSTkwx68nFkrK58pPfXJqIp46UQ=",
"peer": true,
"requires": {
"@vue/compiler-dom": "3.2.8",
"@vue/runtime-dom": "3.2.8",
"@vue/shared": "3.2.8"
}
}
}
}

22
package.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "dsite",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/looching/dsite.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/looching/dsite/issues"
},
"homepage": "https://github.com/looching/dsite#readme",
"dependencies": {
"element-plus": "^1.1.0-beta.8"
}
}

View File

@ -14,13 +14,12 @@ from rest_framework.views import APIView
import recipe.models import recipe.models
import recipe.serializers import recipe.serializers
class RecipeAPI(rest_framework.generics.RetrieveUpdateAPIView, class RecipeAPI(rest_framework.generics.RetrieveUpdateAPIView):
rest_framework.generics.ListAPIView):
authentication_classes = (authentication.TokenAuthentication, # authentication_classes = (authentication.TokenAuthentication,
authentication.SessionAuthentication, # authentication.SessionAuthentication,
authentication.BasicAuthentication) # authentication.BasicAuthentication)
permission_classes = (permissions.IsAuthenticated,) # permission_classes = (permissions.IsAuthenticated,)
queryset = recipe.models.Recipe.objects.all() queryset = recipe.models.Recipe.objects.all()
serializer_class = recipe.serializers.RecipeSerializer serializer_class = recipe.serializers.RecipeSerializer
@ -28,10 +27,10 @@ class RecipeAPI(rest_framework.generics.RetrieveUpdateAPIView,
class RecipeListAPI(rest_framework.generics.ListAPIView, class RecipeListAPI(rest_framework.generics.ListAPIView,
rest_framework.generics.CreateAPIView): rest_framework.generics.CreateAPIView):
authentication_classes = (authentication.TokenAuthentication, # authentication_classes = (authentication.TokenAuthentication,
authentication.SessionAuthentication, # authentication.SessionAuthentication,
authentication.BasicAuthentication) # authentication.BasicAuthentication)
permission_classes = (permissions.IsAuthenticated,) # permission_classes = (permissions.IsAuthenticated,)
queryset = recipe.models.Recipe.objects.all() queryset = recipe.models.Recipe.objects.all()
serializer_class = recipe.serializers.RecipeSerializer serializer_class = recipe.serializers.RecipeSerializer

57
yarn.lock Normal file
View File

@ -0,0 +1,57 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@element-plus/icons@^0.0.11":
version "0.0.11"
resolved "https://registry.nlark.com/@element-plus/icons/download/@element-plus/icons-0.0.11.tgz#9b187c002774548b911850d17fa5fc2f9a515f57"
integrity sha1-mxh8ACd0VIuRGFDRf6X8L5pRX1c=
"@popperjs/core@^2.4.4":
version "2.10.1"
resolved "https://registry.nlark.com/@popperjs/core/download/@popperjs/core-2.10.1.tgz#728ecd95ab207aab8a9a4e421f0422db329232be"
integrity sha1-co7NlasgequKmk5CHwQi2zKSMr4=
async-validator@^3.4.0:
version "3.5.2"
resolved "https://registry.nlark.com/async-validator/download/async-validator-3.5.2.tgz?cache=0&sync_timestamp=1630393256517&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fasync-validator%2Fdownload%2Fasync-validator-3.5.2.tgz#68e866a96824e8b2694ff7a831c1a25c44d5e500"
integrity sha1-aOhmqWgk6LJpT/eoMcGiXETV5QA=
dayjs@1.x:
version "1.10.6"
resolved "https://registry.nlark.com/dayjs/download/dayjs-1.10.6.tgz?cache=0&sync_timestamp=1625557417200&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdayjs%2Fdownload%2Fdayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63"
integrity sha1-KIsqqC8thBimydTfWJjAc3rQKmM=
element-plus@^1.1.0-beta.8:
version "1.1.0-beta.8"
resolved "https://registry.nlark.com/element-plus/download/element-plus-1.1.0-beta.8.tgz?cache=0&sync_timestamp=1630404987049&other_urls=https%3A%2F%2Fregistry.nlark.com%2Felement-plus%2Fdownload%2Felement-plus-1.1.0-beta.8.tgz#e40a2b4767ccbee1ff9aa6d4ed284863ad246e1c"
integrity sha1-5AorR2fMvuH/mqbU7ShIY60kbhw=
dependencies:
"@element-plus/icons" "^0.0.11"
"@popperjs/core" "^2.4.4"
async-validator "^3.4.0"
dayjs "1.x"
lodash "^4.17.20"
mitt "^2.1.0"
normalize-wheel "^1.0.1"
resize-observer-polyfill "^1.5.1"
lodash@^4.17.20:
version "4.17.21"
resolved "https://registry.nlark.com/lodash/download/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=
mitt@^2.1.0:
version "2.1.0"
resolved "https://registry.nlark.com/mitt/download/mitt-2.1.0.tgz?cache=0&sync_timestamp=1624483449786&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fmitt%2Fdownload%2Fmitt-2.1.0.tgz#f740577c23176c6205b121b2973514eade1b2230"
integrity sha1-90BXfCMXbGIFsSGylzUU6t4bIjA=
normalize-wheel@^1.0.1:
version "1.0.1"
resolved "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz#aec886affdb045070d856447df62ecf86146ec45"
integrity sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU=
resize-observer-polyfill@^1.5.1:
version "1.5.1"
resolved "https://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
integrity sha1-DpAg3T0hAkRY1OvSfiPkAmmBBGQ=