소스 검색

静态页面

XuChengxiang 4 년 전
부모
커밋
006d2249f3
3개의 변경된 파일40개의 추가작업 그리고 2개의 파일을 삭제
  1. 27
    2
      src/pages/WuYe/BaoXiuDetail/index.jsx
  2. 9
    0
      src/pages/WuYe/BaoXiuDetail/index.less
  3. 4
    0
      src/utils/api.js

+ 27
- 2
src/pages/WuYe/BaoXiuDetail/index.jsx 파일 보기

@@ -4,6 +4,7 @@ import request, { apis } from '@/utils/request'
4 4
 import { useModel } from '@/store'
5 5
 import toolclass from '@/utils/toolclass.js'
6 6
 import SlidePopup from '@/components/SlidePopup/index'
7
+import { Textarea } from '@tarojs/components'
7 8
 import Page from '@/layouts'
8 9
 import { getShareObject } from '@/utils/share.js'
9 10
 import '@/assets/css/reset.less'
@@ -19,6 +20,8 @@ export default function BaoXiuDetail () {
19 20
   const [ShowPopup, setShowPopup] = useState(false)
20 21
   const [ShowPingJiaPopup, setShowPingJiaPopup] = useState(false)
21 22
   const [StarIndex, setStarIndex] = useState(0)
23
+  const [Comment, setComment] = useState(null)
24
+  const [DataLock, setDataLock] = useState(false)
22 25
 
23 26
   Taro.useShareAppMessage(() => {
24 27
     return getShareObject({
@@ -47,6 +50,24 @@ export default function BaoXiuDetail () {
47 50
     }
48 51
   }
49 52
 
53
+  const CommentChange = (e) => {
54
+    setComment(e.detail.value)
55
+  }
56
+
57
+  const ToPingJia = () => {
58
+    if (DataLock) return
59
+    setDataLock(true)
60
+    request({ ...apis.PostGongDanPingJia, args: { orgId: user.orgId }, params: { ticketId: CurrnetBaoXiuId }, data: { score: StarIndex - 0 + 1, comment: Comment } }).then((res) => { // 获取工单详情
61
+      Taro.showToast({ title: '评价成功', icon: 'none' })
62
+      setDetailInfo({ ...DetailInfo, status: 5 })
63
+      setDataLock(false)
64
+      setShowPingJiaPopup(false)
65
+    }).catch((res) => {
66
+      Taro.showToast({ title: res, icon: 'none' })
67
+      setDataLock(false)
68
+    })
69
+  }
70
+
50 71
   return (
51 72
     <Page>
52 73
       <view className='BaoXiuDetail'>
@@ -111,7 +132,10 @@ export default function BaoXiuDetail () {
111 132
 
112 133
           {/* 更多操作 */}
113 134
           <view className='BottomBtn active'>
114
-            <text onClick={() => { setShowPingJiaPopup(true) }}>评价</text>
135
+            {
136
+              DetailInfo !== null && DetailInfo.status - 0 === 4 &&
137
+              <text onClick={() => { setShowPingJiaPopup(true) }}>评价</text>
138
+            }
115 139
           </view>
116 140
 
117 141
           {/* 更多操作 */}
@@ -130,7 +154,8 @@ export default function BaoXiuDetail () {
130 154
                 ))
131 155
               }
132 156
             </view>
133
-            <text className='Btn'>提交</text>
157
+            <Textarea placeholder='请输入您的评价' onInput={CommentChange} value={Comment}></Textarea>
158
+            <text className='Btn' onClick={ToPingJia}>提交</text>
134 159
           </view>
135 160
         </SlidePopup>
136 161
 

+ 9
- 0
src/pages/WuYe/BaoXiuDetail/index.less 파일 보기

@@ -259,6 +259,15 @@
259 259
       color: #666;
260 260
       line-height: 40px;
261 261
     }
262
+    textarea {
263
+      font-size: 26px;
264
+      line-height: 40px;
265
+      width: 100%;
266
+      display: block;
267
+      box-sizing: border-box;
268
+      border: 2px solid rgba(0, 0, 0, 0.08);
269
+      margin-top: 60px;
270
+    }
262 271
     >.StarLine {
263 272
       font-size: 0;
264 273
       white-space: nowrap;

+ 4
- 0
src/utils/api.js 파일 보기

@@ -1,6 +1,10 @@
1 1
 const prefix = `${HOST}/api/wx`
2 2
 
3 3
 const $api = {
4
+  PostGongDanPingJia: { // 工单评价
5
+    method: 'post',
6
+    url: `${prefix}/accessTicket/:orgId`
7
+  },
4 8
   getGuanJiaGongDanList:{ // 获取管家工单列表
5 9
     method: 'get',
6 10
     url: `${prefix}/life/ticket/list`