diff --git a/src/pages/editor/components/Header/index.js b/src/pages/editor/components/Header/index.js
new file mode 100644
index 0000000..03d00ef
--- /dev/null
+++ b/src/pages/editor/components/Header/index.js
@@ -0,0 +1,112 @@
+import React, { useRef, memo } from 'react'
+import { Button, Input, Popover, Modal } from 'antd'
+import {
+ ArrowLeftOutlined,
+ MobileOutlined,
+ DownloadOutlined,
+ CopyOutlined
+} from '@ant-design/icons'
+import QRCode from 'qrcode.react'
+import { saveAs } from 'file-saver'
+import req from '@/utils/req'
+import Code from '@/assets/code.png'
+
+import styles from './index.less'
+
+const { confirm } = Modal;
+
+const isDev = process.env.NODE_ENV === 'development';
+
+const HeaderComponent = memo((props) => {
+ const { pointData, location } = props
+ const iptRef = useRef(null)
+
+ const toPreview = () => {
+ localStorage.setItem('pointData', JSON.stringify(pointData))
+ savePreview()
+ setTimeout(() => {
+ window.open(isDev ? `/preview?tid=${props.location.query.tid}` : `http://io.nainor.com/h5_plus/preview?tid=${props.location.query.tid}`)
+ }, 600)
+ }
+
+ const content = () => {
+ const { tid } = location.query || ''
+ return
+ }
+
+ const handleSaveTpl = () => {
+ confirm({
+ title: '确定要保存吗?',
+ content:
,
+ okText: '保存',
+ cancelText: '取消',
+ onOk() {
+ let name = iptRef.current.state.value
+ req.post('/visible/tpl/save', { name, tpl: pointData }).then(res => {
+ console.log(res)
+ })
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ }
+
+ const useTemplate = () => {
+ Modal.info({
+ title: '该功能正在升级,可以关注下方公众号实时查看动态',
+ content: (
+
+

+
+ ),
+ okText: '客官知道啦'
+ })
+ }
+
+ const downLoadJson = () => {
+ const jsonStr = JSON.stringify(pointData)
+ const blob = new Blob([jsonStr], { type: "text/plain;charset=utf-8" })
+ saveAs(blob, "template.json")
+ }
+
+ const toLogin = () => {
+ const { tid } = props.location.query || ''
+ window.location.href = `/h5_plus/login?tid=${tid}`
+ }
+
+ const savePreview = () => {
+ const { tid } = props.location.query || ''
+ req.post('/visible/preview', { tid, tpl: pointData })
+ }
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+})
+
+export default HeaderComponent
diff --git a/src/pages/editor/components/Header/index.less b/src/pages/editor/components/Header/index.less
new file mode 100644
index 0000000..d50ff14
--- /dev/null
+++ b/src/pages/editor/components/Header/index.less
@@ -0,0 +1,42 @@
+.header {
+ position: relative;
+ z-index: 10;
+ padding-left: 30px;
+ padding-right: 30px;
+ display: flex;
+ align-items: center;
+ height: 80px;
+ background: #fff;
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
+ .logoArea {
+ width: 300px;
+ .backBtn {
+ display: inline-block;
+ padding: 12px 10px;
+ margin-right: 26px;
+ background-color: rgba(222, 224, 230, 0.3);
+ cursor: pointer;
+ }
+ .logo {
+ display: inline-block;
+ width: 105px;
+ font-size: 24px;
+ font-weight: bold;
+ img {
+ width: 100%;
+ }
+ }
+ }
+ .controlArea {
+ flex: 1;
+ text-align: center;
+ .tit {
+ font-size: 18px;
+ color: #000;
+ }
+ }
+ .btnArea {
+ width: 400px;
+ text-align: right;
+ }
+ }
\ No newline at end of file
diff --git a/src/pages/editor/models/editorModal.js b/src/pages/editor/models/editorModal.js
index d224604..3e62fda 100644
--- a/src/pages/editor/models/editorModal.js
+++ b/src/pages/editor/models/editorModal.js
@@ -41,7 +41,28 @@ export default {
}
},
effects: {
-
+ // 更新一条数据模型信息
+ // *modifyDataModel({ payload }, { call, put }) {
+ // const modifyDataModel = yield call(mesService.modifyDataModel, payload)
+ // const activate = yield call(mesService.activateModifiedTableDataModel, modifyDataModel.dataModelId)
+ // const responseMessage = yield call(mesService.getDetailDataModel, { dataModelId: activate.dataModelId, showDataModelFieldFlag: true })
+ // yield put({
+ // type: 'receiveDetailDataModel',
+ // payload: responseMessage && responseMessage
+ // })
+ // },
+
+ // 创建一条数据模型
+ // *createDataModel({ payload }, { call, put }) {
+ // const responseMessage = yield call(mesService.createDataModel, payload)
+ // if (responseMessage.dataModelId) {
+
+ // router.push({
+ // pathname: '/dataModel/view',
+ // query: { id: responseMessage.dataModelId }
+ // })
+ // }
+ // },
},
subscriptions: {
setup({ dispatch, history }) {
diff --git a/src/pages/editor/preview.js b/src/pages/editor/preview.js
index dc77ac8..da4125f 100644
--- a/src/pages/editor/preview.js
+++ b/src/pages/editor/preview.js
@@ -34,7 +34,7 @@ const PreviewPage = memo((props) => {
useEffect(() => {
const { tid } = props.location.query
req.get('/visible/preview/get', { params: { tid } }).then(res => {
- setPointData(res)
+ setPointData(res.map(item => ({...item, point: {...item.point, isDraggable: false, isResizable: false } })))
}).catch(err => {
setTimeout(() => {
window.close()
diff --git a/src/pages/login/index.less b/src/pages/login/index.less
new file mode 100644
index 0000000..dcad791
--- /dev/null
+++ b/src/pages/login/index.less
@@ -0,0 +1,26 @@
+.loginWrap {
+ width: 100vw;
+ height: 100vh;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ background: #f0f0f0 url(../../assets/login_bg.png) center center;
+ background-size: cover;
+ .tit {
+ font-size: 35px;
+ text-align: center;
+ padding-bottom: 20px;
+ margin-bottom: 36px;
+ border-bottom: 1px solid #f0f0f0;
+ }
+ .formWrap {
+ margin-left: auto;
+ margin-right: auto;
+ width: 520px;
+ padding: 22px 0 20px;
+ background-color: #fff;
+ box-shadow: 0 0 20px rgba(0,0,0,.1);
+ border-radius: 6px;
+ }
+}
\ No newline at end of file
diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx
new file mode 100644
index 0000000..81d4963
--- /dev/null
+++ b/src/pages/login/index.tsx
@@ -0,0 +1,70 @@
+import { Form, Input, Button, Checkbox } from 'antd';
+import http from '@/utils/req';
+import { history } from 'umi';
+import styles from './index.less';
+
+const layout = {
+ labelCol: { span: 6 },
+ wrapperCol: { span: 16 },
+};
+const tailLayout = {
+ wrapperCol: { offset: 6, span: 16 },
+};
+
+const Login = (props) => {
+ const onFinish = values => {
+ http.post('/login', {...values}).then(res => {
+ localStorage.setItem('token', res.token)
+ localStorage.setItem('user', values.username)
+ history.push('/')
+ })
+ };
+
+ const onFinishFailed = errorInfo => {
+ console.log('Failed:', errorInfo);
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default Login
diff --git a/src/utils/req.ts b/src/utils/req.ts
index 651a907..0c268a2 100644
--- a/src/utils/req.ts
+++ b/src/utils/req.ts
@@ -4,7 +4,8 @@ import { message } from 'antd'
const isDev = process.env.NODE_ENV === 'development'
const instance = axios.create({
- baseURL: 'xxxxxxx',
+ // 服务器地址需要自己配置和开发
+ baseURL: isDev ? 'http://localhost:3000/xxx' : 'http://xxxxx',
timeout: 10000,
withCredentials: true
});
@@ -24,8 +25,8 @@ instance.interceptors.request.use(function (config) {
// 添加响应拦截器
instance.interceptors.response.use(function (response) {
- // 对响应数据做点什么, 这里是自定义的信息头,用来给前端说明展示的信息
- if(response.headers['x-x-x'] === 'xxx') {
+ // 对响应数据做点什么
+ if(response.headers['x-show-msg'] === 'zxzk_msg_200') {
message.success(response.data.msg);
}
return response.data.result;