jiangping
2023-09-21 fbb909f4a47ef150bd7741ef98373b2530c89936
属性对比
已添加3个文件
已修改8个文件
248 ■■■■■ 文件已修改
h5/apis/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
h5/package-lock.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
h5/pages/index/index.vue 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
h5/pages/login/login.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
h5/utils/request.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
output.jpg 补丁 | 查看 | 原始文档 | blame | 历史
server/platform/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/ImageUtil.java 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/BaseDataServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/zhubo/src/main/java/com/doumee/api/business/WebParamController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/zhubo/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
h5/apis/index.js
@@ -31,7 +31,7 @@
}
// ç™»å½•
export function loginH5(data) {
export function loginH5(data){
    return post('system/loginH5', data)
}
h5/package-lock.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
{
  "name": "h5",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {}
}
h5/pages/index/index.vue
@@ -227,7 +227,12 @@
                                    </view>
                                </view>
                                <view class="productPage_parameter_item_content_nr">
                                    <view class="item" v-for="(child, i) in item.goodsParamList" :key="i">
                                    <view class="item" v-if="item.param1"  v-for="(child, i) in item.param1" :key="child.index">
                                        <view class="label">{{child.name}}:</view>
                                        <view class="value">{{child.val}}</view>
                                    </view>
                                    <view v-if="item.param2" class="paramline"></view>
                                    <view class="item" v-if="item.param2" v-for="(child, j) in item.param2" :key="child.index">
                                        <view class="label">{{child.name}}:</view>
                                        <view class="value">{{child.val}}</view>
                                    </view>
@@ -844,6 +849,51 @@
                    this.leftShop = JSON.parse(JSON.stringify(val))
                } else if (this.$refs.search.typeName === 'right') {
                    this.rightShop = JSON.parse(JSON.stringify(val))
                    let leftParamList = this.leftShop.goodsParamList;
                    let rightParamList = this.rightShop.goodsParamList;
                    let leftList1 = new Array();
                    let leftList2 =  new Array();
                    let rightList1 = new Array();
                    let rightList2 =  new Array();
                    if(leftParamList && leftParamList.length>0){
                        leftParamList.forEach(item => {
                            let flag =0;
                            let rightTemp = null;
                            if(rightParamList && rightParamList.length>0){
                                rightParamList.forEach(item1 => {
                                    if (item.name === item1.name ) {
                                        flag =1;
                                        rightTemp = item1;
                                        return;
                                    }
                                })
                            }
                            if(flag === 1){
                                leftList1.push(item);
                                rightList1.push(rightTemp);
                            }else{
                                leftList2.push(item);
                            }
                        })
                    }
                    if(rightParamList && rightParamList.length>0){
                        rightParamList.forEach(item=> {
                            let flag1 = 0;
                            rightList1.forEach(item1 => {
                                if (item.name === item1.name ) {
                                    flag1 =1;
                                    //return;
                                }
                            })
                            if(flag1 === 0){
                                rightList2.push(item);
                            }
                        })
                    }
                    Reflect.set(this.leftShop, "param1",leftList1);
                    Reflect.set(this.leftShop, "param2",leftList2);
                    Reflect.set(this.rightShop, "param1",rightList1);
                    Reflect.set(this.rightShop, "param2",rightList2);
                } else {
                    this.shopList.push(JSON.parse(JSON.stringify(val)))
                }
