Skip to content

Commit

Permalink
代码格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
gzydong committed Apr 8, 2021
1 parent cdeeff1 commit 413c73c
Show file tree
Hide file tree
Showing 55 changed files with 1,754 additions and 1,845 deletions.
2 changes: 1 addition & 1 deletion src/api/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const ServeDownloadAnnex = (annex_id) => {
let api = config.BASE_API_URL;
try {
let link = document.createElement('a');
link.href = `${api}/api/v1/download/article-annex?annex_id=${annex_id}&token=${getToken()}`
link.href = `${api}/api/v1/download/article-annex?annex_id=${annex_id}&token=${getToken()}`;
link.click();
} catch (e) {}
}
Expand Down
157 changes: 79 additions & 78 deletions src/components/chat/TalkCodeBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
</el-header>

<el-main class="main no-padding">
<prism-editor
<PrismEditor
class="peditor"
:code="code"
:language="language"
:line-numbers="true"
@change="codeChanged"
style="border-radius: 0"
></prism-editor>
></PrismEditor>
</el-main>

<el-footer class="footer no-padding" height="50px">
Expand All @@ -56,8 +56,9 @@

<div class="buttom-group">
<el-button size="small" @click="close" plain>{{
editMode ? "取消编辑" : "关闭预览"
editMode ? '取消编辑' : '关闭预览'
}}</el-button>

<el-button
type="primary"
size="small"
Expand All @@ -72,27 +73,27 @@
</div>
</template>
<script>
import PrismEditor from "vue-prism-editor";
import "vue-prism-editor/dist/VuePrismEditor.css";
import "prismjs/themes/prism-okaidia.css";
import Vue from "vue";
import { Select, Option } from "element-ui";
Vue.use(Select);
Vue.use(Option);
import PrismEditor from 'vue-prism-editor'
import 'vue-prism-editor/dist/VuePrismEditor.css'
import 'prismjs/themes/prism-okaidia.css'
import Vue from 'vue'
import { Select, Option } from 'element-ui'
Vue.use(Select)
Vue.use(Option)
export default {
name: "TalkCodeBlock",
name: 'TalkCodeBlock',
components: {
PrismEditor,
},
props: {
loadCode: {
type: String,
default: "",
default: '',
},
loadLang: {
type: String,
default: "",
default: '',
},
editMode: {
type: Boolean,
Expand All @@ -101,146 +102,146 @@ export default {
},
data() {
return {
language: "",
code: "",
language: '',
code: '',
options: [
{
value: "css",
label: "css",
value: 'css',
label: 'css',
},
{
value: "less",
label: "less",
value: 'less',
label: 'less',
},
{
value: "javascript",
label: "javascript",
value: 'javascript',
label: 'javascript',
},
{
value: "json",
label: "json",
value: 'json',
label: 'json',
},
{
value: "bash",
label: "bash",
value: 'bash',
label: 'bash',
},
{
value: "c",
label: "c",
value: 'c',
label: 'c',
},
{
value: "cil",
label: "cil",
value: 'cil',
label: 'cil',
},
{
value: "docker",
label: "docker",
value: 'docker',
label: 'docker',
},
{
value: "git",
label: "git",
value: 'git',
label: 'git',
},
{
value: "go",
label: "go",
value: 'go',
label: 'go',
},
{
value: "java",
label: "java",
value: 'java',
label: 'java',
},
{
value: "lua",
label: "lua",
value: 'lua',
label: 'lua',
},
{
value: "nginx",
label: "nginx",
value: 'nginx',
label: 'nginx',
},
{
value: "objectivec",
label: "objectivec",
value: 'objectivec',
label: 'objectivec',
},
{
value: "php",
label: "php",
value: 'php',
label: 'php',
},
{
value: "python",
label: "python",
value: 'python',
label: 'python',
},
{
value: "ruby",
label: "ruby",
value: 'ruby',
label: 'ruby',
},
{
value: "rust",
label: "rust",
value: 'rust',
label: 'rust',
},
{
value: "sql",
label: "sql",
value: 'sql',
label: 'sql',
},
{
value: "swift",
label: "swift",
value: 'swift',
label: 'swift',
},
{
value: "vim",
label: "vim",
value: 'vim',
label: 'vim',
},
{
value: "visual-basic",
label: "visual-basic",
value: 'visual-basic',
label: 'visual-basic',
},
{
value: "shell",
label: "shell",
value: 'shell',
label: 'shell',
},
],
isFullScreen: false,
};
}
},
watch: {
loadCode(value) {
this.code = value;
this.code = value
},
loadLang(value) {
this.language = value;
this.language = value
},
},
created() {
this.code = this.loadCode;
this.language = this.loadLang;
this.code = this.loadCode
this.language = this.loadLang
},
methods: {
submit() {
if (!this.code) {
alert("代码块不能为空...");
return false;
alert('代码块不能为空...')
return false
}
if (this.language == "") {
alert("请选择语言类型...");
return false;
if (this.language == '') {
alert('请选择语言类型...')
return false
}
if (this.code.length > 10000) {
alert("代码字数不能超过10000字!!!");
return false;
alert('代码字数不能超过10000字!!!')
return false
}
this.$emit("confirm", {
this.$emit('confirm', {
language: this.language,
code: this.code,
});
})
},
close() {
this.$emit("close");
this.$emit('close')
},
codeChanged(code) {
this.code = code;
this.code = code
},
},
};
}
</script>
<style lang="less" scoped>
.container {
Expand Down
39 changes: 18 additions & 21 deletions src/components/chat/TalkForwardRecord.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
</el-header>
<el-main class="no-padding main" v-loading="loading">
<el-scrollbar :native="false" tag="section" class="full-height">
<div
class="message-group"
v-for="record in records"
:key="record.id"
>
<div class="message-group" v-for="record in records" :key="record.id">
<div class="left-box">
<el-avatar
shape="square"
Expand Down Expand Up @@ -82,10 +78,10 @@
</div>
</template>
<script>
import { ServeGetForwardRecords } from "@/api/chat";
import { ServeGetForwardRecords } from '@/api/chat'
export default {
name: "TalkForwardRecord",
name: 'TalkForwardRecord',
data() {
return {
// 记录列表
Expand All @@ -96,47 +92,48 @@ export default {
// 窗口是否显示
isShow: false,
};
}
},
methods: {
// 加载数据列表
loadRecords() {
this.loading = true;
this.loading = true
ServeGetForwardRecords({
records_id: this.records_id,
})
.then((res) => {
.then(res => {
if (res.code == 200) {
this.records = res.data.rows;
this.records = res.data.rows
}
})
.finally(() => {
this.loading = false;
});
this.loading = false
})
},
// 显示窗口
open(records_id) {
if (records_id != this.records_id) {
this.records = [];
this.records = []
}
this.records_id = records_id;
this.isShow = true;
this.loadRecords();
this.records_id = records_id
this.isShow = true
this.loadRecords()
},
// 关闭窗口
close() {
this.isShow = false;
this.isShow = false
},
},
};
}
</script>
<style lang="less" scoped>
.lum-dialog-mask {
z-index: 99999;
}
.lum-dialog-box {
width: 500px;
max-width: 500px;
Expand All @@ -147,5 +144,5 @@ export default {
overflow-x: hidden;
}
@import "~@/assets/css/talk/talk-records.less";
</style>
@import '~@/assets/css/talk/talk-records.less';
</style>
Loading

0 comments on commit 413c73c

Please sign in to comment.