Skip to content

Commit

Permalink
Merge pull request #3 from PramSin/vue
Browse files Browse the repository at this point in the history
Vue
  • Loading branch information
PramSin authored Nov 4, 2021
2 parents 0973c39 + 3a32c86 commit 0d1e3df
Show file tree
Hide file tree
Showing 12 changed files with 411 additions and 346 deletions.
7 changes: 3 additions & 4 deletions app/Http/Controllers/SimulationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,16 @@ protected function getPackage(Request $request): array
{
try {
$ver = SimulationWithVersion::findOrFail($request->get('version'));
$url = Storage::temporaryUrl(
$ver->root_path,
now()->addMinutes(20)
$url = Storage::Url(
$ver->root_path
);

$this->r['code'] = 200;
$this->r['message'] = '获取版本链接成功';
$this->r['data'] = $url;
} catch (Exception $e) {
$this->r['code'] = 400;
$this->r['message'] = '获取版本链接失败';
$this->r['message'] = $e->getMessage();
}

return $this->r;
Expand Down
2 changes: 1 addition & 1 deletion construction.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"user_id",
"category_id", // belongTo->Category
"access",
"version", // hasOne->SWVersion
"version", // hasOne->SWVersion //visible
"versions", // hasMany->SWVersions
"likes",
"comments", // hasMany->Comments
Expand Down
53 changes: 50 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@
"tiptap-commands": "^1.15.0",
"tiptap-extensions": "^1.31.1",
"vue-analytics": "^5.22.1",
"vue-axios": "^3.3.7",
"vue-clipboard2": "^0.3.1",
"vue-router": "^3.3.4",
"vue-template-compiler": "^2.6.11",
"vue-axios": "^3.3.7",
"vuex": "^3.5.1"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/vue-fontawesome": "^0.1.10",
"moment": "^2.29.1",
"vue": "^2.6.11",
"vue-cookies": "^1.7.3",
"vue-dayjs": "^1.0.2"
Expand Down
93 changes: 50 additions & 43 deletions resources/js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
<router-link class="list-group-item" active-class="active" to="/about">About</router-link>
<router-link class="list-group-item" active-class="active" to="/home">Home</router-link>
<router-link class="list-group-item" active-class="active" to="/me">Me</router-link>
<router-link class="list-group-item" active-class="active" to="/login">Login</router-link>
</el-aside>

<el-container>
<el-header style="text-align: right; font-size: 20px">
<el-header style="text-align: right;">
<!-- <h2>实验中心(不是)</h2>-->
<el-dropdown @command='handleCommand'>
<i class="el-icon-setting" style="margin-right: 15px; font-size: 20px"></i>
<el-dropdown v-if="is_authorized" @command='handleCommand' style="margin-top: 20px">
<i class="el-icon-setting" style=" margin-right: 10px; font-size: 20px"></i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="to_homepage">查看</el-dropdown-item>
<el-dropdown-item command="change_password">修改密码</el-dropdown-item>
<el-dropdown-item command="exit">登出</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<span>{{ username }}</span>
<el-link :underline='false' @click="to_login" style="font-size: 20px;margin-top: 15px;vertical-align: top;">{{ username }}</el-link>
</el-header>
<el-main>
<router-view></router-view>
Expand All @@ -32,8 +31,27 @@
export default {
name: 'App',
data() {
return {
is_authorized: false
}
},
mounted() {
if (localStorage.getItem('is_authorized') === 'true') {
this.is_authorized = true
}
},
methods: {
to_login() {
if (localStorage.getItem('is_authorized') === 'true') {
this.$router.push({path: "/me"});
}
else {
this.$router.push({path: "/login"});
}
},
handleCommand(command) {
if (localStorage.getItem('is_authorized') === false) {
this.$router.push({path: "/login"})
Expand Down Expand Up @@ -62,8 +80,8 @@ export default {
});
} else {
localStorage.clear()
console.log('111111111')
this.$message('注销成功!');
location.reload()
this.$router.replace({path: '@/components/home'})
/*console.log('2222222222222222')*/
}
Expand All @@ -87,51 +105,40 @@ export default {
</script>

<style>
html,
body {
padding: 0px;
margin: 0px;
<style scoped>
.el-container {
padding: 0;
margin: 0;
height: 100%;
}
#App {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin: 10px;
height: 100%;
.fade-enter-active, .fade-leave-active {
transition: opacity .3s;
}
.el-header {
background-color: #B3C0D1;
color: #333;
line-height: 60px;
.fade-enter, .fade-leave-to {
opacity: 0;
}
</style>
<style lang="scss">
* {
&::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.el-aside {
color: #333;
}
&::-webkit-scrollbar-thumb {
border-radius: 8px;
background-color: hsla(225, 4%, 58%, 0.3);
transition: background-color 0.3s;
.el-container.is-vertical {
overflow: auto;
}
.background-wrapper {
overflow: hidden;
}
&:hover {
background: #bbb;
}
}
.background {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .8);
background-position: center;
background-size: cover;
background-repeat: no-repeat;
filter: blur(5px) brightness(50%);
transform: scale(1.1);
&::-webkit-scrollbar-track {
background: #ededed;
}
}
</style>
10 changes: 1 addition & 9 deletions resources/js/components/Changepsw.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@
export default {
name: "Changepsw",
data() {
let pswcheck= (rule, value, callback) => {
if (value === localStorage.getItem('userpsw')) {
callback()
}
else {
return callback(new Error('原密码错误!'))
}
}
return {
Expand All @@ -60,7 +52,7 @@ export default {
},
rules: {
password: [
{required: true, validator: pswcheck, message: '不能为空', trigger: 'blur'},
{required: true, message: '不能为空', trigger: 'blur'},
],
ori_password: [
{required: true, message: '密码不能为空', trigger: 'blur'},
Expand Down
17 changes: 15 additions & 2 deletions resources/js/components/Demo.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<iframe style="height:100vmin; width:100%;" :src="demosrc" ref="iframe"></iframe>
<iframe style="height:100vmin; width:100%;" :src="demo_src" ref="iframe"></iframe>
</div>
</template>

Expand All @@ -10,8 +10,21 @@ export default {
data(){
return {
demosrc: 'https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik',
demo_src: 'https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik',
}
},
mounted() {
console.log(this.$route.query)
let params = this.$route.query
this.axios
.get('/physlet_api/getPackage', {params})
.then(response => {
let data = response.data.data;
console.log(response.data)
this.demo_src = data
})
}
}
</script>
Expand Down
Loading

0 comments on commit 0d1e3df

Please sign in to comment.