@@ -1792,6 +1842,10 @@
                                margin-top: 12px;
                                display: flex;
                                flex-direction: column;
                                .paramline{
                                    border-bottom: #c7c9ce 2px dashed;
                                    margin-bottom: 15px;
                                }
                                .item {
                                    display: flex;
                                    align-items: flex-start;
h5/pages/login/login.vue
@@ -45,6 +45,7 @@
                    password: this.from.password,
                    username: this.from.account
                }).then(async(res) => {
                    alert(10)
                    this.$store.commit('setToken', res.data)
                    let user = await getUserInfo()
                    this.$store.commit('setUser', user.data)
h5/utils/request.js
@@ -16,7 +16,7 @@
        // http://127.0.0.1/interface/    http://192.168.0.15:10024/   preselect_web_interface
        // https://dmtest.ahapp.net/preselect_web_interface/${url}   http://127.0.0.1:10022/  http://192.168.0.35:10024/
        uni.request({
            url: `http://192.168.0.15:10024/${url}`,
            url: `http://192.168.0.35:10024/${url}`,
            method,
            data,
            header: {
output.jpg
server/platform/src/main/resources/application.yml
@@ -11,7 +11,7 @@
#  application:
#  name: doumeemes
  profiles:
    active: pro
    active: dev
  # JSON返回配置
  jackson:
server/service/src/main/java/com/doumee/core/utils/ImageUtil.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,172 @@
package com.doumee.core.utils;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
import javax.net.ssl.HttpsURLConnection;
public class ImageUtil {
    private static List<File> fileList = new ArrayList<>();
    public static void main(String[] args) {
        //convertAllImages("F:\\before.png", "F:\\after.png");
        fileList.add(new File("C:\\Users\\T14\\Desktop\\1\\1.jpg"));
        convertAllImages(fileList);
    }
    /**
     * åŽ»é™¤æ–‡ä»¶åˆ—è¡¨é‡Œå›¾ç‰‡çš„æ°´å°å¹¶æ›¿æ¢
     *
     * @Param fileList æ–‡ä»¶åˆ—表
     */
    public static void convertAllImages(List<File> fileList) {
        try {
            for (File file : fileList) {
                if (!file.getName().endsWith("png") && !file.getName().endsWith("jpg")) {
                    continue;
                }
                BufferedImage bi = ImageIO.read(file); //用ImageIO流读取像素块
                if (bi != null) {
                    removeWatermark(bi);
                    String formatName = file.getName().substring(file.getName().lastIndexOf(".") + 1);//生成的图片格式
                    ImageIO.write(bi, formatName, file);//用ImageIO流生成的处理图替换原图片
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * ä»Žæºç›®å½•获取图片处理后导出到目标目录
     *
     * @param dir     æºç›®å½•
     * @param saveDir ç›®æ ‡ç›®å½•
     */
    private static void convertAllImages(String dir, String saveDir) {
        File dirFile = new File(dir);
        File saveDirFile = new File(saveDir);
        dir = dirFile.getAbsolutePath();
        saveDir = saveDirFile.getAbsolutePath();
        loadImages(new File(dir));
        for (File file : fileList) {
            String filePath = file.getAbsolutePath();
            String dstPath = saveDir + filePath.substring(filePath.indexOf(dir) + dir.length());
            replace(file.getAbsolutePath(), dstPath);
        }
    }
    /**
     * åŠ è½½å›¾ç‰‡
     */
    private static void loadImages(File f) {
        if (f != null) {
            if (f.isDirectory()) {
                File[] fileArray = f.listFiles();
                if (fileArray != null) {
                    for (File file : fileArray) {
                        loadImages(file); //递归调用
                    }
                }
            } else {
                String name = f.getName();
                if (name.endsWith("png") || name.endsWith("jpg")) {
                    fileList.add(f);
                }
            }
        }
    }
    /**
     * ç”Ÿæˆæºå›¾ç‰‡çš„处理图
     *
     * @param srcFile æºå›¾ç‰‡è·¯å¾„
     * @param dstFile ç›®æ ‡å›¾ç‰‡è·¯å¾„
     */
    private static void replace(String srcFile, String dstFile) {
        try {
            URL http;
            if (srcFile.trim().startsWith("https")) {
                http = new URL(srcFile);
                HttpsURLConnection conn = (HttpsURLConnection) http.openConnection();
                conn.setRequestMethod("GET");
            } else if (srcFile.trim().startsWith("http")) {
                http = new URL(srcFile);
                HttpURLConnection conn = (HttpURLConnection) http.openConnection();
                conn.setRequestMethod("GET");
            } else {
                http = new File(srcFile).toURI().toURL();
            }
            BufferedImage bi = ImageIO.read(http.openStream());
            if (bi != null) {
                removeWatermark(bi);
                exportImage(bi, srcFile, dstFile);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * ç”±ImageIO流生成源图片的处理图
     *
     * @param bi       ImageIO
     * @param fileName æºå›¾ç‰‡å¸¦åŽç¼€çš„æ–‡ä»¶å
     * @param dstFile  ç›®æ ‡å›¾ç‰‡è·¯å¾„
     */
    private static void exportImage(BufferedImage bi, String fileName, String dstFile) {
        try {
            String type = fileName.substring(fileName.lastIndexOf(".") + 1);
            Iterator<ImageWriter> it = ImageIO.getImageWritersByFormatName(type);
            ImageWriter writer = it.next();
            File f = new File(dstFile);
            ImageOutputStream ios = ImageIO.createImageOutputStream(f);
            writer.setOutput(ios);
            writer.write(bi);
            bi.flush();
            ios.flush();
            ios.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * åŽ»é™¤æ°´å°
     */
    private static void removeWatermark(BufferedImage bi) {
        Color wColor = new Color(197, 196, 191);
        Color hColor = new Color(140, 88, 100);
//        Color wColor = new Color(254, 254, 254);
//        Color hColor = new Color(197, 196, 191);
        //白底水印
        for (int i = 0; i < bi.getWidth(); i++) {
            for (int j = 0; j < bi.getHeight(); j++) {
                int color = bi.getRGB(i, j);
                Color oriColor = new Color(color);
                int red = oriColor.getRed();
                int greed = oriColor.getGreen();
                int blue = oriColor.getBlue();
                if (red == 254 && greed == 254 && blue == 254) {
                    continue;
                }
                if (red > 220 && greed > 180 && blue > 80) {
                    bi.setRGB(i, j, wColor.getRGB());
                }
                if (red <= 240 && greed >= 200 && blue >= 150) {
                    bi.setRGB(i, j, wColor.getRGB());
                }
            }
        }
    }
}
server/service/src/main/java/com/doumee/service/business/impl/BaseDataServiceImpl.java
@@ -300,7 +300,7 @@
            for(BaseData data :result.getRecords()){
                //多图,英文逗号隔开
                if(StringUtils.isNotBlank(data.getBgImg())){
                    String tImg =  data.getBgImg().replace(",", ",").replace(".avif", "").replace("/n1/jfs/", "/n0/jfs/");
                    String tImg =  data.getBgImg().replace(",", ",").replace(".avif", "").replace("/n1/jfs/", "/imgzone/jfs/");
                    String[] imgs =tImg.split(",");
                    data.setBgImgs(imgs);
@@ -462,7 +462,7 @@
    private int addImg(int i,OssModel ossModel, Integer id,String bgImg,List<Multifile> fileList,List<FileRecord> fileRecords) {
        if(StringUtils.isNotBlank(bgImg)){
            bgImg = bgImg.replace("/n1/jfs/", "/n0/jfs/");
            bgImg = bgImg.replace("/n1/jfs/", "/imgzone/jfs/");
//            String img =getOssImgurl(ossModel, ossModel.getGoodsFolder() ,bgImg);
            String img = getOssImgurlFile(ossModel.getGoodsFolder(), bgImg, null,Constants.TWO,fileRecords);
            if(StringUtils.isNotBlank(img)){
server/zhubo/src/main/java/com/doumee/api/business/WebParamController.java
@@ -31,7 +31,6 @@
    @Autowired
    private WebParamService webParamService;
    @ApiOperation("获取当前登录企业配置信息")
    @GetMapping("/getByLogin")
    public ApiResponse<WebParam> getByLogin() {
server/zhubo/src/main/resources/application.yml
@@ -11,7 +11,7 @@
#  application:
#    name: doumeemes
  profiles:
    active: pro
    active: dev
  # JSON返回配置
  jackson: