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 0000000..507e313 Binary files /dev/null and b/static/image/tourGuide/2.png differ 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