|
|
@ -4,9 +4,9 @@ |
|
|
<view class="im-footer bg-gray" v-if="contactid!==-2"> |
|
|
<view class="im-footer bg-gray" v-if="contactid!==-2"> |
|
|
<view class="im-menus f-28" v-show="!isFocus || contact.is_group!=1" style="margin-bottom: 8rpx;" :class="[recShow ? 'cuIcon-keyboard' : 'cuIcon-sound']" hover-class="tap" @tap="showRec"></view> |
|
|
<view class="im-menus f-28" v-show="!isFocus || contact.is_group!=1" style="margin-bottom: 8rpx;" :class="[recShow ? 'cuIcon-keyboard' : 'cuIcon-sound']" hover-class="tap" @tap="showRec"></view> |
|
|
<view class="im-menus f-24" v-show="isFocus && contact.is_group==1" style="margin-bottom: 13rpx;" @tap="modelName='userModel'">@</view> |
|
|
<view class="im-menus f-24" v-show="isFocus && contact.is_group==1" style="margin-bottom: 13rpx;" @tap="modelName='userModel'">@</view> |
|
|
<view class="im-msgarea" style="flex: 0.97;"> |
|
|
<view class="im-msgarea" style="flex: 0.97;width: 400rpx;"> |
|
|
<!-- im-flex1 --> |
|
|
<!-- im-flex1 --> |
|
|
<editor id="editor" class="solid-bottom bg-white im-input c-333" :adjust-position="false" maxlength="300" cursor-spacing="10" |
|
|
<editor id="editor" style="width: 100%;line-break: anywhere;" class="solid-bottom bg-white im-input c-333" :adjust-position="false" maxlength="300" cursor-spacing="10" |
|
|
@focus="InputFocus" @blur="InputBlur" @input="changeMsgText" @ready="onEditorReady" :read-only="readOnly" v-show="recShow==false"> </editor> |
|
|
@focus="InputFocus" @blur="InputBlur" @input="changeMsgText" @ready="onEditorReady" :read-only="readOnly" v-show="recShow==false"> </editor> |
|
|
<view class="toolBox" v-show="recShow==true"> |
|
|
<view class="toolBox" v-show="recShow==true"> |
|
|
<view class="recorder" :class="{active:isUseRecorder}" @touchstart.prevent="startRecorder" |
|
|
<view class="recorder" :class="{active:isUseRecorder}" @touchstart.prevent="startRecorder" |
|
|
@ -51,16 +51,16 @@ |
|
|
<view class="upload-emoji" @tap="uploadEmoji"><text class="cuIcon-add c-999" style="vertical-align: sub;"></text></view> |
|
|
<view class="upload-emoji" @tap="uploadEmoji"><text class="cuIcon-add c-999" style="vertical-align: sub;"></text></view> |
|
|
</view> |
|
|
</view> |
|
|
<view v-for="(item,index) in currentEmojiList" class="im-emoji-item" :key="index"> |
|
|
<view v-for="(item,index) in currentEmojiList" class="im-emoji-item" :key="index"> |
|
|
<block v-for="(iteme,indexe) in imglist" :key="indexe" v-if="network_log == 'none'"> |
|
|
<!-- <block v-for="(iteme,indexe) in imglist" :key="indexe" v-if="network_log == 'none'"> |
|
|
<view v-if="iteme.name==item.name"> |
|
|
<view v-if="iteme.name==item.name"> |
|
|
<image :src="iteme.path" style="width:100rpx;height:100rpx" mode="aspectFit" :fade-show="false" lazy-load @tap="chooseDiyEmoji(item)" v-if="emojiName=='favors'"></image> |
|
|
<image :src="iteme.path" style="width:100rpx;height:100rpx" mode="aspectFit" :fade-show="false" lazy-load @tap="chooseDiyEmoji(item)" v-if="emojiName=='favors'"></image> |
|
|
<image :src="iteme.path" style="width:44rpx;;height:44rpx" mode="aspectFit" lazy-load @tap="chooseEmoji(item)" v-else></image> |
|
|
<image :src="iteme.path" style="width:44rpx;;height:44rpx" mode="aspectFit" lazy-load @tap="chooseEmoji(item)" v-else></image> |
|
|
</view> |
|
|
</view> |
|
|
</block> |
|
|
</block> |
|
|
<block v-else> |
|
|
<block v-else> --> |
|
|
<image :src="item.src" style="width:100rpx;height:100rpx" mode="aspectFit" :fade-show="false" lazy-load @tap="chooseDiyEmoji(item)" v-if="emojiName=='favors'"></image> |
|
|
<image :src="item.src" style="width:100rpx;height:100rpx" mode="aspectFit" :fade-show="false" lazy-load @tap="chooseDiyEmoji(item)" v-if="emojiName=='favors'"></image> |
|
|
<image :src="item.src" style="width:44rpx;;height:44rpx" mode="aspectFit" lazy-load @tap="chooseEmoji(item)" v-else></image> |
|
|
<image :src="item.src" style="width:44rpx;;height:44rpx" mode="aspectFit" lazy-load @tap="chooseEmoji(item)" v-else></image> |
|
|
</block> |
|
|
<!-- </block> --> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
|
@ -197,7 +197,8 @@ export default { |
|
|
boardHeight:0, |
|
|
boardHeight:0, |
|
|
inputMsg1:"", |
|
|
inputMsg1:"", |
|
|
network_log:'', |
|
|
network_log:'', |
|
|
imglist:[] |
|
|
imglist:[], |
|
|
|
|
|
FileImg:uni.getStorageSync('FileImg') |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
watch:{ |
|
|
watch:{ |
|
|
@ -261,7 +262,7 @@ export default { |
|
|
this.currentEmojiList=emoji[0]['children']; |
|
|
this.currentEmojiList=emoji[0]['children']; |
|
|
this.getEmojiList(); |
|
|
this.getEmojiList(); |
|
|
// #ifdef APP-PLUS |
|
|
// #ifdef APP-PLUS |
|
|
this.downloadFileImg() |
|
|
// this.downloadFileImg() |
|
|
// #endif |
|
|
// #endif |
|
|
uni.getSystemInfo({ |
|
|
uni.getSystemInfo({ |
|
|
success: res => { |
|
|
success: res => { |
|
|
@ -312,10 +313,10 @@ export default { |
|
|
} |
|
|
} |
|
|
} catch (e){return null;} |
|
|
} catch (e){return null;} |
|
|
// #endif |
|
|
// #endif |
|
|
this.network_log = uni.getStorageSync('network_log') |
|
|
// this.network_log = uni.getStorageSync('network_log') |
|
|
if(this.network_log == 'none'){ |
|
|
// if(this.network_log == 'none'){ |
|
|
this.getImagePath() |
|
|
// this.getImagePath() |
|
|
} |
|
|
// } |
|
|
}, |
|
|
}, |
|
|
methods:{ |
|
|
methods:{ |
|
|
updateKeyboardHeightChange(res){ |
|
|
updateKeyboardHeightChange(res){ |
|
|
@ -385,11 +386,12 @@ export default { |
|
|
this.modelName=''; |
|
|
this.modelName=''; |
|
|
}, |
|
|
}, |
|
|
setAtList(item){ |
|
|
setAtList(item){ |
|
|
|
|
|
const val = {user_id:item.user_id,realname:item.realname?item.realname:item.realname1} |
|
|
this.isAt=true; |
|
|
this.isAt=true; |
|
|
this.closeModel(); |
|
|
this.closeModel(); |
|
|
this.edit.addLink({ |
|
|
this.edit.addLink({ |
|
|
prefix: '@', |
|
|
prefix: '@', |
|
|
data: item |
|
|
data: item.avatar?val:item |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 编辑器获得焦点 |
|
|
// 编辑器获得焦点 |
|
|
@ -699,21 +701,112 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 选择文件 |
|
|
// 选择文件 |
|
|
chooseFile:function(){ |
|
|
// chooseFile:function(){ |
|
|
let self=this; |
|
|
// let self=this; |
|
|
|
|
|
// // #ifdef H5 |
|
|
|
|
|
// uni.chooseFile({ |
|
|
|
|
|
// count: 5, //默认100 |
|
|
|
|
|
// success: function (res) { |
|
|
|
|
|
// self.appendFile(res); |
|
|
|
|
|
// } |
|
|
|
|
|
// }); |
|
|
|
|
|
// // #endif |
|
|
|
|
|
// // #ifdef MP |
|
|
|
|
|
// wx.chooseMessageFile({ |
|
|
|
|
|
// count: 5, //默认100 |
|
|
|
|
|
// success: function (res) { |
|
|
|
|
|
// self.appendFile(res); |
|
|
|
|
|
// } |
|
|
|
|
|
// }); |
|
|
|
|
|
// // #endif |
|
|
|
|
|
|
|
|
|
|
|
// // #ifdef APP-PLUS |
|
|
|
|
|
// const lemonjkFileSelect = uni.requireNativePlugin('lemonjk-FileSelect'); |
|
|
|
|
|
// lemonjkFileSelect.showPicker({ |
|
|
|
|
|
// pathScope: "/Download", // 各属性配置见下方【showPicker可配置参数说明】 |
|
|
|
|
|
// mimeType: "*/*", |
|
|
|
|
|
// utisType:"public.data", |
|
|
|
|
|
// multi:'yes', |
|
|
|
|
|
// }, result => { |
|
|
|
|
|
// // 未授权文件读取权限,可以提示用户未打开读取文件权限(仅安卓) |
|
|
|
|
|
// if(result.code==1001){ |
|
|
|
|
|
// uni.showModal({ |
|
|
|
|
|
// title:"需要文件访问权限", |
|
|
|
|
|
// content:"您还未授权本应用读取文件。为保证您可以正常上传文件,请在权限设置页面打开文件访问权限(不同手机厂商表述可能略有差异)请根据自己手机品牌设置", |
|
|
|
|
|
// confirmText:"去授权", |
|
|
|
|
|
// cancelText:"算了", |
|
|
|
|
|
// success(e) { |
|
|
|
|
|
// if(e.confirm){ |
|
|
|
|
|
// // 跳转到应用设置页 |
|
|
|
|
|
// lemonjkFileSelect.gotoSetting(); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
// } |
|
|
|
|
|
// let type='file'; |
|
|
|
|
|
// let imageExts=['jpg','jpeg','png','bmp','gif']; |
|
|
|
|
|
// let videoExts=['mp4','3gp','avi','m2v','mkv','mov']; |
|
|
|
|
|
// result.files.forEach((item)=>{ |
|
|
|
|
|
// if(imageExts.includes(item.fileExtension)){ |
|
|
|
|
|
// type='image'; |
|
|
|
|
|
// }else if(videoExts.includes(item.fileExtension)){ |
|
|
|
|
|
// type='video'; |
|
|
|
|
|
// }else{ |
|
|
|
|
|
// type='file'; |
|
|
|
|
|
// } |
|
|
|
|
|
// let filePath='file://'+item.filePath; |
|
|
|
|
|
// const message={ |
|
|
|
|
|
// type:type, |
|
|
|
|
|
// status:'going', |
|
|
|
|
|
// fileName:item.FileName, |
|
|
|
|
|
// fileSize:item.fileSize, |
|
|
|
|
|
// content:filePath |
|
|
|
|
|
// }; |
|
|
|
|
|
// this.$emit('send',Object.assign(this.msgItem(), message),filePath); |
|
|
|
|
|
// }) |
|
|
|
|
|
// }) |
|
|
|
|
|
// // #endif |
|
|
|
|
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
|
|
|
|
chooseFile: function() { |
|
|
|
|
|
let self = this; |
|
|
|
|
|
|
|
|
|
|
|
// 允许的文件类型(按扩展名) |
|
|
|
|
|
const allowedExtensions = ['pdf', 'doc', 'docx', 'txt', 'xls', 'xlsx', 'ppt', 'pptx', 'zip', 'rar']; |
|
|
|
|
|
|
|
|
// #ifdef H5 |
|
|
// #ifdef H5 |
|
|
uni.chooseFile({ |
|
|
uni.chooseFile({ |
|
|
count: 5, //默认100 |
|
|
count: 5, |
|
|
success: function (res) { |
|
|
accept: '.' + allowedExtensions.join(',.'), // 限制选择类型 |
|
|
self.appendFile(res); |
|
|
success: function(res) { |
|
|
|
|
|
const filteredFiles = res.tempFiles.filter(file => { |
|
|
|
|
|
const ext = file.name.split('.').pop().toLowerCase(); |
|
|
|
|
|
return allowedExtensions.includes(ext); |
|
|
|
|
|
}); |
|
|
|
|
|
if (filteredFiles.length > 0) { |
|
|
|
|
|
self.appendFile({ tempFiles: filteredFiles }); |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.showToast({ title: '只能上传PDF/Word/Excel等文档', icon: 'none' }); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
// #endif |
|
|
// #endif |
|
|
|
|
|
|
|
|
// #ifdef MP |
|
|
// #ifdef MP |
|
|
wx.chooseMessageFile({ |
|
|
wx.chooseMessageFile({ |
|
|
count: 5, //默认100 |
|
|
count: 5, |
|
|
success: function (res) { |
|
|
type: 'file', // 小程序专用参数:只选文档 |
|
|
self.appendFile(res); |
|
|
success: function(res) { |
|
|
|
|
|
const filteredFiles = res.tempFiles.filter(file => { |
|
|
|
|
|
const ext = file.name.split('.').pop().toLowerCase(); |
|
|
|
|
|
return allowedExtensions.includes(ext); |
|
|
|
|
|
}); |
|
|
|
|
|
if (filteredFiles.length > 0) { |
|
|
|
|
|
self.appendFile({ tempFiles: filteredFiles }); |
|
|
|
|
|
} else { |
|
|
|
|
|
uni.showToast({ title: '只能上传PDF/Word/Excel等文档', icon: 'none' }); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
// #endif |
|
|
// #endif |
|
|
@ -721,51 +814,48 @@ export default { |
|
|
// #ifdef APP-PLUS |
|
|
// #ifdef APP-PLUS |
|
|
const lemonjkFileSelect = uni.requireNativePlugin('lemonjk-FileSelect'); |
|
|
const lemonjkFileSelect = uni.requireNativePlugin('lemonjk-FileSelect'); |
|
|
lemonjkFileSelect.showPicker({ |
|
|
lemonjkFileSelect.showPicker({ |
|
|
pathScope: "/Download", // 各属性配置见下方【showPicker可配置参数说明】 |
|
|
pathScope: "/Download", |
|
|
mimeType: "*/*", |
|
|
mimeType: "application/*", // 限制MIME类型 |
|
|
utisType:"public.data", |
|
|
utisType: "public.data", |
|
|
multi:'yes', |
|
|
multi: 'yes' |
|
|
}, result => { |
|
|
}, result => { |
|
|
// 未授权文件读取权限,可以提示用户未打开读取文件权限(仅安卓) |
|
|
if (result.code == 1001) { |
|
|
if(result.code==1001){ |
|
|
|
|
|
uni.showModal({ |
|
|
uni.showModal({ |
|
|
title:"需要文件访问权限", |
|
|
title: "需要文件访问权限", |
|
|
content:"您还未授权本应用读取文件。为保证您可以正常上传文件,请在权限设置页面打开文件访问权限(不同手机厂商表述可能略有差异)请根据自己手机品牌设置", |
|
|
content: "请授权文件访问权限", |
|
|
confirmText:"去授权", |
|
|
confirmText: "去授权", |
|
|
cancelText:"算了", |
|
|
|
|
|
success(e) { |
|
|
success(e) { |
|
|
if(e.confirm){ |
|
|
if (e.confirm) lemonjkFileSelect.gotoSetting(); |
|
|
// 跳转到应用设置页 |
|
|
|
|
|
lemonjkFileSelect.gotoSetting(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
}) |
|
|
|
|
|
} |
|
|
// 过滤文件类型 |
|
|
let type='file'; |
|
|
const validFiles = result.files.filter(item => { |
|
|
let imageExts=['jpg','jpeg','png','bmp','gif']; |
|
|
const ext = item.fileExtension.toLowerCase(); |
|
|
let videoExts=['mp4','3gp','avi','m2v','mkv','mov']; |
|
|
return allowedExtensions.includes(ext); |
|
|
result.files.forEach((item)=>{ |
|
|
}); |
|
|
if(imageExts.includes(item.fileExtension)){ |
|
|
|
|
|
type='image'; |
|
|
if (validFiles.length === 0) { |
|
|
}else if(videoExts.includes(item.fileExtension)){ |
|
|
uni.showToast({ title: '只能上传PDF/Word/Excel等文档', icon: 'none' }); |
|
|
type='video'; |
|
|
return; |
|
|
}else{ |
|
|
|
|
|
type='file'; |
|
|
|
|
|
} |
|
|
} |
|
|
let filePath='file://'+item.filePath; |
|
|
|
|
|
const message={ |
|
|
validFiles.forEach(item => { |
|
|
type:type, |
|
|
const message = { |
|
|
status:'going', |
|
|
type: 'file', // 强制设为文件类型 |
|
|
fileName:item.FileName, |
|
|
status: 'going', |
|
|
fileSize:item.fileSize, |
|
|
fileName: item.FileName, |
|
|
content:filePath |
|
|
fileSize: item.fileSize, |
|
|
|
|
|
content: 'file://' + item.filePath |
|
|
}; |
|
|
}; |
|
|
this.$emit('send',Object.assign(this.msgItem(), message),filePath); |
|
|
this.$emit('send', Object.assign(this.msgItem(), message), message.content); |
|
|
}) |
|
|
}); |
|
|
}) |
|
|
}); |
|
|
// #endif |
|
|
// #endif |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 写入文件 |
|
|
// 写入文件 |
|
|
appendFile(res){ |
|
|
appendFile(res){ |
|
|
const tempFiles=res.tempFiles; |
|
|
const tempFiles=res.tempFiles; |
|
|
@ -1084,98 +1174,102 @@ export default { |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
downloadFileImg(){ |
|
|
// downloadFileImg(){ |
|
|
var self1 = this; |
|
|
// if(this.FileImg==false){ |
|
|
this.currentEmojiList.forEach((res)=>{ |
|
|
// // console.log('123456'); |
|
|
// console.log(res); |
|
|
// var self1 = this; |
|
|
uni.downloadFile({ url: res.src,success: (downloadResult) => { |
|
|
// this.currentEmojiList.forEach((res)=>{ |
|
|
self1.saveToPermanentStorage(downloadResult.tempFilePath); |
|
|
// // console.log(res); |
|
|
}}) |
|
|
// uni.downloadFile({ url: res.src,success: (downloadResult) => { |
|
|
}); |
|
|
// self1.saveToPermanentStorage(downloadResult.tempFilePath); |
|
|
}, |
|
|
// }}) |
|
|
// App端持久化存储实现 |
|
|
// }); |
|
|
saveToPermanentStorage(tempPath) { |
|
|
// } |
|
|
return new Promise((resolve, reject) => { |
|
|
// }, |
|
|
// 获取应用文档目录(持久化存储) |
|
|
// // App端持久化存储实现 |
|
|
plus.io.resolveLocalFileSystemURL( |
|
|
// saveToPermanentStorage(tempPath) { |
|
|
'_doc', |
|
|
// return new Promise((resolve, reject) => { |
|
|
(docDir) => { |
|
|
// // 获取应用文档目录(持久化存储) |
|
|
// 创建目标路径 |
|
|
// plus.io.resolveLocalFileSystemURL( |
|
|
docDir.getDirectory( |
|
|
// '_doc', |
|
|
'emoji', |
|
|
// (docDir) => { |
|
|
{ create: true, exclusive: false }, |
|
|
// // 创建目标路径 |
|
|
(entry) => { |
|
|
// docDir.getDirectory( |
|
|
// 从临时路径获取文件名 |
|
|
// 'emoji', |
|
|
const fileName = this.getFileName(tempPath); |
|
|
// { create: true, exclusive: false }, |
|
|
const fileName1 = this.getFileName(docDir.fullPath + 'emoji/' +fileName); |
|
|
// (entry) => { |
|
|
// console.log(fileName); |
|
|
// // 从临时路径获取文件名 |
|
|
// console.log(fileName1); |
|
|
// const fileName = this.getFileName(tempPath); |
|
|
// 新增:检查文件是否存在 |
|
|
// uni.setStorageSync('FileImg',true); |
|
|
entry.getFile(fileName1,{ create: false }, // 不创建新文件 |
|
|
// const fileName1 = this.getFileName(docDir.fullPath + 'emoji/' +fileName); |
|
|
(fileEntry) => { |
|
|
// // console.log(fileName); |
|
|
// console.log('文件已存在,拒绝操作'); |
|
|
// // console.log(fileName1); |
|
|
// 文件已存在,拒绝操作 |
|
|
// // 新增:检查文件是否存在 |
|
|
reject(new Error('文件已存在: ' + fileName)); |
|
|
// entry.getFile(fileName1,{ create: false }, // 不创建新文件 |
|
|
}, |
|
|
// (fileEntry) => { |
|
|
(error) => { |
|
|
// // console.log('文件已存在,拒绝操作'); |
|
|
// console.log(error); |
|
|
// // 文件已存在,拒绝操作 |
|
|
// 文件不存在(或发生其他错误),继续复制操作 |
|
|
// reject(new Error('文件已存在: ' + fileName)); |
|
|
if (error.code === 14) { // 1表示文件不存在(不同平台错误码可能不同) |
|
|
// }, |
|
|
this.copyFile(tempPath, entry, fileName, resolve, reject); |
|
|
// (error) => { |
|
|
} else { |
|
|
// // console.log(error); |
|
|
reject(error); |
|
|
// // 文件不存在(或发生其他错误),继续复制操作 |
|
|
} |
|
|
// if (error.code === 14) { // 1表示文件不存在(不同平台错误码可能不同) |
|
|
} |
|
|
// this.copyFile(tempPath, entry, fileName, resolve, reject); |
|
|
); |
|
|
// } else { |
|
|
}, |
|
|
// reject(error); |
|
|
(error) => { |
|
|
// } |
|
|
reject(error); |
|
|
// } |
|
|
} |
|
|
// ); |
|
|
); |
|
|
// }, |
|
|
}, |
|
|
// (error) => { |
|
|
(error) => { |
|
|
// reject(error); |
|
|
reject(error); |
|
|
// } |
|
|
} |
|
|
// ); |
|
|
); |
|
|
// }, |
|
|
}); |
|
|
// (error) => { |
|
|
}, |
|
|
// reject(error); |
|
|
|
|
|
// } |
|
|
|
|
|
// ); |
|
|
|
|
|
// }); |
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
|
// 提取复制逻辑为独立方法 |
|
|
// // 提取复制逻辑为独立方法 |
|
|
copyFile(tempPath, targetDir, fileName, resolve, reject) { |
|
|
// copyFile(tempPath, targetDir, fileName, resolve, reject) { |
|
|
plus.io.resolveLocalFileSystemURL( |
|
|
// plus.io.resolveLocalFileSystemURL( |
|
|
tempPath, |
|
|
// tempPath, |
|
|
(tempEntry) => { |
|
|
// (tempEntry) => { |
|
|
tempEntry.copyTo( |
|
|
// tempEntry.copyTo( |
|
|
targetDir, |
|
|
// targetDir, |
|
|
fileName, |
|
|
// fileName, |
|
|
(newEntry) => { |
|
|
// (newEntry) => { |
|
|
resolve(newEntry.toLocalURL()); |
|
|
// resolve(newEntry.toLocalURL()); |
|
|
}, |
|
|
// }, |
|
|
(error) => { |
|
|
// (error) => { |
|
|
reject(error); |
|
|
// reject(error); |
|
|
} |
|
|
// } |
|
|
); |
|
|
// ); |
|
|
}, |
|
|
// }, |
|
|
(error) => { |
|
|
// (error) => { |
|
|
reject(error); |
|
|
// reject(error); |
|
|
} |
|
|
// } |
|
|
); |
|
|
// ); |
|
|
}, |
|
|
// }, |
|
|
// 获取文件名工具方法 |
|
|
// // 获取文件名工具方法 |
|
|
getFileName(path) { |
|
|
// getFileName(path) { |
|
|
const index = path.lastIndexOf('/'); |
|
|
// const index = path.lastIndexOf('/'); |
|
|
let fileName = path.substr(index + 1); |
|
|
// let fileName = path.substr(index + 1); |
|
|
fileName = fileName.replace(/\(\d+\)(?=\.[^./]+$)/, ''); |
|
|
// fileName = fileName.replace(/\(\d+\)(?=\.[^./]+$)/, ''); |
|
|
return fileName; |
|
|
// return fileName; |
|
|
}, |
|
|
// }, |
|
|
async getImagePath(){ |
|
|
// async getImagePath(){ |
|
|
this.imglist = await getSavedImages3() |
|
|
// this.imglist = await getSavedImages3() |
|
|
this.imglist.map(item => { |
|
|
// this.imglist.map(item => { |
|
|
item.path = plus.io.convertLocalFileSystemURL(item.path) |
|
|
// item.path = plus.io.convertLocalFileSystemURL(item.path) |
|
|
item.name = item.name.replace(/\.png$/i, ''); |
|
|
// item.name = item.name.replace(/\.png$/i, ''); |
|
|
}); |
|
|
// }); |
|
|
// console.info('读取地址',this.imglist); |
|
|
// // console.info('读取地址',this.imglist); |
|
|
}, |
|
|
// }, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|