Skip to content

Commit

Permalink
修正 1.0.1 所有问题
Browse files Browse the repository at this point in the history
  • Loading branch information
fy0 committed Sep 7, 2017
1 parent 066236c commit ce7c346
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 23 deletions.
5 changes: 2 additions & 3 deletions page/src/components/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-if="page_info.items">
<div>
<div class="topic-item" v-for="item in page_info.items" :key="item.id">
<h3 class="title">
<router-link :to="{ path: '/t/' + item.id }">{{item.title}}</router-link>
Expand All @@ -9,7 +9,7 @@
<p class="info">由 {{item.user.name}} 发表于 {{time_to_text(item.time)}}</p>
<div class="divider-line"></div>
</div>
<ul class="ic-pages">
<ul class="ic-pages" v-if="page_info.last_page == page_info.first_page">
<li v-if="page_info.first_page">
<router-link :to="{ path: `/p/${page_info.first_page}` }" class="slim">«</router-link>
</li>
Expand All @@ -33,7 +33,6 @@
</li>
</ul>
</div>
<loading v-else></loading>
</template>

<style>
Expand Down
12 changes: 7 additions & 5 deletions page/src/components/manage/topic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
</div>
</el-card>

<span v-if="data_lst && data_lst.prev_page">
<a href="javascript:void(0)" @click="loadData(data_lst.prev_page)">上一页</a>
</span>
<span v-if="data_lst && data_lst.next_page">
<a href="javascript:void(0)" @click="loadData(data_lst.next_page)">下一页</a>
<span v-if="data_lst.last_page == data_lst.first_page">
<span v-if="data_lst && data_lst.prev_page">
<a href="javascript:void(0)" @click="loadData(data_lst.prev_page)">上一页</a>
</span>
<span v-if="data_lst && data_lst.next_page">
<a href="javascript:void(0)" @click="loadData(data_lst.next_page)">下一页</a>
</span>
</span>
</div>
</template>
Expand Down
18 changes: 10 additions & 8 deletions page/src/components/timeline.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="tmp" v-if="info">
<div class="tmp">
<div class="pure-g" v-for="key in info.key_order" :key="key">
<div class="pure-u-2-24 timeline-tag">
<span>{{key}}</span>
Expand All @@ -17,14 +17,16 @@
</div>
</div>
</div>
<span v-if="info.data && info.data.prev_page">
<router-link :to="{ path: `/timeline/${info.data.prev_page}` }">上一页</router-link>
</span>
<span v-if="info.data && info.data.next_page">
<router-link :to="{ path: `/timeline/${info.data.next_page}` }">下一页</router-link>
</span>

<div class="ic-pages" v-if="info.data.last_page == info.data.first_page">
<span v-if="info.data && info.data.prev_page">
<router-link :to="{ path: `/timeline/${info.data.prev_page}` }">上一页</router-link>
</span>
<span v-if="info.data && info.data.next_page">
<router-link :to="{ path: `/timeline/${info.data.next_page}` }">下一页</router-link>
</span>
</div>
</div>
<loading v-else></loading>
</template>

<style>
Expand Down
15 changes: 12 additions & 3 deletions page/src/components/user/signin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<el-form-item label="" prop="remember">
<el-checkbox v-model="form.remember">30天内记住登录</el-checkbox>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">提交</el-button>
<el-button @click="resetForm('form')">重置</el-button>
<el-form-item >
<el-button :disabled="loading" type="primary" @click="submitForm('form')">提交</el-button>
<el-button :disabled="loading" @click="resetForm('form')">重置</el-button>
</el-form-item>
</el-form>
</div>
Expand All @@ -27,11 +27,13 @@
import Vue from 'vue'
import api from "../../netapi.js"
import state from "../../state.js"
import nprogress from 'nprogress/nprogress.js'
export default {
data () {
return {
state: state,
loading: false,
form: {
username: '',
password: '',
Expand Down Expand Up @@ -61,9 +63,15 @@ export default {
resetForm (formName) {
this.$refs[formName].resetFields();
},
setLoading (val) {
this.loading = val;
if (val) nprogress.start();
else nprogress.done();
},
submitForm (formName) {
this.$refs[formName].validate(async (valid) => {
if (valid) {
this.setLoading(true);
let ret = await api.userSignin(this.form.username, this.form.password, this.form.remember);
if (ret.code == 0) {
ret = await api.userInfo();
Expand All @@ -79,6 +87,7 @@ export default {
$.message_error(i);
}
}
this.setLoading(false);
} else {
return false;
}
Expand Down
13 changes: 11 additions & 2 deletions page/src/components/user/signup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<el-input type="password" v-model="form.password_again" auto-complete="off"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">提交</el-button>
<el-button @click="resetForm('form')">重置</el-button>
<el-button :disabled="loading" type="primary" @click="submitForm('form')">提交</el-button>
<el-button :disabled="loading" @click="resetForm('form')">重置</el-button>
</el-form-item>
</el-form>
</div>
Expand All @@ -23,6 +23,7 @@
import Vue from 'vue'
import api from "../../netapi.js"
import state from "../../state.js"
import nprogress from 'nprogress/nprogress.js'
export default {
data () {
Expand All @@ -32,6 +33,7 @@ export default {
password: '',
password_again: '',
},
loading: false,
form_rules: {
username: [
{ required: true, message: '必须输入账号', trigger: 'blur' },
Expand Down Expand Up @@ -70,9 +72,15 @@ export default {
resetForm (formName) {
this.$refs[formName].resetFields();
},
setLoading (val) {
this.loading = val;
if (val) nprogress.start();
else nprogress.done();
},
submitForm (formName) {
this.$refs[formName].validate(async (valid) => {
if (valid) {
this.setLoading(true);
let ret = await api.userSignup(this.form.username, this.form.password);
if (ret.code == 0) {
ret = await api.userInfo();
Expand All @@ -89,6 +97,7 @@ export default {
$.message_error(i);
}
}
this.setLoading(false);
} else {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion page/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '',
publicPath: '/',
filename: 'build.js'
},
resolveLoader: {
Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## 版本历史

### ver 1.0.1 wip
### ver 1.0.1 update 2017.09.07

* 修正了构建脚本 build-pro.sh

Expand All @@ -17,6 +17,8 @@

* 修正了等待登陆时加载效果不明显,同时几个按钮仍然可点的问题

* 修正资源引用路径在当前相对路径下的问题

* 破坏性改动:无

### ver 1.0.0 update 2017.09.06
Expand Down

0 comments on commit ce7c346

Please sign in to comment.