!272 打开任意笔记,不做修改,时间就会刷新为最新

Merge pull request !272 from 夏志超/master
This commit is contained in:
openharmony_ci 2024-06-27 01:53:55 +00:00 committed by Gitee
commit 4ff3331118
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 28 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import StyleConstants from '../constants/StyleConstants'
import {LogUtil} from './LogUtil'
import FolderUtil from './FolderUtil'
import RdbStoreUtil from './RdbStoreUtil'
import buffer from '@ohos.buffer';
const TAG = "NoteUtil"
@ -282,6 +283,20 @@ export class NoteUtil {
let isRefresh = AppStorage.Get('isUpdate')
AppStorage.Set('isUpdate',!isRefresh)
}
/**
* Format conversion
* @param initContent
*/
contrastInitType(initContent:string):string {
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
if(!base64regex.test(initContent)) {
const inputBuffer = buffer.from(initContent,'utf-8');
initContent = inputBuffer.toString('base64');
}
return initContent;
};
}
let noteUtil = new NoteUtil()

View File

@ -174,7 +174,7 @@ export default {
'<span style="line-height:22.4px;" class="note-checkbox-txt">玉米油40g</span><br><div>' +
'<div><text style="line-height:22.4px;">&nbsp;1.&nbsp;&nbsp;&nbsp;添加鸡蛋、盐、糖、蛋糕粉<br>' +
'&nbsp;2.&nbsp;&nbsp;&nbsp;加入玉米油、牛奶烤箱预热15分钟<br>' +
'&nbsp;3.&nbsp;&nbsp;&nbsp;加入葡萄干、核桃仁烤箱定时40分钟<br><br></text><div>',
'&nbsp;3.&nbsp;&nbsp;&nbsp;加入葡萄干、核桃仁烤箱定时40分钟<br><br></text></div></div></div>',
"content_img": "",
"note_type": NoteType.CusDef,
"is_top": Top.No,

View File

@ -85,6 +85,10 @@ export struct NoteContent {
noteContent = {
callbackhtml: (html) => {
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
this.selectedNoteData.content_text = NoteUtil.contrastInitType(this.selectedNoteData.content_text);
if (this.selectedNoteData.content_text === html ) {
return;
};
this.selectedNoteData.content_text = html
this.selectedNoteData.modified_time = new Date().getTime()
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)

View File

@ -107,6 +107,10 @@ export struct NoteContentComp {
noteContent = {
callbackhtml: (html) => {
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
this.selectedNoteData.content_text = NoteUtil.contrastInitType(this.selectedNoteData.content_text);
if (this.selectedNoteData.content_text === html ) {
return;
};
this.selectedNoteData.content_text = html
this.selectedNoteData.modified_time = new Date().getTime()
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)

View File

@ -111,6 +111,10 @@ export struct NoteContentCompPortrait {
noteContent = {
callbackhtml: (html) => {
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData?.uuid)
this.selectedNoteData.content_text = NoteUtil.contrastInitType(this.selectedNoteData.content_text);
if (this.selectedNoteData.content_text === html ) {
return;
};
this.selectedNoteData.content_text = html
this.selectedNoteData.modified_time = new Date().getTime()
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)