tianyunperfect 1 年之前
父節點
當前提交
61dc584a17
共有 2 個文件被更改,包括 58 次插入81 次删除
  1. 56 30
      simple-demo/send_memos.html
  2. 2 51
      tmp/index.html

+ 56 - 30
simple-demo/send_memos.html

@@ -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']);
                 // 获取资源
                 // 获取资源

+ 2 - 51
tmp/index.html

@@ -4,59 +4,10 @@
     <meta charset="UTF-8">
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>生成命令页面</title>
-    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.2/css/bootstrap.min.css">
-    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/element-ui/2.15.0/theme-chalk/index.css">
+    <title>123</title>
 </head>
 </head>
 <body>
 <body>
-<div id="app" class="container">
-    <h1>生成命令页面</h1>
-    <el-form ref="form" :model="formData" label-width="100px">
-        <el-form-item label="Tag名称">
-            <el-input v-model="formData.tagname"></el-input>
-        </el-form-item>
-        <el-form-item label="备注">
-            <el-input v-model="formData.remark"></el-input>
-        </el-form-item>
-        <el-form-item label="选择仓库">
-            <el-checkbox-group v-model="formData.selectedRepos">
-                <el-checkbox v-for="repo in repos" :label="repo.value" :key="repo.value">{{repo.name}}</el-checkbox>
-            </el-checkbox-group>
-        </el-form-item>
-        <el-form-item>
-            <el-button type="primary" @click="generateCommand">生成命令</el-button>
-        </el-form-item>
-        <el-form-item>
-            <label for="command">生成的命令:</label>
-            <pre id="command">{{ command }}</pre>
-        </el-form-item>
-    </el-form>
-</div>
+<a href="hbuilder://pages/square/cardBagDetail?code=58832469055016960">知识包推广链接</a>
 
 
-<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.5.16/vue.min.js"></script>
-<script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
-<script src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.15.0/index.js"></script>
-<script>
-    new Vue({
-        el: '#app',
-        data: {
-            formData: {
-                tagname: '',
-                remark: '',
-                selectedRepos: []
-            },
-            repos: [
-                { name: '模型manager', value: '/path/to/repo1' },
-                { name: '模型worker', value: '/path/to/repo2' }
-            ],
-            command: ''
-        },
-        methods: {
-            generateCommand() {
-                this.command = `tag_service.sh ${this.formData.selectedRepos.join(",")} ${this.formData.tagname} "${this.formData.remark}"`;
-            }
-        }
-    });
-</script>
 </body>
 </body>
 </html>
 </html>