Ver código fonte

ADD:点赞点踩,报告修改

wjj 4 anos atrás
pai
commit
399f79a37f

+ 66 - 5
src/pages/edit/components/BugGuideTree/index.jsx

@@ -5,15 +5,17 @@ import styles from './index.less';
 import { timeToString } from '../../utils';
 import {
   RollbackOutlined,
+  DislikeOutlined,
+  LikeOutlined,
 } from '@ant-design/icons';
 import { recurrent, severity, bug_categories } from '../Step2/const';
 import * as echarts from 'echarts';
 
-//这里只能放在 pages/edit/assets中作为路径显示
+//tips:这里只能放在 pages/edit/assets中作为路径显示,否则要改动模板代码
 const imgArr = ['noArrived.png', 'yellowFlag.png', 'redFlag.png', 'recPage.png'];
 
 const BugGuideTree = (props) => {
-  const { dispatch, pathInfo, recommendPath, bugRecommendList, categories } = props;
+  const { dispatch, pathInfo, recommendPath, bugRecommendList, categories,reportCommonInfo } = props;
   const allPath = pathInfo.all;  //所有已发现bug
   const userPath = pathInfo.self;  //我的bug
   const { page, info } = recommendPath;
@@ -25,6 +27,7 @@ const BugGuideTree = (props) => {
   const [currDetail, setCurrDetail] = useState({});
   const [treeHeight, setTreeHeight] = useState(600);
   const [treeHeightNum, setTreeHeightNum] = useState(0);
+  const [operator, setOperator] = useState(-1);
 
   const columns = [
     {
@@ -77,6 +80,58 @@ const BugGuideTree = (props) => {
     setCurrDetail({});
   };
 
+  const handleOperateIcon = (type) => {
+    if(operator===-1){
+      //这里的操作是点赞点踩操作
+      setOperator(type);
+      if(type){
+        //type===1表示点赞
+        dispatch({
+          type: 'editReport/goodForReport',
+          payload: {
+            id: currDetail.id,//被点赞的报告的id
+            report_id:reportCommonInfo.id,
+            user_id:2,
+            action:'like'
+          },
+        })
+      }else{
+        dispatch({
+          type: 'editReport/badForReport',
+          payload: {
+            id: currDetail.id,//被点赞的报告的id
+            report_id:reportCommonInfo.id,
+            user_id:2,
+            action:'dislike'
+          },
+        });
+      }
+    }else{
+      //这里的操作是取消点赞点踩操作
+      setOperator(-1);
+      if(type){
+        //type===1表示点赞
+        dispatch({
+          type: 'editReport/cancelGoodForReport',
+          payload: {
+            id: currDetail.id,//被点赞的报告的id
+            report_id:reportCommonInfo.id,
+          },
+        })
+      }else{
+        dispatch({
+          type: 'editReport/cancelBadForReport',
+          payload: {
+            id: currDetail.id,//被点赞的报告的id
+            report_id:reportCommonInfo.id,
+          },
+        });
+      }
+    }
+
+
+  };
+
   const initChartData = () => {
     const data = categories;
     const str = JSON.stringify(data);
@@ -105,7 +160,7 @@ const BugGuideTree = (props) => {
   const setRecPageFirst = () => {
     timer = setTimeout(() => {
       const dom = document.getElementById('myChart');
-      if(dom){
+      if (dom) {
         const myChart = echarts.init(dom);
         let flag = 0;
         let style;
@@ -359,7 +414,7 @@ const BugGuideTree = (props) => {
   useEffect(() => {
     initChartData();
     initItemRecursion(jsonPath.children);
-  }, [pathInfo.all,pathInfo.self,jsonPath.children,info,page]);
+  }, [pathInfo.all, pathInfo.self, jsonPath.children, info, page]);
 
 
   useEffect(() => {
@@ -422,7 +477,12 @@ const BugGuideTree = (props) => {
                   src={currDetail.img_url}
                   className={styles.detailItemImg}
                 />
-
+                {operator !== 0 ?
+                  <LikeOutlined className={`${styles.operatorIcon} ${operator===1 ? styles.operatorIconActive : ''}` }
+                                onClick={() => handleOperateIcon(1)} /> : null}
+                {operator !== 1 ?
+                  <DislikeOutlined className={`${styles.operatorIcon} ${operator===0 ? styles.operatorIconActive : ''}`}
+                                   onClick={() => handleOperateIcon(0)} /> : null}
               </div>
             </div>
           </Col>
@@ -436,4 +496,5 @@ export default connect(({ editReport }) => ({
   categories: editReport.categories,
   recommendPath: editReport.recommendPath,
   bugRecommendList: editReport.bugRecommendList,
+  reportCommonInfo: editReport.reportCommonInfo,
 }))(BugGuideTree);

+ 8 - 0
src/pages/edit/components/BugGuideTree/index.less

@@ -40,5 +40,13 @@
     .detailItemImg {
       display: inline-block;
     }
+    .operatorIcon {
+      font-size: 30px;
+      margin:0 30px;
+      line-height: 80px;
+    }
+    .operatorIconActive {
+      color: red;
+    }
   }
 }

+ 10 - 10
src/pages/edit/components/Step1/index.jsx

@@ -34,14 +34,14 @@ const Step1 = (props) => {
 
   const onFinish = (values) => {
     let formData = new FormData();
-    formData.append('name', values.reportName);
+    formData.append('name', values.name);
     formData.append('case_id', '1718');
     formData.append('task_id', '1718');
-    formData.append('worker_id', '1');
+    formData.append('worker_id', '2');
     formData.append('case_take_id', '1718-1718');
-    formData.append('device_model', values.deviceBrand);
-    formData.append('device_brand', values.deviceName);
-    formData.append('device_os', values.os);
+    formData.append('device_model', values.device_brand);
+    formData.append('device_brand', values.device_name);
+    formData.append('device_os', values.device_os);
     dispatch({
       type: 'editReport/saveReportCommonDetail',
       payload: formData,
@@ -61,7 +61,7 @@ const Step1 = (props) => {
       request.send(formData);
       dispatch({
         type: 'editReport/getOsTypeAction',
-        payload: { examId: 1945 },
+        payload: { examId: 1718 },
       });
     }
     // if (dispatch) {
@@ -88,16 +88,16 @@ const Step1 = (props) => {
         onFinish={onFinish}
         onFinishFailed={onFinishFailed}
       >
-        <Form.Item label="报告名称" name="reportName" rules={[{ required: true, message: '请输入报告名称' }]}>
+        <Form.Item label="报告名称" name="name" rules={[{ required: true, message: '请输入报告名称' }]}>
           <Input placeholder="请输入报告名称" />
         </Form.Item>
-        <Form.Item label="设备名称" name="deviceName" rules={[{ required: true, message: '请输入设备品牌' }]}>
+        <Form.Item label="设备名称" name="device_name" rules={[{ required: true, message: '请输入设备品牌' }]}>
           <Input placeholder="请输入设备名称" />
         </Form.Item>
-        <Form.Item label="设备品牌" name="deviceBrand" rules={[{ required: true, message: '请输入设备品牌' }]}>
+        <Form.Item label="设备品牌" name="device_brand" rules={[{ required: true, message: '请输入设备品牌' }]}>
           <Input placeholder="请输入设备品牌" />
         </Form.Item>
-        <Form.Item label="操作系统" name="os" rules={[{ required: true, message: '请输入操作系统' }]}>
+        <Form.Item label="操作系统" name="device_os" rules={[{ required: true, message: '请输入操作系统' }]}>
           <Select placeholder="请选择操作系统">
             {osType.map((option) => {
               return <Select.Option value={option} key={option}>{option}</Select.Option>;

+ 76 - 40
src/pages/edit/components/Step2/index.jsx

@@ -1,5 +1,5 @@
 import React, { useEffect, useRef, useState } from 'react';
-import { Form, Row, Col, Card, Modal, Input, Select, Upload, Button, message, Tag ,Badge} from 'antd';
+import { Form, Row, Col, Card, Modal, Input, Select, Upload, Button, message, Tag, Badge } from 'antd';
 import { connect } from 'umi';
 import styles from './index.less';
 import {
@@ -38,30 +38,39 @@ const Step2 = (props) => {
   const [reportForm] = Form.useForm();
   const [addCaseForm] = Form.useForm();
   const [addBugForm] = Form.useForm();
+  const [editReportForm] = Form.useForm();
 
   const {
-    data, dispatch, reportCommonInfo,
+    dispatch, reportCommonInfo, osType,
     testCaseList, caseBugList, categories, pathInfo,
   } = props;
 
   const [showTaskRecommendModal, setTaskRecommendModal] = useState(false);
   const [showAddTestCaseModal, setAddTestCaseModal] = useState(false);
   const [showAddBugModal, setAddTestBugModal] = useState(false);
+  const [showEditReportModal, setEditReportModal] = useState(false);
   const currentTestCaseRef = useRef({});
   const [isAddCaseStatus, setIsAddCaseStatus] = useState(true);
   // const [currActiveTestCase, setCurrActiveTestCase] = useState({});
   const [page2List, setPage2List] = useState([]);
   const [page3List, setPage3List] = useState([]);
 
-  const chartRef = useRef();
-
-  if (!data) {
-    return null;
-  }
-
   const handleEditReportInfo = () => {
-    console.log('sss');
-
+    editReportForm.validateFields().then((res)=> {
+      let formData = new FormData();
+      formData.append('name', res.name);
+      formData.append('report_id', reportCommonInfo.id);
+      formData.append('worker_id', '2');
+      formData.append('case_take_id', '1718-1718');
+      formData.append('device_model', res.device_model);
+      formData.append('device_brand', res.device_brand);
+      formData.append('device_os', res.device_os);
+      dispatch({
+        type: 'editReport/updateReportCommonDetail',
+        payload: { formData }
+      })
+    })
+    setEditReportModal(false)
   };
 
   const handleAddOrEditTestCase = () => {
@@ -72,7 +81,7 @@ const Step2 = (props) => {
       formData.append('name', res.name);
       formData.append('front', res.front);
       formData.append('behind', res.behind);
-      formData.append('description', res.result);
+      formData.append('description', res.description);
       if (!isAddCaseStatus) {
         //处理编辑用例
         formData.append('id', currentTestCaseRef.current.id);
@@ -118,7 +127,7 @@ const Step2 = (props) => {
       formData.append('useCase', currentTestCaseRef.current.id);
       formData.append('case_id', '1718');
       formData.append('case_take_id', '1718-1718');
-      formData.append('worker_id', '1');
+      formData.append('worker_id', '2');
       formData.append('page', `${res.page1}-${res.page2}-${res.page3}`);
       //新建bug
       dispatch({
@@ -186,12 +195,6 @@ const Step2 = (props) => {
     setTaskRecommendModal(true);
   };
 
-  // useEffect(() => {
-  //   if(showTaskRecommendModal){
-  //     // initEcharts();
-  //   }
-  // }, [showTaskRecommendModal])
-
   const handleSelectPage1 = (val) => {
     let item = categories.find(x => x.item === val);
     setPage2List(item.children);
@@ -208,7 +211,7 @@ const Step2 = (props) => {
       type: 'editReport/getReportInfo',
       payload: {
         case_take_id: '1718-1718',
-        worker_id: 1,
+        worker_id: '2',
       },
     }).then((res) => {
       // console.log(res)
@@ -218,7 +221,7 @@ const Step2 = (props) => {
         type: 'editReport/getTestCaseList',
         payload: { report_id: reportCommonInfo.id },
       }).then((res) => {
-        if(res&&res.length){
+        if (res && res.length) {
           currentTestCaseRef.current = res[0];
           dispatch({
             type: 'editReport/getCaseBugList',
@@ -242,7 +245,6 @@ const Step2 = (props) => {
             form={reportForm}
             className={styles.stepForm}
             hideRequiredMark
-            initialValues={data}
           >
             <Row gutter={10}>
               <Col span={5}>
@@ -275,7 +277,7 @@ const Step2 = (props) => {
         </Col>
         <Col span={1}>
           <EditOutlined className={styles.editReportInfoIcon}
-                        onClick={() => handleEditReportInfo()}
+                        onClick={() => setEditReportModal(true)}
           />
         </Col>
       </Row>
@@ -299,7 +301,7 @@ const Step2 = (props) => {
 
 
               <div className={styles.testCaseList}>
-                { testCaseList&&testCaseList.length ? testCaseList.map((item) => {
+                {testCaseList && testCaseList.length ? testCaseList.map((item) => {
                   return (
                     <div
                       className={`${styles.testCaseItem} ${currentTestCaseRef.current.id === item.id ? styles.activeCase : ''}`}
@@ -309,12 +311,13 @@ const Step2 = (props) => {
                       }}>
                       <Row gutter={10}>
                         <Col span={6}>
-                          {<span className={styles.testCaseItemNo}>{`NO.${((item.id).substring((item.id.length) - 6)).toUpperCase()}`}</span>}
+                          {<span
+                            className={styles.testCaseItemNo}>{`NO.${((item.id).substring((item.id.length) - 6)).toUpperCase()}`}</span>}
                           {/*<Badge color="#2db7f5"*/}
                           {/*       text={} />*/}
                         </Col>
                         <Col span={15}>
-                          <span >{item.name}</span>
+                          <span>{item.name}</span>
                         </Col>
                         <Col span={3}>
                           <EditOutlined className={styles.editTestBug}
@@ -326,12 +329,12 @@ const Step2 = (props) => {
               </div>
             </Col>
 
-            <Col span={16} >
+            <Col span={16}>
               <div gutter={10} className={styles.testBugTitle}>
                 <h3>缺陷列表</h3>
                 <div>
                   <Button size="small" type="primary"
-                          disabled={JSON.stringify(currentTestCaseRef.current) === "{}"}
+                          disabled={JSON.stringify(currentTestCaseRef.current) === '{}'}
                           onClick={() => handleClickAddBug()}>
                     <PlusOutlined className={styles.addIcon} />
                     缺陷
@@ -339,7 +342,7 @@ const Step2 = (props) => {
 
                   <Button size="small"
                           className={styles.recommendBtn}
-                          disabled={JSON.stringify(currentTestCaseRef.current) === "{}"}
+                          disabled={JSON.stringify(currentTestCaseRef.current) === '{}'}
                           onClick={() => handleClickRecommendBtn()}>
                     <ForkOutlined className={styles.addIcon} />
                     推荐
@@ -348,7 +351,7 @@ const Step2 = (props) => {
 
               </div>
               <div className={styles.testBugList}>
-                {caseBugList&&caseBugList.length ? caseBugList.map((item) => {
+                {caseBugList && caseBugList.length ? caseBugList.map((item) => {
                   return (
                     <div className={styles.testBugItem} key={item.detail.id}>
                       <Row gutter={10}>
@@ -372,9 +375,9 @@ const Step2 = (props) => {
                           </div>
                         </Col>
                         <Col span={12} className={styles.bugImgList}>
-                          <img src={require('../../assets/report1.jpeg')} alt='bug_img'/>
-                          <img src={require('../../assets/report2.jpeg')} alt='bug_img'/>
-                          <img src={require('../../assets/report3.jpeg')} alt='bug_img'/>
+                          <img src={require('../../assets/report1.jpeg')} alt='bug_img' />
+                          <img src={require('../../assets/report2.jpeg')} alt='bug_img' />
+                          <img src={require('../../assets/report3.jpeg')} alt='bug_img' />
                         </Col>
                       </Row>
 
@@ -627,16 +630,49 @@ const Step2 = (props) => {
           {/*</Form.Item>*/}
         </Form>
       </Modal>
-      {/*<Modal title="修改报告信息" visible={showTaskRecommendModal} onOk={() => setTaskRecommendModal(false)}*/}
-      {/*       onCancel={() => setTaskRecommendModal(false)} className="addModal">*/}
-      {/*  <div>*/}
-      {/*    <div id="forceChart"></div>*/}
-      {/*  </div>*/}
-      {/*</Modal>*/}
+      <Modal title="修改报告基础信息" visible={showEditReportModal}
+             footer={[
+               <Button key='submit' type="primary" htmlType="submit"
+                       onClick={handleEditReportInfo}>确定</Button>,
+               <Button key='cancel' htmlType="button" style={{ marginLeft: '10px' }}
+                       onClick={() => {
+                         setEditReportModal(false);
+                       }}>取消</Button>]}
+             onCancel={() => {
+               setEditReportModal(false);
+             }}>
+        <div>
+          <Form
+            {...modalFormItemLayout}
+            form={editReportForm}
+            layout="horizontal"
+            initialValues={reportCommonInfo}
+          >
+            <Form.Item label="报告名称" name="name" rules={[{ required: true, message: '请输入报告名称' }]}>
+              <Input placeholder="请输入报告名称" />
+            </Form.Item>
+            <Form.Item label="设备名称" name="device_model" rules={[{ required: true, message: '请输入设备品牌' }]}>
+              <Input placeholder="请输入设备名称" />
+            </Form.Item>
+            <Form.Item label="设备品牌" name="device_brand" rules={[{ required: true, message: '请输入设备品牌' }]}>
+              <Input placeholder="请输入设备品牌" />
+            </Form.Item>
+            <Form.Item label="操作系统" name="device_os" rules={[{ required: true, message: '请输入操作系统' }]}>
+              <Select placeholder="请选择操作系统">
+                {osType.map((option) => {
+                  return <Select.Option value={option} key={option}>{option}</Select.Option>;
+                })}
+              </Select>
+            </Form.Item>
+          </Form>
+        </div>
+      </Modal>
       <Modal title="任务推荐" visible={showTaskRecommendModal}
              destroyOnClose width={1000}
              onOk={() => setTaskRecommendModal(false)}
-             onCancel={() => {setTaskRecommendModal(false);}
+             onCancel={() => {
+               setTaskRecommendModal(false);
+             }
              }
              className="addModal">
         <div>
@@ -649,10 +685,10 @@ const Step2 = (props) => {
 
 export default connect(({ editReport, loading }) => ({
   submitting: loading.effects['editReport/submitStepForm'],
-  data: editReport.step,
   reportCommonInfo: editReport.reportCommonInfo,
   testCaseList: editReport.testCaseList,
   caseBugList: editReport.caseBugList,
   categories: editReport.categories,
   pathInfo: editReport.pathInfo,
+  osType: editReport.osType,
 }))(Step2);

+ 2 - 2
src/pages/edit/components/Step2/index.less

@@ -98,12 +98,12 @@
     }
   }
 }
-.recommendBtn{
+.recommendBtn,.recommendBtn:active{
   background-color:#67c23a;
   border: 1px solid #67c23a;
   color: white;
   margin-left: 15px;
-  &:hover{
+  &:hover,&:focus{
     background-color: #8dd06b;
     border: 1px solid #67c23a;
     color: white;

+ 69 - 23
src/pages/edit/model.js

@@ -12,7 +12,12 @@ import {
   createCaseBug,
   getRecommendList,
   getPathInfo,
-  getRecommendPath
+  getRecommendPath,
+  goodReport,
+  badReport,
+  cancelGoodReport,
+  cancelBadReport,
+  recordAction,
 } from './service';
 
 const Model = {
@@ -26,14 +31,14 @@ const Model = {
       receiverName: 'Alex',
       amount: '500',
     },
-    taskName:'',
+    taskName: '',
     reportCommonInfo: {},
     testCaseList: [],
     caseBugList: [],
     categories: [],
-    pathInfo:[],
-    recommendPath:[],
-    bugRecommendList:[]
+    pathInfo: [],
+    recommendPath: [],
+    bugRecommendList: [],
   },
   effects: {
     * submitStepForm({ payload }, { call, put }) {
@@ -47,7 +52,7 @@ const Model = {
         payload: 'detail',
       });
     },
-    * getOsType({ payload }, { call, put}) {
+    * getOsType({ payload }, { call, put }) {
       const { examId } = payload;
       const res = yield call(getExamInfo, examId);
       const taskName = res?.result?.name;
@@ -59,8 +64,15 @@ const Model = {
       });
     },
     //todo:更新报告基础信息
-    * updateReportInfo({ payload }, { call, put}) {
-
+    * updateReportCommonDetail({ payload }, { call, put }) {
+      let { formData } = payload;
+      yield call(updateReportInfo, formData);
+      let res = yield call(getReportInfo,
+        formData.get('case_take_id'), formData.get('worker_id'));
+      yield put({
+        type: 'saveReportCommonInfo',
+        payload: res.result,
+      });
     },
     //todo:获取三级菜单信息
     * getCategories({ payload }, { call, put }) {
@@ -87,12 +99,12 @@ const Model = {
     * getReportInfo({ payload }, { call, put }) {
       const { case_take_id, worker_id } = payload;
       let res = yield call(getReportInfo, case_take_id, worker_id);
-      if(res.status === 200){
+      if (res.status === 200) {
         yield put({
           type: 'saveReportCommonInfo',
           payload: res.result,
         });
-      }else{
+      } else {
         yield put({
           type: 'saveCurrentStep',
           payload: 'info',
@@ -144,7 +156,7 @@ const Model = {
     },
     //todo:根据bug id获取bug detail
     * getBugDetail({ payload }, { call, put }) {
-      const {id} = payload;
+      const { id } = payload;
       let bugInfo = yield call(getBugInfo, id);//bug id list
       return bugInfo;
     },
@@ -154,7 +166,7 @@ const Model = {
       let newBugList = [];
       for (const item of bugIdList) {
         let newBugInfo = yield call(getBugInfo, item);
-        newBugList = [...newBugList,newBugInfo]
+        newBugList = [...newBugList, newBugInfo];
       }
       yield put({
         type: 'saveCaseBugList',
@@ -164,43 +176,77 @@ const Model = {
     },
     //todo:保存bug
     * createCaseBug({ payload }, { call, put }) {
-      const { useCase,formData } = payload;
+      const { useCase, formData } = payload;
       let res = yield call(createCaseBug, formData);
       yield put({
         type: 'getCaseBugList',
-        payload: useCase ,
+        payload: useCase,
       });
       return res;
     },
     //todo:获取bug 路径
     * getPathInfo({ payload }, { call, put }) {
-      const { case_take_id , report_id} = payload;
-      let res = yield call(getPathInfo, case_take_id,report_id);
+      const { case_take_id, report_id } = payload;
+      let res = yield call(getPathInfo, case_take_id, report_id);
       yield put({
         type: 'savePathInfo',
-        payload: res ,
+        payload: res,
       });
     },
     //todo:获取bug 推荐路径
     * getBugRecommendPath({ payload }, { call, put }) {
-      const { case_take_id , report_id} = payload;
-      let res = yield call(getRecommendPath, case_take_id,report_id);
+      const { case_take_id, report_id } = payload;
+      let res = yield call(getRecommendPath, case_take_id, report_id);
       yield put({
         type: 'saveRecommendPath',
-        payload: res
+        payload: res,
       });
       return res;
     },
     //todo:获取bug推荐列表
     * getBugRecommendList({ payload }, { call, put }) {
-      const { case_take_id , report_id} = payload;
-      let res = yield call(getRecommendList, case_take_id ,report_id);
+      const { case_take_id, report_id } = payload;
+      let res = yield call(getRecommendList, case_take_id, report_id);
       yield put({
         type: 'saveBugRecommendList',
-        payload: res
+        payload: res,
       });
       return res;
     },
+    //todo:点赞bug报告
+    * goodForReport({ payload }, { call, put }) {
+      const { id, report_id, user_id, action } = payload;
+      let res = yield call(goodReport, id, report_id);
+      console.log('aaa')
+      yield call(recordAction, user_id, id, action);
+      if (res.status === 200) {
+        console.log(res)
+        yield call(recordAction, user_id, id, action);
+      }
+    },
+    //todo:取消点赞bug报告
+    * cancelGoodForReport({ payload }, { call, put }) {
+      const { id, report_id } = payload;
+      yield call(cancelGoodReport, id, report_id);
+    },
+    //todo:点踩bug报告
+    * badForReport({ payload }, { call, put }) {
+      const { id, report_id, user_id, action } = payload;
+      yield call(badReport, id, report_id);
+      yield call(recordAction, user_id, id, action);
+    },
+    //todo:取消点踩bug报告
+    * cancelBadForReport({ payload }, { call, put }) {
+      const { id, report_id } = payload;
+      yield call(cancelBadReport, id, report_id);
+    },
+
+    //todo:存储用户行为
+    * recordAction({ payload }, { call, put }) {
+      const { user_id, target_id, action } = payload;
+      yield call(recordAction, user_id, target_id, action);
+    },
+
   },
   reducers: {
     saveCurrentStep(state, { payload }) {

+ 60 - 1
src/pages/edit/service.js

@@ -8,6 +8,7 @@ export async function fakeSubmitForm(params) {
 }
 //todo:更新报告
 export async function updateReportInfo(data) {
+  console.log(data.get('name'));
   return request('/api/extra/updateReport', {
     method: 'post',
     data,
@@ -102,7 +103,7 @@ export async function getRecommendPath(case_take_id,report_id) {
 
 //todo:获取bug推荐列表
 export async function getRecommendList(case_take_id,report_id) {
-  return request('/api/rec/getList', {
+  return request('/api/report/bugRec', {
     method: 'get',
     params: {
       case_take_id,
@@ -118,3 +119,61 @@ export async function createCaseBug(data) {
     data,
   });
 }
+
+//todo:给别人的报告点赞
+export async function goodReport(id,report_id) {
+  return request('/api/upload/good', {
+    method: 'get',
+    params:{
+      id,
+      report_id
+    }
+  });
+}
+
+//todo:取消报告点赞
+export async function cancelGoodReport(id,report_id) {
+  return request('/api/upload/cancelGood', {
+    method: 'get',
+    params:{
+      id,
+      report_id
+    }
+  });
+}
+
+//todo:报告点踩
+export async function badReport(id,report_id) {
+  return request('/api/upload/bad', {
+    method: 'get',
+    params:{
+      id,
+      report_id
+    }
+  });
+}
+
+//todo:取消报告点踩
+export async function cancelBadReport(id,report_id) {
+  return request('/api/upload/cancelBad', {
+    method: 'get',
+    params:{
+      id,
+      report_id
+    }
+  });
+}
+
+//todo:记录用户行为
+export async function recordAction(user_id,report_id,action) {
+  return request('/api/report/record', {
+    method: 'get',
+    params:{
+      user_id,
+      report_id,
+      action
+    }
+  });
+}
+
+

+ 1 - 1
src/pages/edit/utils.js

@@ -6,7 +6,7 @@ export const timeToString = (time)=>{
   const D = date.getDate() + ' ';
   const h = date.getHours() + ':';
   const m = date.getMinutes() + ':';
-  const s = date.getSeconds();
+  const s = date.getSeconds() < 10 ? ('0' + date.getSeconds()) : date.getSeconds();
   return Y+M+D+h+m+s;
 }