This commit is contained in:
theluyuan 2021-07-13 10:11:41 +08:00
parent c24ddc0aba
commit fb21b1dd54
7 changed files with 218 additions and 22 deletions

81
package-lock.json generated
View File

@ -2314,6 +2314,14 @@
"integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=",
"dev": true
},
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.nlark.com/async-validator/download/async-validator-1.8.5.tgz?cache=0&sync_timestamp=1619755921381&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fasync-validator%2Fdownload%2Fasync-validator-1.8.5.tgz",
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
"requires": {
"babel-runtime": "6.x"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.nlark.com/asynckit/download/asynckit-0.4.0.tgz",
@ -2353,6 +2361,14 @@
"integrity": "sha1-1h9G2DslGSUOJ4Ta9bCUeai0HFk=",
"dev": true
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npm.taobao.org/axios/download/axios-0.21.1.tgz",
"integrity": "sha1-IlY0gZYvTWvemnbVFu8OXTwJsrg=",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"babel-eslint": {
"version": "10.1.0",
"resolved": "https://registry.npm.taobao.org/babel-eslint/download/babel-eslint-10.1.0.tgz",
@ -2367,6 +2383,11 @@
"resolve": "^1.12.0"
}
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY="
},
"babel-loader": {
"version": "8.2.2",
"resolved": "https://registry.npm.taobao.org/babel-loader/download/babel-loader-8.2.2.tgz?cache=0&sync_timestamp=1606424647115&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-loader%2Fdownload%2Fbabel-loader-8.2.2.tgz",
@ -2418,6 +2439,27 @@
"@babel/helper-define-polyfill-provider": "^0.2.2"
}
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.nlark.com/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.nlark.com/core-js/download/core-js-2.6.12.tgz?cache=0&sync_timestamp=1624966056491&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcore-js%2Fdownload%2Fcore-js-2.6.12.tgz",
"integrity": "sha1-2TM9+nsGXjR8xWgiGdb2kIWcwuw="
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.11.1.tgz",
"integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk="
}
}
},
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.2.tgz?cache=0&sync_timestamp=1617714298273&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbalanced-match%2Fdownload%2Fbalanced-match-1.0.2.tgz",
@ -4063,8 +4105,7 @@
"deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz",
"integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M=",
"dev": true
"integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M="
},
"default-gateway": {
"version": "5.0.5",
@ -4513,6 +4554,19 @@
"integrity": "sha1-/R7Tn58xSfYvWBc05PAm5gA2lHk=",
"dev": true
},
"element-ui": {
"version": "2.15.3",
"resolved": "https://registry.nlark.com/element-ui/download/element-ui-2.15.3.tgz",
"integrity": "sha1-VRCKuCo7zGRuewVwhxxIupYwBlI=",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"elliptic": {
"version": "6.5.4",
"resolved": "https://registry.nlark.com/elliptic/download/elliptic-6.5.4.tgz",
@ -5403,8 +5457,7 @@
"follow-redirects": {
"version": "1.14.1",
"resolved": "https://registry.nlark.com/follow-redirects/download/follow-redirects-1.14.1.tgz?cache=0&sync_timestamp=1620555234886&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.14.1.tgz",
"integrity": "sha1-2RFN7Qoc/dM04WTmZirQK/2R/0M=",
"dev": true
"integrity": "sha1-2RFN7Qoc/dM04WTmZirQK/2R/0M="
},
"for-in": {
"version": "1.0.2",
@ -7561,6 +7614,11 @@
"integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=",
"dev": true
},
"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="
},
"npm-run-path": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz",
@ -9223,6 +9281,11 @@
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.nlark.com/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz?cache=0&sync_timestamp=1618847256390&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fresize-observer-polyfill%2Fdownload%2Fresize-observer-polyfill-1.5.1.tgz",
"integrity": "sha1-DpAg3T0hAkRY1OvSfiPkAmmBBGQ="
},
"resolve": {
"version": "1.20.0",
"resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.20.0.tgz?cache=0&sync_timestamp=1613054862388&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.20.0.tgz",
@ -10413,6 +10476,11 @@
"neo-async": "^2.6.0"
}
},
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.nlark.com/throttle-debounce/download/throttle-debounce-1.1.0.tgz",
"integrity": "sha1-UYU9o3vmihVctugns1FKPEIuic0="
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npm.taobao.org/through/download/through-2.3.8.tgz",
@ -11079,6 +11147,11 @@
}
}
},
"vue-router": {
"version": "3.5.2",
"resolved": "https://registry.nlark.com/vue-router/download/vue-router-3.5.2.tgz",
"integrity": "sha1-X1Xj8lGXDjbD6NiKfNLWejUK3lw="
},
"vue-style-loader": {
"version": "4.1.3",
"resolved": "https://registry.npm.taobao.org/vue-style-loader/download/vue-style-loader-4.1.3.tgz",

View File

@ -8,8 +8,11 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5",
"vue": "^2.6.11"
"element-ui": "^2.15.3",
"vue": "^2.6.11",
"vue-router": "^3.5.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",

BIN
shopmanage.zip Normal file

Binary file not shown.

View File

@ -1,28 +1,20 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<div>
<!-- <index></index>
<login></login> -->
<router-view></router-view>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
name: "App",
components:{
HelloWorld
}
}
};
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

