test01 4 years ago
parent
commit
fd25717005

+ 9 - 2
js/admin/index/content.jsx

@@ -57,8 +57,13 @@ import Product from '@/administration/weapp/product';
 import Pay from '@/administration/weapp/pay';
 //产品类型
 import ProductSort from '@/administration/weapp/productSort';
+//产品分享
+import WeappShare from '@/administration/weapp/weappShare';
 
-
+// 友情链接
+import Links from '../../component/administration/linkCity/links';
+// 热门城市
+import Cities from '../../component/administration/linkCity/cities';
 const { Content } = Layout;
 
 export default class ContentRouter extends React.Component {
@@ -89,7 +94,9 @@ export default class ContentRouter extends React.Component {
                     <Route path="/pay" component={Pay} />
                     <Route path="/product" component={Product} />
                     <Route path="/productSort" component={ProductSort} />
-
+                    <Route path="/weappShare" component={WeappShare} />
+                    <Route path="/links" component={Links} />
+                    <Route path="/cities" component={Cities} />
 
                     <Route path="/jzmList" component={JzmList} />
                     <Route path="/mcjList" component={McjList} />

+ 15 - 0
js/admin/menu.jsx

@@ -51,9 +51,24 @@ module.exports = {
             icon: "database"
         },
         {
+            name: "微信分享",
+            url: "weappShare",
+            icon: "database"
+        },
+        {
             name: "产品类型管理",
             url: "productSort",
             icon: "database"
+        },
+        {
+            name: "友情链接管理",
+            url: "links",
+            icon: "database"
+        },
+        {
+            name: "热门城市管理",
+            url: "cities",
+            icon: "database"
         }
     ]
 };

+ 83 - 2
js/component/administration/business/customers.jsx

@@ -38,7 +38,8 @@ const Customers = Form.create()(
           pageSize: this.state.pagination.pageSize,
           name: this.state.name,
           startTime: this.state.time[0],
-          endTime: this.state.time[1]
+          endTime: this.state.time[1],
+          status:this.state.statusView
         },
         success: function(data) {
           let theArr = [];
@@ -56,7 +57,7 @@ const Customers = Form.create()(
                 mobile: thisdata.mobile,
                 status: thisdata.status,
                 remark: thisdata.remark,
-                createTimes: thisdata.createTimes
+                createTimes: thisdata.createTimes,
               });
             }
             this.state.pagination.current = data.data.pageNo;
@@ -199,6 +200,68 @@ const Customers = Form.create()(
             status: []
         })
     },
