|
@@ -18,8 +18,8 @@
|
|
}
|
|
}
|
|
|
|
|
|
.editClass button {
|
|
.editClass button {
|
|
- display: block;
|
|
|
|
- margin-top: 5px;
|
|
|
|
|
|
+ display: inline;
|
|
|
|
+ /*margin-top: 5px;*/
|
|
margin-left: 10px;
|
|
margin-left: 10px;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -71,6 +71,7 @@
|
|
padding: 10px;
|
|
padding: 10px;
|
|
z-index: 100;
|
|
z-index: 100;
|
|
}
|
|
}
|
|
|
|
+
|
|
</style>
|
|
</style>
|
|
<script src="js/vue.min.js"></script>
|
|
<script src="js/vue.min.js"></script>
|
|
<script src="elementUI/index.js"></script>
|
|
<script src="elementUI/index.js"></script>
|
|
@@ -114,16 +115,23 @@
|
|
|
|
|
|
<div v-for="item in contentList">
|
|
<div v-for="item in contentList">
|
|
<el-row style="margin: 10px; padding: 10px" class="border">
|
|
<el-row style="margin: 10px; padding: 10px" class="border">
|
|
- <el-col :span="16" class="contentLine">
|
|
|
|
- <div>
|
|
|
|
|
|
+ <el-col :span="12" class="contentLine">
|
|
|
|
+ <div style="display: flex">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
v-model="item.created_ts"
|
|
v-model="item.created_ts"
|
|
type="datetime"
|
|
type="datetime"
|
|
|
|
+ readonly="true"
|
|
placeholder="选择日期时间">
|
|
placeholder="选择日期时间">
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
|
|
+ <div style="margin-left: 20px">
|
|
|
|
+ <el-checkbox-button v-for="tag in commonTags" :label="tag" :key="item"
|
|
|
|
+ @change="checked=>checkChange(checked,item,tag)"
|
|
|
|
+ :checked="isChooseTag(item,tag)">{{tag}}
|
|
|
|
+ </el-checkbox-button>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- <div>
|
|
|
|
- <el-input v-model="item.content" type="textarea" :autosize="{minRows: 2}" disabled="true"></el-input>
|
|
|
|
|
|
+ <div class="myText" @dblclick="edit(item)">
|
|
|
|
+ <el-input v-model="item.content" type="textarea" :autosize="{minRows: 1}" readonly="true"></el-input>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<el-image v-for="img in resourceMap[item.id]"
|
|
<el-image v-for="img in resourceMap[item.id]"
|
|
@@ -134,22 +142,16 @@
|
|
</el-image>
|
|
</el-image>
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :span="4">
|
|
|
|
- <div class="editClass">
|
|
|
|
- <div v-for="cTag in commonTags">
|
|
|
|
- <el-tag style="margin-left: 10px">{{cTag}}</el-tag>
|
|
|
|
- <el-button style="display: inline;margin-left: 0" size="mini" @click="addTag(item,cTag)">新增</el-button>
|
|
|
|
- <el-button style="display: inline;margin-left: 0" size="mini" @click="delTag(item,cTag)">删除</el-button>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="4">
|
|
|
|
|
|
+ <el-col :span="4" style="display: flex">
|
|
<div class="editClass">
|
|
<div class="editClass">
|
|
<el-button size="small" @click="window.open('https://memos.tianyunperfect.cn/m/' + item.resource_name)">跳转</el-button>
|
|
<el-button size="small" @click="window.open('https://memos.tianyunperfect.cn/m/' + item.resource_name)">跳转</el-button>
|
|
|
|
+ <br>
|
|
<el-button size="small" @click="edit(item)">编辑</el-button>
|
|
<el-button size="small" @click="edit(item)">编辑</el-button>
|
|
-
|
|
|
|
|
|
+ </div>
|
|
|
|
+ <div class="editClass">
|
|
<el-button size="small" @click="archive(item)">归档</el-button>
|
|
<el-button size="small" @click="archive(item)">归档</el-button>
|
|
- <el-button size="small" @click="del(item)">删除</el-button>
|
|
|
|
|
|
+ <br>
|
|
|
|
+ <el-button size="small" type="warning" @click="del(item)">删除</el-button>
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -165,11 +167,12 @@
|
|
<el-date-picker
|
|
<el-date-picker
|
|
v-model="tmpItem.created_ts"
|
|
v-model="tmpItem.created_ts"
|
|
type="datetime"
|
|
type="datetime"
|
|
|
|
+ value-format="yyyy-MM-ddTHH:mm:ss"
|
|
placeholder="选择日期时间">
|
|
placeholder="选择日期时间">
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- <el-input v-model="tmpItem.content" type="textarea" :autosize="{minRows: 2}"></el-input>
|
|
|
|
|
|
+ <el-input ref="contentEdit" v-model="tmpItem.content" type="textarea" :autosize="{minRows: 2}"></el-input>
|
|
</div>
|
|
</div>
|
|
<div style="display: flex">
|
|
<div style="display: flex">
|
|
<div v-for="img in resourceMap[tmpItem.id]">
|
|
<div v-for="img in resourceMap[tmpItem.id]">
|
|
@@ -217,7 +220,7 @@
|
|
contentList: [],
|
|
contentList: [],
|
|
sendBtnAble: true,
|
|
sendBtnAble: true,
|
|
resourceMap: {}, // 资源map,
|
|
resourceMap: {}, // 资源map,
|
|
- commonTags: ['日记', '梦记', '美食', '备份',]
|
|
|
|
|
|
+ commonTags: ['todo', '日记', '梦记', '美食', '备份', '歌曲', '电影', '随笔'],
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
tagChecked: function () {
|
|
tagChecked: function () {
|
|
@@ -236,6 +239,22 @@
|
|
this.search();
|
|
this.search();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ msg(content) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: content,
|
|
|
|
+ type: 'success'
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ isChooseTag(item, tag) {
|
|
|
|
+ return item.content.indexOf("#" + tag + " ") !== -1;
|
|
|
|
+ },
|
|
|
|
+ checkChange(val, item, tag) {
|
|
|
|
+ if (val) {
|
|
|
|
+ this.addTag(item, tag);
|
|
|
|
+ } else {
|
|
|
|
+ this.delTag(item, tag);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
addTag(item, cTag) {
|
|
addTag(item, cTag) {
|
|
let content = item.content;
|
|
let content = item.content;
|
|
// 如果已经有了,就不添加
|
|
// 如果已经有了,就不添加
|
|
@@ -250,8 +269,8 @@
|
|
created_ts: item.created_ts
|
|
created_ts: item.created_ts
|
|
}, {});
|
|
}, {});
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
- showMsg('更新成功', 1);
|
|
|
|
- this.search();
|
|
|
|
|
|
+ this.msg('更新成功');
|
|
|
|
+ // this.search();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
delTag(item, cTag) {
|
|
delTag(item, cTag) {
|
|
@@ -268,8 +287,8 @@
|
|
created_ts: item.created_ts
|
|
created_ts: item.created_ts
|
|
}, {});
|
|
}, {});
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
- showMsg('更新成功', 1);
|
|
|
|
- this.search();
|
|
|
|
|
|
+ this.msg('更新成功');
|
|
|
|
+ // this.search();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
del(item) {
|
|
del(item) {
|
|
@@ -277,15 +296,16 @@
|
|
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'}).then(() => {
|
|
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'}).then(() => {
|
|
requestUtil.async(`https://web_history.tianyunperfect.cn/memos/delete`, 'post', {id: item.id}, {}).then(res => {
|
|
requestUtil.async(`https://web_history.tianyunperfect.cn/memos/delete`, 'post', {id: item.id}, {}).then(res => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
- showMsg('删除成功', 1);
|
|
|
|
- this.search();
|
|
|
|
|
|
+ this.msg('删除成功');
|
|
|
|
+ // 在 this.contentList 上直接去除
|
|
|
|
+ this.contentList = this.contentList.filter(it => it.id !== item.id);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
})
|
|
})
|
|
},
|
|
},
|
|
archive(item) {
|
|
archive(item) {
|
|
requestUtil.async(`https://web_history.tianyunperfect.cn/memos/archive`, 'post', {id: item.id}, {}).then(res => {
|
|
requestUtil.async(`https://web_history.tianyunperfect.cn/memos/archive`, 'post', {id: item.id}, {}).then(res => {
|
|
- showMsg('归档成功', 1);
|
|
|
|
|
|
+ this.msg('归档成功');
|
|
this.search();
|
|
this.search();
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -301,8 +321,8 @@
|
|
created_ts: this.tmpItem.created_ts
|
|
created_ts: this.tmpItem.created_ts
|
|
}, {});
|
|
}, {});
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
- showMsg('更新成功', 1);
|
|
|
|
- this.search();
|
|
|
|
|
|
+ this.msg('更新成功');
|
|
|
|
+ // this.search();
|
|
}
|
|
}
|
|
this.dialogVisible = false;
|
|
this.dialogVisible = false;
|
|
done();
|
|
done();
|
|
@@ -312,6 +332,10 @@
|
|
edit(item) {
|
|
edit(item) {
|
|
this.tmpItem = item;
|
|
this.tmpItem = item;
|
|
this.dialogVisible = true;
|
|
this.dialogVisible = true;
|
|
|
|
+ // 获取焦点
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.contentEdit.focus()
|
|
|
|
+ })
|
|
},
|
|
},
|
|
isDisabled(item) {
|
|
isDisabled(item) {
|
|
// 默认不可编辑,这个时候 没有disable属性
|
|
// 默认不可编辑,这个时候 没有disable属性
|
|
@@ -335,10 +359,11 @@
|
|
let res = requestUtil.sync('https://memos.tianyunperfect.cn/api/v1/memo', 'post', {content: updatedContent}, myHeaders);
|
|
let res = requestUtil.sync('https://memos.tianyunperfect.cn/api/v1/memo', 'post', {content: updatedContent}, myHeaders);
|
|
if (res['name']) {
|
|
if (res['name']) {
|
|
// window.location.href = `https://memos.tianyunperfect.cn/m/${res['name']}`;
|
|
// window.location.href = `https://memos.tianyunperfect.cn/m/${res['name']}`;
|
|
- showMsg('记录成功', 1);
|
|
|
|
|
|
+ this.msg('记录成功');
|
|
this.contentStr = '';
|
|
this.contentStr = '';
|
|
this.search();
|
|
this.search();
|
|
}
|
|
}
|
|
|
|
+ this.sendBtnAble = true;
|
|
},
|
|
},
|
|
search: function () {
|
|
search: function () {
|
|
document.documentElement.scrollTo(0, 0);
|
|
document.documentElement.scrollTo(0, 0);
|
|
@@ -352,6 +377,7 @@
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this.contentList = res.res;
|
|
this.contentList = res.res;
|
|
|
|
+
|
|
// contentList 循环获取里面所有的id数组
|
|
// contentList 循环获取里面所有的id数组
|
|
let idArr = this.contentList.map(item => item['id']);
|
|
let idArr = this.contentList.map(item => item['id']);
|
|
// 获取资源
|
|
// 获取资源
|