View File

@ -1,8 +1,27 @@
import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from "axios"
import Router from "vue-router"
Vue.use(Router)
Vue.config.productionTip = false
Vue.prototype.axios = axios
Vue.use(ElementUI);
const router = new Router({
mode:"history",
routes:[{
path:"/login",
component: () => import("./views/login.vue")
},{
path:"/index",
component: () => import("./views/index.vue")
}]
})
new Vue({
render: h => h(App),
router:router
}).$mount('#app')

31
src/views/index.vue Normal file
View File

@ -0,0 +1,31 @@
<template>
<div>
<el-table :data="list" style="width: 100%">
<el-table-column prop="name" label="名字" width="180"> </el-table-column>
<el-table-column prop="des" label="注释" width="180"> </el-table-column>
<el-table-column prop="number" label="数量"> </el-table-column>
</el-table>
</div>
</template>
<style scoped>
</style>
<script>
export default {
data(){
return {
list:[]
}
},
mounted(){
// alert("")
// .post arg 1 url 2 data 3
this.axios.post('https://tomcat.theluyuan.com/vegetables/product/selectall',{},{
headers:{
token: localStorage.getItem("token")
}
}).then((res)=>{
this.list = res.data.data
})
}
};
</script>

78
src/views/login.vue Normal file
View File

@ -0,0 +1,78 @@
<template>
<div class="box">
<div class="login">
<el-form :model="user" label-position="left">
<el-form-item label="手机号">
<el-input v-model="user.phone" placeholder="请输入手机号"></el-input>
</el-form-item>
<el-form-item label="密码">
<el-input v-model="user.password" placeholder="请输入密码"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="login">查询</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<style scoped>
.el-form-item {
display: flex;
}
.box {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.login {
width: 300px;
height: 200px;
box-shadow: 3px 3px 10px #ccc;
border-radius: 5px;
/* margin: auto; */
}
</style>
<script>
export default {
data() {
return {
user: {
phone: "18235782827",
password: "123",
},
};
},
methods: {
login() {
this.axios({
url: "https://tomcat.theluyuan.com/vegetables/user/login",
method: "POST",
data: {
phone: this.user.phone,
password: this.user.password,
},
}).then((res) => {
console.log(res);
if (res.data.code == 4000) {
this.$message.error(res.data.message);
} else if (res.data.code == 2000) {
this.$message({
message: res.data.message,
type: "success",
});
localStorage.setItem("token",res.data.data.token)
this.$router.push("/index")
} else {
this.$message({
message: "未知错误",
type: "warning",
});
}
});
},
},
};
</script>