傅行帆 5 jaren geleden
bovenliggende
commit
74b69c453d
3 gewijzigde bestanden met toevoegingen van 48 en 16 verwijderingen
  1. 21
    0
      src/app.js
  2. 23
    12
      src/pages/sample/h5/components/H5Card.jsx
  3. 4
    4
      src/pages/sample/h5/edit.jsx

+ 21
- 0
src/app.js Bestand weergeven

@@ -1,3 +1,24 @@
1
+(function (doc, win) {
2
+  var docEl = doc.documentElement,
3
+    resizeEvt = 'onorientationchange' in window ? 'onorientationchange' : 'resize',
4
+    recalc = function () {
5
+      var clientWidth = docEl.clientWidth;
6
+      if (!clientWidth) return;
7
+      if (clientWidth < 1700) {
8
+        docEl.style.fontSize = '150px';
9
+      } else if ( 1700>=clientWidth>2000 ){
10
+        docEl.style.fontSize = '170px';
11
+      }else{
12
+        docEl.style.fontSize = '170px';
13
+        // docEl.style.fontSize = 100 * (clientWidth / 1400) + 'px';
14
+      }
15
+    };
16
+
17
+  if (!doc.addEventListener) return;
18
+  win.addEventListener(resizeEvt, recalc, false);
19
+  doc.addEventListener('DOMContentLoaded', recalc, false);
20
+})(document, window);
21
+
1 22
 export const dva = {
2 23
   config: {
3 24
     onError(e) {

+ 23
- 12
src/pages/sample/h5/components/H5Card.jsx Bestand weergeven

@@ -12,7 +12,7 @@ const { Meta } = Card
12 12
 const H5Card = props => {
13 13
   const { h5Data } = props
14 14
 
15
-  const colerArr = ["#2db7f5","#87d068","#108ee9","magenta","red","volcano","orange","green","geekblue","purple"]
15
+  const colerArr = ["#2db7f5", "#87d068", "#108ee9", "magenta", "red", "volcano", "orange", "green", "geekblue", "purple"]
16 16
   const toEdit = () => {
17 17
     router.push({
18 18
       pathname: '/sample/h5/edit',
@@ -29,7 +29,7 @@ const H5Card = props => {
29 29
       okText: '确认',
30 30
       cancelText: '取消',
31 31
       onOk() {
32
-        request({ ...apis.sample.puth5, urlData: { id: h5Data.sampleId }}).then((data) => {
32
+        request({ ...apis.sample.puth5, urlData: { id: h5Data.sampleId } }).then((data) => {
33 33
           message.info('操作成功!')
34 34
           props.onChange()
35 35
         }).catch((err) => {
@@ -40,24 +40,35 @@ const H5Card = props => {
40 40
     });
41 41
   }
42 42
 
43
-    return (
44
-      <>
43
+  return (
44
+    <>
45 45
       <Card
46 46
         hoverable
47
-        style={{ width: 480,height: 450,marginTop: 50,position: "relative" }}
48
-        cover={<img height="335px" alt="example" onClick={toEdit} src={h5Data.coverImg} />}
47
+        style={{
48
+          minWidth: '240px',
49
+          marginRight: '0.1rem',
50
+          height: '2.1rem',
51
+          background: 'rgba(255, 255, 255, 1)',
52
+          boxShadow: '0px 0px 16px 2px rgba(0, 0, 0, 0.12)',
53
+          borderRadius: '12px',
54
+          marginBottom: '0.1rem',
55
+          position: 'relative',
56
+          padding: '0.1rem'
57
+        }}
58
+        // style={{ width: 480,height: 450,marginTop: 50,position: "relative" }}
59
+        cover={<img  width="100%" style={{height:'1.3rem'}} alt="example" onClick={toEdit} src={h5Data.coverImg} />}
49 60
         extra={<a onClick={deleteSample}>删除</a>}
50 61
         title={h5Data.status == 1 ? '已发布' : h5Data.status == 0 ? '未发布' : ''}
51 62
       >
52 63
         <Meta onClick={toEdit} title={h5Data.sampleName} />
53
-        <div style={{position: "absolute", bottom: "50px", right: "20px", margin: '20px 0'}}>
54
-          {(h5Data.tags || []).map((x,i) => {
64
+        <div style={{ position: "absolute", bottom: "50px", right: "20px", margin: '20px 0' }}>
65
+          {(h5Data.tags || []).map((x, i) => {
55 66
             return <Tag color={colerArr[i]}>{x}</Tag>
56 67
           })}
57 68
         </div>
58 69
       </Card>
59 70
     </>
60
-    )
61
-  }
62
- 
63
-  export default H5Card
71
+  )
72
+}
73
+
74
+export default H5Card

+ 4
- 4
src/pages/sample/h5/edit.jsx Bestand weergeven

@@ -12,12 +12,12 @@ import moment from 'moment';
12 12
 
13 13
 const formItemLayout = {
14 14
   labelCol: {
15
-    xs: { span: 24 },
16
-    sm: { span: 2 },
15
+    xs: { span: 6 },
16
+    sm: { span: 6 },
17 17
   },
18 18
   wrapperCol: {
19
-    xs: { span: 24 },
20
-    sm: { span: 16 },
19
+    xs: { span: 18 },
20
+    sm: { span: 18 },
21 21
   },
22 22
 };
23 23