|
@@ -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;
|