From cbac020334d405abf79b29f6da488a98e911c58c Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Tue, 29 Jul 2025 16:12:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=88=BF=E6=BA=90?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=80=89=E6=8B=A9=E9=A1=B5=E9=9D=A2=E5=92=8C?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E4=B8=AD=E5=BF=83=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 重构房源发布表单输入类型和验证规则 feat(house): 新增经营性建设用地和其他农村资源录入页面 style: 优化首页位置显示和搜索框布局 refactor(user): 重构用户信息展示和会员状态显示 feat(detail): 优化房源详情页字段显示逻辑 refactor(store): 合并data和user模块到主store fix(config): 修复uvUI初始化顺序和HTTP实例检查 docs: 更新README和注释说明 chore: 更新依赖和配置文件 --- .cursor/rules/index.mdc | 5 + App.vue | 6 +- common/api.js | 7 +- common/config.js | 3 +- config.js | 23 +- main.js | 47 +-- manifest.json | 2 +- mixins/configList.js | 2 +- pages.json | 46 ++- pages/home/index.vue | 32 +- pages/login/index.vue | 3 +- pages/tourGuide/tourGuide.vue | 488 ++++++++++++++++++++++++----- pages/user/index.vue | 109 +++---- pages_subpack/detail/index.vue | 63 ++-- pages_subpack/house/commercial.vue | 450 +++++++++++++++++++++++++++ pages_subpack/house/farmhouse.vue | 623 +++++++++++++++++++++++++++++++++++++ pages_subpack/house/index.vue | 33 +- pages_subpack/house/other.vue | 479 ++++++++++++++++++++++++++++ pages_subpack/house/select.vue | 254 +++++++++++++++ pages_subpack/member/index.vue | 311 ++++++++++++++++++ pages_subpack/version/index.vue | 15 +- static/image/tourGuide/2.png | Bin 0 -> 3273 bytes store/index.js | 44 ++- store/modules/data.js | 21 -- store/modules/user.js | 53 ---- 25 files changed, 2790 insertions(+), 329 deletions(-) create mode 100644 .cursor/rules/index.mdc create mode 100644 pages_subpack/house/commercial.vue create mode 100644 pages_subpack/house/farmhouse.vue create mode 100644 pages_subpack/house/other.vue create mode 100644 pages_subpack/house/select.vue create mode 100644 pages_subpack/member/index.vue create mode 100644 static/image/tourGuide/2.png delete mode 100644 store/modules/data.js delete mode 100644 store/modules/user.js diff --git a/.cursor/rules/index.mdc b/.cursor/rules/index.mdc new file mode 100644 index 0000000..b6ecb6a --- /dev/null +++ b/.cursor/rules/index.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: true +--- diff --git a/App.vue b/App.vue index bd74810..324597e 100644 --- a/App.vue +++ b/App.vue @@ -2,11 +2,13 @@ export default { onLaunch: function() { console.log('App Launch') - this.$store.commit('initConfig') }, onShow: function() { - + this.$store.commit('initConfig') + if(uni.getStorageSync('token')){ + this.$store.commit('getUserInfo') + } }, onHide: function() { console.log('App Hide') diff --git a/common/api.js b/common/api.js index 7c3a8a7..48694b0 100644 --- a/common/api.js +++ b/common/api.js @@ -1,6 +1,11 @@ +// 检查 HTTP 实例是否已初始化 +if (!uni.$uv || !uni.$uv.http) { + console.error('HTTP 实例未初始化,请检查 uvUI 配置') +} + const { http } = uni.$uv + // 获取菜单 -console.info(`http`,http) export const fetchMenu = (params, config = {}) => http.get('/applet/index/getRecommendDocs', params, config) diff --git a/common/config.js b/common/config.js index 1e528e7..ddf9c19 100644 --- a/common/config.js +++ b/common/config.js @@ -1,7 +1,8 @@ export default { // baseUrl : 'http://127.0.0.1:8000', // baseUrl: 'https://api.book118.com', - baseUrl:'https://houserent-admin.hhlm1688.com' + baseUrl:'https://houserent-admin.hhlm1688.com', + // baseUrl:'http://augcl.natapp1.cc', // baseUrl:'http://h5.xzaiyp.top' // baseUrl:'https://houserent-admin.hhlm1688.com' // baseUrl:'http://h5.xzaiyp.top' diff --git a/config.js b/config.js index 7e3dfbd..009d516 100644 --- a/config.js +++ b/config.js @@ -1,11 +1,9 @@ import Vue from 'vue' import utils from './utils/utils.js' -import uvUI from '@/uni_modules/uv-ui-tools' - -Vue.use(uvUI); +// 移除重复的 uvUI 导入和初始化,已在 main.js 中处理 // 当前环境 -const type = 'prod' +const type = 'dev' // 环境配置 @@ -17,7 +15,8 @@ const config = { baseUrl : 'http://augcl.natapp1.cc/employ-api', }, prod : { - baseUrl : 'https://employadmin.augcl.com/employ-api', + baseUrl : 'https://houserent-admin.hhlm1688.com/employ-api', + // baseUrl : 'https://employadmin.augcl.com/employ-api', } } @@ -25,18 +24,18 @@ const config = { // 默认配置 const defaultConfig = { mapKey : 'XMBBZ-BCPCV-SXPPQ-5Y7MY-PHZXK-YFFVU', - aliOss : { - url : 'https://tennis-oss.xzaiyp.top/', - config : { + aliOss: { + url: 'https://image.hhlm1688.com/', + config: { //桶的地址 region: 'oss-cn-guangzhou', //id - accessKeyId:'LTAI5tNycA46YTwm383dRvMV', + accessKeyId: 'LTAI5tQSs47izVy8DLVdwUU9', //密钥 - accessKeySecret:'tAdbYQCmdur6jbZ8hjvgB7T1Z52mIG', + accessKeySecret: 'qHI7C3PaXYZySr84HTToviC71AYlFq', //桶的名字 - bucket: 'zhuoqiu-image', - endpoint:'oss-cn-guangzhou.aliyuncs.com', + bucket: 'hanhaiimage', + endpoint: 'oss-cn-shenzhen.aliyuncs.com', } }, } diff --git a/main.js b/main.js index bb5991e..1163c7e 100644 --- a/main.js +++ b/main.js @@ -1,20 +1,25 @@ import App from './App' -import uvUI from '@/uni_modules/uv-ui-tools' import { Request } from '@/util/request/index' - - +import uvUI from '@/uni_modules/uv-ui-tools' +import { Request } from '@/util/request/index' + + import Vue from 'vue' -Vue.config.productionTip = false - -import './config.js' import './utils/index.js' - -import mixinConfigList from '@/mixins/configList.js' - -Vue.mixin(mixinConfigList) +Vue.config.productionTip = false + +// 确保 uvUI 在其他配置之前正确初始化 +Vue.use(uvUI) + +import './config.js' +import './utils/index.js' + +import mixinConfigList from '@/mixins/configList.js' + +Vue.mixin(mixinConfigList) + +App.mpType = 'app' -App.mpType = 'app' - try { function isPromise(obj) { return (!!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function"); @@ -36,15 +41,17 @@ try { }); }, }); -} catch (error) {} - -import store from '@/store' Vue.prototype.$store = store - +} catch (error) {} + +import store from '@/store' +Vue.prototype.$store = store + +// 初始化 HTTP 请求配置 +Request() const app = new Vue({ - ...App, + ...App, store -}) +}) -app.$mount() -Request(app) +app.$mount() diff --git a/manifest.json b/manifest.json index f37dbac..4e0c91f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name" : "tenancy-wechat-uniapp", - "appid" : "__UNI__09A45BC", + "appid" : "__UNI__197A38F", "description" : "", "versionName" : "1.0.0", "versionCode" : "100", diff --git a/mixins/configList.js b/mixins/configList.js index b5956a6..7dd9d30 100644 --- a/mixins/configList.js +++ b/mixins/configList.js @@ -13,7 +13,7 @@ export default { } }, computed: { - ...mapState(['userInfo']), + ...mapState(['userInfo','vipInfo', 'configList']), }, // 定义全局分享 // 1.发送给朋友 diff --git a/pages.json b/pages.json index bf4ba7b..75fe5b9 100644 --- a/pages.json +++ b/pages.json @@ -4,7 +4,7 @@ "path": "pages/home/index", "style": { "navigationBarTitleText": "租房", - "enablePullDownRefresh": true, //配置后,可以下拉刷新,上拉加载` + "enablePullDownRefresh": true, "onReachBottomDistance": 100 } }, @@ -32,7 +32,7 @@ "path": "pages/discover/index", "style": { "navigationBarTitleText": "发现", - "enablePullDownRefresh": true, //配置后,可以下拉刷新,上拉加载` + "enablePullDownRefresh": true, "onReachBottomDistance": 100 } }, @@ -60,7 +60,7 @@ { "path": "pages/tourGuide/tourGuide", "style": { - "navigationBarTitleText": "地图导览", + "navigationBarTitleText": "地图找房", "navigationBarBackgroundColor": "#1EC77A", "navigationBarTextStyle": "white" } @@ -119,6 +119,30 @@ "navigationBarTitleText": "房屋发布" } }, + { + "path": "house/select", + "style": { + "navigationBarTitleText": "选择发布类型" + } + }, + { + "path": "house/farmhouse", + "style": { + "navigationBarTitleText": "闲置农房录入" + } + }, + { + "path": "house/commercial", + "style": { + "navigationBarTitleText": "经营性建设用地录入" + } + }, + { + "path": "house/other", + "style": { + "navigationBarTitleText": "其他农村资源录入" + } + }, { "path": "realname/index", "style": { @@ -178,6 +202,14 @@ "navigationBarBackgroundColor": "#ffffff", "navigationBarTextStyle": "black" } + }, + { + "path": "member/index", + "style": { + "navigationBarTitleText": "开通会员", + "navigationBarBackgroundColor": "#1EC77A", + "navigationBarTextStyle": "white" + } } ] } @@ -202,14 +234,8 @@ "pagePath": "pages/tourGuide/tourGuide", "iconPath": "static/bar/find.png", "selectedIconPath": "static/bar/find_selected.png", - "text": "发现" + "text": "地图找房" }, - // { - // "pagePath": "pages/discover/index", - // "iconPath": "static/bar/find.png", - // "selectedIconPath": "static/bar/find_selected.png", - // "text": "发现" - // }, { "pagePath": "pages/user/index", "iconPath": "static/bar/user.png", diff --git a/pages/home/index.vue b/pages/home/index.vue index 0449f7e..dee8500 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -1,12 +1,12 @@ + + + + \ No newline at end of file diff --git a/pages_subpack/house/select.vue b/pages_subpack/house/select.vue new file mode 100644 index 0000000..2eb7224 --- /dev/null +++ b/pages_subpack/house/select.vue @@ -0,0 +1,254 @@ + + + + + \ No newline at end of file diff --git a/pages_subpack/member/index.vue b/pages_subpack/member/index.vue new file mode 100644 index 0000000..29f2b03 --- /dev/null +++ b/pages_subpack/member/index.vue @@ -0,0 +1,311 @@ + + + + + \ No newline at end of file diff --git a/pages_subpack/version/index.vue b/pages_subpack/version/index.vue index 0bf9a30..98bc0da 100644 --- a/pages_subpack/version/index.vue +++ b/pages_subpack/version/index.vue @@ -1,8 +1,10 @@ @@ -13,5 +15,8 @@ } - \ No newline at end of file diff --git a/static/image/tourGuide/2.png b/static/image/tourGuide/2.png new file mode 100644 index 0000000000000000000000000000000000000000..507e313afe26b1b98cc375d452de256d6559bddb GIT binary patch literal 3273 zcmV;)3^wzLP)Px>gGod|RA@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gk>S2Ue zmTNkdiv$qS!||TG1=p}O$X!=rb^a4PB9jyK+>{ZK%DHuWIn#1|wz(^&6|5&1{?;yBfq?U$@ zcAlt>xkd%>j$e+w>M6|b)h%PI|3xt3fw~dfaxt+r*AsYipf*J09-hWG`2&1oX8d3>*N}C1$Id}67uCP7j#bIOQ88;eOeI0wA|=8uewC>rC%k*kgiXPN;zfy9@SkS!Hh%9emx1@lD>rws#NIX-EdJi|q00000NkvXX Hu0mjfvUDum literal 0 HcmV?d00001 diff --git a/store/index.js b/store/index.js index 522a6c9..a83d72a 100644 --- a/store/index.js +++ b/store/index.js @@ -1,7 +1,5 @@ import Vue from 'vue' import Vuex from 'vuex' -import data from './modules/data' -import user from './modules/user' import { getConfig, getInfo } from "@/common/api.js" @@ -11,18 +9,39 @@ const store = new Vuex.Store({ state: { token:"", userInfo : {}, //用户信息 + vipInfo : {}, + configList : {}, }, mutations: { // 初始化配置 initConfig(state){ - getConfig({}).then(response=>{ - uni.setStorageSync('configList', response.result) - }).catch(error=>{ + console.log('initConfig 开始执行') + + if (!uni.$uv || !uni.$uv.http) { + console.error('uni.$uv.http 未初始化,请检查 uvUI 配置') + return + } + + getConfig({}).then(res=>{ + console.log('getConfig 请求成功:', res) + uni.setStorageSync('configList', res.result) + const configList = { + ...state.configList, + } + if (res.code == 200) { + res.result.forEach(n => { + configList[n.keyName] = n.keyContent; + configList[n.keyName + '_keyValue'] = n.keyValue; + }); + } + state.configList = configList + uni.$emit('initConfig', state.configList) + console.log('配置初始化完成:', state.configList) + + }).catch(error=>{ + console.error('getConfig 请求失败:', error) }) - }, - onAuth(state){ - }, setUserInfo(state,obj){ state.userInfo = obj.userInfo @@ -35,10 +54,11 @@ const store = new Vuex.Store({ } getInfo({}).then(result=>{ - if(result.result.nickName){ - state.userInfo = result.result - fn && fn(result.result) - }else{ + + state.userInfo = result.result.member || {} + state.vipInfo = result.result.vipInfo || {} + + if(!result.result.member.nickName){ uni.navigateTo({ url:"/pages/login/index" }) diff --git a/store/modules/data.js b/store/modules/data.js deleted file mode 100644 index 99565b5..0000000 --- a/store/modules/data.js +++ /dev/null @@ -1,21 +0,0 @@ -import { getConfig } from "@/common/api.js" - -export default { - state: { - }, - getters: { - - }, - mutations: { - // 初始化配置 - initConfig(state){ - getConfig({}).then(response=>{ - uni.setStorageSync('configList', response.result) - }).catch(error=>{ - - }) - }, - }, - - actions: {} -} \ No newline at end of file diff --git a/store/modules/user.js b/store/modules/user.js deleted file mode 100644 index 8f61571..0000000 --- a/store/modules/user.js +++ /dev/null @@ -1,53 +0,0 @@ - - - -import { getInfo } from "@/common/api.js" - -export default { - state: { - token:"", - userInfo : {}, //用户信息 - }, - mutations: { - onAuth(state){ - - }, - setUserInfo(state,obj){ - state.userInfo = obj.userInfo - state.token = obj.token - }, - getUserInfo(state){ - - if(!uni.getStorageSync('token')){ - return - } - - getInfo({}).then(result=>{ - if(result.result.nickName){ - state.userInfo = result.result - }else{ - uni.navigateTo({ - url:"/pages/login/index" - }) - } - }) - }, - logout(state){ - uni.showModal({ - title: '确认退出登录吗', - success(r) { - if(r.confirm){ - state.userInfo = {} - state.token = "" - uni.removeStorageSync('token') - uni.redirectTo({ - url: '/pages/index/index' - }) - } - } - }) - }, - }, - - actions: {} -} \ No newline at end of file