Explorar el Código

portal首页主题设置

yanym hace 6 meses
padre
commit
50d0b3b71a

+ 3 - 2
suishenbang-admin/src/main/resources/application-uat.yml

@@ -9,7 +9,8 @@ ruoyi:
   # 实例演示开关
   demoEnabled: true
   # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
-  profile: /home/admin/project/file
+#  profile: /home/admin/project/file
+  profile: D:/ruoyi/uploadPath
   # 获取ip地址开关
   addressEnabled: false
   cloudPath: http://127.0.0.1:8000/
@@ -108,7 +109,7 @@ spring:
     #邮件服务器地址
     host: mail.dgtis.com
     #端口号
-    port: 25
+    port: 10002
     #发送者邮箱地址
     username: dgtmail@dgtis.com
     #邮箱的授权码

+ 1 - 1
suishenbang-admin/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 spring:
   profiles: 
-    active: dev
+    active: uat
 
 #开发环境dev 测试环境test 正式环境prod  启动时可以设置参数Java -jar xxxxxx.jar spring.profiles.actiove=prod

+ 3 - 2
suishenbang-api/src/main/resources/application-uat.yml

@@ -7,7 +7,8 @@ ruoyi:
   # 版权年份
   copyrightYear: 2020
   # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
-  profile: /home/admin/project/file
+#  profile: /home/admin/project/file
+  profile: D:/ruoyi/uploadPath
   # 获取ip地址开关
   addressEnabled: false
   #是否开启swagger
@@ -30,7 +31,7 @@ libang:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为80
-  port: 10001
+  port: 10003
   servlet:
     # 应用的访问路径
     context-path: /wxportal-api

+ 1 - 1
suishenbang-api/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 spring:
   profiles:
-    active: dev
+    active: uat
 
 #开发环境dev 测试环境test 正式环境prod  启动时可以设置参数Java -jar xxxxxx.jar spring.profiles.actiove=prod

+ 10 - 0
suishenbang-wxportal/suishenbang-wxportal-manager/src/main/java/com/dgtly/wxportal/controller/WxMagnetController.java

@@ -82,6 +82,16 @@ public class WxMagnetController extends BaseController
         return prefix + "/add";
     }
 
+    /**
+     * 新增主题
+     */
+    @GetMapping("/themeAdd")
+    public String themeAdd()
+    {
+
+        return prefix + "/themeAdd";
+    }
+
     /**
      * 新增保存磁贴
      */

+ 288 - 0
suishenbang-wxportal/suishenbang-wxportal-manager/src/main/resources/templates/wxportal/magnet/themeAdd.html

