mirror of
https://gitee.com/openharmony/applications_notes
synced 2024-11-26 17:20:25 +00:00
打开任意笔记,不做修改,时间就会刷新为最新
Signed-off-by: xiazhichao9 <xiazhichao05@chinasoftinc.com>
This commit is contained in:
parent
92751875c2
commit
e8732a0151
@ -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()
|
||||
|
@ -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;"> 1. 添加鸡蛋、盐、糖、蛋糕粉<br>' +
|
||||
' 2. 加入玉米油、牛奶,烤箱预热15分钟<br>' +
|
||||
' 3. 加入葡萄干、核桃仁,烤箱定时40分钟<br><br></text><div>',
|
||||
' 3. 加入葡萄干、核桃仁,烤箱定时40分钟<br><br></text></div></div></div>',
|
||||
"content_img": "",
|
||||
"note_type": NoteType.CusDef,
|
||||
"is_top": Top.No,
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user