diff --git a/App.vue b/App.vue index 8804d6c..28b9659 100644 --- a/App.vue +++ b/App.vue @@ -49,7 +49,7 @@ @import url("static/fonts/iconfont.css"); page>view { - background: linear-gradient(to bottom,#CEDCFF,#F0F0F0 554rpx); + /* background: linear-gradient(to bottom,#CEDCFF,#F0F0F0 554rpx); */ min-height: 100%; } diff --git a/common/api/config.js b/common/api/config.js index fbe524c..908c9d8 100644 --- a/common/api/config.js +++ b/common/api/config.js @@ -11,8 +11,13 @@ export default{ // imgUrl: 'https://digital-core.dieruen-iot.com', // wsUrl: 'wss://digital-core.dieruen-iot.com', // 谷云正式 - baseUrl: 'https://digital-core.drgyen.com', - imgUrl: 'https://digital-core.drgyen.com', + // baseUrl: 'https://digital-core.drgyen.com', + // imgUrl: 'https://digital-core.drgyen.com', + // wsUrl: 'wss://digital-core.drgyen.com', + + // 商城本地测试环境 + baseUrl: 'http://192.168.1.17:8080', + imgUrl: 'http://192.168.1.17:8080', wsUrl: 'wss://digital-core.drgyen.com', // 长城 // baseUrl: 'https://zhny.snc.cn/prod-api/', @@ -41,4 +46,6 @@ export default{ // mqttUrl:'ws://192.168.18.139:8083/mqtt', // mqttUrl:'wx://iot.gkiiot.com:8083/mqtt', // #endif + // 客户端id + clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e', } \ No newline at end of file diff --git a/common/api/request.js b/common/api/request.js index 6501a19..3326403 100644 --- a/common/api/request.js +++ b/common/api/request.js @@ -20,7 +20,8 @@ request.interceptors.request.use((request) => { request.baseURL = config.baseUrl; const userToken = uni.getStorageSync('userToken'); if(userToken){ - request.headers["Authorization"] = userToken; + request.headers["Authorization"] = 'Bearer ' + userToken; + request.headers["Clientid"] = config.clientId; } // 防止缓存 if (request.method === 'POST' && request.headers['Content-Type'] !== 'multipart/form-data') { diff --git a/pages.json b/pages.json index 8d31b95..a8324ba 100644 --- a/pages.json +++ b/pages.json @@ -3,7 +3,13 @@ // 下载安装方式 "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" }, - "pages": [ + "pages": [{ + "path": "pages/auth/passwordLogin", + "style": { + "navigationBarTitleText": "密码登录", + "navigationBarBackgroundColor": "#1890ff" + } + }, { "path": "pages/auth/login", "style": { @@ -12,36 +18,13 @@ } }, { - "path": "pages/auth/defalut", + "path": "pages/tabBar/new", "style": { - "navigationBarTitleText": "项目" + "navigationBarTitleText": "消息", + "enablePullDownRefresh": true + // "navigationStyle": "custom" } }, - { - "path": "pages/auth/passwordLogin", - "style": { - "navigationBarTitleText": "密码登录", - "navigationBarBackgroundColor": "#1890ff" - } - }, - { - "path": "pages/auth/companyRegister", - "style": { - "navigationBarTitleText": "企业注册" - } - }, - // { - // "path": "pages/index/enter", - // "style": { - // "navigationBarTitleText": "综合能源管理" - // } - // }, - // { - // "path": "pages/index/guidePage", - // "style": { - // "navigationBarTitleText": "综合能源管理" - // } - // }, { "path": "pages/tabBar/order", "style": { @@ -73,21 +56,8 @@ "navigationBarTitleText": "我的" // "navigationStyle": "custom", } - }, { - "path": "pages/tabBar/scan", - "style": { - "navigationBarTitleText": "添加设备" - // "navigationStyle": "custom", - } } - // , { - // "path": "pages/oneselfUser/index", - // "style": { - // "navigationBarTitleText": "个人用户", - // "enablePullDownRefresh": true - // // "navigationStyle": "custom" - // } - // } + ], "subPackages": [ // { @@ -154,11 +124,6 @@ "navigationBarTitleText": "设置" // "navigationStyle": "custom" } - }, { - "path": "passwordModify", - "style": { - "navigationBarTitleText": "修改密码" - } }, { "path": "maintenanceRecord", "style": { @@ -606,7 +571,7 @@ } }] }, - { + { "root": "pages/user/", "pages": [{ "path": "renew", @@ -640,6 +605,11 @@ "navigationBarTitleText": "帮助中心", "navigationBarBackgroundColor": "#fff" } + }, { + "path": "passwordModify", + "style": { + "navigationBarTitleText": "修改密码" + } }] } ], @@ -648,44 +618,32 @@ "selectedColor": "#0066cc", "backgroundColor": "#FFFFFF", "list": [{ - "pagePath": "pages/tabBar/home", - "text": "首页", - "iconPath": "static/images/toolbar/home.png", - "selectedIconPath": "static/images/toolbar/home-active.png" - }, { - "pagePath": "pages/tabBar/project", - "text": "项目", - "iconPath": "static/images/toolbar/project.png", - "selectedIconPath": "static/images/toolbar/project-active.png" - }, { - "pagePath": "pages/tabBar/scan", - "text": "扫一扫", - "iconPath": "static/images/toolbar/scan.png", - "selectedIconPath": "static/images/toolbar/scan-active.png" - }, { - "pagePath": "pages/tabBar/alarm", - "text": "报警", - "iconPath": "static/images/toolbar/alarm.png", - "selectedIconPath": "static/images/toolbar/alarm-active.png" - }, { - "pagePath": "pages/tabBar/my", - "text": "我的", - "iconPath": "static/images/toolbar/my.png", - "selectedIconPath": "static/images/toolbar/my-active.png" - } - ] + "pagePath": "pages/tabBar/new", + "text": "消息", + "iconPath": "static/images/toolbar/new.png", + "selectedIconPath": "static/images/toolbar/new-active.png" + }, { + "pagePath": "pages/tabBar/order", + "text": "订单", + "iconPath": "static/images/toolbar/order.png", + "selectedIconPath": "static/images/toolbar/order-active.png" + }, { + "pagePath": "pages/tabBar/my", + "text": "我的", + "iconPath": "static/images/toolbar/my.png", + "selectedIconPath": "static/images/toolbar/my-active.png" + }] }, "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "uni-app", - "navigationBarBackgroundColor": "#CEDCFF", + "navigationBarBackgroundColor": "#f5f5f5", // "navigationBarBackgroundColor": "#11BF96", "backgroundColor": "#F0F0F0" }, "condition": { //模式配置,仅开发期间生效 "current": 0, //当前激活的模式(list 的索引项) - "list": [ - { + "list": [{ "path": "pages/auth/passwordLogin", "name": "默认页面" //模式名称 }, @@ -699,44 +657,44 @@ }, { "path": "pages/auth/passwordLogin", - "name": "密码登录" ,//模式名称 + "name": "密码登录", //模式名称 "query": "mode=1&user=17859911022&pwd=888888" }, { "path": "pages/home/wisdomElectricity/realTime/parameterSetup", - "name": "设备参数调整" ,//模式名称 + "name": "设备参数调整", //模式名称 "query": "deviceId=ed41e7462f5041aa98780ce3062765d0&deviceKey=1267240812100022" }, { "path": "pages/project/space/index", - "name": "标签管理" ,//模式名称 + "name": "标签管理", //模式名称 // "query": "projectId=62&projectRole=root&typeName=设备组" "query": "projectId=62&projectRole=root&typeName=空间" }, { "path": "pages/project/space/deviceList", - "name": "空间设备管理" ,//模式名称 + "name": "空间设备管理", //模式名称 "query": "labelCode=16&projectId=63&projectRole=root&tagType=57135cfcdfa74d39b05aa04237893121&isDefault=Y" }, { "path": "pages/project/deviceGroup/index", - "name": "设备分组" ,//模式名称 + "name": "设备分组", //模式名称 "query": "projectId=62" }, { "path": "pages/project/space/addDeviceList", - "name": "空间设备添加" ,//模式名称 + "name": "空间设备添加", //模式名称 "query": "labelCode=16" }, { "path": "pages/home/wisdomElectricity/realTime/alarmConfig", - "name": "告警配置" ,//模式名称 + "name": "告警配置", //模式名称 "query": "deviceKey=1267240812100027" }, { "path": "pages/tabBar/scan", "name": "扫码" //模式名称 - },{ + }, { "path": "pages/tabBar/home", "name": "首页" //模式名称 }, @@ -746,7 +704,7 @@ }, { "path": "pages/project/index", - "name": "项目详情" ,//模式名称 + "name": "项目详情", //模式名称 "query": "projectId=62&projectCode=bd80a3c80c394dae8a2d8138713f2bcf" }, { @@ -759,12 +717,12 @@ }, { "path": "pages/project/equipmentStatus/status", - "name": "设备列表" ,//模式名称 + "name": "设备列表", //模式名称 "query": "projectId=62&adminFlag=true&projectRole=root" }, { "path": "pages/project/projectUser", - "name": "用户列表" ,//模式名称 + "name": "用户列表", //模式名称 "query": "projectId=56" }, { @@ -810,4 +768,4 @@ } ] } -} +} \ No newline at end of file diff --git a/pages/auth/passwordLogin.vue b/pages/auth/passwordLogin.vue index 033b3d1..fe41281 100644 --- a/pages/auth/passwordLogin.vue +++ b/pages/auth/passwordLogin.vue @@ -151,6 +151,13 @@ padding-top: 500rpx; + + + {{activeTenantObj.companyName}} + + + @@ -176,14 +183,14 @@ padding-top: 500rpx; 阅读并同意以下协议《用户协议》 - @@ -191,6 +198,7 @@ padding-top: 500rpx; Copyright 2022-2024 {{appConfig.companyName}} Powered By DSservice {{appConfig.contractRecordNumber || ''}} + @@ -213,9 +221,12 @@ padding-top: 500rpx; captchaData: null, current: 0, form: { + clientId: "", + grantType: "password", + rememberMe: false, + tenantId: "", username: "", - password: "", - code: "" + password: "" }, mode:null, rules: { @@ -224,7 +235,7 @@ padding-top: 500rpx; required: true, message: '请输入手机号/账号', trigger: ['change', 'blur'], - }, ], + }], password: [{ required: true, message: '请输入密码', @@ -235,6 +246,15 @@ padding-top: 500rpx; message: '请输入验证码', trigger: ['change', 'blur'], }] + }, + tenantShow:false, + tenantList:[], + activeTenantObj:{ + tenantId: "", + companyName: "", + domain: "", + logo: null, + registerEnable: false } } }, @@ -254,6 +274,7 @@ padding-top: 500rpx; if(e.mode){ this.mode = e.mode; } + this.getTenantList(); if(e.mode == '1'){ //mode:1 带密码参数直接登录 this.form.username = e.user || ''; this.form.password = e.pwd || ''; @@ -263,7 +284,7 @@ padding-top: 500rpx; console.log("userToken", userToken) if (userToken) { uni.switchTab({ - url: "../tabBar/project" + url: "../tabBar/order" }) } else { // this.getCodeImageFn(); @@ -297,6 +318,39 @@ padding-top: 500rpx; this.$refs.uForm.setRules(this.rules); }, methods: { + getTenantList(){ + uni.request({ + url: config.baseUrl + "/auth/tenant/list", + method: "GET", + data: {}, + header: { + Clientid: config.clientId + }, + success: (res) => { + console.log("res11",res); + if(res.data.code == 200){ + + this.tenantList = res.data.data.voList || []; + + if(res.data.data.voList!=[]){ + this.activeTenantObj = res.data.data.voList[0]; + this.form.tenantId = res.data.data.voList[0].tenantId; + } + } + } + }); + }, + changeTenant(e){ + console.log("e",e) + this.tenantList.forEach((item) => { + if (item.tenantId == e[0].value) { + this.activeTenantObj = item; + this.form.tenantId = item.tenantId; + this.appConfig.logo = item.logo; + this.appConfig.name = item.companyName; + } + }); + }, GetWxMiniProgramUrlParam(url) { let theRequest = {}; if (url.indexOf("#") != -1) { @@ -347,7 +401,7 @@ padding-top: 500rpx; password: this.form.password, }, header: { - UserType: this.usetTypeValue == "普通用户" ? "PERSONAL" : "TENANT" + UserType: this.usetTypeValue == "普通用户" ? "PERSONAL" : "TENANT", }, success: (res) => { console.log(res); @@ -378,7 +432,7 @@ padding-top: 500rpx; }) } else { uni.switchTab({ - url: "../tabBar/project" + url: "../tabBar/order" }) } }, 1000) @@ -400,25 +454,23 @@ padding-top: 500rpx; this.$refs.uForm.validate(valid => { if (valid) { uni.request({ - url: config.baseUrl + "/login", + url: config.baseUrl + "/auth/login", method: "POST", data: { - username: this.form.username, - password: this.form.password, - // code: this.form.code, - // uuid: this.captchaData.uuid, + ...this.form, + clientId: config.clientId, }, header: { - UserType: this.usetTypeValue == "普通用户" ? "PERSONAL" : "TENANT" + Clientid: config.clientId }, success: (res) => { console.log(res); - if (res.data.token) { + if (res.data.code == 200 && res.data.data.access_token) { this.$refs.uToast.show({ title: '登录成功', type: 'success', }) - this.$store.dispatch('setLogin', res.data.token); + this.$store.dispatch('setLogin', res.data.data.access_token); uni.setStorage({ key: 'userType', data: this.usetTypeValue, @@ -440,7 +492,7 @@ padding-top: 500rpx; }) } else { uni.switchTab({ - url: "../tabBar/project" + url: "../tabBar/order" }) } }, 1000) diff --git a/pages/my/passwordModify.vue b/pages/my/passwordModify.vue new file mode 100644 index 0000000..9a1f03e --- /dev/null +++ b/pages/my/passwordModify.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/pages/tabBar/my.vue b/pages/tabBar/my.vue index 7a95bc9..fe2dc31 100644 --- a/pages/tabBar/my.vue +++ b/pages/tabBar/my.vue @@ -1,64 +1,43 @@ @@ -152,12 +131,12 @@ // let userToken = uni.getStorageSync("userToken"); let userType = uni.getStorageSync("userType"); // let getUserInfoUrl = userType === "企业用户"?"/system/personal/profile":"/system/user/profile"; - let getUserInfoUrl = "/system/user/profile"; + let getUserInfoUrl = "/system/user/getInfo"; this.$get(getUserInfoUrl).then((res) => { console.log(res, "res"); if (!res.data) return; - this.userInfo = res.data; + this.userInfo = res.data.user; this.tenantInfo = res.data.tenant; uni.setStorageSync("tenantInfo", res.data.tenant) uni.setStorageSync("userInfo", this.userInfo) @@ -181,20 +160,91 @@ // uni.clearStorageSync(); uni.removeStorageSync('userToken'); uni.reLaunch({ - url:"../auth/login" + url:"../auth/passwordLogin" }) }, } } diff --git a/static/images/toolbar/new-active.png b/static/images/toolbar/new-active.png new file mode 100644 index 0000000..e696a48 Binary files /dev/null and b/static/images/toolbar/new-active.png differ diff --git a/static/images/toolbar/new.png b/static/images/toolbar/new.png new file mode 100644 index 0000000..584f71e Binary files /dev/null and b/static/images/toolbar/new.png differ diff --git a/static/images/toolbar/order-active.png b/static/images/toolbar/order-active.png new file mode 100644 index 0000000..759e57b Binary files /dev/null and b/static/images/toolbar/order-active.png differ diff --git a/static/images/toolbar/order.png b/static/images/toolbar/order.png new file mode 100644 index 0000000..bb6bf90 Binary files /dev/null and b/static/images/toolbar/order.png differ