Kaynağa Gözat

application mode

sunmingan 4 yıl önce
ebeveyn
işleme
67b8fb6255

+ 11 - 6
UI/src/pages/.umi/router.js

@@ -156,6 +156,11 @@ let routes = [
         "exact": true,
         "component": require('../sellmanage/adminiFans.js').default
       },
+      {
+        "path": "/sellmanage/appManagement",
+        "exact": true,
+        "component": require('../sellmanage/appManagement.js').default
+      },
       {
         "path": "/sellmanage/aterialManagement",
         "exact": true,
@@ -242,14 +247,14 @@ let routes = [
         "component": require('../demo/DTable.js').default
       },
       {
-        "path": "/demo/bird-cascader",
+        "path": "/login",
         "exact": true,
-        "component": require('../demo/bird-cascader.js').default
+        "component": require('../login/index.js').default
       },
       {
-        "path": "/login",
+        "path": "/demo/tabs",
         "exact": true,
-        "component": require('../login/index.js').default
+        "component": require('../demo/tabs.js').default
       },
       {
         "path": "/demo/bird-selector",
@@ -477,9 +482,9 @@ let routes = [
         "component": require('../user/wechatUsers.js').default
       },
       {
-        "path": "/demo/tabs",
+        "path": "/demo/bird-cascader",
         "exact": true,
-        "component": require('../demo/tabs.js').default
+        "component": require('../demo/bird-cascader.js').default
       },
       {
         "component": () => React.createElement(require('D:/home/qiyewechatApp/UI/node_modules/umi-build-dev/lib/plugins/404/NotFound.js').default, { pagesPath: 'src/pages', hasRoutesInConfig: false })

+ 409 - 0
UI/src/pages/sellmanage/appManagement.js

@@ -0,0 +1,409 @@
+import React, { Component } from "react";
+import { BirdGrid } from "components/Grid";
+import { Modal, Tabs, message, Input, Button } from "antd";
+import AutoForm from "components/Grid/BirdGridForm";
+import config from "utils/config";
+import "antd/dist/antd.css";
+import request from "utils/request";
+// import { Button } from "antd/lib/radio";
+
+const { WXMpAPI3, WXMpAPI } = config;
+const { TabPane } = Tabs;
+
+class AddminiFans extends Component {
+  constructor(props) {
+    super(props);
+    this.state = {
+      //点击查看弹窗
+      seeVisiable: false,
+      seeConfirmLoading: false,
+      //设置总分组
+      totalVisiable: false,
+      totalConfirmLoading: false,
+      totalSecret: {},
+      //宽度
+      formOption: [],
+      formOption2: [],
+      formOption3: [],
+      formWidth: 520,
+      formConfirmLoading: false,
+      formOption: { modal: "", title: "" },
+      formOption2: { modal: "", title: "" },
+      formOption3: { modal: "", title: "" }
+    };
+  }
+
+  //点击查看事件
+  seeLinks = () => {
+    // console.log(111111111);
+    this.setState({
+      seeVisiable: true,
+      seeConfirmLoading: true
+    });
+  };
+  /* 点击查看按钮取消事件 */
+  listCancelClick = () => {
+    this.setState({
+      seeVisiable: false,
+      seeConfirmLoading: false
+    });
+  };
+  //点击复制按钮
+  copyLinks = () => {
+    var Url = document.getElementsByClassName("url")[0];
+    // Url.select(); // 选择对
+    // document.execCommand("Copy");
+    console.log("复制成功");
+  };
+
+  /* 弹出框取消事件 */
+  cancelClick() {
+    this.setState({
+      formVisiable: false,
+      formConfirmLoading: false
+    });
+  }
+
+  callback(key) {
+    console.log(key);
+  }
+
+  saveClick(callback) {
+    let self = this;
+    let form = this.refs.autoForm;
+    if (!form.validate()) return;
+
+    let dto = form.state.initValue;
+
+    let extraParams = form.state.extraParams;
+    for (let extra of extraParams) {
+      dto[extra.field] = extra.value;
+    }
+    request({
+      url: WXMpAPI + "/wx/application/save",
+      method: "post",
+      data: dto
+    }).then(function(result) {
+      if (result.success === 1) {
+        message.success("操作成功!");
+        // 操作成功之后
+        if (callback) callback(result);
+        self.setState({
+          formVisiable: false,
+          formConfirmLoading: false
+        });
+        self.refs.gridResource.reload();
+        
+      } else {
+        if (result.message) {
+          message.error(result.message);
+        } else {
+          message.error(result.msg);
+        }
+      }
+    });
+  }
+  render() {
+    let self = this;
+    let gridOptionResource = {
+      title: "图片",
+      pageSize: 10,
+      checkable: false,
+      sortDirection: "asc",
+      url: {
+        read: WXMpAPI + "/wx/application/getAll ",
+        add: WXMpAPI + "/wx/application/save",
+        // edit: WXMpAPI3 + "/wx/application/save"
+        // read: APIV3Auth + "/ums/resource/query",
+        // add: APIV3Auth + "/ums/resource/addResource",
+        // edit: APIV3Auth + "/ums/resource/update"
+      },
+      afterSave: function() {
+        console.log(self.refs.gridResource);
+      },
+      columns: [
+        { title: "应用ID", data: "id", type: "number" },
+        { title: "应用名称", data: "name", type: "text", query: true,editor: { isRequired: true } },
+        { title: "应用图标", data: "img", type: "img", query: false, editor: { isRequired: true, tips: "请上传1:1尺寸的图片" ,action: WXMpAPI + "/wx/file/upload"}, hide: true },
+        { title: "绑定端口图标", data: "img", render: (text, row, index) => (
+            <div key={index}>
+              <div>
+                <img
+                  className="small"
+                  style={{
+                    width: "30px",
+                    height: "30px",
+                    marginLeft: "30px",
+                    marginTop: "10px"
+                  }}
+                  src={row.img}
+                />
+              </div>
+            </div>
+          )
+        },
+        { title: "供应渠道", data: "typeName", type: "dropdown", query: true,source:{multi:false,data:[
+          {label:'亮健优医',value:'0'},
+          {label:'营销平台',value:'1'},
+          {label:'互联网医院',value:'2'},
+          {label:'亮健好药网',value:'3'}
+        ]}, editor: {ap: 'hide'} }
+        ,
+        { title: "供应渠道", data: "type", type: "dropdown", query: true,source:{multi:false,data:[
+          {label:'亮健优医',value:'0'},
+          {label:'营销平台',value:'1'},
+          {label:'互联网医院',value:'2'},
+          {label:'亮健好药网',value:'3'}
+        ]}, editor: { isRequired: true },hide: true }
+        ,
+        { title: "应用类型", data: "appType", type: "dropdown", query: false,source:{multi:false,data:[
+          {label:'公众号H5',value:'1'},
+          {label:'小程序',value:'2'},
+          {label:'APP',value:'3'},
+          {label:'WAP-H5',value:'4'}
+        ]}, editor: { isRequired: true },hide :true }
+        ,{ title: "应用入口", data: "enterUrl", type: "text", query: false,editor: {
+            isRequired: true,
+            tips: "应用入口:点击可直接访问的链接入口,如H5链接"
+          },
+          hide: true
+        },
+        {
+          title: "应用介绍",
+          data: "content",
+          type: "textarea",
+          query: false,
+          editor: {
+            isRequired: false
+          },
+          hide: true
+        }
+        ,{ title: "绑定状态", data: "stateName", type: "text", query: false },
+        { title: "操作选项", type: "command",
+            actions: [
+              {
+                name: "编辑",
+                onClick: data => {
+                  const fields = [
+                    { title: "供应渠道", data: "type", type: "dropdown", query: true, source:{multi:false,data:[
+                      {label:'亮健优医',value:'0'},
+                      {label:'营销平台',value:'1'},
+                      {label:'互联网医院',value:'2'},
+                      {label:'亮健好药网',value:'3'}
+                    ]}, editor: { isRequired: true } },
+                    { title: "应用图标", data: "img", type: "img", editor: { isRequired: true }, query: true },
+                    { title: "应用名称", data: "name", type: "text", editor: { isRequired: true, tips: "微信公众号名称" }, query: true },
+                    { title: "营销短语", data: "phrase", type: "text", editor: { tips: "用于在应用右上角标红提示,引导用户点击使用。如“hot”、“new”等" }, query: true },
+                    { title: "应用入口", data: "enterUrl", type: "text", query: false, editor: { isRequired: true, tips: "应用入口:点击可直接访问的链接入口,如H5链接" }, hide: true },
+                    { title: "应用介绍", data: "content", type: "textarea", editor: {}, query: true }
+                  ];
+      
+                  let formOption = { model: "add", title: "添加应用", fields: fields, value: data,  extraParams: [], sourceData:data };
+      
+                  self.setState({ formVisiable: true, formOption: formOption });
+                }
+              }
+            ]
+        }
+      ],
+      // actions: [
+      //   {
+      //     name: "应用详情",
+      //     onClick: function() {
+           
+      //     }
+      //   }
+      // ]
+    };
+    let messageSetting = {
+      title: "信息设置",
+      pageSize: 10,
+      checkable: false,
+      sortDirection: "asc",
+      url: {
+        // read: APIV3Auth + "/ums/resource/query",
+        add: WXMpAPI + "/ums/resource/addResource",
+        edit: WXMpAPI + "/ums/resource/update",
+        delete: "/test/delete"
+      },
+      afterSave: function() {
+        console.log(self.refs.gridResource);
+      },
+      dataSource: [
+        {
+          id: "001",
+          name1: "用药提醒",
+          name2: "模板信息",
+          name3: "提醒用户用药"
+        }
+      ],
+      columns: [
+        { title: "消息编号", data: "id", type: "number" },
+        {
+          title: "消息名称",
+          data: "name1",
+          type: "text",
+          query: false,
+          editor: { isRequired: true }
+        },
+        // {
+        //   title: "消息类型",
+        //   data: "name2",
+        //   type: "dropdown",
+        //   query: true,
+        //   source: { url: "/ums/resource/parents" },
+        //   editor: { isRequired: true }
+        // },
+        {
+          title: "消息类型",
+          data: "name2",
+          type: "text",
+          query: false,
+          editor: {
+            isRequired: true,
+            tips: "应用入口:点击可直接访问的链接入口,如H5链接"
+          }
+        },
+        {
+          title: "消息用途",
+          data: "name3",
+          type: "textarea",
+          query: false,
+          editor: {
+            isRequired: true
+          }
+        },
+        {
+          title: "操作选项",
+          type: "command"
+        }
+      ]
+    };
+    let releaseChannel = {
+      title: "发布渠道",
+      pageSize: 10,
+      checkable: false,
+      sortDirection: "asc",
+      url: {
+        // read: APIV3Auth + "/ums/resource/query",
+        add: WXMpAPI + "/ums/resource/addResource",
+        edit: WXMpAPI + "/ums/resource/update"
+        // delete: "/test/delete"
+      },
+      afterSave: function() {
+        console.log(self.refs.gridResource);
+      },
+      dataSource: [
+        {
+          id: "001",
+          name1: "亮健优医"
+        }
+      ],
+      columns: [
+        { title: "序号", data: "id", type: "number" },
+        {
+          title: "发布端口",
+          data: "name1",
+          type: "text",
+          query: false
+          // editor: { isRequired: true }
+        },
+        {
+          title: "消息类型",
+          data: "name2",
+          type: "dropdown",
+          query: false,
+          source: { url: "/ums/resource/parents" },
+          editor: { isRequired: true },
+          hide: true
+        },
+        {
+          title: "模板消息ID",
+          data: "names",
+          type: "text",
+          query: false,
+          editor: { isRequired: true },
+          hide: true
+        },
+        {
+          title: "链接",
+          data: "url",
+          render: (text, row, index) => (
+            <div key={index}>
+              <div>
+                <a onClick={this.seeLinks}>查看</a>
+              </div>
+            </div>
+          )
+        },
+        {
+          title: "模板消息配置",
+          type: "command"
+        }
+      ]
+    };
+
+    return (
+      <div>
+        <BirdGrid gridOption={gridOptionResource} ref="gridResource"></BirdGrid>
+
+        {/* {新建端口} */}
+        <Modal
+          title={this.state.formOption.title}
+          width="70%"
+          visible={this.state.formVisiable}
+          onOk={() => this.saveClick()}
+          onCancel={() => this.cancelClick()}
+          confirmLoading={this.state.formConfirmLoading}
+        >
+          <Tabs defaultActiveKey="1">
+            <TabPane tab="基础信息" key="1">
+              <AutoForm formOption={this.state.formOption} ref="autoForm" />
+            </TabPane>
+            <TabPane tab="消息设置" key="2">
+              <BirdGrid
+                gridOption={messageSetting}
+                ref="messageSetting"
+              ></BirdGrid>
+            </TabPane>
+            <TabPane tab="发布渠道" key="3">
+              <BirdGrid
+                gridOption={releaseChannel}
+                ref="releaseChannel"
+              ></BirdGrid>
+            </TabPane>
+          </Tabs>
+        </Modal>
+        {/* 点击查看按钮弹窗 */}
+        <Modal
+          title="应用链接"
+          width={this.state.formWidth}
+          visible={this.state.seeVisiable}
+          onOk={() => this.listClick()}
+          onCancel={() => this.listCancelClick()}
+          footer={null}
+        >
+          <div key="">
+            <p>您可复制链接,放置到对应端口菜单中,如放置到公众号菜单。</p>
+            <textarea
+              style={{ width: "100%" }}
+              type="text"
+              className="url"
+              defaultValue="http://ue.360lj.com/api/Home/Login?identity=0&backurl=http://ue.360lj.com/dist/shortVideo?duankouID=001"
+            />
+            {/* http://ue.360lj.com/api/Home/Login?identity=0&backurl=http://ue.360lj.com/dist/shortVideo?duankouID=001 */}
+            <Button
+              onClick={this.copyLinks()}
+              style={{ marginLeft: "200px", marginTop: "20px" }}
+              type="primary"
+            >
+              复制
+            </Button>
+          </div>
+        </Modal>
+      </div>
+    );
+  }
+}
+
+export default AddminiFans;

+ 7 - 3
mpwechatApp/src/main/java/com/liangjian11/wx/mp/mapper/ApplicationMapper.java

@@ -16,7 +16,7 @@ public interface ApplicationMapper extends BaseMapper<Application> {
      * @param app
      */
     @Insert("INSERT INTO application ([type],[name], [img], [phrase], [enterUrl], [content], [createTime], [updateTime], [state] ,[appType]) VALUES" +
-        " (#{app.type},#{app.name} ,#{app.img}, #{app.phrase}, #{app.enterUrl}, #{app.content}, #{app.createTime}, #{app.updateTime}, #{app.state} ,#{app.appType}})")
+        " (#{app.type},#{app.name} ,#{app.img}, #{app.phrase}, #{app.enterUrl}, #{app.content}, #{app.createTime}, #{app.updateTime}, #{app.state} ,#{app.appType})")
     @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")/*增加这个注解插入记录后会返回自增长的id*/
     void insertAppcation(@Param("app") Application app);
 
@@ -49,8 +49,12 @@ public interface ApplicationMapper extends BaseMapper<Application> {
      * @param size
      * @return
      */
-    @Select("SELECT * from (select  row_number() over (  order by u.createTime DESC)  as rownum,u.* from application u ${sqlStr} ) A where A.rownum>#{index} AND A.rownum<#{size} ")
-    List<Application> queryExternalList(@Param("sqlStr") String sqlStr, @Param("index") Integer index, @Param("size") Integer size);
+    @Select("SELECT * from (select  row_number() over (  order by u.createTime DESC)  as rownum,u.*" +
+        ",case type when '0' then '亮健优医' when '1' then '营销平台' when '2' then '互联网医院' when '3' then '亮健好药网' end typeName" +
+        ",case appType when '1' then '公众号H5' when '2' then '小程序' when '3' then 'APP' when '4' then 'WAP-H5' end appTypeName" +
+        ",case state when '0' then '正常' when '1' then '下架' end stateName" +
+        " from application u ${sqlStr} ) A where A.rownum>#{index} AND A.rownum<#{size} ")
+    List<Map<String,Object>> queryExternalList(@Param("sqlStr") String sqlStr, @Param("index") Integer index, @Param("size") Integer size);
 
     /**
      * 根据条件查询数量

+ 22 - 3
mpwechatApp/src/main/java/com/liangjian11/wx/mp/service/impl/ApplicationServiceImpl.java

@@ -6,11 +6,14 @@ import com.liangjian11.wx.mp.service.ApplicationService;
 import com.liangjian11.wx.mp.utils.DateUtil;
 import com.liangjian11.wx.mp.utils.FiltersData;
 import com.liangjian11.wx.mp.utils.ResultInfo;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class ApplicationServiceImpl implements ApplicationService {
@@ -18,6 +21,9 @@ public class ApplicationServiceImpl implements ApplicationService {
     @Autowired
     ApplicationMapper appMapper;
 
+    @Value("${project.weburl}")
+    private String webUrl;
+
     @Override
     public void insertInfo(Application app) throws Exception {
         appMapper.insert(app);
@@ -30,12 +36,15 @@ public class ApplicationServiceImpl implements ApplicationService {
         String sqlStr=data.getFilterString();
         Integer totalCount=this.appMapper.queryExternalCount(sqlStr);
 
-        List<Application> list = new ArrayList<>();
+        List<Map<String,Object>> listMap = new ArrayList<>();
         if(totalCount != null && totalCount > 0){
-            list = this.appMapper.queryExternalList(sqlStr,start,end);
+            listMap = this.appMapper.queryExternalList(sqlStr,start,end);
+            for (Map m: listMap) {
+                m.put("img",webUrl + m.get("img"));
+            }
         }
         ResultInfo result = new ResultInfo(ResultInfo.TYPE_RESULT_SUCCESS,100,"操作成功!");
-        result.setItems(list);
+        result.setItems(listMap);
         result.setTotalCount(totalCount);
         return result;
     }
@@ -50,8 +59,18 @@ public class ApplicationServiceImpl implements ApplicationService {
         /**
          * 业务操作
          */
+        // 图片处理
+        String imgUrl = app.getImg();
+        if(StringUtils.isNotBlank(imgUrl)){
+            if(imgUrl.indexOf(webUrl) > -1){
+                String newPath = imgUrl.replaceAll(webUrl,"");
+                app.setImg(newPath);
+            }
+        }
+
         if(app.getId() == null){
             //新增
+            app.setState("0"); //默认状态为正常
             app.setCreateTime(DateUtil.getNowDateTimeStr());
             app.setUpdateTime(DateUtil.getNowDateTimeStr());
             appMapper.insertAppcation(app);