反馈接口对接
This commit is contained in:
@@ -6,10 +6,17 @@ import config from '../js/config';
|
||||
* @returns
|
||||
*/
|
||||
export function addFeedBack(params) {
|
||||
return request({
|
||||
url: '/feedback/addFeedBack',
|
||||
method: 'post',
|
||||
data: params,
|
||||
let files = params.files;
|
||||
console.log(files);
|
||||
let data = JSON.parse(JSON.stringify(params));
|
||||
delete data.files
|
||||
return uni.uploadFile({
|
||||
url: config.domain + '/feedback/addFeedBack', //仅为示例,非真实的接口地址
|
||||
files: files,
|
||||
header: {
|
||||
Authorization: '12',
|
||||
},
|
||||
formData: data,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,7 +35,6 @@ export function queryFeedBackDetail(id) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 问题列表
|
||||
export function queryFeedBackPage(params) {
|
||||
return request({
|
||||
@@ -47,7 +53,7 @@ export function queryFeedBackPage(params) {
|
||||
/**
|
||||
* 添加反馈聊天
|
||||
*
|
||||
* @param {*} params {chatContent: '', id: 12, user_id: 1}
|
||||
* @param {*} params {chatContent: '', id: 12, userId: 1}
|
||||
* @returns
|
||||
*/
|
||||
export function AddFeedbackChat(params) {
|
||||
@@ -55,10 +61,12 @@ export function AddFeedbackChat(params) {
|
||||
url: '/feedbackChat/AddFeedbackChat',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新反馈聊天状态
|
||||
* @param {*} params {
|
||||
@@ -72,5 +80,8 @@ export function updateChatStatus(params) {
|
||||
url: '/feedbackChat/updateChatStatus',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export default (options = {}) => {
|
||||
: options.url,
|
||||
data: {
|
||||
...options.data,
|
||||
userId: uni.getStorageSync('userInfo').id,
|
||||
},
|
||||
header: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8',
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
<uni-easyinput type="text" v-model="formData.title" placeholder="请输入问题简要" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="描述">
|
||||
<uni-easyinput type="textarea" v-model="formData.des" placeholder="请输入详细描述" />
|
||||
<uni-easyinput type="textarea" v-model="formData.description" placeholder="请输入详细描述" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="图片">
|
||||
<uni-file-picker :auto-upload="false" :fileList="formData.fileList" @change="fileChange" />
|
||||
<uni-file-picker :auto-upload="false" @select="fileChange" @delete="delImg" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
@@ -29,14 +29,17 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import { addFeedBack } from '../../common/api/feedback'
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
formData: {
|
||||
title: '',
|
||||
des: '',
|
||||
fileList: []
|
||||
description: '',
|
||||
type: 1,
|
||||
userId: '',
|
||||
files: []
|
||||
},
|
||||
range: [
|
||||
{ value: 0, text: "DVR" },
|
||||
@@ -46,16 +49,55 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
delImg(e) {
|
||||
console.log(e);
|
||||
this.formData.files = this.formData.files.filter(item => item.url !== e.tempFilePath)
|
||||
},
|
||||
fileChange(e) {
|
||||
console.log(e);
|
||||
e.tempFilePaths.forEach(item => {
|
||||
this.formData.files.push({
|
||||
url: item,
|
||||
name: 'files'
|
||||
})
|
||||
})
|
||||
console.log(this.formData.files);
|
||||
},
|
||||
add() {
|
||||
this.formData.push({
|
||||
type: '',
|
||||
address: '',
|
||||
})
|
||||
},
|
||||
submit () {
|
||||
console.log(this.formData)
|
||||
uni.navigateBack({ delta: 1 })
|
||||
submit() {
|
||||
if (!this.formData.title) {
|
||||
uni.showToast({
|
||||
title: '请输入标题',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
addFeedBack(this.formData).then(res => {
|
||||
console.log(res)
|
||||
res = res[1]
|
||||
res = JSON.parse(res.data)
|
||||
console.log(res);
|
||||
if (res.code = 'A0000') {
|
||||
this.$util.toast(res.message)
|
||||
setTimeout(() => {
|
||||
// uni.redirectTo({ url: '/pages/message/feedback' })
|
||||
}, 1000);
|
||||
} else {
|
||||
this.$util.toast(res.message)
|
||||
}
|
||||
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
this.formData.userId = uni.getStorageSync('userInfo').id
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -221,7 +221,8 @@ export default {
|
||||
role: 4
|
||||
}
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: 4
|
||||
role: 4,
|
||||
id: 1
|
||||
})
|
||||
}
|
||||
if (this.userInfo.role == 4 || this.userInfo.role == 5 || this.userInfo.role == 6) {
|
||||
|
||||
@@ -1,26 +1,36 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<uni-list :border="false">
|
||||
<uni-list-item show-badge badgeType="error" isDot badge-text="新消息" title="机器死机" note="2023-02-03" clickable @click="jump" />
|
||||
<uni-list-item title="机器开不了机" note="2023-01-31" clickable @click="jump" />
|
||||
<uni-list-item :show-badge="item.chatCount > 0" badgeType="error" isDot badge-text="新消息" :title="item.title"
|
||||
:note="item.createTime" clickable v-for="(item, index) in store.data" :key="index" @click="jump(item)" />
|
||||
</uni-list>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
<Cn-empty v-if="store.empty"></Cn-empty>
|
||||
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryFeedBackPage } from '../../common/api/feedback'
|
||||
import list from '../../common/js/list'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
mixins: [list],
|
||||
data() {
|
||||
return {
|
||||
title: '灿能'
|
||||
}
|
||||
},
|
||||
onLoad () {
|
||||
|
||||
onShow() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
jump(){
|
||||
uni.navigateTo({ url: '/pages/message/feedbackDetail' })
|
||||
init() {
|
||||
this.store = this.DataSource('/feedback/queryFeedBackPage')
|
||||
this.store.params.userId = uni.getStorageSync('userInfo').id
|
||||
this.store.reload()
|
||||
},
|
||||
jump(item) {
|
||||
uni.navigateTo({ url: '/pages/message/feedbackDetail?id=' + item.id +'&chatCount=' + item.chatCount })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<view slot='body'>
|
||||
<view class='detail'>
|
||||
<view class="detail-content ">
|
||||
<view class="detail-content-title mb20">机器不稳定</view>
|
||||
<view> 2023-02-14</view>
|
||||
<view class="mt10 mb10">机器不稳定机器不稳定机器不稳定机器不稳定机器不稳定</view>
|
||||
<view class="detail-content-title mb20">{{ pageData.title }}</view>
|
||||
<view> {{ pageData.createTime }}</view>
|
||||
<view class="mt10 mb10">{{ pageData.description }}</view>
|
||||
<uni-file-picker readonly v-model="imageValue" mode="grid" />
|
||||
</view>
|
||||
<view class="detail-content " style="margin-bottom:0">
|
||||
@@ -15,15 +15,15 @@
|
||||
</view>
|
||||
</view>
|
||||
<uni-list>
|
||||
<uni-list-item title="客服" note="已经安排专员处理,请保持电话畅通" rightText="09-13 10:52" />
|
||||
<uni-list-item title="用户名" note="重启还是不行" rightText="09-13 10:50" />
|
||||
<uni-list-item title="客服" note="重启试试" rightText="09-13 09:50" />
|
||||
<uni-list-item :title="item.createBy" :note="item.chatContent" :rightText="item.createTime"
|
||||
v-for="(item, index) in pageData.csFeedbackChatPOList" :key="index" />
|
||||
</uni-list>
|
||||
<!-- 输入框示例 -->
|
||||
<uni-popup ref="inputDialog" type="dialog">
|
||||
<uni-popup-dialog ref="inputClose" type="info" mode="input" title="输入内容" value="对话框预置提示内容!"
|
||||
placeholder="请输入内容" @confirm="dialogInputConfirm">
|
||||
<uni-easyinput type="textarea" :maxlength="250" autoHeight v-model="value" placeholder="请输入内容"></uni-easyinput>
|
||||
<uni-easyinput type="textarea" :maxlength="250" autoHeight v-model="chatContent"
|
||||
placeholder="请输入内容"></uni-easyinput>
|
||||
</uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
@@ -31,23 +31,53 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import { queryFeedBackDetail, AddFeedbackChat, updateChatStatus } from '../../common/api/feedback'
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
value: "",
|
||||
chatContent: "",
|
||||
imageValue: [
|
||||
{
|
||||
"name": "file.png",
|
||||
"extname": "png",
|
||||
"url": "/static/logo.png",
|
||||
}
|
||||
]
|
||||
|
||||
],
|
||||
pageData: {
|
||||
},
|
||||
pageOption: {}
|
||||
}
|
||||
},
|
||||
onLoad(o) {
|
||||
this.pageOption = o
|
||||
this.init()
|
||||
if (o.chatCount > 0) {
|
||||
updateChatStatus({
|
||||
id: o.id,
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open () {
|
||||
init() {
|
||||
this.loading = true
|
||||
queryFeedBackDetail(this.pageOption.id).then(res => {
|
||||
// 反转数组
|
||||
res.data.csFeedbackChatPOList.reverse()
|
||||
this.pageData = res.data
|
||||
this.loading = false
|
||||
console.log(res);
|
||||
})
|
||||
},
|
||||
dialogInputConfirm() {
|
||||
AddFeedbackChat({ chatContent: this.chatContent, id: this.pageOption.id }).then(res => {
|
||||
console.log(res);
|
||||
this.$util.toast('回复成功')
|
||||
this.init()
|
||||
this.chatContent = ''
|
||||
})
|
||||
},
|
||||
open() {
|
||||
this.$refs.inputDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user