mirror of
https://gitee.com/java110/PropertyApp.git
synced 2026-02-23 21:36:39 +08:00
Merge branch 'master' of http://git.homecommunity.cn/supervip/PropertyApp
This commit is contained in:
commit
2b5afe5def
@ -1,9 +1,9 @@
|
|||||||
import conf from '../conf/config.js'
|
import conf from '../conf/config.js'
|
||||||
const baseUrl = conf.baseUrl;
|
const baseUrl = conf.baseUrl;
|
||||||
const hcBaseUrl = conf.baseUrl;
|
const hcBaseUrl = conf.commonBaseUrl;
|
||||||
export default {
|
export default {
|
||||||
baseUrl: baseUrl,
|
baseUrl: baseUrl,
|
||||||
hcBaseUrl: baseUrl, // 登录接口
|
hcBaseUrl: hcBaseUrl, // 登录接口
|
||||||
loginUrl: baseUrl + 'app/loginProperty',
|
loginUrl: baseUrl + 'app/loginProperty',
|
||||||
areaUrl: baseUrl + "app/area.listAreas",
|
areaUrl: baseUrl + "app/area.listAreas",
|
||||||
GetNoticeListUrl: baseUrl + 'app/notice.listNotices', //公告接口
|
GetNoticeListUrl: baseUrl + 'app/notice.listNotices', //公告接口
|
||||||
|
|||||||
@ -35,6 +35,7 @@ export function replaceImgSrc(_content, _url) {
|
|||||||
if (isEmpty(_content)) {
|
if (isEmpty(_content)) {
|
||||||
return _content;
|
return _content;
|
||||||
}
|
}
|
||||||
|
_content = _content.replaceAll("&","&")
|
||||||
// a 为富文本的字符串内容,为了测试,只写了img标签
|
// a 为富文本的字符串内容,为了测试,只写了img标签
|
||||||
let b = /<img [^>]*src=['"]([^'"]+)[^>]*>/g; // img 标签取src里面内容的正则
|
let b = /<img [^>]*src=['"]([^'"]+)[^>]*>/g; // img 标签取src里面内容的正则
|
||||||
let s = _content.match(b); // 取到所有img标签 放到数组 s里面
|
let s = _content.match(b); // 取到所有img标签 放到数组 s里面
|
||||||
|
|||||||
@ -6,7 +6,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export function translate(imgSrc, callback) {
|
export function translate(imgSrc, callback) {
|
||||||
|
// #ifndef H5
|
||||||
imageToBease64(imgSrc, callback)
|
imageToBease64(imgSrc, callback)
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
translateH5(imgSrc,callback)
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,4 +71,63 @@ export function base64ToBlob(base64) {
|
|||||||
return new Blob([u8arr], {
|
return new Blob([u8arr], {
|
||||||
type: mime
|
type: mime
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export function translateH5(imgSrc, callback) {
|
||||||
|
|
||||||
|
var img = new Image();
|
||||||
|
|
||||||
|
img.src = imgSrc;
|
||||||
|
|
||||||
|
img.onload = function () {
|
||||||
|
|
||||||
|
var that = this;
|
||||||
|
|
||||||
|
var h = that.height;
|
||||||
|
|
||||||
|
// 默认按比例压缩
|
||||||
|
|
||||||
|
var w = that.width;
|
||||||
|
|
||||||
|
var canvas = document.createElement('canvas');
|
||||||
|
|
||||||
|
var ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
|
var anw = document.createAttribute("width");
|
||||||
|
|
||||||
|
anw.nodeValue = w;
|
||||||
|
|
||||||
|
var anh = document.createAttribute("height");
|
||||||
|
|
||||||
|
anh.nodeValue = h;
|
||||||
|
|
||||||
|
canvas.setAttributeNode(anw);
|
||||||
|
|
||||||
|
canvas.setAttributeNode(anh);
|
||||||
|
|
||||||
|
ctx.drawImage(that, 0, 0, w, h);
|
||||||
|
|
||||||
|
//压缩比例
|
||||||
|
|
||||||
|
var quality = 0.3;
|
||||||
|
|
||||||
|
var base64 = canvas.toDataURL('image/jpeg', quality);
|
||||||
|
|
||||||
|
canvas = null;
|
||||||
|
|
||||||
|
// var blob = base64ToBlob(base64);
|
||||||
|
|
||||||
|
// console.log(333);
|
||||||
|
// console.log(base64)
|
||||||
|
|
||||||
|
//Blob对象转blob地址
|
||||||
|
|
||||||
|
// var blobUrl = window.URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
callback(base64);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@
|
|||||||
let _tmpStartTime = new Date(_startTime);
|
let _tmpStartTime = new Date(_startTime);
|
||||||
|
|
||||||
// _item.startTime = _that.java110Util.date.formatDate(_tmpStartTime);
|
// _item.startTime = _that.java110Util.date.formatDate(_tmpStartTime);
|
||||||
_item.context = replaceImgSrc(_item.context,conf.baseUrl);
|
_item.context = replaceImgSrc(_item.context,conf.commonBaseUrl);
|
||||||
_that.activity = _item;
|
_that.activity = _item;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -81,7 +81,7 @@
|
|||||||
let storeId = _userInfo.storeId;
|
let storeId = _userInfo.storeId;
|
||||||
let _objData = {
|
let _objData = {
|
||||||
page: 1,
|
page: 1,
|
||||||
row: 15,
|
row: 1000,
|
||||||
storeId: storeId,
|
storeId: storeId,
|
||||||
name: this.name
|
name: this.name
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user