diff --git a/common/api/device.js b/common/api/device.js index 425e0b9..72b555d 100644 --- a/common/api/device.js +++ b/common/api/device.js @@ -20,7 +20,7 @@ export function getDevCount(id) { url: '/cs-device-boot/deviceUser/devCount', method: 'post', - data: { id }, + data: {id}, }) } @@ -89,10 +89,22 @@ export const queryTopologyDiagram = (devId) => { // 设备扫码移交 -export const transferDevice = (id) => { +export const transferDevice = (id, userId) => { return request({ url: '/cs-device-boot/deviceUser/transfer', method: 'POST', + data: { + ids: id, + userId: userId || uni.getStorageSync('userInfo').userIndex + }, + }) +} +// 设备扫码分享 + +export const shareDevice = (id, userId) => { + return request({ + url: '/cs-device-boot/deviceUser/share', + method: 'POST', data: { ids: id, }, @@ -141,8 +153,6 @@ export const updateDevice = (params) => { header: { 'Content-Type': 'application/json', }, - data: { - pointList: params, - }, + data: params, }) } diff --git a/common/api/feedback.js b/common/api/feedback.js index 1a8a472..800a3cd 100644 --- a/common/api/feedback.js +++ b/common/api/feedback.js @@ -1,5 +1,6 @@ import request from '../js/request'; import config from '../js/config'; + /** * 添加反馈 * @param {*} params {description: '', files: '', title: 1,type: 1,user_id:12} @@ -7,17 +8,25 @@ import config from '../js/config'; */ export function addFeedBack(params) { let files = params.files; - console.log(files); + console.log(files.length); let data = JSON.parse(JSON.stringify(params)); delete data.files - return uni.uploadFile({ - url: config.domain + '/cs-system-boot/feedback/addFeedBack', //仅为示例,非真实的接口地址 - files: files, - header: { - Authorization: uni.getStorageSync('access_token'), - }, - formData: data, - }); + if (files.length) { + return uni.uploadFile({ + url: config.domain + '/cs-system-boot/feedback/addFeedBack', //仅为示例,非真实的接口地址 + files: files, + header: { + Authorization: uni.getStorageSync('access_token'), + }, + formData: data, + }); + } else { + return request({ + url: '/cs-system-boot/feedback/addFeedBack', + method: 'post', + data: data, + }); + } } /** @@ -68,12 +77,12 @@ export function AddFeedbackChat(params) { } /** - * 更新反馈聊天状态 + * 更新反馈聊天状态 * @param {*} params { "id": "2e47078c0f59a4a612655bb3bbaed617", "userId": "12" } - * @returns + * @returns */ export function updateChatStatus(params) { return request({ diff --git a/common/api/mine.js b/common/api/mine.js index 19c4240..aff6125 100644 --- a/common/api/mine.js +++ b/common/api/mine.js @@ -35,5 +35,32 @@ export const queryAppInfoByType = (type) => { } +/** + * 查看用户消息推送配置 + */ -// \ No newline at end of file +export const queryUserPushConfig = () => { + return request({ + url: '/cs-system-boot/appInfoSet/queryByUserId', + method: 'post', + header: { + 'Content-Type': 'application/json', + }, + data: {}, + }) +} + +/** + * 更新消息推送配置 + */ + +export const updatePushConfig = (params) => { + return request({ + url: '/cs-system-boot/appInfoSet/update', + method: 'post', + header: { + 'Content-Type': 'application/json', + }, + data: params, + }) +} diff --git a/common/js/config.js b/common/js/config.js index f4ed095..0f3935a 100644 --- a/common/js/config.js +++ b/common/js/config.js @@ -1,4 +1,4 @@ -const debug = true // true 是连地服务端本地,false 是连接线上 +const debug = false // true 是连地服务端本地,false 是连接线上 const development = { domain: 'http://192.168.1.115:10215', diff --git a/common/js/list.js b/common/js/list.js index 6f9ae1c..358d941 100644 --- a/common/js/list.js +++ b/common/js/list.js @@ -30,6 +30,10 @@ export default { pageNum: 1, pageSize: 20, }, + timer:null, + callBack: null, + firstCallBack: null, + loadedCallback: null, reload() { this.data = [] this.status = 'loading' @@ -37,9 +41,13 @@ export default { this.params.pageNum = 1 this.next() }, - callBack: null, - firstCallBack: null, - loadedCallback: null, + search() { + // 节流搜索 + clearTimeout(this.timer) + this.timer = setTimeout(() => { + this.reload() + }, 300) + }, next() { me.$request({ url: url, diff --git a/components/Cn-htmlToImg/Cn-htmlToImg.vue b/components/Cn-htmlToImg/Cn-htmlToImg.vue index 65163af..58e4e49 100644 --- a/components/Cn-htmlToImg/Cn-htmlToImg.vue +++ b/components/Cn-htmlToImg/Cn-htmlToImg.vue @@ -34,10 +34,12 @@ export default { let dom = document.getElementById(domId); console.log(dom.offsetWidth, dom.offsetHeight); html2canvas(dom, { - scale: 2, useCORS: true, - dpi: 300, - taintTest: true, + scrollX:0, + scrollY:0, + width: dom.offsetWidth, + height: dom.offsetHeight, + allowTaint:true }).then((canvas) => { // this.$refs.header.appendChild(canvas); const posterImg = canvas.toDataURL() diff --git a/manifest.json b/manifest.json index 0edfc10..b21873f 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "灿能物联", "appid" : "__UNI__88BC25B", "description" : "", - "versionName" : "1.1.0", - "versionCode" : 110, + "versionName" : "1.1.4", + "versionCode" : 114, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { @@ -132,7 +132,7 @@ "/api" : { "https" : true, // "target" : "https://china.indpecker.com", - "target" : "http://192.168.1.115:10215", + "target" : "http://192.168.1.139:10215", "changOrigin" : true, "pathRewrite" : { "/api" : "" diff --git a/pages.json b/pages.json index b86eeac..fa10b19 100644 --- a/pages.json +++ b/pages.json @@ -4,23 +4,7 @@ { "path": "pages/index/index", "style": { - "app-plus": { - "bounce": "none", //关闭窗口回弹效果 - "titleNView": { - "titleText": "灿能物联", // 窗口的标题 - "titleAlign": "left", - "padding-left": "16rpx", - "padding-right": "20rpx", - "buttons": [ - { - "text": "请先创建工程", - "fontSize": "28rpx", - "select": true, - "width": "auto" - } - ] - } - } + "navigationStyle": "custom" } }, { @@ -247,12 +231,42 @@ "navigationBarTitleText": "移交" } }, + { + "path": "pages/device/share", + "style": { + "navigationBarTitleText": "分享" + } + }, { "path": "pages/home/feedback", "style": { "navigationBarTitleText": "提交反馈" } }, + { + "path": "pages/home/selectEngineering", + "style": { + "app-plus": { + "bounce": "none", + //关闭窗口回弹效果 + "titleNView": { + "titleText": "灿能物联", + // 窗口的标题 + "titleAlign": "center", + "padding-left": "16rpx", + "padding-right": "20rpx", + "buttons": [ + { + "text": "创建工程", + "fontSize": "28rpx", + "select": false, + "width": "auto" + } + ] + } + } + } + }, { "path": "pages/message/feedback", "style": { @@ -455,9 +469,8 @@ "navigationBarTextStyle": "black", "navigationBarTitleText": "灿能电力", "navigationBarBackgroundColor": "#ffffff", - "backgroundColor": "#f3f4f5" + "backgroundColor": "#f3f4f5", // #ifdef H5 - , "navigationStyle": "custom" // #endif }, @@ -470,7 +483,8 @@ }, "condition": { //模式配置,仅开发期间生效 - "current": 0, //当前激活的模式(list 的索引项) + "current": 0, + //当前激活的模式(list 的索引项) "list": [] } } \ No newline at end of file diff --git a/pages/device/APF/comp/xieBo.vue b/pages/device/APF/comp/xieBo.vue index da9d492..de3c49d 100644 --- a/pages/device/APF/comp/xieBo.vue +++ b/pages/device/APF/comp/xieBo.vue @@ -2,7 +2,7 @@ - + @@ -12,8 +12,8 @@ export default { props: { basicData: { type: Array, - default: () => [] - } + default: () => [], + }, }, data() { return { @@ -26,31 +26,45 @@ export default { //您可以通过修改 config-ucharts.js 文件中下标为 ['column'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。 opts: { enableScroll: true, - color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"], - padding: [10, 0, 10, 0], + color: [ + '#1890FF', + '#91CB74', + '#FAC858', + '#EE6666', + '#73C0DE', + '#3CA272', + '#FC8452', + '#9A60B4', + '#ea7ccc', + ], + padding: [20, 10, 0, 0], legend: {}, xAxis: { disableGrid: true, itemCount: 8, // scrollShow: true, + data: [ + { + min: 0, + }, + ], }, yAxis: { data: [ { - min: 0 - } - ] + min: 0, + tofix: 4, + }, + ], }, extra: { column: { - type: "group", - width: 30, - activeBgColor: "#000000", - activeBgOpacity: 0.08 - } + width: 10, + categoryGap: 1, + }, }, - } - }; + }, + } }, watch: { basicData: { @@ -75,7 +89,8 @@ export default { }) if (index > -1) { if (this.renderData[arr[index]['name']][item.phase]) { - this.renderData[arr[index]['name']][item.phase][item.statisticalName] = item.statisticalData || 0 + this.renderData[arr[index]['name']][item.phase][item.statisticalName] = + item.statisticalData || 0 } else { this.renderData[arr[index]['name']][item.phase] = { phase: item.phase, @@ -88,76 +103,59 @@ export default { this.sex = Object.keys(this.renderData['电网侧']).map((item, index) => { return { text: item, - value: index + value: index, } }) - let obj = JSON.parse(JSON.stringify(this.renderData['电网侧'][Object.keys(this.renderData['电网侧'])[0]])) + let obj = JSON.parse( + JSON.stringify(this.renderData['电网侧'][Object.keys(this.renderData['电网侧'])[0]]), + ) delete obj['phase'] - console.log(Object.keys(obj).map(item => { - return Number(item.match(/Pq_HarmI_(\d+)/)[1]) - })) - console.log(Object.values(this.renderData['电网侧'][this.sex[this.radio].text]).filter((item) => { - return typeof item === 'number' - })) - console.log(Object.values(this.renderData['负载侧'][this.sex[this.radio].text]).filter((item) => { - return typeof item === 'number' - })) - this.chartData = { - categories: Object.keys(obj).map(item => { + console.log( + Object.keys(obj).map((item) => { return item.match(/Pq_HarmI_(\d+)/)[1] }), + ) + console.log( + Object.values(this.renderData['电网侧'][this.sex[this.radio].text]).filter((item) => { + return typeof item === 'number' + }), + ) + console.log( + Object.values(this.renderData['负载侧'][this.sex[this.radio].text]).filter((item) => { + return typeof item === 'number' + }), + ) + this.chartData = { + categories: Object.keys(obj).map((item) => { + return Number(item.match(/Pq_HarmI_(\d+)/)[1]) + }), series: [ { - name: "电网侧", + name: '电网侧', data: Object.values(this.renderData['电网侧'][this.sex[this.radio].text]).filter((item) => { return typeof item === 'number' - }) + }), }, { - name: "负载侧", + name: '负载侧', data: Object.values(this.renderData['负载侧'][this.sex[this.radio].text]).filter((item) => { return typeof item === 'number' - }) - } - ] + }), + }, + ], } }, deep: true, immediate: true, - } - }, - mounted() { - // this.getServerData(); - }, - methods: { - getServerData() { - //模拟从服务器获取数据时的延时 - setTimeout(() => { - //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 - let res = { - categories: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"], - series: [ - { - name: "电网侧", - data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 7] - }, - { - name: "负载册", - data: [5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] - } - ] - }; - this.chartData = JSON.parse(JSON.stringify(res)); - }, 500); }, - } + }, } \ No newline at end of file + diff --git a/pages/device/APF/detail.vue b/pages/device/APF/detail.vue index d4a025b..9213122 100644 --- a/pages/device/APF/detail.vue +++ b/pages/device/APF/detail.vue @@ -1,7 +1,7 @@ + diff --git a/pages/device/transfer.vue b/pages/device/transfer.vue index 4e7452c..9e95ba3 100644 --- a/pages/device/transfer.vue +++ b/pages/device/transfer.vue @@ -4,7 +4,8 @@ - + 请让接收人员扫码接收 @@ -12,7 +13,7 @@ - + @@ -22,22 +23,51 @@ // import QRCode from 'qrcodejs2' // import UQRCode from '@/uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js'; +import {transferDevice} from "@/common/api/device"; + export default { data() { return { loading: false, content: '', + options: {}, } }, methods: { back() { - uni.navigateBack({ delta: 1 }) + uni.navigateBack({delta: 1}) }, home() { - uni.navigateBack({ delta: 1 }) + uni.navigateBack({delta: 1}) + }, + transferDevice(userId) { + transferDevice(this.options.id, userId).then((res) => { + uni.showToast({ + title: '移交成功', + icon: 'none', + }) + uni.navigateBack() + }) + }, + scan() { + uni.scanCode({ + success: (res) => { + console.log(res) + let data = JSON.parse(res.result) + if (data.type === 'userId') { + this.transferDevice(data.id) + } else { + uni.showToast({ + title: '请扫描正确的二维码', + icon: 'none', + }) + } + }, + }) }, }, onLoad(options) { + this.options = options this.content = JSON.stringify({ type: 'transferDevice', id: options.id, diff --git a/pages/engineering/detail.vue b/pages/engineering/detail.vue index 7ed2bf6..2865642 100644 --- a/pages/engineering/detail.vue +++ b/pages/engineering/detail.vue @@ -10,7 +10,7 @@ {{ engineering.provinceName + engineering.cityName }} {{ engineering.createTime }} - {{ engineering.description }} + 工程描述:{{ engineering.description }} 设备个数 - 3 + {{item.devNum}} - 用户个数 - 1 + 创建时间 + {{item.createTime}} diff --git a/pages/engineering/list.vue b/pages/engineering/list.vue index 83bd02e..ad9f6b0 100644 --- a/pages/engineering/list.vue +++ b/pages/engineering/list.vue @@ -17,12 +17,15 @@ @clickLeft="back" @clickRight="add" /> + @@ -57,6 +60,7 @@ export default { init() { this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) this.store = this.DataSource('/cs-device-boot/engineering/queryEngineeringPage') + this.store.params.name = '' this.store.reload() this.store.firstCallBack = (res) => { let engineering = uni.getStorageSync('engineering') diff --git a/pages/home/feedback.vue b/pages/home/feedback.vue index 04b7652..2a8ccc2 100644 --- a/pages/home/feedback.vue +++ b/pages/home/feedback.vue @@ -8,28 +8,29 @@ --> - + - + - + - 提交 + 提交 - + + \ No newline at end of file diff --git a/pages/index/comp/device.vue b/pages/index/comp/device.vue index b0f98b2..16156d8 100644 --- a/pages/index/comp/device.vue +++ b/pages/index/comp/device.vue @@ -1,6 +1,6 @@ +