From f395da8f93fb8ed5705ef0ec9da3c166fb6934a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Thu, 10 Aug 2023 09:18:17 +0800 Subject: [PATCH] =?UTF-8?q?APPbug=E5=8F=8D=E9=A6=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 10 +- common/api/device.js | 2 +- common/api/engineering.js | 20 ++ common/api/project.js | 49 ++- common/css/base.scss | 19 +- common/js/list.js | 60 ++-- common/js/request.js | 2 + components/Cn-grid-item/Cn-grid-item.vue | 4 +- manifest.json | 6 +- pages.json | 25 +- pages/device/APF/detail.vue | 100 ++---- pages/device/list.vue | 3 +- pages/engineering/detail.vue | 37 +-- pages/engineering/list.vue | 14 +- pages/engineering/new.vue | 4 +- pages/engineering/setting.vue | 201 ++++++++++++ pages/index/comp/device.vue | 131 ++++++-- pages/index/comp/indexGongCheng.vue | 71 +++-- pages/index/comp/indexYouKe.vue | 68 ++-- pages/index/comp/indexYunWei.vue | 115 +++++-- pages/index/comp/indexZhuYongHu.vue | 71 +++-- pages/index/comp/indexZhuanZhi.vue | 136 ++++---- pages/index/index.vue | 38 ++- pages/index/message.vue | 4 +- pages/index/mine.vue | 27 +- pages/mine/policy.vue | 50 ++- pages/mine/result.vue | 2 +- pages/mine/setup.vue | 6 +- pages/mine/setupMessage.vue | 51 +-- pages/project/detail.vue | 48 +-- pages/project/list.vue | 3 +- pages/project/new.vue | 30 +- pages/user/changePhone.vue | 4 +- pages/user/forget.vue | 2 +- pages/user/login.vue | 30 +- pages/user/register.vue | 4 +- static/device_bad.png | Bin 0 -> 2641 bytes static/device_ready.png | Bin 0 -> 2593 bytes static/device_success.png | Bin 0 -> 2615 bytes static/like.png | Bin 0 -> 3411 bytes uni_modules/uni-search-bar/changelog.md | 35 ++ .../components/uni-search-bar/i18n/en.json | 4 + .../components/uni-search-bar/i18n/index.js | 8 + .../uni-search-bar/i18n/zh-Hans.json | 4 + .../uni-search-bar/i18n/zh-Hant.json | 4 + .../uni-search-bar/uni-search-bar.vue | 298 ++++++++++++++++++ uni_modules/uni-search-bar/package.json | 86 +++++ uni_modules/uni-search-bar/readme.md | 14 + 48 files changed, 1420 insertions(+), 480 deletions(-) create mode 100644 pages/engineering/setting.vue create mode 100644 static/device_bad.png create mode 100644 static/device_ready.png create mode 100644 static/device_success.png create mode 100644 static/like.png create mode 100644 uni_modules/uni-search-bar/changelog.md create mode 100644 uni_modules/uni-search-bar/components/uni-search-bar/i18n/en.json create mode 100644 uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js create mode 100644 uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hans.json create mode 100644 uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hant.json create mode 100644 uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue create mode 100644 uni_modules/uni-search-bar/package.json create mode 100644 uni_modules/uni-search-bar/readme.md diff --git a/App.vue b/App.vue index bf52ac9..c41174a 100644 --- a/App.vue +++ b/App.vue @@ -3,7 +3,7 @@ import { queryDictDataCache } from './common/api/dictionary.js' import encrypt from './common/js/aes.js' export default { onLaunch: function () { - console.log(window); + console.log(window) // this.connect() console.log('App Launch') let devCode = uni.getStorageSync('devCode') @@ -14,9 +14,11 @@ export default { }, }) } - }, - onShow: function () { - console.log('App Show') + if (!uni.getStorageSync(this.$cacheKey.userInfo)) { + uni.reLaunch({ + url: '/pages/login/login', + }) + } queryDictDataCache().then((res) => { uni.setStorageSync(this.$cacheKey.dictData, res.data) }) diff --git a/common/api/device.js b/common/api/device.js index 5b1e4a7..425e0b9 100644 --- a/common/api/device.js +++ b/common/api/device.js @@ -94,7 +94,7 @@ export const transferDevice = (id) => { url: '/cs-device-boot/deviceUser/transfer', method: 'POST', data: { - eid: id, + ids: id, }, }) } diff --git a/common/api/engineering.js b/common/api/engineering.js index 9dfa144..02f19c4 100644 --- a/common/api/engineering.js +++ b/common/api/engineering.js @@ -48,3 +48,23 @@ export function deleteEngineering(id) { }, }) } + +// 查询工程配置列表 +export function queryAllEnginner(params) { + return request({ + url: '/cs-device-boot/csMarketData/queryAllEnginner', + method: 'post', + }) +} + +// 更新工程配置 +export function csMarketDataAdd(params) { + return request({ + url: '/cs-device-boot/csMarketData/follow', + method: 'post', + data: params, + header: { + 'Content-Type': 'application/json', + }, + }) +} diff --git a/common/api/project.js b/common/api/project.js index e059181..09809eb 100644 --- a/common/api/project.js +++ b/common/api/project.js @@ -2,25 +2,41 @@ import request from '../js/request' import config from '../js/config' export function addAppProject(params, files) { - return uni.uploadFile({ - url: config.domain + '/cs-device-boot/project/addAppProject', //仅为示例,非真实的接口地址 - files: files, - header: { - Authorization: uni.getStorageSync('access_token'), - }, - formData: params, - }) + if (files.length === 0) { + return request({ + url: '/cs-device-boot/project/addAppProject', + method: 'post', + data: params, + }) + } else { + return uni.uploadFile({ + url: config.domain + '/cs-device-boot/project/addAppProject', //仅为示例,非真实的接口地址 + files: files, + header: { + Authorization: uni.getStorageSync('access_token'), + }, + formData: params, + }) + } } // 修改项目 export function updateAppProject(params, files) { - return uni.uploadFile({ - url: config.domain + '/cs-device-boot/project/auditAppProject', //仅为示例,非真实的接口地址 - files: files, - header: { - Authorization: uni.getStorageSync('access_token'), - }, - formData: params, - }) + if (files.length === 0) { + return request({ + url: '/cs-device-boot/project/updateAppProject', + method: 'post', + data: params, + }) + }else{ + return uni.uploadFile({ + url: config.domain + '/cs-device-boot/project/auditAppProject', //仅为示例,非真实的接口地址 + files: files, + header: { + Authorization: uni.getStorageSync('access_token'), + }, + formData: params, + }) + } } export function getProjectList(params) { @@ -101,4 +117,3 @@ export function addAppTopologyDiagram(params, filePath) { ), }) } - diff --git a/common/css/base.scss b/common/css/base.scss index 8129090..df08772 100644 --- a/common/css/base.scss +++ b/common/css/base.scss @@ -149,22 +149,22 @@ page { margin: 0 20rpx; display: grid; grid-gap: 20rpx; - grid-template-columns: 1fr 1fr 1fr; + grid-template-columns: 1fr 1fr 1fr 1fr; .header-item { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10rpx 10rpx 20rpx; - color: #111; + color: #fff; font-size: 28rpx; - background: #fff; + background: $uni-theme-color; border-radius: 12rpx; .header-item-value { font-size: 32rpx; } - .header-item-label{ - font-size: 28rpx; + .header-item-label { + font-size: 24rpx; } } } @@ -182,18 +182,21 @@ page { z-index: 2; .nav-menu { - padding: 10rpx 20rpx; + padding: 6rpx 20rpx; margin-left: 20rpx; margin-bottom: 20rpx; - font-size: 28rpx; + font-size: 24rpx; border-radius: 8rpx; background: #ebeaec; color: #666; - &-active { background: #dfe5f7; color: $uni-theme-color; } + &-btn { + background: $uni-theme-color; + color: #fff; + } } } diff --git a/common/js/list.js b/common/js/list.js index a8ba012..6f9ae1c 100644 --- a/common/js/list.js +++ b/common/js/list.js @@ -1,23 +1,23 @@ export default { onPullDownRefresh() { - this.store && this.store.reload(); + this.store && this.store.reload() this.store.loadedCallback = () => { - uni.stopPullDownRefresh(); - }; + uni.stopPullDownRefresh() + } }, onReachBottom() { if (this.store.status != 'noMore') { - this.store.next && this.store.next(); + this.store.next && this.store.next() } }, data() { return { store: {}, - }; + } }, methods: { DataSource(url) { - var me = this; + var me = this return { data: [], status: 'more', @@ -31,11 +31,11 @@ export default { pageSize: 20, }, reload() { - this.data = []; - this.status = 'loading'; - this.empty = false; - this.params.pageNum = 1; - this.next(); + this.data = [] + this.status = 'loading' + this.empty = false + this.params.pageNum = 1 + this.next() }, callBack: null, firstCallBack: null, @@ -47,37 +47,35 @@ export default { header: this.header, method: 'POST', }).then((res) => { - console.warn(res); - let resultData = - res.data?.list || res.data?.records || []; + console.warn(res) + let resultData = res.data?.list || res.data?.records || [] if (this.params.pageNum == 1) { - this.data = resultData; + this.data = resultData if (resultData.length == 0 || resultData == 0) { - this.empty = true; - } else if ( - resultData.length < this.params.pageSize - ) { - this.status = 'noMore'; + this.empty = true + this.status = 'noMore' + } else if (resultData.length < this.params.pageSize) { + this.status = 'noMore' } else if (res.total == resultData.length) { - this.status = 'noMore'; + this.status = 'noMore' } } else { - this.data.push(...resultData); + this.data.push(...resultData) if (resultData.length < this.params.pageSize) { - this.status = 'noMore'; + this.status = 'noMore' } } if (this.params.pageNum == 1) { - this.firstCallBack && this.firstCallBack(); + this.firstCallBack && this.firstCallBack() } - this.loadedCallback && this.loadedCallback(); - this.params.pageNum++; - this.total = res.total; - this.loading = false; - }); + this.loadedCallback && this.loadedCallback() + this.params.pageNum++ + this.total = res.total + this.loading = false + }) }, - }; + } }, }, -}; +} diff --git a/common/js/request.js b/common/js/request.js index f6b3d3c..cceb302 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -24,6 +24,7 @@ export default (options = {}) => { } uni.request({ url, + timeout: 5000, data: { ...options.data, }, @@ -65,6 +66,7 @@ export default (options = {}) => { * @param {Number} code 错误码 */ function errHandler(res) { + console.log(res); switch (res.code) { case 'A0024': uni.reLaunch({ url: '/pages/user/login' }) diff --git a/components/Cn-grid-item/Cn-grid-item.vue b/components/Cn-grid-item/Cn-grid-item.vue index 7542168..b904f3f 100644 --- a/components/Cn-grid-item/Cn-grid-item.vue +++ b/components/Cn-grid-item/Cn-grid-item.vue @@ -33,7 +33,7 @@ export default { position: relative; width: 80rpx; height: 80rpx; - background: $uni-theme-yellow; + background: $uni-theme-color; border-radius: 20rpx; .grid-card-content-item-icon-2 { @@ -64,7 +64,7 @@ export default { text-align: center; margin-top: 16rpx; color: #111; - font-size: 28rpx; + font-size: 24rpx; } } \ No newline at end of file diff --git a/manifest.json b/manifest.json index e266cde..831b512 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "灿能物联", "appid" : "__UNI__88BC25B", "description" : "", - "versionName" : "1.0.4", - "versionCode" : 103, + "versionName" : "1.0.7", + "versionCode" : 107, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { @@ -132,7 +132,7 @@ "/api" : { "https" : true, // "target" : "https://china.indpecker.com", - "target" : "http://192.168.1.13:10215", + "target" : "http://192.168.1.139:10215", "changOrigin" : true, "pathRewrite" : { "/api" : "" diff --git a/pages.json b/pages.json index 9c15178..656f5ab 100644 --- a/pages.json +++ b/pages.json @@ -4,8 +4,23 @@ { "path": "pages/index/index", "style": { - "navigationStyle": "custom", - "navigationBarTextStyle": "white" + "app-plus": { + "bounce": "none", //关闭窗口回弹效果 + "titleNView": { + "titleText": "灿能物联", // 窗口的标题 + "titleAlign": "left", + "padding-left": "16rpx", + "padding-right": "20rpx", + "buttons": [ + { + "text": "请选择工程", + "fontSize": "28rpx", + "select": true, + "width": "auto" + } + ] + } + } } }, { @@ -317,6 +332,12 @@ "navigationBarTitleText": "工程详情" } }, + { + "path": "pages/engineering/setting", + "style": { + "navigationBarTitleText": "关注工程配置" + } + }, { "path": "pages/user/erweima", "style": { diff --git a/pages/device/APF/detail.vue b/pages/device/APF/detail.vue index 11341dd..7aa16e5 100644 --- a/pages/device/APF/detail.vue +++ b/pages/device/APF/detail.vue @@ -137,9 +137,9 @@ export default { { text: '功率', }, - { - text: '波形', - }, + // { + // text: '波形', + // }, { text: 'I/O', }, @@ -238,56 +238,29 @@ export default { uni.pageScrollTo({ scrollTop: 0, duration: 0 }) }, init() { - switch (this.userInfo.authorities) { - case 1: - this.content.splice(0, 1) - this.content.splice( - 0, - 0, - { - iconPath: '/static/version.png', - text: '版本', - }, - { - iconPath: '/static/template.png', - text: '模版', - }, - ) - break - case 2: - this.content.splice(0, 1) - break - case 4: - this.content.splice( - 1, - 0, - { - iconPath: '/static/delate.png', - text: '报表', - }, - - { - iconPath: '/static/feedback.png', - text: '反馈', - }, - ) - break - case 5: - this.content.splice( - 2, - 0, - { - iconPath: '/static/table.png', - text: '报表', - }, - { - iconPath: '/static/feedback.png', - text: '反馈', - }, - ) - break - default: - break + if (this.isPrimaryUser == 1) { + this.content.splice( + 0, + 0, + { + iconPath: '/static/transfer.png', + text: '移交', + }, + { + iconPath: '/static/feedback.png', + text: '编辑', + }, + { + iconPath: '/static/delate.png', + text: '删除', + }, + ) + if (this.userInfo.authorities === 'app_vip_user') { + this.content.splice(3, 0, { + iconPath: '/static/share.png', + text: '分享', + }) + } } }, renderFinish(e) { @@ -387,26 +360,7 @@ export default { this.devId = options.id this.isPrimaryUser = options.isPrimaryUser - if (this.isPrimaryUser == 1) { - this.content.splice(0, 0, { - iconPath: '/static/delate.png', - text: '删除', - }) - this.content.splice(0, 0, { - iconPath: '/static/feedback.png', - text: '编辑', - }) - this.content.splice(0, 0, { - iconPath: '/static/transfer.png', - text: '移交', - }) - if (this.userInfo.authorities !== 'engineering_user') { - this.content.splice(0, 0, { - iconPath: '/static/share.png', - text: '分享', - }) - } - } + this.init() queryTopologyDiagram(options.id).then((res) => { this.deviceInfo = res.data diff --git a/pages/device/list.vue b/pages/device/list.vue index 0dc18c6..945c47f 100644 --- a/pages/device/list.vue +++ b/pages/device/list.vue @@ -5,7 +5,7 @@ @@ -56,6 +86,9 @@ export default { data() { return { loading: false, + transfer: false, + share: false, + checkList: [], select: { projectName: '', projectNameIndex: 0, @@ -67,6 +100,7 @@ export default { projectList: [], projectType: [], navHeight: 0, + userInfo: {}, } }, computed: { @@ -84,39 +118,66 @@ export default { }) }, }, - mounted() { - setTimeout(() => { - // 获取nav高度 - uni.createSelectorQuery() - .select('.uni-navbar') - .boundingClientRect((rect1) => { - this.navHeight = rect1.height - // 获取nav高度 - uni.createSelectorQuery() - .select('.nav') - .boundingClientRect((rect2) => { - // #ifdef H5 - this.minHeight = - 'calc(100vh - env(safe-area-inset-bottom) - ' + - (50 + (rect2.height + rect1.height)) + - 'px)' - // #endif - // #ifdef APP-PLUS - this.minHeight = 'calc(100vh - ' + (rect2.height + rect1.height) + 'px)' - // #endif - }) - .exec() - }) - .exec() - }, 1000) + created() { + this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo) }, methods: { + deviceIcon(e) { + let str = '' + switch (e) { + case 1: + str = '/static/device_bad.png' + break + case 2: + str = '/static/device.png' + break + default: + str = '/static/device.png' + break + } + return str + }, + switchChange(e) { + console.log(e) + let index = this.checkList.indexOf(e.equipmentId) + if (index > -1) { + this.checkList.splice(index, 1) + } else { + this.checkList.push(e.equipmentId) + } + }, + submit() { + console.log(this.checkList) + if (this.transfer) { + this.transfer = false + uni.navigateTo({ url: '/pages/device/transfer?id=' + this.checkList.join(',') }) + } else if (this.share) { + this.share = false + this.$emit('share', this.shareList) + } + this.checkList = [] + }, async init() { this.getProjectList() this.getDeviceList() }, getDeviceList() { this.store.params.pageSize = 999 + this.store.firstCallBack = () => { + // 获取nav高度 + uni.createSelectorQuery() + .select('.nav') + .boundingClientRect((rect2) => { + if (!rect2) return + // #ifdef H5 + this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + rect2.height) + 'px)' + // #endif + // #ifdef APP-PLUS + this.minHeight = 'calc(100vh - ' + rect2.height + 'px)' + // #endif + }) + .exec() + } this.store.reload() }, getProjectList() { @@ -214,4 +275,14 @@ export default { }, } - + diff --git a/pages/index/comp/indexGongCheng.vue b/pages/index/comp/indexGongCheng.vue index 7cc4ecf..273ab8a 100644 --- a/pages/index/comp/indexGongCheng.vue +++ b/pages/index/comp/indexGongCheng.vue @@ -1,21 +1,40 @@