diff --git a/common/api/gc.js b/common/api/gc.js index fa8b05a..109b936 100644 --- a/common/api/gc.js +++ b/common/api/gc.js @@ -1,7 +1,7 @@ import request from '../js/request'; import config from '../js/config'; -export function addEngineering(params, files) { +export function addEngineering(params) { return request({ url: '/engineering/addEngineering', method: 'post', diff --git a/common/api/project.js b/common/api/project.js index 71a52fa..306b989 100644 --- a/common/api/project.js +++ b/common/api/project.js @@ -1,19 +1,18 @@ import request from '../js/request' import config from '../js/config' -export function addAppProject (params, files) { +export function addAppProject(params, files) { return uni.uploadFile({ url: config.domain + '/project/addAppProject', //仅为示例,非真实的接口地址 files: files, header: { - "Authorization": "12", + Authorization: '12', }, formData: params, - }); + }) } - -export function getProjectList (params) { +export function getProjectList(params) { return request({ url: '/project/queryProject', method: 'post', @@ -23,3 +22,59 @@ export function getProjectList (params) { }, }) } + +// 查询拓扑图 + +export function queryTopologyDiagramPage(params) { + return request({ + url: '/topologyDiagram/queryTopologyDiagramPage', + method: 'post', + data: Object.assign( + { + currentPage: 1, + pageSize: 999, + projectId: '', + searchValue: '', + }, + params + ), + header: { + 'Content-Type': 'application/json', + }, + }) +} + +// 删除拓扑图 +export function deleteAppTopologyDiagram(id) { + return request({ + url: '/topologyDiagram/AuditAppTopologyDiagram', + method: 'post', + data: { + id, + status: 0, + }, + header: { + 'Content-Type': 'application/json', + }, + }) +} + +// 新增拓扑图 + +export function addAppTopologyDiagram(params, filePath) { + return uni.uploadFile({ + url: config.domain + '/topologyDiagram/addAppTopologyDiagram', //仅为示例,非真实的接口地址 + filePath, + name: 'file', + header: { + Authorization: '12', + }, + formData: Object.assign( + { + topologyDiagramName: '', + projectId: '', + }, + params + ), + }) +} diff --git a/common/js/util.js b/common/js/util.js index f82f35b..7f39edc 100644 --- a/common/js/util.js +++ b/common/js/util.js @@ -12,7 +12,7 @@ const toast = (title, duration = 1500, call, mask = false, icon = 'none') => { }) setTimeout(() => { call && call() - }, duration); + }, duration) } /** * @description 格式化时间 @@ -20,7 +20,7 @@ const toast = (title, duration = 1500, call, mask = false, icon = 'none') => { * @param cFormat * @returns {string|null} */ -function parseTime (time, cFormat) { +function parseTime(time, cFormat) { if (arguments.length === 0) { return null } @@ -44,7 +44,7 @@ function parseTime (time, cFormat) { h: date.getHours(), i: date.getMinutes(), s: date.getSeconds(), - a: date.getDay() + a: date.getDay(), } return format.replace(/{([ymdhisa])+}/g, (result, key) => { let value = formatObj[key] @@ -58,14 +58,13 @@ function parseTime (time, cFormat) { }) } - /** * @description 格式化时间 * @param time * @param option * @returns {string} */ -function formatTime (time, option) { +function formatTime(time, option) { if (('' + time).length === 10) { time = parseInt(time) * 1000 } else { @@ -88,11 +87,7 @@ function formatTime (time, option) { return '1天前' } return ( - d.getMonth() + - 1 + - '月' + - d.getDate() + - '日' + d.getMonth() + 1 + '月' + d.getDate() + '日' // + // d.getHours() + // '时' @@ -122,24 +117,23 @@ const validatePhoneNumber = (phone) => { return testReg.test(phone) } - const getUserLocation = (call) => { uni.getLocation({ type: 'wgs84', success: function (address) { call(address) }, - fail: err => { + fail: (err) => { uni.showModal({ title: '提示', content: '定位失败,请打开定位权限', success: function (res) { if (res.confirm) { uni.openSetting({ - success: resSett => { + success: (resSett) => { if (resSett.authSetting['scope.userLocation']) { uni.getLocation({ - success: address => { + success: (address) => { call && call(address) }, }) @@ -147,7 +141,7 @@ const getUserLocation = (call) => { }, }) } - } + }, }) }, }) @@ -156,7 +150,7 @@ const getUserLocation = (call) => { // 加载用户配置 var globalConfigIsLoading = false, global_config = null, - globalConfigCallbacks = []; + globalConfigCallbacks = [] /** * 加载用户配置 * @param call 加载成功后的回调 @@ -164,41 +158,44 @@ var globalConfigIsLoading = false, */ const loadConfig = (call, need_fresh = false) => { if (call && global_config && !need_fresh) { - call(global_config); - return; + call(global_config) + return } if (globalConfigIsLoading) { - globalConfigCallbacks.push(call); - return; + globalConfigCallbacks.push(call) + return } - globalConfigIsLoading = true; + globalConfigIsLoading = true request({ url: '/org/userResource/userMsg', - }).then(rs => { - - globalConfigIsLoading = false; - global_config = rs.data; - uni.setStorage({ - key: 'userInfo', - data: global_config, - }) - if (call) { - call(global_config); - } - for (var i = 0; i < globalConfigCallbacks.length; i++) { - globalConfigCallbacks[i](global_config); - } - globalConfigCallbacks = []; - }).catch(err => { - globalConfigIsLoading = false; - console.warn(err); - // uni.reLaunch({ url: '/pages/user/login' }) }) + .then((rs) => { + globalConfigIsLoading = false + global_config = rs.data + uni.setStorage({ + key: 'userInfo', + data: global_config, + }) + if (call) { + call(global_config) + } + for (var i = 0; i < globalConfigCallbacks.length; i++) { + globalConfigCallbacks[i](global_config) + } + globalConfigCallbacks = [] + }) + .catch((err) => { + globalConfigIsLoading = false + console.warn(err) + // uni.reLaunch({ url: '/pages/user/login' }) + }) } - - - +const prePage = () => { + let pages = getCurrentPages() + let prePage = pages[pages.length - 2] + return prePage +} export default { validatePhoneNumber, @@ -208,4 +205,5 @@ export default { h5Helper, getUserLocation, loadConfig, + prePage, } diff --git a/pages.json b/pages.json index 5560919..32fbb7f 100644 --- a/pages.json +++ b/pages.json @@ -309,6 +309,12 @@ "navigationBarTitleText": "工程列表" } }, + { + "path": "pages/gc/detail", + "style": { + "navigationBarTitleText": "工程详情" + } + }, { "path": "pages/user/erweima", "style": { diff --git a/pages/gc/detail.vue b/pages/gc/detail.vue new file mode 100644 index 0000000..2c2aa3d --- /dev/null +++ b/pages/gc/detail.vue @@ -0,0 +1,231 @@ + + + diff --git a/pages/gc/list.vue b/pages/gc/list.vue index 5b2b817..e06160f 100644 --- a/pages/gc/list.vue +++ b/pages/gc/list.vue @@ -1,23 +1,32 @@