diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/common/config.js b/common/config.js index b446adc..a6f0024 100644 --- a/common/config.js +++ b/common/config.js @@ -1,8 +1,9 @@ // 全局配置文件 -// let baseUrl = 'https://sourcebyte.vip'; -// let staticUrl = 'https://sourcebyte.vip'; -let baseUrl = 'http://localhost:8089'; -let staticUrl = 'http://localhost:8089'; +// let baseUrl = 'http://219.138.32.164:8089'; +// let baseUrl = 'http://localhost:3000/api'; +// let staticUrl = 'http://localhost:3000'; +let baseUrl = 'https://www.wujiaguotou.com/api'; +let staticUrl = 'https://www.wujiaguotou.com'; // 版本号 用于更新 let version = 1; // vuex_version版本号 用于显示 diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 44ca65f..650f7d1 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -5,16 +5,23 @@ const install = (Vue, vm) => { Vue.prototype.$u.http.setConfig({ // baseUrl打包app时放开,h5模式下会和vue.config.js代理冲突,导致失效 baseUrl: config.baseUrl, - + originalData:true, + timeout: 10000, }); // 请求拦截,配置Token等参数 Vue.prototype.$u.http.interceptor.request = (config) => { // config.header.Token = '5d33018e653d897fc259b42cf022c1b3'; // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html // 自定义token头 + // 1️⃣ 获取本地 userInfo + const userInfo = uni.getStorageSync('userInfo') || {}; + + // 2️⃣ 提取 userType + const userType = userInfo.userType; config.header = { ...config.header, // ⭐ 保留你外部传入的 header - 'content-type': 'application/json' + 'content-type': 'application/json', + ...(userType ? { 'USERTYPE': userType } : {}) // 有 userType 才加 } return config; }; @@ -22,25 +29,25 @@ const install = (Vue, vm) => { Vue.prototype.$u.http.interceptor.response = (res) => { // 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据 // 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果 - if(res.code == 200) { - return res; - } else if(res.code == 301) { + if(res.statusCode == 200) { + return res.data; + } else if(res.statusCode == 301) { vm.$u.toast('警告:' + res.msg); return false; - } else if(res.code == 401) { - uni.reLaunch({ - url:'../login/login' + } else if(res.statusCode == 401) { + uni.navigateTo({ + url:'/pages-biz/login/login' }) vm.$u.toast('认证失败,请重新登录') return false; - } else if(res.code == 403) { - uni.reLaunch({ - url:'../login/login' + } else if(res.statusCode == 403) { + uni.navigateTo({ + url:'/pages-biz/login/login' }) vm.$u.toast('认证失败,请重新登录') return false; - } else if(res.code == 500) { - vm.$u.toast('错误:' + res.msg); + } else if(res.statusCode == 500) { + vm.$u.toast('请求错误:' + res.msg); return false; } else { // 其他情况都认为是不合法的 @@ -48,6 +55,20 @@ const install = (Vue, vm) => { return false; } }; + + + Vue.prototype.$u.http.interceptor.responseError = (err) => { + // err 是 uni.request 的 fail 对象 + // 超时一般是 err.errMsg 包含 timeout + + if (err.errMsg && err.errMsg.includes('timeout')) { + vm.$u.toast('请求超时,请稍后重试'); + } else { + vm.$u.toast('网络异常,请检查网络'); + } + + return Promise.reject(err); + }; } export default { diff --git a/common/utils/auth.js b/common/utils/auth.js new file mode 100644 index 0000000..bdea0e6 --- /dev/null +++ b/common/utils/auth.js @@ -0,0 +1,38 @@ +export function getToken() { + const lifeData = uni.getStorageSync('lifeData') || {} + const token = lifeData.vuex_token + return token; +} + +export function checkToken(token) { + if (!token || (typeof token === 'object' && Object.keys(token).length === 0)) { + uni.reLaunch({ + url: '/pages-biz/login/login' + }) + return Promise.reject('no token') + } + + return new Promise((resolve, reject) => { + uni.$u.get('/login/checkExpiration', {}, { + WT: token + }).then(res => { + if (res.data) { + uni.reLaunch({ + url: '/pages-biz/login/login' + }) + reject('token expired') + } else { + resolve(true) + } + }).catch(err => { + uni.reLaunch({ + url: '/pages-biz/login/login' + }) + }) + }) +} + +export function getUserType(){ + let userInfo = uni.getStorageSync('userInfo') + return userInfo.userType +} \ No newline at end of file diff --git a/common/utils/ras.js b/common/utils/ras.js new file mode 100644 index 0000000..2b307b2 --- /dev/null +++ b/common/utils/ras.js @@ -0,0 +1,13 @@ +import JSEncrypt from 'jsencrypt' + +const PUBLIC_KEY = ` +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk6Kvq4tCfQJFO3xqMN86ra6YPKEGgDJGVNAo8HAb9ZxL8fgckaHN4wpI8D8D0HDP/Xn8ZrS7wZFSAecUmWBtyBjZdMOdSMZm1LdX036+XpyGVktsrE15n85KG9+P4H4he9ZbiPPMGYvmkn/zaxMxUagSHhPpvrwRMovA8onKzSL67CFOWl95HXxhJ1GhlKIQVBz9R5OsHhwZFfPu2xtajCtiGtF2zjF3ojwpLNca+ADC6mZufRV/MD1+gMMS5GcwG5xALDyG+Aqv4xHto30SGks3FJ9k9bAwA8vyOU8SBeG8fW8lbO9XrtbupmxUm5RnSEtNUy/iUuO1hEmpSqQfBQIDAQAB +-----END PUBLIC KEY----- +` + +export function rsaEncrypt(text) { + const encryptor = new JSEncrypt() + encryptor.setPublicKey(PUBLIC_KEY) + return encryptor.encrypt(text) +} diff --git a/common/utils/searchData.js b/common/utils/searchData.js index 99c1643..6eaa167 100644 --- a/common/utils/searchData.js +++ b/common/utils/searchData.js @@ -16,6 +16,16 @@ export default [{ "value": "" }, ] +}, +{ + "name": '街道', + "type": 'hierarchy', + "submenu": [ + { + "name": "不限", + "value": "" + }, + ] }, { "name": '方式', diff --git a/common/utils/text.js b/common/utils/text.js new file mode 100644 index 0000000..7cbf2f6 --- /dev/null +++ b/common/utils/text.js @@ -0,0 +1,16 @@ +/** + * 文本省略处理 + * @param {String} text 原始文本 + * @param {Number} maxLen 最大显示字数 + * @param {String} suffix 省略后缀,默认 ... + * @returns {String} + */ +function ellipsisText(text, maxLen = 20, suffix = '...') { + if (!text) return ''; + if (text.length <= maxLen) return text; + return text.slice(0, maxLen) + suffix; +} + +module.exports = { + ellipsisText +}; \ No newline at end of file diff --git a/components/Carousel/Carousel.vue b/components/Carousel/Carousel.vue new file mode 100644 index 0000000..0c7d78b --- /dev/null +++ b/components/Carousel/Carousel.vue @@ -0,0 +1,402 @@ + + + + + \ No newline at end of file diff --git a/components/asset/assetList.vue b/components/asset/assetList.vue index c8bb65a..45338f8 100644 --- a/components/asset/assetList.vue +++ b/components/asset/assetList.vue @@ -2,23 +2,21 @@ - + - {{ item.name }} - {{ item.address }} - {{ item.statusText }} + {{ item.assetsName }} + {{ item.assetsAddress }} - - + @@ -29,17 +27,11 @@ export default { list: { type: Array, default: () => [], - }, - showLoadmore: { - type: Boolean, - default: true, - }, - loadStatus: { - type: String, - default: "loadmore", - }, + } }, emits: ["click"], + onLoad(options) { + }, methods: { onClick(item) { this.$emit("click", item); diff --git a/components/bottom/assetBottomBar.vue b/components/bottom/assetBottomBar.vue index 4dfc14f..d9626b7 100644 --- a/components/bottom/assetBottomBar.vue +++ b/components/bottom/assetBottomBar.vue @@ -11,10 +11,10 @@ - - 预约看房 + + {{btnTitle || '加载错误'}} - + @@ -25,7 +25,51 @@ import share from '../share/share.vue'; export default { name: 'assetBottomBar', components: { share }, - props: { assetId: [String, Number], phone: String }, + props: { + assetId: [String, Number], + phone: String , + btnTitle: { + type: String, + default: '' + }, + shareBtnTitle: { + type: String, + default: '' + }, + /** 小程序页面路径 */ + pagePath: { + type: String, + required: true + }, + + /** H5 页面路径 */ + h5Path: { + type: String, + required: true + }, + + /** 分享参数(id / code 等) */ + query: { + type: Object, + default: () => ({}) + }, + + /** 小程序码接口 */ + minicodeApi: { + type: String, + default: '' + }, + + /** H5 基础域名(可选) */ + baseUrl: { + type: String, + default: '' + }, + btnColor: { + type: String, + default: '' + } + }, methods: { onShare() { console.log("调用分享") @@ -92,18 +136,15 @@ export default { font-size: 22rpx; } -/* 蓝色描边主按钮(完全居中) */ .main-btn { flex-shrink: 0; width: 340rpx; height: 88rpx; - border: 2rpx solid #FF2F31; border-radius: 44rpx; - background-color: #ffffff; display: flex; align-items: center; justify-content: center; - color: #FF2F31; + color: #ffffff; font-size: 30rpx; font-weight: 500; transition: all 0.2s; diff --git a/components/card/mycard.vue b/components/card/mycard.vue deleted file mode 100644 index fa39038..0000000 --- a/components/card/mycard.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/gallery/AssetGallery.vue b/components/gallery/AssetGallery.vue deleted file mode 100644 index 09e33a6..0000000 --- a/components/gallery/AssetGallery.vue +++ /dev/null @@ -1,295 +0,0 @@ - - - - - diff --git a/components/navbar/customNavbar.vue b/components/navbar/customNavbar.vue index b7dc9f1..d0771d1 100644 --- a/components/navbar/customNavbar.vue +++ b/components/navbar/customNavbar.vue @@ -12,20 +12,18 @@ - - + + + + + + + @@ -106,7 +104,7 @@ export default { }, showHome: { type: Boolean, - default: false // 回首页按钮默认不显示 + default: true // 回首页按钮默认不显示 } }, data() { @@ -155,15 +153,18 @@ export default { }, onBack() { - if (this.back) { - this.back(); - } else { + const pages = getCurrentPages(); + if (pages.length > 1) { uni.navigateBack(); + } else { + uni.switchTab({ + url:'/pages/index/index' + }) } }, goHome(){ - uni.reLaunch({ - url:'../index/index' + uni.switchTab({ + url:'/pages/index/index' }) }, onExtraIconClick(index) { @@ -186,30 +187,41 @@ export default { .nav-content { display: flex; align-items: center; - justify-content: space-between; + position: relative; height: 100%; padding: 0 24rpx; } - .nav-left { - width: 50rpx; - display: flex; - align-items: center; - } - - .nav-title { - flex: 1; - text-align: center; - font-size: 32rpx; - } - - .nav-right { - display: flex; - align-items: center; - .nav-btn { - margin-left: 20rpx; - } - } +.nav-left{ + width: 120rpx; +} +.nav-left, +.nav-right { + display: flex; + align-items: center; + z-index: 2; +} +.nav-title { + pointer-events: none; + position: absolute; + left: 50%; + transform: translateX(-50%); + max-width: 60%; + text-align: center; + font-size: 32rpx; + font-weight: 500; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + z-index: 1; +} + // .nav-right { + // display: flex; + // align-items: center; + // .nav-btn { + // margin-left: 20rpx; + // } + // } // 透明状态样式 &.transparent { diff --git a/components/navbar/indexNavbar.vue b/components/navbar/indexNavbar.vue index 60ece24..3dac966 100644 --- a/components/navbar/indexNavbar.vue +++ b/components/navbar/indexNavbar.vue @@ -87,11 +87,14 @@ export default { }, methods: { onBack() { - if (this.back) { - this.back(); - } else { - uni.navigateBack(); - } + const pages = getCurrentPages(); + if (pages > 1) { + uni.navigateBack(); + } else { + uni.switchTab({ + url:'/pages/index/index' + }) + } }, goHome(){ uni.reLaunch({ diff --git a/components/share/share.vue b/components/share/share.vue index 6a2fec2..ff3662b 100644 --- a/components/share/share.vue +++ b/components/share/share.vue @@ -1,15 +1,29 @@ + + \ No newline at end of file diff --git a/pages-assets/discharge/leaseCancelList.vue b/pages-assets/discharge/leaseCancelList.vue new file mode 100644 index 0000000..d49003e --- /dev/null +++ b/pages-assets/discharge/leaseCancelList.vue @@ -0,0 +1,255 @@ + + + + + \ No newline at end of file diff --git a/pages/message/guestbook.vue b/pages-assets/fallback/fallback.vue similarity index 51% rename from pages/message/guestbook.vue rename to pages-assets/fallback/fallback.vue index d85b96e..366c733 100644 --- a/pages/message/guestbook.vue +++ b/pages-assets/fallback/fallback.vue @@ -2,12 +2,12 @@ + :text-color="navbarStyle.textColor" :opacity="navbarStyle.opacity" :show-home="true" /> - - + + {{ item.statusText }} 留言内容 @@ -16,15 +16,22 @@ {{ item.content }} - 留言时间:{{ item.time }} + 留言时间:{{ item.summitDate }} - + + + + + - - - - - - - - - - diff --git a/pages/detail/preHouse.vue b/pages/detail/preHouse.vue deleted file mode 100644 index b61b048..0000000 --- a/pages/detail/preHouse.vue +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - diff --git a/pages/form/check.vue b/pages/form/check.vue deleted file mode 100644 index 994f2a3..0000000 --- a/pages/form/check.vue +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - diff --git a/pages/form/leaseCancel.vue b/pages/form/leaseCancel.vue deleted file mode 100644 index 2b8fa18..0000000 --- a/pages/form/leaseCancel.vue +++ /dev/null @@ -1,219 +0,0 @@ -