+    // 导出
+    exportExec() {
+      message.config({
+        duration: 20,
+      });
+      let loading = message.loading("下载中...");
+      this.setState({
+        exportPendingLoading: true,
+      });
+  
+      let data = {
+          name: this.state.name || undefined,
+          startTime: this.state.time[0] || undefined,
+          endTime: this.state.time[1] || undefined,
+          status:this.state.statusView || undefined
+      };
+      for (let i of Object.keys(data)) {
+        if (i === "status" || i === "clockIn") {
+          if (isNaN(parseInt(data[i]))) {
+            delete data[i];
+          }
+        } else if (!data[i]) {
+          delete data[i];
+        }
+      }
+      // console.log(data);
+      // debugger
+      // let obj1 = JSON.parse(JSON.stringify(this.state.columns));
+      // console.log(obj1);
+      // data = Object.assign(data, obj1);
+  
+      // if (this.props.exportExecProcessing) {
+      //   data = this.props.exportExecProcessing(data);
+      // }
+      // console.log(data);
+      $.ajax({
+        method: "get",
+        dataType: "json",
+        crossDomain: false,
+        url: globalConfig.context +'/api/admin/visitingCustomers/listVisitingCustomers/export',
+        data,
+        success: function (data) {
+          if (data.error.length === 0) {
+            this.download(data.data.data);
+            // console.log(data.data.data);
+          } else {
+            message.warning(data.error[0].message);
+          }
+        }.bind(this),
+      }).always(
+        function () {
+          loading();
+          this.setState({
+            exportPendingLoading: false,
+          });
+        }.bind(this)
+      );
+    },
+    download(fileName) {
+      window.location.href =
+        globalConfig.context + "/open/download?fileName=" + fileName+"&delete=true";
+    },
     delete(record) {
         this.setState({
           loading: true
@@ -269,6 +332,7 @@ const Customers = Form.create()(
     reset() {
       this.state.time = []
       this.state.name = undefined
+      this.state.statusView = undefined
       this.loadData()
     },
 
@@ -291,6 +355,20 @@ const Customers = Form.create()(
                   this.setState({ name: e.target.value });
                 }}
               />
+               {/* 互链 */}
+            <Select
+              placeholder="是否查看"
+              style={{ width: 150 }}
+              value={this.state.statusView}
+              onChange={(e) => {
+                this.setState({
+                  statusView: e,
+                });
+              }}
+            >
+              <Option value="1">是,已查看</Option>
+              <Option value="0">否,待查看</Option>
+            </Select>
               <span style={{ fontSize: 14 }} >提交日期:</span>
               <RangePicker
                 value={[
@@ -311,6 +389,9 @@ const Customers = Form.create()(
               <Button onClick={this.reset} style={{ marginRight: "10px" }}>
                 重置
               </Button>
+              <Button loading={this.state.exportPendingLoading} onClick={this.exportExec} style={{ marginRight: "10px" }}>
+                导出
+              </Button>
             </div>
             <div className="patent-table">
               <SpinContainer spinning={this.state.loading}>

+ 614 - 0
js/component/administration/linkCity/Cities.jsx

@@ -0,0 +1,614 @@
+import React, { Component } from "react";
+import {
+  Table,
+  Modal,
+  message,
+  Spin,
+  Input,
+  Select,
+  Button,
+  Form,
+  Upload,
+  Popconfirm,
+  AutoComplete,
+  DatePicker,
+  Col,
+  Tabs,
+  Tag,
+  Radio,
+  Group,
+  InputNumber,
+} from "antd";
+import SpinContainer from "../../SpinContainer";
+import $ from "jquery/src/ajax";
+const { TextArea } = Input;
+const RadioGroup = Radio.Group;
+const Option = AutoComplete.Option;
+const confirm = Modal.confirm;
+class Cities extends Component {
+  constructor(props) {
+    super(props);
+    this.state = {
+      dataView: null,
+      PublicView: null,
+      contentView: "",
+      remarksView: "",
+      hid:'none',
+      contentViewLength: 0,
+      contentViewLength1: 0,
+      pagination: {
+        defaultCurrent: 1,
+        defaultPageSize: 10,
+        showQuickJumper: true,
+        pageSize: 10,
+        onChange: function(page) {
+          this.linkList(page);
+          this.setState({
+            selectedRowKeys: []
+          });
+        }.bind(this),
+        showTotal: function(total) {
+          return "共" + total + "条数据";
+        }
+      },
+      columns: [
+        {
+          title: "序号",
+          dataIndex: "id",
+          key: "id",
+          width: "80px",
+        },
+        {
+          title: "排序",
+          dataIndex: "sort",
+          key: "sort",
+          width: "80px",
+        },
+        {
+          title: "链接地址",
+          dataIndex: "url",
+          key: "url",
+          width: "100",
+        },
+        {
+          title: "热门城市",
+          dataIndex: "name",
+          key: "name",
+          width: "100",
+        },
+        // {
+        //   title: "互链",
+        //   dataIndex: "mutualChain",
+        //   key: "mutualChain",
+        //   width: "100",
+        //   render: (text, record) => {
+        //     return (
+        //       <div>
+        //       {
+        //         text == 0 ? '否': '是'
+        //       }
+        //       </div>
+        //     );
+        //   },
+        // },
+        {
+          title: "备注",
+          dataIndex: "remarks",
+          key: "remarks",
+          width: "100",
+        },
+        {
+          title: "状态",
+          dataIndex: "status",
+          key: "status",
+          width: "100",
+          render: (text, record) => {
+            return (
+              <div>
+              {
+                text == 0 ? '正常': '冻结'
+              }
+              </div>
+            );
+          },
+        },
+        {
+          title: "操作",
+          dataIndex: "cz",
+          key: "cz",
+          width: "100px",
+          render: (text, record) => {
+            return (
+              <div>
+                <Popconfirm
+                  title={record.status == 0 ? "确认冻结?" : "确认恢复?"}
+                  onConfirm={()=>this.linksUpdate(record)}
+                  okText="确定"
+                  cancelText="取消"
+                >
+                  <Button
+                    style={{background:record.status ?'#009966':''}}
+                    type={record.status == 0 ? 'primary' :'primary'}
+                    onClick={(e) => {
+                      e.stopPropagation();
+                      
+                      // this.setState({
+                      //   addFlag: false,
+                      // });
+                    }}
+                  >
+                    {record.status == 0 ? "冻结" : "恢复"}
+                  </Button>
+                </Popconfirm>
+              </div>
+            );
+          },
+        },
+      ],
+      dataSourceView: [],
+      coorVisible: "none",
+      list: [],
+      visible: false,
+      viewKey: 0,
+      modalView: false,
+      modalRecord: false,
+      closable: false,
+      disabledView: "none",
+      loading: false,
+    };
+    this.formRef = {};
+    this.submitOrder = this.submitOrder.bind(this);
+    this.linkList = this.linkList.bind(this);
+    this.linksUpdate =  this.linksUpdate.bind(this)
+    this.reset =  this.reset.bind(this)
+    this.tableRowClick = this.tableRowClick.bind(this)
+    this.cleanAllpopularCities= this.cleanAllpopularCities.bind(this)
+  }
+  componentDidMount() {
+    this.linkList(1)
+  }
+  cleanAllpopularCities() {
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/popularCities/cleanAllpopularCities",
+      success: function (data) {
+        if (data.error.length) {
+          this.setState({
+            loading: false,
+          });
+          message.warning(data.error[0].message);
+        } else {
+          message.success("清除成功");
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  // 修改链接状态
+  linksUpdate(record){
+    if (!this.state.sort && !record.sort) {
+      message.warning("请填写排序");
+      return;
+    }else if(!this.state.name && !record.name) {
+      message.warning("请输入城市名");
+      return;
+    }
+    $.ajax({
+      method: "post",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/popularCities/update",
+      data: {
+        sort: record.sort || this.state.sort,
+        status: record.status == 0 ? '1' :'0' || this.state.status,
+        // mutualChain: record.mutualChain || this.state.mutualChain,
+        name: record.name || this.state.name,
+        url: record.url || this.state.url,
+        remarks: record.remarks || this.state.remarks,
+        id: record.id || this.state.id,
+      },
+      success: function (data) {
+        if (data.error.length) {
+          this.setState({
+            loading: false,
+          });
+          message.warning(data.error[0].message);
+        } else {
+          this.setState({
+            visible:false,
+            hid:'none'
+          })
+          this.linkList(1)
+          message.success("修改成功");
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  reset() {
+    this.setState({
+      sortType1:undefined,
+      name1:undefined,
+      mutualChain1:undefined,
+      status1:undefined
+    },()=>{
+      this.linkList();
+    });
+  }
+  // 新增友情链接
+  submitOrder() {
+    if (!this.state.sort) {
+      message.warning("请填写排序");
+      return;
+    } else if(!this.state.name) {
+      message.warning("请输入城市名");
+      return;
+    }
+    this.setState({
+      loading: true,
+    });
+    $.ajax({
+      method: "post",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/popularCities/add",
+      data: {
+        sort: this.state.sort,
+        status: 0,
+        // mutualChain:this.state.mutualChain,
+        name:this.state.name,
+        url:this.state.url,
+        remarks:this.state.remarks
+      },
+      success: function (data) {
+        if (data.error.length) {
+          this.setState({
+            loading: false,
+          });
+          message.warning(data.error[0].message);
+        } else {
+          this.setState({
+            loading: false,
+            visible:false,
+            viewKey: this.state.viewKey + 1,
+            sort: "",
+            // mutualChain: "",
+            name: '',
+            url: '',
+            remarks:''
+          });
+          this.linkList(1)
+          // this.assistList();
+          message.success("添加成功");
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  linkList(page){
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/popularCities/list",
+      data: {
+        sortType:this.state.sortType1 || undefined,
+        name: this.state.name1 || undefined,
+        // mutualChain:this.state.mutualChain || undefined,
+        status:this.state.status1 || undefined,
+        pageNo:page || 1,
+        pageSize:10
+      },
+      success: function (data) {
+        if (data.error.length) {
+          this.setState({
+            loading: false,
+          });
+          message.warning(data.error[0].message);
+        } else {
+          this.setState({
+            list: data.data.list,
+            pagination: this.state.pagination
+          });
+          this.state.pagination.total = data.data.totalCount;
+          this.state.pagination.current = data.data.pageNo;
+          }
+          if (data.data && data.data.list && !data.data.list.length) {
+            this.state.pagination.total = 0;
+          }  
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+    // 双击表格弹出修改
+  tableRowClick(record) {
+      this.setState({
+        visible:true,
+        sort: record.sort,
+        status: record.status,
+        // mutualChain: record.mutualChain,
+        name: record.name,
+        url: record.url,
+        remarks: record.remarks,
+        id:record.id,
+        hid:'block'
+      })
+    }
+  render() {
+    const formItemLayout = {
+      labelCol: { span: 8 },
+      wrapperCol: { span: 14 },
+    };
+    return (
+      <div>
+        <div className="user-content">
+          <div className="content-title">
+            <span>热门城市</span>
+          </div>
+          <div className="user-search">
+            <Select
+              placeholder="排序从高到低"
+              style={{ width: 150 }}
+              value={
+                this.state.sortType1
+              }
+              onChange={(e) => {
+                this.setState({
+                  sortType1: e,
+                });
+              }}
+            >
+              <Option value="0">排序从高到低</Option>
+              <Option value="1">排序从低到高</Option>
+            </Select>
+            {/* 显示名称关键字 */}
+            <Input
+              style={{bottom:'6px'}}
+              placeholder="请输入显示名称关键字"
+              value={this.state.name1}
+              onChange={(e) => {
+                this.setState({ name1: e.target.value });
+              }}
+            />
+            {/* 互链 */}
+            {/* <Select
+              placeholder="互链"
+              style={{ width: 150 }}
+              value={
+                this.state.mutualChain
+              }
+              onChange={(e) => {
+                this.setState({
+                  mutualChain: e,
+                });
+              }}
+            >
+              <Option value="1">是,以互链</Option>
+              <Option value="0">否,没互链</Option>
+            </Select> */}
+            {/*  */}
+            <Select
+              placeholder="状态"
+              style={{ width: 150 }}
+              value={
+                this.state.status1
+              }
+              onChange={(e) => {
+                this.setState({
+                  status1: e,
+                });
+              }}
+            >
+              <Option value="0">正常</Option>
+              <Option value="1">冻结</Option>
+            </Select>
+            <Button
+              type="primary"
+              onClick={()=>this.linkList(1)}
+              style={{ marginLeft: "10px" }}
+            >
+              搜索
+            </Button>
+            <Button onClick={this.reset}>重置</Button>
+            <Button
+              type="primary"
+              onClick={() => {
+                this.setState({ 
+                  visible: true ,
+                  sort: "",
+                  mutualChain: "",
+                  name: '',
+                  url: '',
+                  remarks:''
+                });
+              }}
+              style={{ marginLeft: "100px" }}
+            >
+              新增链接
+            </Button>
+            <Button
+              type="primary"
+              onClick={() => this.cleanAllpopularCities()}
+              style={{ float: "right" }}
+            >
+              清除热门城市缓存
+            </Button>
+          </div>
+          <div className="patent-table">
+            <SpinContainer spinning={this.state.loading}>
+              <Table
+                columns={this.state.columns}
+                dataSource={this.state.list}
+                pagination={this.state.pagination}
+                onRowClick={this.tableRowClick}
+              />
+            </SpinContainer>
+          </div>
+          <Modal
+            visible={this.state.visible}
+            key={this.state.viewKey}
+            title="新增/编辑热门"
+            onCancel={() => {
+              this.setState({
+                visible: false,
+                viewKey:this.state.viewKey+1
+              });
+            }}
+            onOk={() => {}}
+            footer={false}
+          >
+            <Form
+              onSubmit={this.handleSubmit}
+              ref={this.formRef}
+              style={{ marginRight: "120px" }}
+            >
+              <Form.Item
+                {...formItemLayout}
+                label="排序"
+                name="sort"
+                hasFeedback
+              >
+                <InputNumber
+                  value={this.state.sort}
+                  min={1}
+                  onChange={(e) => {
+                    if(isNaN(e)) {
+                      message.info("请输入数字")
+                    }
+                    this.setState({ sort: e });
+                  }}
+                />
+                <span style={{ color: "red" }}>数字越大排序越前</span>
+              </Form.Item>
+              <Form.Item
+                {...formItemLayout}
+                label="链接"
+                name="url"
+                hasFeedback
+              >
+                <Input
+                style={{width:"120px"}}
+                value={this.state.url}
+                  placeholder="请输入http://地址"
+                  onChange={(e) => {
+                    this.setState({ url: e.target.value });
+                  }}
+                />
+                <span style={{ color: "red" }}>请输入http://地址</span>
+              </Form.Item>
+              <Form.Item
+                {...formItemLayout}
+                label="热门城市"
+                name="name"
+                hasFeedback
+              >
+                <Input
+                value={this.state.name}
+                  placeholder="请输入显示在页面的热门城市"
+                  onChange={(e) => {
+                    this.setState({ name: e.target.value });
+                  }}
+                />
+              </Form.Item>
+              {/* <Form.Item
+                {...formItemLayout}
+                label="是否互链"
+                name="mutualChain"
+                hasFeedback
+              >
+                <RadioGroup onChange={(e) => {this.setState({
+                  mutualChain:e.target.value
+                })}} value={this.state.mutualChain}>
+                  <Radio value={0}>是</Radio>
+                  <Radio value={1}>否</Radio>
+                </RadioGroup>
+              </Form.Item> */}
+              <Form.Item
+                {...formItemLayout}
+                label="备注"
+                name="remarks"
+                hasFeedback
+              >
+               <TextArea
+                value={this.state.remarks}
+                maxLength={500}
+                placeholder="请输入备注..."
+                rows={4}
+                onChange={(e) => {
+                    this.setState({
+                      remarks: e.target.value,
+                    })
+                  }}
+               />
+              </Form.Item>
+            </Form>
+            <div
+              style={{
+                display: "flex",
+                justifyContent: "center",
+              }}
+            >
+              <Button
+              style={{display:this.state.hid == 'none' ? 'block' :'none'}}
+                onClick={this.submitOrder}
+                type="primary"
+                loading={this.state.loading}
+              >
+                保存并发布
+              </Button>
+              <Button
+                style={{display:this.state.hid}}
+                onClick={this.linksUpdate}
+                type="primary"
+                loading={this.state.loading}
+              >
+                完成修改
+              </Button>
+              <Button
+                type="dashed"
+                style={{ marginLeft: "15px" }}
+                onClick={() => {
+                  this.setState({
+                    visible: false,
+                    viewKey: this.state.viewKey + 1,
+                    sort: "",
+                    // mutualChain: "",
+                    name: '',
+                    url: '',
+                    remarks:''
+                  });
+                }}
+              >
+                取消
+              </Button>
+            </div>
+          </Modal>
+        </div>
+      </div>
+    );
+  }
+}
+
+export default Cities;

+ 611 - 0
js/component/administration/linkCity/Links.jsx

@@ -0,0 +1,611 @@
+import React, { Component } from "react";
+import {
+  Table,
+  Modal,
+  message,
+  Spin,
+  Input,
+  Select,
+  Button,
+  Form,
+  Upload,
+  Popconfirm,
+  AutoComplete,
+  DatePicker,
+  Col,
+  Tabs,
+  Tag,
+  Radio,
+  Group,
+  InputNumber,
+} from "antd";
+import SpinContainer from "../../SpinContainer";
+import $ from "jquery/src/ajax";
+const { TextArea } = Input;
+const RadioGroup = Radio.Group;
+const Option = AutoComplete.Option;
+const confirm = Modal.confirm;
+class Links extends Component {
+  constructor(props) {
+    super(props);
+    this.state = {
+      dataView: null,
+      PublicView: null,
+      contentView: "",
+      remarksView: "",
+      contentViewLength: 0,
+      contentViewLength1: 0,
+      hid:'none',
+      pagination: {
+        defaultCurrent: 1,
+        defaultPageSize: 10,
+        showQuickJumper: true,
+        pageSize: 10,
+        onChange: function (page) {
+          this.linkList(page);
+          this.setState({
+            selectedRowKeys: [],
+          });
+        }.bind(this),
+        showTotal: function (total) {
+          return "共" + total + "条数据";
+        },
+      },
+      columns: [
+        {
+          title: "序号",
+          dataIndex: "id",
+          key: "id",
+          width: "80px",
+        },
+        {
+          title: "排序",
+          dataIndex: "sort",
+          key: "sort",
+          width: "80px",
+        },
+        {
+          title: "友情链接地址",
+          dataIndex: "url",
+          key: "url",
+          width: "100",
+        },
+        {
+          title: "显示名称",
+          dataIndex: "name",
+          key: "name",
+          width: "100",
+        },
+        {
+          title: "互链",
+          dataIndex: "mutualChain",
+          key: "mutualChain",
+          width: "100",
+          render: (text, record) => {
+            return <div>{text == 0 ? "否" : "是"}</div>;
+          },
+        },
+        {
+          title: "备注",
+          dataIndex: "remarks",
+          key: "remarks",
+          width: "100",
+        },
+        {
+          title: "状态",
+          dataIndex: "status",
+          key: "status",
+          width: "100",
+          render: (text, record) => {
+            return <div>{text == 0 ? "正常" : "冻结"}</div>;
+          },
+        },
+        {
+          title: "操作",
+          dataIndex: "cz",
+          key: "cz",
+          width: "100px",
+          render: (text, record) => {
+            return (
+              <div>
+                <Popconfirm
+                  title={record.status == 0 ? "确认冻结?" : "确认恢复?"}
+                  onConfirm={()=>this.linksUpdate(record)}
+                  okText="确定"
+                  cancelText="取消"
+                >
+                  <Button
+                     style={{background:record.status ?'#009966':''}}
+                     type={record.status == 0 ? 'primary' :'primary'}
+                    onClick={(e) => {
+                      e.stopPropagation();
+                      
+                      // this.setState({
+                      //   addFlag: false,
+                      // });
+                    }}
+                  >
+                    {record.status == 0 ? "冻结" : "恢复"}
+                  </Button>
+                </Popconfirm>
+              </div>
+            );
+          },
+        },
+      ],
+      dataSourceView: [],
+      coorVisible: "none",
+      list: [],
+      visible: false,
+      viewKey: 0,
+      modalView: false,
+      modalRecord: false,
+      closable: false,
+      disabledView: "none",
+      loading: false,
+    };
+    this.formRef = {};
+    this.submitOrder = this.submitOrder.bind(this);
+    this.linkList = this.linkList.bind(this);
+    this.linksUpdate = this.linksUpdate.bind(this);
+    this.reset = this.reset.bind(this);
+    this.tableRowClick = this.tableRowClick.bind(this)
+    this.cleanAllLinks = this.cleanAllLinks.bind(this)
+  }
+  componentDidMount() {
+    this.linkList(1);
+  }
+  // 清除缓存
+  cleanAllLinks() {
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/links/cleanAllLinks",
+      success: function (data) {
+        if (data.error.length) {
+          this.setState({
+            loading: false,
+          });
+          message.warning(data.error[0].message);
+        } else {
+          message.success("清除成功");
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  // 修改链接状态
+  linksUpdate(record) {
+    if (!this.state.sort && !record.sort) {
+      message.warning("请填写排序");
+      return;
+    } else if (!this.state.url && !record.url) {
+      message.warning("请填写友情链接");
+      return;
+    } else if (!this.state.name && !record.name) {
+      message.warning("请输入链接名");
+      return;
+    } 
+    // console.log(record);
+    // console.log(this.state.status);
+    $.ajax({
+      method: "post",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/links/update",
+      data: {
+        sort: record.sort || this.state.sort,
+        status: record.status == 0 ? '1' :'0' || this.state.status,
+        mutualChain: record.mutualChain || this.state.mutualChain,
+        name: record.name || this.state.name,
+        url: record.url || this.state.url,
+        remarks: record.remarks || this.state.remarks,
+        id: record.id || this.state.id,
+      },
+      success: function (data) {
+        if (data.error.length) {
+          this.setState({
+            loading: false,
+          });
+          message.warning(data.error[0].message);
+        } else {
+          this.setState({
+            visible:false,
+            hid:'none'
+          })
+          this.linkList(1);
+          message.success("修改成功");
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  reset() {
+    this.setState({
+      sortType1: undefined,
+      name1: undefined,
+      mutualChain1: undefined,
+      status1: undefined,
+    },()=>{
+      this.linkList();
+    });
+    
+  }
+  // 新增友情链接
+  submitOrder() {
+    if (!this.state.sort) {
+      message.warning("请填写排序");
+      return;
+    } else if (!this.state.url) {
+      message.warning("请填写友情链接");
+      return;
+    } else if (!this.state.name) {
+      message.warning("请输入链接名");
+      return;
+    } 
+    this.setState({
+      loading: true,
+    });
+    $.ajax({
+      method: "post",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/links/add",
+      data: {
+        sort: this.state.sort,
+        status: 0,
+        mutualChain: this.state.mutualChain || 0,
+        name: this.state.name,
+        url: this.state.url,
+        remarks: this.state.remarks,
+      },
+      success: function (data) {
+        if (data.error.length) {
+          this.setState({
+            loading: false,
+          });
+          message.warning(data.error[0].message);
+        } else {
+          this.setState({
+            loading: false,
+            visible: false,
+            viewKey: this.state.viewKey + 1,
+            sort: "",
+            mutualChain: "",
+            name: "",
+            url: "",
+            remarks: "",
+          });
+          this.linkList(1);
+          // this.assistList();
+          message.success("添加成功");
+        }
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  linkList(page) {
+    $.ajax({
+      method: "get",
+      dataType: "json",
+      crossDomain: false,
+      url: globalConfig.context + "/api/admin/links/list",
+      data: {
+        sortType: this.state.sortType1 || undefined,
+        name: this.state.name1 || undefined,
+        mutualChain: this.state.mutualChain1 || undefined,
+        status: this.state.status1 || undefined,
+        pageNo: page || 1,
+        pageSize: 10,
+      },
+      success: function (data) {
+        if (data.error.length) {
+          this.setState({
+            loading: false,
+          });
+          message.warning(data.error[0].message);
+        } else {
+          this.setState({
+            list: data.data.list,
+            pagination: this.state.pagination
+          });
+          this.state.pagination.total = data.data.totalCount;
+            this.state.pagination.current = data.data.pageNo;
+          }
+          if (data.data && data.data.list && !data.data.list.length) {
+            this.state.pagination.total = 0;
+          }  
+      }.bind(this),
+    }).always(
+      function () {
+        this.setState({
+          loading: false,
+        });
+      }.bind(this)
+    );
+  }
+  // 双击表格弹出修改
+  tableRowClick(record) {
+    this.setState({
+      visible:true,
+      sort: record.sort,
+      status: record.status,
+      mutualChain: record.mutualChain,
+      name: record.name,
+      url: record.url,
+      remarks: record.remarks,
+      id:record.id,
+      hid:'block'
+    })
+  }
+  render() {
+    const formItemLayout = {
+      labelCol: { span: 8 },
+      wrapperCol: { span: 14 },
+    };
+    return (
+      <div>
+        <div className="user-content">
+          <div className="content-title">
+            <span>产品管理</span>
+          </div>
+          <div className="user-search">
+            <Select
+              placeholder="排序从高到低"
+              style={{ width: 150 }}
+              value={this.state.sortType1}
+              onChange={(e) => {
+                this.setState({
+                  sortType1: e,
+                });
+              }}
+            >
+              <Option value="0">排序从高到低</Option>
+              <Option value="1">排序从低到高</Option>
+            </Select>
+            {/* 显示名称关键字 */}
+            <Input
+              style={{bottom:'6px'}}
+              placeholder="请输入显示名称关键字"
+              value={this.state.name1}
+              onChange={(e) => {
+                this.setState({ name1: e.target.value });
+              }}
+            />
+            {/* 互链 */}
+            <Select
+              placeholder="互链"
+              style={{ width: 150 }}
+              value={this.state.mutualChain1}
+              onChange={(e) => {
+                this.setState({
+                  mutualChain1: e,
+                });
+              }}
+            >
+              <Option value="1">是,以互链</Option>
+              <Option value="0">否,没互链</Option>
+            </Select>
+            {/*  */}
+            <Select
+              placeholder="状态"
+              style={{ width: 150 }}
+              value={this.state.status1}
+              onChange={(e) => {
+                this.setState({
+                  status1: e,
+                });
+              }}
+            >
+              <Option value="0">正常</Option>
+              <Option value="1">冻结</Option>
+            </Select>
+            <Button
+              type="primary"
+              onClick={() => this.linkList(1)}
+              style={{ marginLeft: "10px" }}
+            >
+              搜索
+            </Button>
+            <Button onClick={this.reset}>重置</Button>
+            <Button
+              type="primary"
+              onClick={() => {
+                this.setState({
+                  visible: true,
+                  sort: "",
+                  mutualChain: "",
+                  name: "",
+                  url: "",
+                  remarks: "",
+                });
+              }}
+              style={{ marginLeft: "100px" }}
+            >
+              新增链接
+            </Button>
+            <Button
+              type="primary"
+              onClick={() => this.cleanAllLinks()}
+              style={{ float: "right" }}
+            >
+              清除友情链接缓存
+            </Button>
+          </div>
+          <div className="patent-table">
+            <SpinContainer spinning={this.state.loading}>
+              <Table
+                columns={this.state.columns}
+                dataSource={this.state.list}
+                pagination={this.state.pagination}
+                onRowClick={this.tableRowClick}
+              />
+            </SpinContainer>
+          </div>
+          <Modal
+            visible={this.state.visible}
+            key={this.state.viewKey}
+            title="新增/编辑友情链接"
+            onCancel={() => {
+              this.setState({
+                visible: false,
+                viewKey: this.state.viewKey + 1,
+              });
+            }}
+            onOk={() => {}}
+            footer={false}
+          >
+            <Form
+              onSubmit={this.handleSubmit}
+              ref={this.formRef}
+              style={{ marginRight: "120px" }}
+            >
+              <Form.Item
+                {...formItemLayout}
+                label="排序"
+                name="sort"
+                hasFeedback
+              >
+                <InputNumber
+                  min={1}
+                  value={this.state.sort}
+                  onChange={(e) => {
+                    if(isNaN(e)) {
+                      message.info("请输入数字")
+                    }
+                    this.setState({ sort: e });
+                  }}
+                />
+                <span style={{ color: "red" }}>数字越大排序越前</span>
+              </Form.Item>
+              <Form.Item
+                {...formItemLayout}
+                label="友链地址"
+                name="url"
+                hasFeedback
+              >
+                <Input
+                  style={{width:"120px"}}
+                  alue={this.state.url}
+                  placeholder="请输入http://地址"
+                  onChange={(e) => {
+                    this.setState({ url: e.target.value });
+                  }}
+                />
+                <span style={{ color: "red" }}>请输入http://地址</span>
+              </Form.Item>
+              <Form.Item
+                {...formItemLayout}
+                label="显示名称"
+                name="name"
+                hasFeedback
+              >
+                <Input
+                  value={this.state.name}
+                  placeholder="请输入显示在页面的网站名称"
+                  onChange={(e) => {
+                    this.setState({ name: e.target.value });
+                  }}
+                />
+              </Form.Item>
+              <Form.Item
+                {...formItemLayout}
+                label="是否互链"
+                name="mutualChain"
+                hasFeedback
+              >
+                <RadioGroup
+                  onChange={(e) => {
+                    this.setState({
+                      mutualChain: e.target.value,
+                    });
+                  }}
+                  value={this.state.mutualChain || 0}
+                >
+                  <Radio value={1}>是</Radio>
+                  <Radio value={0}>否</Radio>
+                </RadioGroup>
+              </Form.Item>
+              <Form.Item
+                {...formItemLayout}
+                label="备注"
+                name="remarks"
+                hasFeedback
+              >
+                <TextArea
+                value={this.state.remarks}
+                  maxLength={500}
+                  placeholder="请输入备注..."
+                  rows={4}
+                  onChange={(e) => {
+                    this.setState({
+                      remarks: e.target.value,
+                    });
+                  }}
+                />
+              </Form.Item>
+            </Form>
+            <div
+              style={{
+                display: "flex",
+                justifyContent: "center",
+              }}
+            >
+              <Button
+                style={{display:this.state.hid == 'none' ? 'block' :'none'}}
+                onClick={this.submitOrder}
+                type="primary"
+                loading={this.state.loading}
+              >
+                提交
+              </Button>
+              <Button
+                style={{display:this.state.hid}}
+                onClick={this.linksUpdate}
+                type="primary"
+                loading={this.state.loading}
+              >
+                完成修改
+              </Button>
+              <Button
+                type="dashed"
+                style={{ marginLeft: "15px" }}
+                onClick={() => {
+                  this.setState({
+                    visible: false,
+                    viewKey: this.state.viewKey + 1,
+                    sort: "",
+                    mutualChain: "",
+                    name: "",
+                    url: "",
+                    remarks: "",
+                  });
+                }}
+              >
+                取消
+              </Button>
+            </div>
+          </Modal>
+        </div>
+      </div>
+    );
+  }
+}
+
+export default Links;

+ 1 - 1
js/component/administration/weapp/pay/index.jsx

@@ -148,7 +148,7 @@ class Pay extends Component{
                     <span>支付管理</span>
                 </div>
                 <div className="user-search">
-                    <Input placeholder="用户关键字" value={this.state.searchUserName} onChange={(e) => { this.setState({ searchUserName: e.target.value }); }} />
+                    <Input style={{bottom:'5px'}} placeholder="用户关键字" value={this.state.searchUserName} onChange={(e) => { this.setState({ searchUserName: e.target.value }); }} />
                     <Select
                         placeholder="请选择支付状态"
                         style={{ width: 120 }}

+ 319 - 0
js/component/administration/weapp/product/addShare.jsx

@@ -0,0 +1,319 @@
+import React,{Component} from 'react';
+import SpinContainer from "../../../SpinContainer";
+import {Button, Form, Icon, Input, message, Modal, Select, Upload} from "antd";
+import {beforeUploadFile,splitUrl} from "@/tools.js";
+import Editors from "@/richTextEditors";
+import $ from "jquery/src/ajax";
+
+const FormItem = Form.Item;
+
+//上传图片组件
+const PicturesWall = React.createClass({
+    getInitialState() {
+        return {
+            previewVisible: false,
+            previewImage: "",
+            fileList: this.props.pictureUrl,
+            type:''
+        };
+    },
+    getDefaultProps() {
+        return {
+            changeClick: this.modifyChange
+        };
+    },
+    handleCancel() {
+        this.setState({ previewVisible: false });
+    },
+    handlePreview(file) {
+        let type = '';
+
+        if(file.type){
+            let str = file.type;
+            let index = str.indexOf("/");
+            type =str.substring(0,index) === 'video' ? 1 : str.substring(0,index) === 'audio' ? 2 : 0;
+        }else{
+            // let str = file.url || file.thumbUrl;
+            // let index = str.lastIndexOf(".");
+            // type = str.substring(index+1);
+            type = this.props.type;
+        }
+        this.setState({
+            type,
+            previewImage: file.url || file.thumbUrl,
+            previewVisible: true
+        });
+    },
+    handleChange(info) {
+        let fileList = info.fileList;
+        this.setState({ fileList });
+        this.props.fileList(fileList);
+    },
+    componentWillReceiveProps(nextProps) {
+        this.state.fileList = nextProps.pictureUrl;
+    },
+    render() {
+        const { previewVisible, previewImage, fileList } = this.state;
+        const uploadButton = (
+            <div>
+                <Icon type="plus" />
+                <div className="ant-upload-text">点击上传</div>
+            </div>
+        );
+        return (
+            <div style={{ display: "inline-block" }}>
+                <Upload
+                    accept={
+                        this.props.type === 0 ? "image/*" :
+                            this.props.type === 1 ?
+                                'video/mp4,video/rmvb,video/mkv,video/avi' :
+                                this.props.type === 2 ?
+                                "audio/mp3" : '*'}
+                    beforeUpload={beforeUploadFile}
+                    action={globalConfig.context + "/api/admin/project/uploadFile"}
+                    data={{ sign: "purchase_picture" }}
+                    listType="picture-card"
+                    fileList={fileList}
+                    onPreview={this.handlePreview}
+                    onChange={this.handleChange}
+                >
+                    {fileList && fileList.length >= 1 ? null : uploadButton}
+                </Upload>
+                <Modal
+                    maskClosable={false}
+                    visible={previewVisible}
+                    footer={null}
+                    onCancel={this.handleCancel}
+                >
+                    {
+                        this.state.type=== 0 ?
+                            <img alt="" style={{ width: "100%" }} src={previewImage} /> :
+                            this.state.type=== 1 ?
+                                <video style={{width:'100%'}} controls="controls" autoPlay="" name="media">
+                                    <source src={previewImage} type="video/mp4"/>
+                                </video>:
+                                this.state.type=== 2 ?
+                                    <audio src={previewImage} controls="controls">Your browser does not support the audio element.</audio>: ''
+                    }
+                </Modal>
+            </div>
+        );
+    }
+});
+
+class Add extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+            loading: false,
+            projectType: props.shareType || '',
+            name:'',
+            pictureImgUrl: '',
+            shareImgUrl:'',
+            shareId:'',
+        }
+        this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this);
+        this.getShareOrgCodeUrl = this.getShareOrgCodeUrl.bind(this);
+        this.onOk = this.onOk.bind(this);
+        this.getWeChatShareDetals = this.getWeChatShareDetals.bind(this);
+    }
+
+    componentDidMount() {
+        if(this.props.id || this.props.shareId){
+            this.getWeChatShareDetals();
+        }
+    }
+
+    getOrgCodeUrl(e) {
+        this.setState({ pictureImgUrl: e });
+    }
+
+    getShareOrgCodeUrl(e) {
+        this.setState({ shareImgUrl: e });
+    }
+
+    onOk(){
+        if(!this.state.name){
+            message.warning('请输入分享标题');
+            return false;
+        }
+        if(isNaN(parseInt(this.state.projectType))){
+            message.warning('请选择分享位置');
+            return false;
+        }
+        if(this.state.pictureImgUrl.length === 0){
+            message.warning('请上传朋友分享图');
+            return false;
+        }
+        if(this.state.shareImgUrl.length === 0){
+            message.warning('请上传朋友圈分享图');
+            return false;
+        }
+        this.setState({
+            loading: true
+        });
+        let url = this.state.shareId ? "/api/admin/weChatShare/update" : "/api/admin/weChatShare/add"
+        $.ajax({
+            method: "post",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + url,
+            data: {
+                pid: this.props.id || undefined,       //项目编号
+                id: this.state.shareId || undefined,
+                title: this.state.name || undefined,
+                shareUrl: this.state.pictureImgUrl[0].response.data || undefined,
+                momentsUrl: this.state.shareImgUrl[0].response.data || undefined,
+                type: this.state.projectType,
+            },
+            success: function(data) {
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                } else {
+                    message.success(this.state.shareId ? '修改成功' : '添加成功');
+                    this.props.onOk();
+                }
+            }.bind(this)
+        }).always(
+            function() {
+                this.setState({
+                    loading: false
+                });
+            }.bind(this)
+        );
+    }
+
+    getWeChatShareDetals() {
+        this.setState({
+            loading: true
+        });
+        let data = {};
+        if(this.props.id){
+            data.pid = this.props.id
+        }else if(this.props.shareId){
+            data.id = this.props.shareId
+        }
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/admin/weChatShare/details",
+            data: data
+        }).done((data1) => {
+            if (data1.error.length !== 0) {
+                message.warning(data1.error[0].message);
+            } else {
+                if(data1.data){
+                    this.setState({
+                        name: data1.data.title,
+                        projectType: data1.data.type,
+                        pictureImgUrl: data1.data.shareUrl ? splitUrl(data1.data.shareUrl, ',', globalConfig.avatarHost + '/upload') : [],
+                        shareImgUrl: data1.data.momentsUrl ? splitUrl(data1.data.momentsUrl, ',', globalConfig.avatarHost + '/upload') : [],
+                        shareId:data1.data.id,
+                    })
+                }
+            }
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this))
+    }
+
+    render() {
+        return (
+            <Modal
+                className="customeDetails"
+                title={this.state.shareId ? "修改分享" : "添加分享"}
+                okText={"保存"}
+                width="1050"
+                visible={this.props.visible}
+                onCancel={this.props.onCancel}
+                footer={false}
+            >
+                <Form
+                    layout="horizontal"
+                    id="demand-form"
+                >
+                    <SpinContainer spinning={this.state.loading}>
+                        <div className="clearfix">
+                            <FormItem
+                                className="half-item"
+                                labelCol={{ span: 8 }}
+                                wrapperCol={{ span: 12 }}
+                                label="转发标题"
+                            >
+                                <Input
+                                    placeholder="请输入转发标题"
+                                    value={this.state.name}
+                                    onChange={(e) => {
+                                        this.setState({ name: e.target.value });
+                                    }}
+                                />
+                            </FormItem>
+                            {!this.props.shareType ? <FormItem
+                                className="half-item"
+                                labelCol={{ span: 8 }}
+                                wrapperCol={{ span: 12 }}
+                                label="分享位置"
+                            >
+                                <Select
+                                    value={this.state.projectType}
+                                    placeholder="请选择分享位置"
+                                    onChange={e => {
+                                        this.setState({
+                                            projectType: e
+                                        });
+                                    }}
+                                >
+                                    <Option value={1}>首页</Option>
+                                </Select>
+                            </FormItem> : null}
+                            <div className="clearfix">
+                                <FormItem
+                                    className="half-item"
+                                    labelCol={{ span: 8 }}
+                                    wrapperCol={{ span: 12 }}
+                                    label="朋友分享图"
+                                    extra='图片长宽比是 5:4,建议尺寸660*528'
+                                >
+                                    <PicturesWall
+                                        type={0}
+                                        fileList={this.getOrgCodeUrl}
+                                        pictureUrl={this.state.pictureImgUrl}
+                                    />
+                                </FormItem>
+                            </div>
+                            <div className="clearfix">
+                                <FormItem
+                                    className="half-item"
+                                    labelCol={{ span: 8 }}
+                                    wrapperCol={{ span: 12 }}
+                                    label="朋友圈分享图"
+                                    extra='图片长宽比是 1:1,会自动收缩,尺寸大小影响不大'
+                                >
+                                    <PicturesWall
+                                        type={0}
+                                        fileList={this.getShareOrgCodeUrl}
+                                        pictureUrl={this.state.shareImgUrl}
+                                    />
+                                </FormItem>
+                            </div>
+                        </div>
+                        <div style={{display:'flex',justifyContent: 'center'}}>
+                            <Button
+                                type="primary"
+                                onClick={()=>{
+                                    this.onOk();
+                                }}>
+                                保存
+                            </Button>
+                        </div>
+                    </SpinContainer>
+                </Form>
+            </Modal>
+        )
+    }
+}
+
+export default Add;

+ 32 - 3
js/component/administration/weapp/product/index.jsx

@@ -4,6 +4,7 @@ import SpinContainer from "../../../SpinContainer";
 import $ from "jquery/src/ajax";
 import moment from "moment";
 import Add from './add';
+import AddShare from './AddShare';
 import {getPicPath} from "@/tools.js";
 
 const { RangePicker } = DatePicker;
@@ -159,6 +160,16 @@ class Product extends Component{
                                         {record.host === 0 ? "推荐首页" : '首页撤下'}
                                     </Button>
                                 </Popconfirm>
+                                <Button
+                                    type="primary"
+                                    style={{ marginLeft: 10,background:'#2aaf65' }}
+                                    onClick={(e) => {
+                                        e.stopPropagation();
+                                        this.shareEdit(record);
+                                    }}
+                                >
+                                    编辑分享
+                                </Button>
                             </div>
                         );
                     }
@@ -178,6 +189,7 @@ class Product extends Component{
                 }
             },
             visible:false,
+            shareVisible:false,
 
         }
         this.search = this.search.bind(this);
@@ -187,6 +199,7 @@ class Product extends Component{
         this.addProduct = this.addProduct.bind(this);
         this.onCancel = this.onCancel.bind(this);
         this.edit = this.edit.bind(this);
+        this.shareEdit = this.shareEdit.bind(this);
         this.delete = this.delete.bind(this);
         this.homeOperation = this.homeOperation.bind(this);
     }
@@ -203,7 +216,6 @@ class Product extends Component{
     }
 
     tableRowClick(value){
-        console.log(value)
         this.setState({
             visible:true,
             id:value.id,
@@ -219,6 +231,14 @@ class Product extends Component{
         })
     }
 
+    shareEdit(value){
+        this.setState({
+            shareVisible:true,
+            id:value.id,
+            infor:value,
+        })
+    }
+
     loadData(pageNo = 1) {
         this.setState({
             loading: true
@@ -258,13 +278,14 @@ class Product extends Component{
     }
 
     addProduct(){
-        this.setState({visible:false});
+        this.setState({visible:false,shareVisible:false});
         this.loadData(this.state.pageNo)
     }
 
     onCancel(){
         this.setState({
             visible:false,
+            shareVisible:false,
             id:'',
             infor:'',
         })
@@ -346,7 +367,7 @@ class Product extends Component{
                     <span>产品管理</span>
                 </div>
                 <div className="user-search">
-                    <Input placeholder="产品关键字" value={this.state.searchUserName} onChange={(e) => { this.setState({ searchUserName: e.target.value }); }} />
+                    <Input style={{bottom:'5px'}} placeholder="产品关键字" value={this.state.searchUserName} onChange={(e) => { this.setState({ searchUserName: e.target.value }); }} />
                     <span style={{ fontSize: 14 }} >提交日期:</span>
                     <RangePicker
                         value={[
@@ -382,6 +403,14 @@ class Product extends Component{
                     onOk={this.addProduct}
                     onCancel={this.onCancel}
                 /> : null}
+                {this.state.shareVisible ? <AddShare
+                    shareType='0'
+                    id={this.state.id}
+                    infor={this.state.infor}
+                    visible={this.state.shareVisible}
+                    onOk={this.addProduct}
+                    onCancel={this.onCancel}
+                /> : null}
                 <Modal
                     visible={this.state.imgeditvisible}
                     onCancel={()=>{this.imghandleCancel()}}

+ 1 - 1
js/component/administration/weapp/user/index.jsx

@@ -126,7 +126,7 @@ class User extends Component{
                     <span>用户管理</span>
                 </div>
                 <div className="user-search">
-                    <Input placeholder="用户关键字" value={this.state.searchUserName}
+                    <Input style={{bottom:'5px'}} placeholder="用户关键字" value={this.state.searchUserName}
                            onChange={(e) => { this.setState({ searchUserName: e.target.value }); }} />
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button>

+ 389 - 0
js/component/administration/weapp/weappShare/index.jsx

@@ -0,0 +1,389 @@
+import React,{Component}from 'react';
+import {Button, DatePicker, Icon, Input, message, Modal, Popconfirm, Select, Table} from "antd";
+import SpinContainer from "../../../SpinContainer";
+import $ from "jquery/src/ajax";
+import moment from "moment";
+import AddShare from '../product/addShare';
+import {getPicPath} from "@/tools.js";
+
+const { RangePicker } = DatePicker;
+
+class WeappShare extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+            pageNo: 1,
+            searchUserName: '',
+            projectType: '',
+            loading: false,
+            imgeditvisible: false,
+            maximg: '',
+            columns:[
+                {
+                    title: '序号',
+                    dataIndex: 'key',
+                    key: 'key'
+                },
+                {
+                    title: '分享标题',
+                    dataIndex: 'title',
+                    key: 'title',
+                },
+                {
+                    title: '分享位置',
+                    dataIndex: 'type',
+                    key: 'type',
+                    render: type => (
+                        type === 0 ? '项目详情' :
+                            type === 1 ? '首页' : ''
+                    )
+                },
+                {
+                    title: '朋友分享缩略图',
+                    dataIndex: 'shareUrl',
+                    key: 'shareUrl',
+                    render: url => {
+                        let path = getPicPath(globalConfig.avatarUploadHost, url);
+                        return (
+                            <div style={{
+                                display: 'flex',
+                                alignItems: 'center',
+                            }}>
+                                <img src={path} style={{ width: "100px", height: 50 }} />
+                                <Button
+                                    className="buttonimg"
+                                    style={{ marginLeft: 10 }}
+                                    onClick={e => {
+                                        e.stopPropagation();
+                                        this.setState({
+                                            imgeditvisible: true,
+                                            maximg: path,
+                                        })
+                                    }}
+                                >
+                                    查看大图
+                                </Button>
+                            </div>
+                        );
+                    }
+                },
+                {
+                    title: '朋友圈分享缩略图',
+                    dataIndex: 'momentsUrl',
+                    key: 'momentsUrl',
+                    render: url => {
+                        let path = getPicPath(globalConfig.avatarUploadHost, url);
+                        return (
+                            <div style={{
+                                display: 'flex',
+                                alignItems: 'center',
+                            }}>
+                                <img src={path} style={{ width: "100px", height: 50 }} />
+                                <Button
+                                    className="buttonimg"
+                                    style={{ marginLeft: 10 }}
+                                    onClick={e => {
+                                        e.stopPropagation();
+                                        this.setState({
+                                            imgeditvisible: true,
+                                            maximg: path,
+                                        })
+                                    }}
+                                >
+                                    查看大图
+                                </Button>
+                            </div>
+                        );
+                    }
+                },
+                {
+                    title: "操作",
+                    dataIndex: "aab",
+                    key: "aab",
+                    render: (text, record) => {
+                        return (
+                            <div>
+                                <Button
+                                    type="primary"
+                                    onClick={(e) => {
+                                        e.stopPropagation();
+                                        this.edit(record);
+                                    }}
+                                >
+                                    编辑
+                                </Button>
+                                <Popconfirm
+                                    placement="top"
+                                    title={"是否确认删除?"}
+                                    onConfirm={e => {
+                                        e.stopPropagation();
+                                        this.delete(record.id);
+                                    }}
+                                    okText="确认"
+                                    cancelText="取消"
+                                >
+                                    <Button
+                                        type="primary"
+                                        style={{ marginLeft: 10,background:'#f00' }}
+                                        onClick={(e)=>{
+                                            e.stopPropagation();
+                                        }}
+                                    >
+                                        删除
+                                    </Button>
+                                </Popconfirm>
+                            </div>
+                        );
+                    }
+                }
+            ],
+            dataSource:[],
+            pagination: {
+                defaultCurrent: 1,
+                defaultPageSize: 10,
+                showQuickJumper: true,
+                pageSize: 10,
+                onChange: function (page) {
+                    this.loadData(page);
+                }.bind(this),
+                showTotal: function (total) {
+                    return '共' + total + '条数据';
+                }
+            },
+            visible:false,
+
+        }
+        this.search = this.search.bind(this);
+        this.reset = this.reset.bind(this);
+        this.tableRowClick = this.tableRowClick.bind(this);
+        this.loadData = this.loadData.bind(this);
+        this.addProduct = this.addProduct.bind(this);
+        this.onCancel = this.onCancel.bind(this);
+        this.edit = this.edit.bind(this);
+        this.delete = this.delete.bind(this);
+        this.homeOperation = this.homeOperation.bind(this);
+    }
+
+    search(){this.loadData();}
+
+    reset(){
+        this.setState({
+            projectType:'',
+            searchUserName: '',
+        },()=>{
+            this.loadData();
+        })
+    }
+
+    tableRowClick(value){
+        console.log(value)
+        this.setState({
+            visible:true,
+            id:value.pid,
+            shareType:value.type+'',
+            infor:value,
+            shareId:value.id,
+        })
+    }
+
+    edit(value){
+        this.setState({
+            visible:true,
+            id:value.pid,
+            infor:value,
+            shareType:value.type+'',
+            shareId:value.id,
+        })
+    }
+
+    loadData(pageNo = 1) {
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/admin/weChatShare/pageList",
+            data: {
+                pageNo: pageNo || 1,
+                pageSize: 10,
+                name: this.state.searchUserName || undefined,
+                type: this.state.projectType,
+            }
+        }).done((data1) => {
+            if (data1.error.length !== 0) {
+                message.warning(data1.error[0].message);
+            } else {
+                for (let i = 0; i < data1.data.list.length; i++) {
+                    data1.data.list[i].key = (data1.data.pageNo-1)*10+(i+1);
+                }
+                this.state.pagination.current = data1.data.pageNo;
+                this.state.pagination.total = data1.data.totalCount;
+            }
+            this.setState({
+                dataSource: data1.data.list,
+                pagination: this.state.pagination,
+                pageNo: data1.data.pageNo
+            });
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this))
+    }
+
+    addProduct(){
+        this.setState({visible:false,shareType:'',shareId:''});
+        this.loadData(this.state.pageNo)
+    }
+
+    onCancel(){
+        this.setState({
+            visible:false,
+            id:'',
+            infor:'',
+            shareType:'',
+            shareId:'',
+        })
+    }
+
+    homeOperation(id,host){
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "post",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/admin/project/update",
+            data: {
+                id,
+                host
+            },
+            success: function(data) {
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                } else {
+                    message.warning('操作成功');
+                    this.loadData(this.state.pageNo);
+                }
+            }.bind(this)
+        }).always(
+            function() {
+                this.setState({
+                    loading: false
+                });
+            }.bind(this)
+        );
+    }
+
+    delete(id){
+        this.setState({
+            loading: true
+        });
+        $.ajax({
+            method: "post",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/admin/weChatShare/delete",
+            data: {
+                id
+            },
+            success: function(data) {
+                if (data.error && data.error.length) {
+                    message.warning(data.error[0].message);
+                } else {
+                    message.warning('删除成功');
+                    this.loadData(this.state.pageNo);
+                }
+            }.bind(this)
+        }).always(
+            function() {
+                this.setState({
+                    loading: false
+                });
+            }.bind(this)
+        );
+    }
+
+    componentDidMount() {
+        this.loadData();
+    }
+
+    imghandleCancel() {
+        this.setState({
+            imgeditvisible: false
+        });
+    }
+
+    render() {
+        return (
+            <div className="user-content" >
+                <div className="content-title">
+                    <span>小程序分享管理</span>
+                </div>
+                <div className="user-search">
+                    <Input
+                        placeholder="请输入分享标题"
+                        value={this.state.searchUserName}
+                        onChange={(e) => { this.setState({ searchUserName: e.target.value }); }}
+                        style={{
+                            marginRight: "10px",
+                            marginBottom: "10px"
+                        }}
+                    />
+                    <Select
+                        style={{width:130}}
+                        value={this.state.projectType || undefined}
+                        placeholder="请选择分享位置"
+                        onChange={e => {
+                            this.setState({
+                                projectType: e
+                            });
+                        }}
+                    >
+                        <Option value={0}>项目详情</Option>
+                        <Option value={1}>首页</Option>
+                    </Select>
+                    <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
+                    <Button onClick={this.reset}>重置</Button>
+                    <Button
+                        type="primary"
+                        onClick={()=>{this.setState({visible:true,shareType: '',shareId:''})}}
+                        style={{ marginLeft: "100px" }}
+                    >
+                        新增分享
+                    </Button>
+                </div>
+                <div className="patent-table">
+                    <SpinContainer spinning={this.state.loading}>
+                        <Table columns={this.state.columns}
+                               dataSource={this.state.dataSource}
+                               pagination={this.state.pagination}
+                               onRowClick={this.tableRowClick} />
+                    </SpinContainer>
+                </div>
+                {this.state.visible ? <AddShare
+                    id={this.state.id}
+                    shareType={this.state.shareType}
+                    shareId={this.state.shareId}
+                    infor={this.state.infor}
+                    visible={this.state.visible}
+                    onOk={this.addProduct}
+                    onCancel={this.onCancel}
+                /> : null}
+                <Modal
+                    visible={this.state.imgeditvisible}
+                    onCancel={()=>{this.imghandleCancel()}}
+                    onOk={()=>{this.imghandleCancel()}}
+                    footer={false}
+                >
+                    <img style={{ width: "100%" }} src={this.state.maximg} />
+                </Modal>
+            </div >
+        )
+    }
+}
+
+export default WeappShare;

+ 12 - 0
js/component/richTextEditors.jsx

@@ -44,6 +44,10 @@ function uploadImg(s,_this) {
     let myform = new FormData()
     let file = document.getElementById(_this.props.id + "fileToUpload").files[0];
     if (!file) { return; };
+    if(file.size > 52428800){
+        message.warning('图片大小不能超过50M');
+        return
+    }
     myform.append('file', file);
     myform.append('sign', RichTextUploadSign);
     $.ajax({
@@ -102,6 +106,10 @@ function uploadAudio(s,_this) {
     let myform = new FormData()
     let file = document.getElementById(_this.props.id + "fileToUploadAudio").files[0]
     if (!file) { return; };
+    if(file.size > 52428800){
+        message.warning('音频大小不能超过50M');
+        return
+    }
     myform.append('file', file);
     myform.append('sign', RichTextUploadSign);
     $.ajax({
@@ -150,6 +158,10 @@ function uploadVideo(s,_this) {
     let myform = new FormData()
     let file = document.getElementById(_this.props.id + "fileToUploadVideo").files[0]
     if (!file) { return; };
+    if(file.size > 52428800){
+        message.warning('视频大小不能超过50M');
+        return
+    }
     myform.append('file', file);
     myform.append('sign', RichTextUploadSign);
     $.ajax({

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.0.4",
+  "version": "1.0.5",
   "description": "",
   "main": "index.js",
   "scripts": {

+ 1 - 0
webpack-dll.config.js

@@ -11,6 +11,7 @@ let theme = {
 };
 module.exports = (function () {
     let staticHost = 'http://172.16.0.254';
+    // let staticHost = 'http://172.16.0.52';
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';

+ 4 - 2
webpack.config.js

@@ -135,7 +135,8 @@ module.exports = (function () {
         }));
     }
 
-    let staticHost = 'http://172.16.0.253:80';
+    // let staticHost = 'http://172.16.0.253:80';
+    let staticHost = 'http://172.16.0.52:80';
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://static.jishutao.com'
@@ -169,7 +170,8 @@ module.exports = (function () {
         plugins: plugins,
         devServer: {
             disableHostCheck: true,
-            host: '172.16.0.253',
+            // host: '172.16.0.253',
+            host: '172.16.0.52',
             port: 80,
             allowedHosts: ['127.0.0.1','192.168.0.20','192.168.0.99'],
             headers: {