文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit ac77814c by 李严凡

Merge branch 'develop' of https://gitlab.redhtc.com/Berlincen/DA-Platform into develop

parents a89ee214 0e79b9d3
var baseURL = 'http://localhost:9100/api'
var baseURL = 'http://47.92.1.107/api'
export {
baseURL
......
import axios from 'axios'
import { baseURL } from '@/assets/js/env.js'
import { Message } from 'element-ui'
axios.defaults.baseURL = baseURL
axios.defaults.timeout = 8000
// 添加响应拦截器
axios.interceptors.response.use(function (response) {
let res = response.data
if (response.config.url === '/file/getFiles') {
res.id = response.config.params.pieceId
}
return res
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error)
})
// 添加请求拦截器,每次请求设置都请求cookie信息
axios.interceptors.request.use(function (config) {
// 除了登录和注册请求,其余请求如果没有用户信息(即没登录),就跳转到登录页面
if (!window.vm.$store.state.userInfo &&
config.url !== '/user/signin' &&
config.url !== '/user/signup') {
Message({
type: 'warning',
message: '您未登录,请前往登录界面进行操作'
})
window.vm.$router.replace('/')
}
return config
}, function (error) {
return Promise.reject(error)
})
export default axios
......@@ -33,7 +33,23 @@ export default {
}
},
beforeMount () {
this.getTasks()
console.log('2')
},
mounted () {
var self = this
this.axios.get('/task/getTasks', {
params: {
pageSize: self.pageSize,
currentPage: self.currentPage,
...self.condition
}
}).then(res => {
console.log(res)
self.tasks = res.data.tasks
self.pageNum = res.data.pageNum
self.pageChange()
})
console.log('1')
},
methods: {
// 任务列表更新
......@@ -50,6 +66,7 @@ export default {
...self.condition
}
}).then(res => {
console.log(res)
self.tasks = res.data.tasks
self.pageNum = res.data.pageNum
self.pageChange()
......
......@@ -5,8 +5,6 @@
<div class="filter-item">
任务名称:
<el-input class="filter-input" prefix-icon="el-icon-search" v-model="keyword" placeholder="请输入查询条件"></el-input>
</div>
<div class="filter-item">
<el-button class="filter-button" type="primary" @click="search()">查询</el-button>
</div>
<el-divider></el-divider>
......@@ -26,13 +24,11 @@
<div class="notice">
<div class="notice-title">公告</div>
<div class="notice-body">
<img src="@/assets/empty.png" alt="暂无公告">
</div>
</div>
<div class="notice">
<div class="notice-title">公告</div>
<div class="notice-body">
<img src="@/assets/empty.png" alt="暂无公告">
<h4>标注方法:</h4>
<p>1.在任务大厅选择想要标注的任务,进入任务详情界面,勾选想要标注的分片,跳转到我的任务界面,对勾选的任务分片进行标注。</p>
<p>2.文本标注:进入文本标注页面后,鼠标选中一段文本,自动弹出标注选项,选择对应的实体和属性即可完成标注。</p>
<p>3.图像图层标注:点击矩形标注、多边形标注或者地标标注,选择对应标注类型,之后选中图像或图层上的区域,对标注区域命名,最后保存标注结果即可标注成功。</p>
<!-- <img src="@/assets/empty.png" alt="暂无公告"> -->
</div>
</div>
</div>
......@@ -88,6 +84,7 @@ export default {
margin-bottom: 15px;
.filter-input{
margin-left: 20px;
margin-right: 20px;;
width: 300px;
}
}
......@@ -106,10 +103,9 @@ export default {
}
.notice-body{
background-color: white;
height: 200px;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
text-align: left;
font-size: 14px;
}
}
}
......
......@@ -185,16 +185,16 @@ export default {
},
async mounted () {
let routeParams = this.$route.params
console.log("routeParams")
console.log(routeParams)
// console.log("routeParams")
// console.log(routeParams)
this.imageName = routeParams.file.url
this.relationId = routeParams.relationId
this.description = routeParams.piece.template
console.log(this.baseURL)
// console.log(this.baseURL)
let baseURL = this.baseURL
// 获取图片列表并转换格式
let imageList = await this.getLabelList()
console.log(imageList)
// console.log(imageList)
this.imageList = imageList.imageList
// 加载第一张图片
......@@ -202,17 +202,17 @@ export default {
// var imgUrl = this.data.length ? this.data[0].imageUrl : 'https://juanmdbucket.oss-cn-beijing.aliyuncs.com/20200627155321.png'
// 这个是现在使用的代码
var imgUrl = baseURL + '/files/getImage/' + this.imageName
console.log(imgUrl)
// console.log(imgUrl)
// 如果不使用后端可以用这个模拟
// var imgUrl = 'https://juanmdbucket.oss-cn-beijing.aliyuncs.com/20200301231737.png'
this.imageUrl = imgUrl
// 把这个函数放在后面是因为formExchange中可能会用到this.imageUrl
console.log('input')
console.log(this.imageList)
// console.log('input')
// console.log(this.imageList)
this.formExchange(this.imageList)
console.log('output')
console.log(this.data)
// console.log('output')
// console.log(this.data)
console.log(this.data.length + ' 图片张数')
var img = new Image()
......@@ -265,7 +265,7 @@ export default {
// 还原数据库里的标注记录
let id = _this.pictureId
console.log('id = ' + id)
// console.log('id = ' + id)
_this.data.forEach(function (element, index) {
var indexPic = index
......@@ -274,8 +274,8 @@ export default {
// console.log(element)
var num = []
element.pointList.forEach(function (element1) {
console.log('pointlist')
console.log(element1)
// console.log('pointlist')
// console.log(element1)
num.push(element1.X)
num.push(element1.Y)
})
......@@ -284,7 +284,7 @@ export default {
// var rx = element.pointList[1].X
// var ry = element.pointList[1].Y
// var num = [r1, r2, rx, ry]
console.log(num)
// console.log(num)
_this.canvasAll[indexPic].push(num)
})
})
......@@ -760,7 +760,7 @@ export default {
let imageList = res.data
// console.log(imageList.imageList[0].imageUrl)
// self.$store.commit('setImageData', imageList.imageList)
console.log(imageList)
// console.log(imageList)
return imageList
} else {
// self.$store.commit('clearImageData')
......@@ -774,8 +774,8 @@ export default {
},
// 将数据库保存的数据格式转换为前端可以直接使用的格式,同时如果第一次标注该图片,会生成新数据
formExchange (inputData) {
console.log('formexchange')
console.log(inputData)
// console.log('formexchange')
// console.log(inputData)
if (inputData.length > 0) {
var index = 0
inputData.forEach(element => {
......@@ -797,8 +797,8 @@ export default {
children: []
}
this.data.push(newData)
console.log('formexchange')
console.log(this.data)
// console.log('formexchange')
// console.log(this.data)
//imageNum这个虽然没啥用,但是先放着吧
this.imageNum = 1
}
......@@ -1071,20 +1071,20 @@ export default {
this.$alert('保存成功', '保存成功', {
confirmButtonText: '确定',
callback: action => {
this.$message({
type: 'info',
message: `action: ${action}`
})
// this.$message({
// type: 'info',
// //message: `action: ${action}`
// })
}
})
} else {
this.$alert('保存失败', '保存失败', {
confirmButtonText: '确定',
callback: action => {
this.$message({
type: 'info',
message: `action: ${action}`
})
// this.$message({
// type: 'info',
// message: `action: ${action}`
// })
}
})
}
......@@ -1092,10 +1092,10 @@ export default {
this.$alert('保存失败', '保存失败', {
confirmButtonText: '确定',
callback: action => {
this.$message({
type: 'info',
message: `action: ${action}`
})
// this.$message({
// type: 'info',
// message: `action: ${action}`
// })
}
})
})
......
......@@ -305,15 +305,21 @@
},
// 双击显示详细信息
markInfo (index) {
// 改变中心位置
this.setCenter('mark', this.landmarkData[index])
this.isMark = true
this.labelNow = index
this.isInfo = true
this.labelName = this.landmarkData[index].landmarkName
this.labelPosition = 'X:' + this.landmarkData[index].X + '\nY:' + this.landmarkData[index].Y
this.labelPosition = '经度:' + this.landmarkData[index].X + '\n纬度:' + this.landmarkData[index].Y
},
areaInfo (index) {
// 改变中心位置
this.setCenter('polygon', this.layerData[index].pointList)
this.isMark = false
this.labelNow = index
this.isInfo = true
......@@ -362,6 +368,27 @@
this.map.add(polygon)
})
},
// 计算多边形几何中心, 没有使用的函数
findCenter(pointList){
var minX = 1000
var minY = 1000
var maxX = -1000
var maxY = -1000
pointList.forEach((element, i) => {
if (element.X < minX)
minX = element.X
if (element.X > maxX)
maxX = element.X
if (element.Y < minY)
minY = element.Y
if (element.Y > maxY)
maxY = element.Y
})
let midX = (minX + maxX)/ 2
let midY = (minY + maxY)/ 2
this.jumpByPosition(midX, midY)
},
markEnter (index) {
//还原地标
this.map.clearMap()
......@@ -399,8 +426,25 @@
this.map.add(polygon)
})
},
setCenter () {
this.map.setCenter([this.centerY, this.centerX])
setCenter (type, pointList) {
if(type == 'mark') {
var tmp = new AMap.Marker({
position: new AMap.LngLat(pointList.X, pointList.Y), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
title: 'tmp'
});
}else if(type == 'polygon') {
var path = []
pointList.forEach(e => {
path.push(new AMap.LngLat(e.X, e.Y))
})
var tmp = new AMap.Polygon({
path: path,
fillColor: '#fff', // 多边形填充颜色
borderWeight: 2, // 线条宽度,默认为 1
strokeColor: 'red', // 线条颜色
})
}
this.map.setFitView(tmp)
},
/**
* 还原数据中的地标、标注区域
......@@ -692,20 +736,20 @@
this.$alert('保存成功', '保存成功', {
confirmButtonText: '确定',
callback: action => {
this.$message({
type: 'info',
message: `action: ${ action }`
});
// this.$message({
// type: 'info',
// message: `action: ${ action }`
// });
}
});
} else {
this.$alert('保存失败', '保存失败', {
confirmButtonText: '确定',
callback: action => {
this.$message({
type: 'info',
message: `action: ${ action }`
});
// this.$message({
// type: 'info',
// message: `action: ${ action }`
// });
}
});
}
......@@ -713,10 +757,10 @@
this.$alert('保存失败', '保存失败', {
confirmButtonText: '确定',
callback: action => {
this.$message({
type: 'info',
message: `action: ${ action }`
});
// this.$message({
// type: 'info',
// message: `action: ${ action }`
// });
}
});
})
......
......@@ -315,6 +315,9 @@
},
// 双击显示详细信息
markInfo (index) {
// 改变中心位置
this.setCenter('mark', this.landmarkData[index])
this.isMark = true
this.labelNow = index
this.isInfo = true
......@@ -323,7 +326,11 @@
this.labelPosition = 'X:' + this.landmarkData[index].X + '\nY:' + this.landmarkData[index].Y
},
areaInfo (index) {
// 改变中心位置
this.setCenter('polygon', this.layerData[index].pointList)
this.isMark = false
this.labelNow = index
this.isInfo = true
......@@ -372,6 +379,26 @@
this.map.add(polygon)
})
},
// 计算多边形几何中心,没有使用的函数
findCenter(pointList){
var minX = 1000
var minY = 1000
var maxX = -1000
var maxY = -1000
pointList.forEach((element, i) => {
if (element.X < minX)
minX = element.X
if (element.X > maxX)
maxX = element.X
if (element.Y < minY)
minY = element.Y
if (element.Y > maxY)
maxY = element.Y
})
let midX = (minX + maxX)/ 2
let midY = (minY + maxY)/ 2
this.jumpByPosition(midX, midY)
},
markEnter (index) {
//还原地标
this.map.clearMap()
......@@ -409,8 +436,25 @@
this.map.add(polygon)
})
},
setCenter () {
this.map.setCenter([this.centerY, this.centerX])
setCenter (type, pointList) {
if(type == 'mark') {
var tmp = new AMap.Marker({
position: new AMap.LngLat(pointList.X, pointList.Y), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
title: 'tmp'
});
}else if(type == 'polygon') {
var path = []
pointList.forEach(e => {
path.push(new AMap.LngLat(e.X, e.Y))
})
var tmp = new AMap.Polygon({
path: path,
fillColor: '#fff', // 多边形填充颜色
borderWeight: 2, // 线条宽度,默认为 1
strokeColor: 'red', // 线条颜色
})
}
this.map.setFitView(tmp)
},
/**
* 还原数据中的地标、标注区域
......
......@@ -6,18 +6,14 @@ import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import axios from '@/assets/js/http.js'
import VueAxios from 'vue-axios'
import * as math from 'mathjs'
// cnpm i default-passive-events -S
import 'default-passive-events'
import { baseURL } from '@/assets/js/env.js'
Vue.prototype.$math = math
axios.defaults.baseURL = baseURL
axios.defaults.timeout = 8000
Vue.prototype.baseURL = axios.defaults.baseURL // 图片标注接口使用
Vue.use(VueAxios, axios)
......@@ -38,30 +34,4 @@ var vm = new Vue({
template: '<App/>'
})
// 添加响应拦截器
axios.interceptors.response.use(function (response) {
let res = response.data
if (response.config.url === '/file/getFiles') {
res.id = response.config.params.pieceId
}
return res
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error)
})
// 添加请求拦截器,每次请求设置都请求cookie信息
axios.interceptors.request.use(function (config) {
// 除了登录和注册请求,其余请求如果没有用户信息(即没登录),就跳转到登录页面
if (!vm.$store.state.userInfo &&
config.url !== '/user/signin' &&
config.url !== '/user/signup') {
ElementUI.Message({
type: 'warning',
message: '您未登录,请前往登录界面进行操作'
})
vm.$router.replace('/')
}
return config
}, function (error) {
return Promise.reject(error)
})
window.vm = vm
......@@ -18,7 +18,7 @@ def getTokenList():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......@@ -51,7 +51,7 @@ def addToken():
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......@@ -89,7 +89,7 @@ def deleteToken():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......@@ -131,7 +131,7 @@ def revToken():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......@@ -172,7 +172,7 @@ def insertDocument():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......@@ -221,7 +221,7 @@ def revDocumentState():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......@@ -261,7 +261,7 @@ def createTemplated():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['code'] = '0'
return json.dumps(return_dict, ensure_ascii=False)
......@@ -296,7 +296,7 @@ def getTemplated():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['code'] = '0'
return json.dumps(return_dict, ensure_ascii=False)
......@@ -325,7 +325,7 @@ def getOneTemplate():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......@@ -358,7 +358,7 @@ def deleteTemplate():
# 判断传入的json数据是否为空
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......
......@@ -167,12 +167,12 @@ def get_image_size(imageName):
# documentId获取文本内容
@uploadDownload.route('/getFileContent', methods=['POST'])
@uploadDownload.route('/getFileContent', methods=['Post'])
def getFileContent():
return_dict = {'return_code': '200', 'return_info': '处理成功', 'result': False}
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
......@@ -195,18 +195,17 @@ def getFileContent():
# documentId获取表格内容
@uploadDownload.route('/getExcelContent', methods=['POST'])
@uploadDownload.route('/getExcelContent', methods=['Post'])
def getExcelContent():
return_dict = {'return_code': '200', 'return_info': '处理成功', 'result': False}
try:
get_Data = request.get_data()
get_Data = json.loads(get_Data)
data = request.get_json(silent=True)
except Exception as e:
return_dict['return_code'] = '201'
return_dict['return_info'] = '请求参数有误'
return json.dumps(return_dict, ensure_ascii=False)
documentId = get_Data.get('documentId')
documentId = data['documentId']
result = mongodbApi.findOne(collectionTest, {"documentId": documentId})
# 判断是否查询到结果
......@@ -270,7 +269,7 @@ def getExcelContent():
@uploadDownload.route('/downloadContent', methods=['POST'])
def downloadContent():
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
documentId = get_Data.get('documentId')
result = mongodbApi.findOne(collectionTest, {"documentId": documentId})
......@@ -285,7 +284,7 @@ def downloadContent():
@uploadDownload.route('/downloadFile', methods=['POST'])
def downloadFile():
get_Data = request.get_data()
get_Data = json.loads(get_Data)
get_Data = json.loads(get_Data.decode('utf-8'))
relationId = get_Data.get('relationId')
result = mongodbApi.findOne(collectionTest, {"relationId": relationId})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment