From 73397f006a9c5b3b36d9543495bb1647d7c892d5 Mon Sep 17 00:00:00 2001 From: guoweilong Date: Wed, 8 Nov 2023 18:33:12 +0800 Subject: [PATCH] fix:0.1.0问题修复 --- App.vue | 1 + api/dict.js | 2 +- common/config.js | 3 ++- components/news-list/news-list.vue | 2 +- index.html | 1 + main.js | 13 +++++++++---- package-lock.json | 28 ++++++++-------------------- package.json | 5 ++++- pages.json | 4 ++-- pages/login/mobile.vue | 23 +++++++++++++++-------- pages/market/index.vue | 44 +++++++++++++++++++++----------------------- pages/market/insight.vue | 38 +++++++++++++++----------------------- pages/market/userDetails.vue | 75 ++++++++++++++++++++++++++++++++++++++------------------------------------- static/images/empty/login-out.png | Bin 7762 -> 0 bytes static/images/icon/eyeOff.png | Bin 0 -> 3487 bytes static/images/icon/eyeOn.png | Bin 0 -> 1989 bytes static/images/icon/login-out.png | Bin 0 -> 2465 bytes static/images/icon/nodata.png | Bin 0 -> 102407 bytes static/images/icon/pwd.png | Bin 0 -> 2520 bytes static/images/icon/user.png | Bin 0 -> 4210 bytes store/mudules/dict.js | 9 +++++---- store/mudules/user.js | 20 +++++++++++++++++++- utils/dict.js | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ utils/request/responseInterceptors.js | 1 + vue.config.js | 5 +++-- 25 files changed, 235 insertions(+), 128 deletions(-) delete mode 100644 static/images/empty/login-out.png create mode 100644 static/images/icon/eyeOff.png create mode 100644 static/images/icon/eyeOn.png create mode 100644 static/images/icon/login-out.png create mode 100644 static/images/icon/nodata.png create mode 100644 static/images/icon/pwd.png create mode 100644 static/images/icon/user.png create mode 100644 utils/dict.js diff --git a/App.vue b/App.vue index cf633af..e2d2bd9 100644 --- a/App.vue +++ b/App.vue @@ -14,6 +14,7 @@ export default { // #endif }, onShow: function () { + this.$store.dispatch('loadDictDatas') console.log('App Show') }, onHide: function () { diff --git a/api/dict.js b/api/dict.js index 5589ac7..6dbe699 100644 --- a/api/dict.js +++ b/api/dict.js @@ -1,4 +1,4 @@ const { http } = uni.$u // 查询全部字典数据列表 -export const listSimpleDictDatas = params => http.get('/ticket/dict-data/list-all-simple', params) +export const listSimpleDictDatas = params => http.get('/system/dict/type/getAllTypeData',params) diff --git a/common/config.js b/common/config.js index 1682c60..5c8894d 100644 --- a/common/config.js +++ b/common/config.js @@ -2,7 +2,8 @@ module.exports = { //后端接口地址 // baseUrl: 'http://10.11.38.240:9001', //内网开发环境 baseUrl: 'http://172.17.56.37:18082/api', //测试环境 - // baseUrl: 'http://172.17.56.16:18082/api', //正式环境 + // baseUrl: 'http://172.17.56.16:18082/api', //ip正式环境 + // baseUrl: 'https://scdcapp.chinagasholdings.com/api', //域名正式环境 // baseUrl: 'http://api-dashboard.yudao.iocoder.cn/app-api', // 超时 timeout: 30000, diff --git a/components/news-list/news-list.vue b/components/news-list/news-list.vue index 48e9fe8..dd4a438 100644 --- a/components/news-list/news-list.vue +++ b/components/news-list/news-list.vue @@ -6,7 +6,7 @@ {{newItem.title}} - {{ $dict(newItem.plateName || "") }} + {{ getDictDataLabel(DICT_TYPE.SYS_PLATE_NAME, newItem.plateName) || "" }} {{newItem.organizeName || ""}} diff --git a/index.html b/index.html index 03e5fc6..08e5e4d 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,7 @@ + diff --git a/pages/market/index.vue b/pages/market/index.vue index 8fb021d..c7200e6 100644 --- a/pages/market/index.vue +++ b/pages/market/index.vue @@ -3,18 +3,18 @@ - + 退出登录 + borderColor="rgb(230, 230, 230)" height="74rpx" bgColor="#F5F6FA" @clear="clearInit" @search="search"> - + { // console.log(res); if (res.code === 200) { diff --git a/pages/market/insight.vue b/pages/market/insight.vue index a0c1f42..f59be22 100644 --- a/pages/market/insight.vue +++ b/pages/market/insight.vue @@ -42,7 +42,7 @@ - + {{item.reportName || ""}} @@ -63,7 +63,7 @@ - + @@ -115,7 +115,9 @@ total2: null, queryParameter: { pageNum: 1, - pageSize: 10 + pageSize: 10, + roleId:this.$store.state.user.roleId, + entity:this.$store.state.user.entity, }, tabList1: [{ name: '全部' @@ -223,7 +225,7 @@ fiscalYear: this.fiscalYear } } - console.log(Params); + console.log("市场摸底查询参数",Params); Params = { ...this.queryParameter, ...Params @@ -242,14 +244,12 @@ }) }, updateList2() { - let Params + let Params = {}; if (this.current2 === 0) { if (this.keyword) { - Params = { - householdName: this.keyword, - } + Params.householdName = this.keyword } - getPoolResidentlist(Params).then(res => { + getPoolResidentlist({...Params,...this.queryParameter}).then(res => { // console.log(res); if (res.code === 200) { if (this.queryParameter.pageSize > 1) { @@ -262,11 +262,9 @@ }) } else if (this.current2 === 1) { if (this.keyword) { - Params = { - householdName: this.keyword, - } + Params.householdName = this.keyword } - getPoolCommercelist(Params).then(res => { + getPoolCommercelist({...Params,...this.queryParameter}).then(res => { // console.log(res); if (res.code === 200) { if (this.queryParameter.pageSize > 1) { @@ -279,11 +277,9 @@ }) } else if (this.current2 === 2) { if (this.keyword) { - Params = { - contactPerson: this.keyword, - } + Params.contactPerson = this.keyword } - getPoolIndustrylist(Params).then(res => { + getPoolIndustrylist({...Params,...this.queryParameter}).then(res => { // console.log(res); if (res.code === 200) { if (this.queryParameter.pageSize > 1) { @@ -294,8 +290,6 @@ this.total2 = res.total; } }) - } else { - } this.checkTotal() console.log("待开发", this.newList2); @@ -312,10 +306,8 @@ resetQuery() { this.newList1 = []; this.newList2 = []; - this.queryParameter = { - pageNum: 1, - pageSize: 10 - } + this.queryParameter.pageNum = 1; + this.queryParameter.pageSize = 10; }, tabChange1(e) { console.log(e); diff --git a/pages/market/userDetails.vue b/pages/market/userDetails.vue index 8b8d072..da39b89 100644 --- a/pages/market/userDetails.vue +++ b/pages/market/userDetails.vue @@ -47,7 +47,7 @@ 房主年龄 - {{allData.householdAge}} + {{ getDictDataLabel(DICT_TYPE.SYS_HOUSEHOLD_AGE, allData.householdAge) || "" }} 联系电话 @@ -86,7 +86,7 @@ 经营业主年龄 - {{allData.householdAge}} + {{ getDictDataLabel(DICT_TYPE.SYS_HOUSEHOLD_AGE, allData.householdAge) || "" }} 联系电话 @@ -117,7 +117,7 @@ 职务 - {{allData.duties}} + {{ getDictDataLabel(DICT_TYPE.SYS_INDUSTRY_DUTIES, allData.duties) || "" }} 电话 @@ -138,7 +138,7 @@ 居住人口 - {{allData.resideNumber}} + {{ getDictDataLabel(DICT_TYPE.SYS_LIVE_NO, allData.resideNumber) || "" }} 房屋户型 @@ -150,55 +150,55 @@ 房屋建设年限 - {{allData.houseYear}} + {{ getDictDataLabel(DICT_TYPE.SYS_BUILD_YEAR, allData.houseYear) || "" }} 房屋居住性质 - {{allData.houseNature}} + {{ getDictDataLabel(DICT_TYPE.SYS_HOUSE_NATURE, allData.houseNature) || "" }} 居住属性 - {{allData.resideAttribute}} + {{ getDictDataLabel(DICT_TYPE.SYS_LIVE_ATTRIBUTE, allData.resideAttribute) || "" }} 房屋性质 - {{allData.houseAttribute}} + {{ getDictDataLabel(DICT_TYPE.SYS_HOUSE_ATTRIBUTE, allData.houseAttribute) || "" }} 房屋结构类型 - {{allData.houseStructure}} + {{ getDictDataLabel(DICT_TYPE.SYS_HOUSE_STRUCTURE, allData.houseStructure) || "" }} 所在房屋距离中压管道 - {{allData.distance}} + {{ getDictDataLabel(DICT_TYPE.SYS_DISTANCE, allData.distance) || "" }} 所在房屋是否有物业 - {{allData.isExist}} + {{allData.isExist?'是':'否'}} 房屋是否列入拆迁规划 - {{allData.isPlan}} + {{allData.isPlan?'是':'否'}} 水/电表是否一户一表 - {{allData.isSingleMeter}} + {{allData.isSingleMeter?'是':'否'}} 是否独立厨房 - {{allData.isSingleKitchen}} + {{allData.isSingleKitchen?'是':'否'}} 是否集中供暖 - {{allData.isHeating}} + {{allData.isHeating?'是':'否'}} 楼前立管是否安装 - {{allData.isInstall}} + {{allData.isInstall?'是':'否'}} 现使用能源 - {{allData.currentEnergy}} + {{allData.currentEnergy?'是':'否'}} 现使用能源价格(元) @@ -206,7 +206,7 @@ 用户报装意愿 - {{allData.inclinate}} + {{ getDictDataLabel(DICT_TYPE.SYS_INSTALL_INCLINATE, allData.inclinate) || "" }} 不报装原因 @@ -225,43 +225,43 @@ 经营范围 - {{allData.businessScope}} + {{ getDictDataLabel(DICT_TYPE.SYS_BUSINESS_SCOPE, allData.businessScope) || "" }} 所在场所房屋性质 - {{allData.houseNature}} + {{ getDictDataLabel(DICT_TYPE.SYS_HOUSE_NATURE, allData.houseNature) || "" }} 所在场所房屋类型 - {{allData.houseAttribute}} + {{ getDictDataLabel(DICT_TYPE.SYS_COMMERCE_ATTRIBUTE, allData.houseAttribute) || "" }} 所在场所房屋结构类型 - {{allData.houseStructure}} + {{ getDictDataLabel(DICT_TYPE.SYS_HOUSE_STRUCTURE, allData.houseStructure) || "" }} 所在场所房屋建设年限 - {{allData.houseYear}} + {{ getDictDataLabel(DICT_TYPE.SYS_BUILD_YEAR, allData.houseYear) || "" }} 所在房屋是否列入拆迁规划 - {{allData.isPlan}} + {{allData.isPlan?'是':'否'}} 水/电表是否一户一表 - {{allData.isSingleMeter}} + {{allData.isSingleMeter?'是':'否'}} 是否有供暖需求 - {{allData.isHeating}} + {{allData.isHeating?'是':'否'}} 所在房屋距离中压管道 - {{allData.distance}} + {{allData.distance?'是':'否'}} 现使用能源 - {{allData.currentEnergy}} + {{allData.currentEnergy?'是':'否'}} 现使用能源价格(元) @@ -292,15 +292,15 @@ 是否已供气 - {{allData.isProvide}} + {{allData.isProvide?'是':'否'}} 商业状态 - {{allData.commercialStatus}} + {{ getDictDataLabel(DICT_TYPE.SYS_COMMERCIAL_STATUS, allData.commercialStatus) || "" }} 项目类别 - {{allData.projectType}} + {{ getDictDataLabel(DICT_TYPE.SYS_PROJECT_TYPE, allData.projectType) || "" }} 行业分类 @@ -308,7 +308,7 @@ 最近管道距离 - {{allData.distance}} + {{ getDictDataLabel(DICT_TYPE.SYS_DISTANCE, allData.distance) || "" }} 预计最大开口气量 @@ -316,11 +316,12 @@ 预计签约日期 - {{allData.predictSign}} + {{ $dayjs().UTC(allData.predictSign).format('YYYY') || ""}} 预计安装日期 - {{allData.predictInstall}} + + {{ allData.predictInstall || ""}} 预计日用气量 @@ -328,7 +329,7 @@ 耗能设备名称 - {{allData.machineName}} + {{ getDictDataLabel(DICT_TYPE.SYS_MACHINE_NAME, allData.machineName) || "" }} 耗能设备型号 @@ -336,7 +337,7 @@ 用能类型 - {{allData.userType}} + {{ getDictDataLabel(DICT_TYPE.SYS_INDUSTRY_TYPE, allData.userType) || "" }} 更新时间 @@ -433,7 +434,7 @@ box-sizing: border-box; font-family: '苹方 中等', '苹方', sans-serif; color: #2b3950; - text-align: left; + text-align: right; line-height: normal; font-size: 26rpx; } diff --git a/static/images/empty/login-out.png b/static/images/empty/login-out.png deleted file mode 100644 index 7e81565..0000000 Binary files a/static/images/empty/login-out.png and /dev/null differ diff --git a/static/images/icon/eyeOff.png b/static/images/icon/eyeOff.png new file mode 100644 index 0000000..a31b238 Binary files /dev/null and b/static/images/icon/eyeOff.png differ diff --git a/static/images/icon/eyeOn.png b/static/images/icon/eyeOn.png new file mode 100644 index 0000000..7bfea55 Binary files /dev/null and b/static/images/icon/eyeOn.png differ diff --git a/static/images/icon/login-out.png b/static/images/icon/login-out.png new file mode 100644 index 0000000..b197b19 Binary files /dev/null and b/static/images/icon/login-out.png differ diff --git a/static/images/icon/nodata.png b/static/images/icon/nodata.png new file mode 100644 index 0000000..056109d Binary files /dev/null and b/static/images/icon/nodata.png differ diff --git a/static/images/icon/pwd.png b/static/images/icon/pwd.png new file mode 100644 index 0000000..590d614 Binary files /dev/null and b/static/images/icon/pwd.png differ diff --git a/static/images/icon/user.png b/static/images/icon/user.png new file mode 100644 index 0000000..6cdd7be Binary files /dev/null and b/static/images/icon/user.png differ diff --git a/store/mudules/dict.js b/store/mudules/dict.js index 6cc2d20..c698c67 100644 --- a/store/mudules/dict.js +++ b/store/mudules/dict.js @@ -32,12 +32,13 @@ const actions = { } // 处理 dictValue 层级 dictDataMap[dictData.dictType].push({ - value: dictData.value, - label: dictData.label, - colorType: dictData.colorType, - cssClass: dictData.cssClass, + value: dictData.dictValue, + label: dictData.dictLabel, + // colorType: dictData.colorType, + // cssClass: dictData.cssClass, }) }) + console.log(dictDataMap); // 存储到 Store 中 commit('SET_DICT_DATAS', dictDataMap) }) diff --git a/store/mudules/user.js b/store/mudules/user.js index a15c989..de10641 100644 --- a/store/mudules/user.js +++ b/store/mudules/user.js @@ -8,6 +8,9 @@ const user = { state: { accessToken: uni.getStorageSync(AccessTokenKey), // 访问令牌 refreshToken: uni.getStorageSync(RefreshTokenKey), // 刷新令牌 + roleId:"", + entity:"", + entityName:"", userInfo: {} }, mutations: { @@ -28,8 +31,20 @@ const user = { const { access_token, refresh_token } = data state.accessToken = access_token state.refreshToken = refresh_token + const sysUser = data.sysUser; + const ysEntities = sysUser.ysEntities || [] + let roleIdString = sysUser.roles.map(role => role.roleId).join(',') || ""; + let entityString = ysEntities.map(item => item.entity).join(',') || ""; + let entityNameString = ysEntities.map(item => item.entityName).join(',') || ""; + console.log(roleIdString,entityString,entityNameString); + state.roleId = roleIdString; + state.entity = entityString; + state.entityName = entityNameString; + uni.setStorageSync('roleId', roleIdString) + uni.setStorageSync('entity', entityString) + uni.setStorageSync('entityName', entityNameString) uni.setStorageSync(AccessTokenKey, access_token) - uni.setStorageSync(RefreshTokenKey, refresh_token) + // uni.setStorageSync(RefreshTokenKey, refresh_token) // 加载用户信息 // this.dispatch('ObtainUserInfo') @@ -45,6 +60,9 @@ const user = { state.accessToken = '' state.refreshToken = '' state.userInfo = {} + uni.reLaunch({ + url:'/pages/login/mobile' + }) } }, actions: { diff --git a/utils/dict.js b/utils/dict.js new file mode 100644 index 0000000..a255764 --- /dev/null +++ b/utils/dict.js @@ -0,0 +1,89 @@ +/** + * Created by 芋道源码 + * + * 数据字典工具类 + */ +import store from '@/store' + +export const DICT_TYPE = { + // ========== APP模块 ========== + SYS_PLATE_NAME: 'sys_plate_name', // 板块名称 + SYS_HOUSEHOLD_AGE: 'sys_household_age', // 户主年龄 + SYS_LIVE_NO:'sys_live_no', //居住人口 + SYS_BUILD_YEAR:'sys_build_year', //房屋建设年限 + SYS_HOUSE_ATTRIBUTE:'sys_house_attribute', //房屋性质 + SYS_LIVE_ATTRIBUTE:'sys_live_attribute', //居住属性 + SYS_HOUSE_NATURE:'sys_house_nature', // 房屋居住性质 + SYS_HOUSE_STRUCTURE:'sys_house_structure', //房屋结构类型 + SYS_DISTANCE:'sys_distance', //到中压管道距离 + SYS_CURRENT_ENERGY:'sys_current_energy', //现使用能源 + SYS_BUSINESS_SCOPE:'sys_business_scope', //经营范围 + SYS_COMMERCE_ATTRIBUTE:'sys_commerce_attribute', //商业所在场所房屋类型 + SYS_MACHINE_NAME:'sys_machine_name', //耗能设备名称 + SYS_INDUSTRY_TYPE:'sys_industry_type', //用能类型 + SYS_INDUSTRY_DUTIES:'sys_industry_duties', //职务 + SYS_REPORT_STATUS:'sys_report_status', //洞察报告状态 + SYS_INSIGH_AREA:'sys_Insigh_area', //区域 + SYS_INSTALL_INCLINATE:'sys_install_inclinate', //用户报装意愿 + SYS_COMMERCIAL_STATUS:'sys_commercial_status', //商机状态 + SYS_PROJECT_TYPE:'sys_project_type', //项目类别 + SYS_KEYWORD:'sys_keyword', //市场咨询关键词 + SYS_PUBLISH_STATUS:'sys_publish_status', //资讯状态 +} + +/** + * 获取 dictType 对应的数据字典数组 + * + * @param dictType 数据类型 + * @returns {*|Array} 数据字典数组 + */ +export function getDictDatas(dictType) { + return store.getters.dict_datas[dictType] || [] +} + +/** + * 获取 dictType 对应的数据字典数组 + * + * @param dictType 数据类型 + * @param values 数组、单个元素 + * @returns {*|Array} 数据字典数组 + */ +export function getDictDatas2(dictType, values) { + if (values === undefined) { + return []; + } + // 如果是单个元素,则转换成数组 + if (!Array.isArray(values)) { + values = [this.value]; + } + // 获得字典数据 + const results = []; + for (const value of values) { + const dict = getDictData(dictType, value); + if (dict) { + results.push(dict); + } + } + return results; +} + +export function getDictData(dictType, value) { + // 获取 dictType 对应的数据字典数组 + const dictDatas = getDictDatas(dictType) + if (!dictDatas || dictDatas.length === 0) { + return '' + } + // 获取 value 对应的展示名 + value = value + '' // 强制转换成字符串,因为 DictData 小类数值,是字符串 + for (const dictData of dictDatas) { + if (dictData.value === value) { + return dictData; + } + } + return undefined +} + +export function getDictDataLabel(dictType, value) { + const dict = getDictData(dictType, value); + return dict ? dict.label : ''; +} diff --git a/utils/request/responseInterceptors.js b/utils/request/responseInterceptors.js index cb924f3..447d01b 100644 --- a/utils/request/responseInterceptors.js +++ b/utils/request/responseInterceptors.js @@ -31,6 +31,7 @@ module.exports = vm => { isRefreshToken = true // 1. 如果获取不到刷新令牌,则只能执行登出操作 if (!vm.$store.getters.refreshToken) { + console.log("token失效,退出登录"); vm.$store.commit('CLEAR_LOGIN_INFO') return Promise.reject(res) } diff --git a/vue.config.js b/vue.config.js index 7de3715..25aa2d4 100644 --- a/vue.config.js +++ b/vue.config.js @@ -5,11 +5,12 @@ module.exports = { // 调试时允许内网穿透,让外网的人访问到本地调试的H5页面 disableHostCheck: true, // /本地调试时打开 - port: '8081', //代理端口,不固定8222,可以是其他的 + port: '18082', //代理端口,不固定8222,可以是其他的 open: false, //项目启动时是否自动打开浏览器 proxy: { '/api': { - target: 'http://172.17.56.37/api', //接口地址 + target: 'http://172.17.56.37/api', //测试接口地址 + // target: 'http://172.17.56.16/api', //正式接口地址 // ws:true, //允许ws跨域 secure:true, //类型:https=false http=true changeOrigin: true, //是否跨域 -- libgit2 0.21.2