uu
This commit is contained in:
parent
65e7250cca
commit
3d1709fba3
6
App.vue
6
App.vue
@ -64,13 +64,7 @@
|
|||||||
...mapMutations(['setUniverifyErrorMsg', 'setUniverifyLogin']),
|
...mapMutations(['setUniverifyErrorMsg', 'setUniverifyLogin']),
|
||||||
appCheckUpdate(){
|
appCheckUpdate(){
|
||||||
console.log("appCheckUpdate=============")
|
console.log("appCheckUpdate=============")
|
||||||
// #ifdef APP-PLUS
|
|
||||||
// App平台检测升级,服务端代码是通过uniCloud的云函数实现的,详情可参考:https://ext.dcloud.net.cn/plugin?id=4542
|
|
||||||
// if (plus.runtime.appid !== 'HBuilder') { // 真机运行不需要检查更新,真机运行时appid固定为'HBuilder',这是调试基座的appid
|
|
||||||
// checkUpdate()
|
|
||||||
// }
|
|
||||||
checkUpdate()
|
checkUpdate()
|
||||||
// #endif
|
|
||||||
},
|
},
|
||||||
async updateActiveTime(opt = {}){
|
async updateActiveTime(opt = {}){
|
||||||
let { directUpdate } = opt
|
let { directUpdate } = opt
|
||||||
|
|||||||
@ -83,6 +83,26 @@ let coreRequest = function(url, params = {}, options = {}, methodType, coreParam
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const coreDownloadRequest = (url, params = {}, options = {}, methodType = 'GET', coreParams = {})=> {
|
||||||
|
let comReqData = getCommonReqData()
|
||||||
|
// 统一把emo转unicode
|
||||||
|
// emoUnicode(params)
|
||||||
|
const reqParams = {
|
||||||
|
...baseParam,
|
||||||
|
...params,
|
||||||
|
}
|
||||||
|
url = `${host}${url}`
|
||||||
|
options = {
|
||||||
|
...comReqData.header,
|
||||||
|
...options,
|
||||||
|
}
|
||||||
|
|
||||||
|
// get请求 需要转成query参
|
||||||
|
url = url + (url.indexOf('?') == -1 ? '?': '') + tansGetParamsToQuery(reqParams)
|
||||||
|
return { url, header: options }
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
coreDownloadRequest,
|
||||||
coreRequest
|
coreRequest
|
||||||
}
|
}
|
||||||
@ -148,6 +148,8 @@ const downloadFile = (url, ext = {})=> {
|
|||||||
if (res.statusCode === 200 || res.statusCode === 400) {
|
if (res.statusCode === 200 || res.statusCode === 400) {
|
||||||
console.log('下载成功');
|
console.log('下载成功');
|
||||||
resolve(res)
|
resolve(res)
|
||||||
|
} else {
|
||||||
|
reject('下载失败')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err)=>{
|
fail: (err)=>{
|
||||||
@ -158,33 +160,43 @@ const downloadFile = (url, ext = {})=> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveNetFile = (url) => {
|
const saveNetFile = ({ url, header } = {}) => {
|
||||||
return new Promise(async (resolve, reject)=> {
|
return new Promise(async (resolve, reject) => {
|
||||||
showLoading('正在保存文件')
|
showLoading('正在保存文件')
|
||||||
try{
|
try {
|
||||||
let dRes = await getImageInfo(url)
|
let dRes = await downloadFile(url, { header })
|
||||||
console.log("save:downloadFile:getImageInfo", dRes)
|
console.log("saveNetFile:downloadFile==", dRes)
|
||||||
let { tempFilePath, path } = dRes
|
let {
|
||||||
|
tempFilePath,
|
||||||
|
path
|
||||||
|
} = dRes
|
||||||
|
path = path || tempFilePath
|
||||||
|
debugger
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
saveAs(path)
|
saveAs(path)
|
||||||
// #endif
|
// #endif
|
||||||
// let res = await saveFile({ path })
|
// let res = await saveFile({ path })
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
plus.io.convertLocalFileSystemURL(path);
|
plus.io.convertLocalFileSystemURL(path);
|
||||||
plus.runtime.openFile(path); //选择软件打开文件
|
plus.runtime.openFile(path); //选择软件打开文件
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
debugger
|
||||||
|
await uniPromiseApi('openDocument', { filePath: path, showMenu: true, })
|
||||||
|
// #endif
|
||||||
|
|
||||||
hideLoading()
|
hideLoading()
|
||||||
showToast('保存成功')
|
showToast('保存成功')
|
||||||
resolve(tempFilePath)
|
resolve(tempFilePath)
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
hideLoading()
|
hideLoading()
|
||||||
showToast('保存失败')
|
showToast('保存失败')
|
||||||
reject(e)
|
reject(e)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveFile = ({ tempFilePath })=> {
|
const saveFile = ({ tempFilePath })=> {
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
async handleSave(){
|
async handleSave(){
|
||||||
this.saveNetFile(this.qrCodeImgUrl)
|
this.saveNetFile({ url: this.qrCodeImgUrl })
|
||||||
},
|
},
|
||||||
handlePrint() {
|
handlePrint() {
|
||||||
this.$refs.curPrint.startPrint({
|
this.$refs.curPrint.startPrint({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user