Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
feat(认证): 现在投稿前需要进行验证投稿权限才可继续操作
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jul 12, 2018
1 parent 123596f commit 21ad733
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/components/common/svgIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,26 @@
<path d="M9.8,5.9C9.9,5.9,9.9,5.9,9.8,5.9l0,2.7c0,0,0,0,0,0H7.1c0,0,0,0,0,0V5.9c0,0,0,0,0,0H9.8 M9.8,5H7.1c-0.5,0-1,0.4-1,1 v2.7c0,0.5,0.4,1,1,1h2.7c0.5,0,1-0.4,1-1V5.9C10.8,5.4,10.4,5,9.8,5L9.8,5z"/>
</symbol>
<symbol
id="post-news"
viewBox="0 0 24 24"
fill="#333">
<path d="M15.5,7.9l0.4-1.6L17.6,8L16,8.4c-0.1,0-0.3,0-0.4-0.1C15.5,8.2,15.5,8,15.5,7.9L15.5,7.9z"/>
<path
d="M20.7,1.5l0.8-0.8c0.2-0.2,0.4-0.2,0.6,0l1.1,1.1c0.1,0.1,0.1,0.2,0.1,0.3c0,0.1,0,0.2-0.1,0.3l-0.8,0.8
L20.7,1.5L20.7,1.5L20.7,1.5z"/>
<polygon points="22.1,3.5 17.9,7.7 16.2,6 20.4,1.8 22.1,3.5 "/>
<path
d="M5.4,11.5h13.1c0.3,0,0.6,0.3,0.6,0.6c0,0.3-0.3,0.6-0.6,0.6H5.4c-0.3,0-0.6-0.3-0.6-0.6
C4.8,11.8,5,11.5,5.4,11.5L5.4,11.5z"/>
<path
d="M5.4,16.2h8.3c0.3,0,0.6,0.3,0.6,0.6c0,0.3-0.3,0.6-0.6,0.6H5.4c-0.3,0-0.6-0.3-0.6-0.6
C4.8,16.5,5,16.2,5.4,16.2L5.4,16.2z"/>
<path
d="M21.9,6.4c-0.3,0-0.6,0.3-0.6,0.6v13.8c0,0.3-0.3,0.6-0.6,0.6H3.1c-0.3,0-0.6-0.3-0.6-0.6V3.2
c0-0.3,0.3-0.6,0.6-0.6h13.8c0.3,0,0.6-0.3,0.6-0.6v0c0-0.3-0.3-0.6-0.6-0.6H3.1c-1,0-1.8,0.8-1.8,1.8v17.6c0,1,0.8,1.8,1.8,1.8
h17.6c1,0,1.8-0.8,1.8-1.8V7C22.5,6.6,22.2,6.4,21.9,6.4z"/>
</symbol>
<symbol
id="discover-group"
viewBox="0 0 24 24"
fill="#333">
Expand Down
45 changes: 45 additions & 0 deletions src/page/news/NewsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="#base-search"/>
</router-link>
<svg
class="m-style-svg m-svg-def"
@click="beforeCreatePost">
<use
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="#post-news"/>
</svg>
</div>
</header>

Expand All @@ -44,6 +51,8 @@
</template>

<script>
import bus from "@/bus";
import _ from "lodash";
import NewsItem from "./components/NewsItem.vue";
import NewsFilter from "./components/NewsFilter.vue";
Expand Down Expand Up @@ -100,6 +109,42 @@ export default {
this.list = [...this.list, ...data];
this.$refs.loadmore.bottomEnd(data.length < 10);
});
},
/**
* 投稿前进行认证确认
*/
beforeCreatePost() {
// 如果后台设置了不需要验证 或 用户已经认证就直接跳转
const noNeedVerify =
!this.$store.state.CONFIG["news:contribute"].verified ||
!_.isEmpty(this.$store.state.CURRENTUSER.verified);
if (noNeedVerify) return this.$router.push({ path: "/post/release" });
else {
const actions = [
{
text: "个人认证",
method: () =>
this.$router.push({
path: "/profile/certificate",
query: { type: "user" }
})
},
{
text: "企业认证",
method: () =>
this.$router.push({
path: "/profile/certificate",
query: { type: "org" }
})
}
];
bus.$emit(
"actionSheet",
actions,
"取消",
"认证用户才能创建投稿,去认证?"
);
}
}
}
};
Expand Down

0 comments on commit 21ad733

Please sign in to comment.