@@ -0,0 +1,288 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('主题配置')" />
+    <th:block th:include="include :: datetimepicker-css" />
+    <th:block th:include="include :: bootstrap-select-css" />
+    <th:block th:include="include :: cropbox-css"/>
+    <style>
+        .file-wraps{
+            width: 80px;
+            height: 80px;
+            flex-direction: row;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            background-color: #ffffff;
+            border: 1px solid #f5f5f5;
+            position: relative;
+        }
+        .file-wraps input{
+            position: absolute;
+            top: 0;
+            bottom: 0;
+            left: 0;
+            right: 0;
+            opacity: 0;
+        }
+        .file-wraps-small-icon{
+            width: 50px;
+            height: 50px;
+            flex-direction: row;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            background-color: #ffffff;
+            border: 1px solid #f5f5f5;
+            position: relative;
+        }
+        .file-wraps-small-icon input{
+            position: absolute;
+            top: 0;
+            bottom: 0;
+            left: 0;
+            right: 0;
+            opacity: 0;
+        }
+        .smallIconBox{
+            flex-direction: row;
+            display: flex;
+            align-items: center;
+            position: relative;
+        }
+        .smallIconItem{
+            width: 80px;
+            height: 80px;
+            flex-direction: column;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+        }
+        .activityIconBox{
+            flex-direction: row;
+            display: flex;
+            align-items: center;
+            position: relative;
+        }
+        .activityIconItem{
+            width: 50px;
+            height: 50px;
+            flex-direction: column;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            position: relative;
+        }
+    </style>
+</head>
+<body class="white-bg">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+    <form class="form-horizontal m" id="form-configuration-add">
+        <div class="form-group" id="bgImageItem">
+            <label class="col-sm-3 control-label">门户背景:</label>
+            <div class="col-sm-8">
+                <div class="file-wraps">
+                    <div id="bgImageDiv" style="width: 80px;height: 80px;display: none;"></div>
+                    <i id="bgImageIcon" class="fa fa-plus" style="font-size: 40px"></i>
+                    <input type="file" class="uploadImage" id="bgImage" name="bgImage" accept="image/*"/>
+                </div>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">小图标设置:</label>
+            <div class="col-sm-8">
+                <div class="smallIconBox">
+                    <div class="smallIconItem" th:each="dict : ${@dict.getType('home_icon_type')}">
+                        <div class="file-wraps-small-icon">
+                            <div th:id="${dict.dictValue}" style="width: 50px;height: 50px;display: none;"></div>
+                            <i th:id="${dict.dictValue}+'Icon'" class="fa fa-plus" style="font-size: 30px"></i>
+                            <input type="file" class="uploadImage" th:id="${dict.dictCode}" th:name="${dict.dictValue}" accept="image/*"/>
+                        </div>
+                        <span th:text="${dict.dictLabel}" style="margin-top: 10px;"></span>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">活动图标设置:</label>
+            <div class="col-sm-8">
+                <div class="activityIconBox">
+                    <div class="activityIconItem">
+                        <!--<img src="" style="width: 50px;height: 50px;">-->
+                        <i class="fa"></i>
+                    </div>
+                </div>
+                <div id="activityImageDiv" style="width: 50px;height: 50px;display: none;"></div>
+                <div class="file-wraps-small-icon">
+                    <i id="activityImageIcon" class="fa fa-plus" style="font-size: 30px"></i>
+                    <input type="file" class="uploadImage" id="activityImage" name="activityImage" accept="image/*"/>
+                </div>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">活动图标开始时间:</label>
+            <div class="col-sm-8">
+                <input id="alertStartTime" name="alertStartTime" class="form-control" type="datetime-local">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">活动图标结束时间:</label>
+            <div class="col-sm-8">
+                <input id="alertEndTime" name="alertEndTime" class="form-control" type="datetime-local">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">提示文字:</label>
+            <div class="col-sm-8">
+                <input id="alertTitle" name="alertTitle" class="form-control" type="text">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">提示文字颜色:</label>
+            <div class="col-sm-8">
+                <input id="alertTitleColor" name="alertTitleColor" class="form-control" type="text">
+            </div>
+        </div>
+    </form>
+</div>
+<th:block th:include="include :: footer" />
+<th:block th:include="include :: datetimepicker-js" />
+<th:block th:include="include :: bootstrap-select-js" />
+<th:block th:include="include :: cropbox-js"/>
+<script type="text/javascript">
+    var prefix = ctx + "system/configuration"
+    var prefixEdit = "http://localhost:10000/oneportal/wxportal/magnet"
+    // var getCompanyListPrefix = "http://localhost:10001/wxportal-api/sysuser/searchOrg";
+    var getCompanyListPrefix = "https://suishenbangtest.nipponpaint.com.cn/wxportal-api/sysuser/searchOrg";
+
+    var bgImageUrl;
+    var smallImageUrlArray = {};
+    var activityImageUrlArray = [];
+    var options = {
+        thumbBox: '.thumbBox',
+        spinner: '.spinner',
+        imgSrc: ctx + 'img/profile.jpg'
+    }
+
+    $(document).ready(function () {
+
+    })
+
+    $('.uploadImage').on('change', function (res) {
+        var reader = new FileReader();
+        reader.onload = function (e) {
+            options.imgSrc = e.target.result;
+            //根据MIME判断上传的文件是不是图片类型
+            if ((options.imgSrc).indexOf("image/") == -1) {
+                $.modal.alertWarning("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
+            }
+        }
+        reader.readAsDataURL(this.files[0]);
+        upBg(this.files[0],res.currentTarget.name);
+    })
+
+    $("#alertStartTime").on('change',function () {
+        if ($(this).val() != -1){
+            var startTimeChange1 = $('#alertStartTime').val().replace('T',' ');
+            var endTimeChange1 = $('#alertEndTime').val().replace('T',' ');
+            if (new Date(startTimeChange1).getTime() - new Date(endTimeChange1).getTime() >= 0){
+                $.modal.alertWarning("弹框结束时间不能小于开始时间");
+            }
+        }
+    })
+
+    $("#alertEndTime").on('change',function () {
+        if ($(this).val() != -1){
+            var startTimeChange2 = $('#alertStartTime').val().replace('T',' ');
+            var endTimeChange2 = $('#alertEndTime').val().replace('T',' ');
+            if (new Date(startTimeChange2).getTime() - new Date(endTimeChange2).getTime() >= 0){
+                $.modal.alertWarning("弹框结束时间不能小于开始时间");
+            }
+        }
+    })
+
+    $("#form-configuration-add").validate({
+        focusCleanup: true,
+        // rules:{
+        //     alertStartTime:{
+        //         required:true
+        //     },
+        //     alertEndTime:{
+        //         required:true
+        //     }
+        // },
+    });
+
+    function upBg(imgFile,imgType) {
+        var formdata = new FormData();
+        formdata.append("file", imgFile);
+        $.ajax({
+            url: ctx + "common/upload",
+            data: formdata,
+            type: "post",
+            processData: false,
+            contentType: false,
+            success: function (result) {
+                if (result.code == 0) {
+                    if (imgType == 'bgImage'){
+                        bgImageUrl = result.data.url;
+                        $("#bgImageDiv").html("<img src='" + result.data.url + "' style='width;100%;height:100%;'>");
+                        document.getElementById("bgImageDiv").style.display = 'block';
+                        document.getElementById("bgImageIcon").style.display = 'none';
+                    } else if (imgType == 'activityImage'){
+                        activityImageUrlArray.push(result.data.url);
+                        console.log('activityImageUrlArray',activityImageUrlArray);
+                        $("#activityImageDiv").html("<img src='" + result.data.url + "' style='width;100%;height:100%;'>");
+                        document.getElementById("activityImageDiv").style.display = 'block';
+                    } else {
+                        smallImageUrlArray[imgType] = result.data.url;
+                        $("#"+imgType).html("<img src='" + result.data.url + "' style='width;100%;height:100%;'>");
+                        document.getElementById(imgType).style.display = 'block';
+                        document.getElementById(imgType+'Icon').style.display = 'none';
+                    }
+                } else {
+                    $.modal.alertWarning(result.msg);
+                }
+            }
+        })
+    }
+
+    function submitHandler() {
+        if ($.validate.form()) {
+            var alertTitle = $('#alertTitle').val();
+            var alertTitleColor = $('#alertTitleColor').val();
+            var startTime = $('#alertStartTime').val().replace('T',' ');
+            var endTime = $('#alertEndTime').val().replace('T',' ');
+            if (new Date(startTime).getTime() - new Date(endTime).getTime() >= 0){
+                $.modal.alertWarning("弹框结束时间不能小于开始时间");
+            }else {
+                var objSubmit = {
+                    portal_background:bgImageUrl,
+                    // small_icon_extra:smallImageUrlArray,
+                    bottom_prompt_text:alertTitle,
+                    prompt_text_color:alertTitleColor
+                    // activity_icon_starttime:startTime,
+                    // activity_icon_endtime:endTime
+                    // activity_icon_extra:activityImageUrlArray
+                }
+                console.log('objSubmit', objSubmit);
+                var configSubmit = {
+                    url: prefixEdit + "/editHome",
+                    type: "post",
+                    dataType: "json",
+                    data: objSubmit,
+                    beforeSend: function () {
+                        $.modal.loading("正在处理中,请稍后...");
+                    },
+                    success:function (result) {
+                        $.modal.closeLoading();
+                        $.operate.successCallback(result);
+                    }
+                }
+                $.ajax(configSubmit)
+            }
+        }
+    }
+</script>
+</body>
+</html>

+ 415 - 0
suishenbang-wxportal/suishenbang-wxportal-manager/src/main/resources/templates/wxportal/magnet/themeEdit.html

@@ -0,0 +1,415 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <th:block th:include="include :: header('修改磁贴')"/>
+    <th:block th:include="include :: cropbox-css"/>
+    <style>
+        .bg-sm {
+            width: 119px;
+            height: 109px;
+            font-size: 75px;
+            color: black;
+            text-align: center
+        }
+        .bg-md {
+            width: 180px;
+            height: 150px;
+            font-size: 105px;
+            color: black;
+            text-align: center
+        }
+        .bg-lg {
+            width: 365px;
+            height: 160px;
+            font-size: 115px;
+            color: black;
+            text-align: center
+        }
+        .thumbBox_S {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            width: 238px;
+            height: 218px;
+            margin-left: -119px;
+            margin-top: -109px;
+            box-sizing: border-box;
+            border: 1px solid rgb(102, 102, 102);
+            box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
+            background: none repeat scroll 0% 0% transparent;
+        }
+        .thumbBox_M {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            width: 360px;
+            height: 300px;
+            margin-left: -180px;
+            margin-top: -150px;
+            box-sizing: border-box;
+            border: 1px solid rgb(102, 102, 102);
+            box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
+            background: none repeat scroll 0% 0% transparent;
+        }
+        .thumbBox_L {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            width: 730px;
+            height: 320px;
+            margin-left: -365px;
+            margin-top: -160px;
+            box-sizing: border-box;
+            border: 1px solid rgb(102, 102, 102);
+            box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
+            background: none repeat scroll 0% 0% transparent;
+        }
+        .imageBox_S {
+            margin: 0 auto;
+            width: 400px;
+        }
+        .imageBox_M {
+            margin: 0 auto;
+            width: 400px;
+        }
+        .imageBox_L {
+            margin: 0 auto;
+            width: 800px;
+        }
+    </style>
+</head>
+<body class="white-bg">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="div1">
+    <form class="form-horizontal m" id="form-magnet-edit" th:object="${wxMagnet}">
+        <input type="hidden" name="magnetId" th:field="*{magnetId}">
+
+        <div class="form-group">
+            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>磁贴类型:</label>
+            <div class="col-sm-8">
+                <select name="magnetType" id="sel_magnetType" class="form-control m-b"
+                        th:with="type=${@dict.getType('sys_magnet_type')}"
+                        onchange="javascript:magnetTypeChange()">
+                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
+                            th:field="*{magnetType}"></option>
+                </select>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>磁贴名称:</label>
+            <div class="col-sm-8">
+                <input class="form-control" type="text" name="magnetName" id="magnetName" th:field="*{magnetName}"
+                       required>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>显示排序:</label>
+            <div class="col-sm-8">
+                <input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>磁贴尺寸:</label>
+            <div class="col-sm-8">
+                <select name="magnetSize" id="sel_magnetSize" class="form-control m-b"
+                        th:with="type=${@dict.getType('wx_magnet_size')}" onchange="javascript:sizeChange()">
+                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
+                            th:field="*{magnetSize}"></option>
+                </select>
+            </div>
+        </div>
+        <div class="form-group" style="display: none;">
+            <label class="col-sm-3 control-label"><span style="color: red; ">*</span>请求地址:</label>
+            <div class="col-sm-8">
+                <input id="url" name="url" class="form-control" type="text" th:field="*{url}" required>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">背景图片:</label>
+            <div class="col-sm-8">
+                <input id="input_bgUrl" name="bgUrl" th:field="*{bgUrl}" type="hidden"/>
+                <div class="thumbnail slideshow_span" id="div-bgUrl" onclick="javascript:bgUpload('bg')">
+                    <img th:src="@{*{bgUrl}}" style="width:100%;height:100%;">
+                </div>
+            </div>
+        </div>
+
+        <div class="form-group" style="display: none;">
+            <label class="col-sm-3 control-label">小程序二维码:</label>
+            <div class="col-sm-8">
+                <input id="input_appletQrUrl" name="appletQrUrl" th:field="*{appletQrUrl}" type="hidden"/>
+                <div class="thumbnail slideshow_span bg-sm" id="div-appletQrUrl" onclick="javascript:bgUpload('qr')">
+                    <img th:src="@{*{appletQrUrl}}" style="width:100%;height:100%;">
+                </div>
+            </div>
+        </div>
+
+        <div class="form-group">
+            <label class="col-sm-3 control-label">菜单状态:</label>
+            <div class="col-sm-8">
+                <div class="radio-box" th:each="dict : ${@dict.getType('sys_show_hide')}">
+                    <input type="radio" th:id="${dict.dictCode}" name="visible" th:value="${dict.dictValue}"
+                           th:field="*{visible}">
+                    <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
+                </div>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">磁贴标记父结构:</label>
+            <div class="col-sm-8">
+                <input class="form-control" type="text" name="fatherMagnet" id="fatherMagnet" th:field="*{fatherMagnet}"
+                       >
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">备注:</label>
+            <div class="col-sm-8">
+                <textarea id="remark" name="remark" class="form-control" type="text" th:field="*{remark}"></textarea>
+            </div>
+        </div>
+    </form>
+</div>
+
+<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="div2" style="display: none">
+    <div id="imageBox">
+        <div id="thumbBox"></div>
+        <div class="spinner" style="display: none">Loading...</div>
+    </div>
+    <div class="action" style="margin: 10px auto;">
+        <div class="new-contentarea tc">
+            <a href="javascript:void(0)" class="upload-img"> <label for="avatar">选择图片</label> </a>
+            <input type="file" class="" name="avatar" id="avatar" accept="image/*"/>
+        </div>
+        <input type="button" id="submitbuttonBg" onclick="upBg()" class="btn-info Btnsty_peyton" value="上传"/>
+        <input type="button" id="submitbuttonQr" onclick="upQr()" class="btn-info Btnsty_peyton" value="上传"/>
+        <input type="button" onclick="back()" class="btn-info Btnsty_peyton " value="返回"/>
+    </div>
+
+</div>
+<th:block th:include="include :: footer"/>
+<th:block th:include="include :: cropbox-js"/>
+<script th:inline="javascript">
+    var prefix = ctx + "wxportal/magnet";
+    var cropper;
+    var size = "S";
+    var magnet_type = "0";
+    var options = {
+        thumbBox: '.thumbBox_' + size,
+        spinner: '.spinner',
+        imgSrc: ctx + 'img/profile.jpg'
+    }
+    $(function () {
+        var magnetType = $("#sel_magnetType").val();
+        var $appletQrUrl = $("#input_appletQrUrl").parents(".form-group");
+        var $url = $("#url").parents(".form-group");
+        if (magnetType == "1") {
+            $appletQrUrl.removeAttr('disabled');
+            $appletQrUrl.show();
+            $url.attr('disabled', 'disabled');
+            $url.hide();
+        } else {
+            $url.removeAttr('disabled');
+            $url.show();
+            $appletQrUrl.attr('disabled', 'disabled');
+            $appletQrUrl.hide();
+        }
+        $("#form-magnet-edit").validate({
+            onkeyup: false,
+            rules: {
+                url: {
+                    required: true,
+                },
+                magnetName: {
+                    remote: {
+                        url: prefix + "/checkMagnetNameUnique",
+                        type: "post",
+                        dataType: "json",
+                        data: {
+                            "magnetId": function () {
+                                return $("#magnetId").val();
+                            },
+                            "magnetName": function () {
+                                return $.common.trim($("#magnetName").val());
+                            }
+                        },
+                        dataFilter: function (data, type) {
+                            return $.validate.unique(data);
+                        }
+                    }
+                },
+                orderNum: {
+                    digits: true
+                },
+
+            },
+            messages: {
+                "magnetName": {
+                    remote: "菜单已经存在"
+                }
+            },
+            focusCleanup: true
+        });
+
+        $('#avatar').on('change', function () {
+            var reader = new FileReader();
+            reader.onload = function (e) {
+                options.imgSrc = e.target.result;
+                //根据MIME判断上传的文件是不是图片类型
+                if ((options.imgSrc).indexOf("image/") == -1) {
+                    $.modal.alertWarning("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
+                } else {
+                    cropper = $('.imageBox').cropbox(options);
+                }
+            }
+            reader.readAsDataURL(this.files[0]);
+        })
+
+
+        $('#btnZoomIn').on('click', function () {
+            cropper.zoomIn();
+        })
+
+        $('#btnZoomOut').on('click', function () {
+            cropper.zoomOut();
+        })
+
+
+        sizeChange();
+    });
+
+    function submitHandler() {
+        if ($.validate.form()) {
+            $.operate.save(prefix + "/edit", $('#form-magnet-edit').serialize());
+        }
+    }
+
+    function back() {
+        $("#div1").show();
+        $("#div2").hide();
+    }
+
+    /*上传背景图片*/
+    function bgUpload(value) {
+        var imgUrl = null;
+        if (value == 'bg') {
+            $("#submitbuttonQr").hide();
+            $("#submitbuttonBg").show();
+            imgUrl = ctx + $("#input_bgUrl").val();
+        } else if (value == 'qr') {
+            $("#submitbuttonBg").hide();
+            $("#submitbuttonQr").show();
+            imgUrl = ctx + $("#input_appletQrUrl").val();
+        }
+        $("#div1").hide();
+        $("#div2").show();
+
+        if (imgUrl == null || imgUrl == '') {
+            imgUrl = ctx + 'img/profile.jpg';
+        }
+        options = {
+            thumbBox: '.thumbBox_' + size,
+            spinner: '.spinner',
+            imgSrc: imgUrl
+        }
+        cropper = $('.imageBox').cropbox(options);
+    }
+
+    function upBg() {
+        var img = cropper.getBlob();
+        var formdata = new FormData();
+        formdata.append("file", img);
+        $.ajax({
+            url: ctx + "common/upload",
+            data: formdata,
+            type: "post",
+            processData: false,
+            contentType: false,
+            success: function (result) {
+                if (result.code == 0) {
+                    $("#input_bgUrl").val(result.data.fileName);
+                    $("#div-bgUrl").html("<img src='" + result.data.url + "' style='width:100%;height:100%;'>");
+                    $("#div1").show();
+                    $("#div2").hide();
+                } else {
+                    $("#div1").show();
+                    $("#div2").hide();
+                    $.modal.alertWarning(result.msg);
+                }
+
+            }
+        })
+    }
+
+    function upQr() {
+        var img = cropper.getBlob();
+        var formdata = new FormData();
+        formdata.append("file", img);
+        $.ajax({
+            url: ctx + "common/upload",
+            data: formdata,
+            type: "post",
+            processData: false,
+            contentType: false,
+            success: function (result) {
+                if (result.code == 0) {
+                    $("#input_appletQrUrl").val(result.data.fileName);
+                    $("#div-appletQrUrl").html("<img src='" + result.data.url + "' style='width:100%;height:100%;'>");
+                    $("#div1").show();
+                    $("#div2").hide();
+                } else {
+                    $("#div1").show();
+                    $("#div2").hide();
+                    $.modal.alertWarning(result.msg);
+                }
+
+            }
+        })
+    }
+
+    function sizeChange() {
+        size = $("#sel_magnetSize").val();
+        $("#div-bgUrl").removeClass("bg-sm");
+        $("#div-bgUrl").removeClass("bg-md");
+        $("#div-bgUrl").removeClass("bg-lg");
+        $("#imageBox").removeClass();
+        $("#thumbBox").removeClass();
+        if (size == "l" || size == "L") {
+            $("#div-bgUrl").addClass("bg-lg");
+            size = "L";
+            $("#imageBox").addClass("imageBox imageBox_L");
+            $("#thumbBox").addClass("thumbBox_L");
+        } else if (size == "m" || size == "M") {
+            $("#div-bgUrl").addClass("bg-md");
+            size = "M";
+            $("#imageBox").addClass("imageBox imageBox_M");
+            $("#thumbBox").addClass("thumbBox_M");
+        } else if (size == "s" || size == "S") {
+            $("#div-bgUrl").addClass("bg-sm");
+            size = "S";
+            $("#imageBox").addClass("imageBox imageBox_S");
+            $("#thumbBox").addClass("thumbBox_S");
+        }
+    }
+
+    function magnetTypeChange() {
+        magnet_type = $("#sel_magnetType").val();
+        var $appletQrUrl = $("#input_appletQrUrl").parents(".form-group");
+        var $url = $("#url").parents(".form-group");
+        if (magnet_type == "1") {
+            $("#imageBox").addClass("imageBox imageBox_S");
+            $("#thumbBox").addClass("thumbBox_S");
+            $appletQrUrl.removeAttr('disabled');
+            $appletQrUrl.show();
+            $url.attr('disabled', 'disabled');
+            $url.hide();
+        } else {
+            $appletQrUrl.attr('disabled', 'disabled');
+            $appletQrUrl.hide();
+            $("#input_appletQrUrl").val("");
+            $url.removeAttr('disabled');
+            $url.show();
+        }
+    }
+
+</script>
+</body>
+</html>

+ 10 - 3
suishenbang-wxportal/suishenbang-wxportal-manager/src/main/resources/templates/wxportal/magnet/wxMagnet.html

@@ -55,6 +55,9 @@
 			<a class="btn btn-success" onclick="addNew()" shiro:hasPermission="wxportal:magnet:add">
 				<i class="fa fa-plus"></i> 新增
 			</a>
+			<a class="btn btn-success" onclick="setTheme()" shiro:hasPermission="wxportal:magnet:themeAdd">
+				主题设置
+			</a>
 			<!--<a class="btn btn-primary" onclick="$.operate.editFull()" shiro:hasPermission="wxportal:magnet:edit">-->
 			<!--<i class="fa fa-edit"></i> 修改-->
 			<!--</a>-->
@@ -183,14 +186,18 @@
 
 	function addNew(){
 		$.modal.openFull("添加" + $.table._option.modalName, $.operate.addUrl(0));
-
 	}
 
 	function editMagnet(id){
-
 		$.modal.openFull("修改" + $.table._option.modalName, $.operate.editUrl(id));
-
 	}
+
+    function setTheme(){
+	    console.log(1,$.operate.addUrl(0))
+        console.log(2,$.operate.editUrl(1))
+        console.log(3,prefix)
+        $.modal.openFull("主题设置", prefix + '/themeAdd');
+    }
 </script>
 </body>
 </html>