This commit is contained in:
2025-11-14 11:39:33 +08:00
parent 6e5d892992
commit 1ba633ba45
7143 changed files with 922330 additions and 0 deletions

19
common/config.js Normal file
View File

@@ -0,0 +1,19 @@
// 全局配置文件
// let baseUrl = 'http://192.168.0.108:8088';
// let staticUrl = 'http://192.168.0.108:8088';
let baseUrl = 'https://sourcebyte.vip';
let staticUrl = 'https://sourcebyte.vip';
// 版本号 用于更新
let version = 1;
// vuex_version版本号 用于显示
let vuex_version = '1.0.' + version;
// 是否需要热更新(后台自动更新)
let flag_hot = false;
export default {
baseUrl: baseUrl,
staticUrl:staticUrl,
version: version,
vuex_version: vuex_version,
}

View File

@@ -0,0 +1,52 @@
// 这里的vm就是我们在vue文件里面的this所以我们能在这里获取vuex的变量比如存放在里面的token
// 同时我们也可以在此使用getApp().globalData如果你把token放在getApp().globalData的话也是可以使用的
import config from "./config.js" // 全局配置文件
const install = (Vue, vm) => {
Vue.prototype.$u.http.setConfig({
// baseUrl打包app时放开h5模式下会和vue.config.js代理冲突导致失效
baseUrl: config.baseUrl,
});
// 请求拦截配置Token等参数
Vue.prototype.$u.http.interceptor.request = (config) => {
// config.header.Token = '5d33018e653d897fc259b42cf022c1b3';
// 方式一存放在vuex的token假设使用了uView封装的vuex方式https://uviewui.com/components/globalVariable.html
// 自定义token头
// config.header.Authorization = vm.vuex_token;
return config;
};
// 响应拦截,判断状态码是否通过
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) {
vm.$u.toast('警告:' + res.msg);
return false;
} else if(res.code == 401) {
uni.reLaunch({
url:'../login/login'
})
vm.$u.toast('认证失败,请重新登录')
return false;
} else if(res.code == 403) {
uni.reLaunch({
url:'../login/login'
})
vm.$u.toast('认证失败,请重新登录')
return false;
} else if(res.code == 500) {
vm.$u.toast('错误:' + res.msg);
return false;
} else {
// 其他情况都认为是不合法的
vm.$u.toast('警告:' + res.msg);
return false;
}
};
}
export default {
install
}

129
common/utils/appUpdate.js Normal file
View File

@@ -0,0 +1,129 @@
import config from "./config.js"
//APP更新
export default function appUpdate() {
console.log('start');
let baseUrl = config.baseUrl;
let version = config.version;
console.log(baseUrl);
// 打包时全局配置中设置该版本号
console.log(version);
console.log('开始更新');
var url = baseUrl+'/api/checkVersion'
// uni.request({
// url: url, //检查更新的服务器地址
// success: (res) => {
// let remoteVersion = res.data.obj.title
// plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
// let client_version = wgtinfo.version
// let needUpdated = false;
// var flag_update = needUpdated
// var flag_hot = false;
// if (flag_update) {
// let downUrl = host + '/appController.do?download&Token=' + token + '&id=' + res.data.obj.id
// // 提醒用户更新
// uni.showModal({
// title: '更新提示',
// showCancel: false,
// content: res.data.obj.des,
// success: (e) => {
// if (e.confirm) {
// if (plus.os.name.toLowerCase() == 'ios') {
// // 跳转到下载页面
// plus.runtime.openURL(downUrl)
// } else {
// var dtask = plus.downloader.createDownload(
// downUrl, {},
// function(d, status) {
// uni.showToast({
// title: '下载完成',
// mask: false,
// duration: 1000
// });
// // 下载完成
// if (status == 200) {
// plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename), {}, e => e, function(error) {
// uni.showToast({
// title: '安装失败-01',
// mask: false,
// duration: 1500
// });
// })
// } else {
// uni.showToast({
// title: '更新失败-02',
// mask: false,
// duration: 1500
// });
// }
// });
// try {
// dtask.start(); // 开启下载的任务
// var prg = 0;
// var showLoading = plus.nativeUI.showWaiting("正在下载"); //创建一个showWaiting对象
// dtask.addEventListener('statechanged', function(
// task,
// status
// ) {
// // 给下载任务设置一个监听 并根据状态 做操作
// switch (task.state) {
// case 1:
// showLoading.setTitle("正在下载");
// break;
// case 2:
// showLoading.setTitle("已连接到服务器");
// break;
// case 3:
// prg = parseInt(
// (parseFloat(task.downloadedSize) /
// parseFloat(task.totalSize)) *
// 100
// );
// // showLoading.setTitle(" 正在下载" + prg + "% ");
// showLoading.setTitle(" 正在下载中...");
// break;
// case 4:
// plus.nativeUI.closeWaiting();
// //下载完成
// break;
// }
// });
// } catch (err) {
// plus.nativeUI.closeWaiting();
// uni.showToast({
// title: '更新失败-03',
// mask: false,
// duration: 1500
// });
// }
// }
// }
// }
// })
// } else if (flag_hot) {
// uni.downloadFile({
// url: res.data.wgtUrl,
// success: (downloadResult) => {
// console.log(downloadResult.tempFilePath)
// if (downloadResult.statusCode === 200) {
// plus.nativeUI.toast(`正在热更新!${res.data.versionCode}`);
// plus.runtime.install(downloadResult.tempFilePath, {
// force: false
// }, function() {
// plus.nativeUI.toast("热更新成功");
// plus.runtime.restart();
// }, function(e) {
// console.log(e)
// plus.nativeUI.toast(`热更新失败:${e.message}`);
// });
// }
// }
// });
// }
// });
// }
// })
}

156
common/utils/searchData.js Normal file
View File

@@ -0,0 +1,156 @@
//0.0.4版本起 返回结果将有两部分组成:
/*
{
index:[], //旧版本的下标数组形式
value:[] //菜单中的valve,结构和下标结果数组一样,只是把下标替换成了value而已
}
*/
// 以下演示数据中,我故意把value设置成跟name一样,只是为了方便演示,使示例更加易懂,实际使用时候value应该是一个标识,给后台识别所用的.
// 数据较长,请仔细查看。
export default [{
"name": '小区',
"type": 'hierarchy',
"submenu": [
{
"name": "不限",
"value": ""
},
]
},
{
"name": '方式',
"type": 'hierarchy',
"submenu": [
{
"name": "不限",
"value": ""
},
{
"name": "整租",
"value": "0"
},
{
"name": "合租",
"value": "1"
},
]
},
{
"name": '租金',
"type": 'hierarchy',
"submenu": [
{
"name": "不限",
"value": ""
},
{
"name": "<1000元",
"value": "1000"
},
{
"name": "1000-1500元",
"value": "1500"
},
{
"name": "1500-2000元",
"value": "2000"
},
{
"name": "2000-3000元",
"value": "3000"
},
{
"name": "3000-4500元",
"value": "4500"
},
{
"name": "<6000元",
"value": "6000"
}
]
},
{
"name": '筛选',
"type": 'radio',
"submenu": [{
"name": "居室",
"submenu": [{
"name": "一室",
"value": "一室"
},
{
"name": "二室",
"value": "二室"
},
{
"name": "三室",
"value": "三室"
},
{
"name": "四室",
"value": "四室"
}
]
},
{
"name": "装修",
"submenu": [
{
"name": "简装",
"value": "简装",
},
{
"name": "中装",
"value": "中装",
},
{
"name": "精装修",
"value": "精装修"
},
{
"name": "豪装",
"value": "豪装"
}
]
},
{
"name": "房屋亮点",
"submenu": [
{
"name": "独卫",
"value": "独卫"
},
{
"name": "独立阳台",
"value": "独立阳台"
},
{
"name": "精装修",
"value": "精装修"
},
{
"name": "智能锁",
"value": "智能锁"
},
{
"name": "可短租",
"value": "可短租"
},
{
"name": "首次出租",
"value": "首次出租"
},
{
"name": "免物业费",
"value": "免物业费"
},
{
"name": "民用水电",
"value": "民用水电"
},
]
}
]
}
]

68
common/utils/tip.js Normal file
View File

@@ -0,0 +1,68 @@
// 不含icon提示框
const toast = str => {
return new Promise((resolve, reject) => {
uni.showToast({
title: str,
icon: "none",
duration: 3000,
success: () => {
setTimeout(() => {
resolve
}, 3000)
}
})
})
};
// 成功提示框
const successToast = str => {
return new Promise((resolve, reject) => {
uni.showToast({
title: str,
icon: "success",
duration: 3000,
success: () => {
setTimeout(() => {
resolve()
}, 3000)
}
})
})
};
// loading
const showLoading = () => {
return new Promise((resolve, reject) => {
uni.showLoading({
success: () => {
resolve()
}
})
})
};
// tipLoading ==>提示loading
const tipLoading = str => {
return new Promise((resolve, reject) => {
uni.showLoading({
title: str,
success: () => {
resolve()
}
})
})
};
// 隐藏loading
const hideLoading = () => {
return new Promise((resolve, reject) => {
uni.hideLoading({
success: () => {
resolve()
}
})
})
};
export default {
toast: toast,
successToast: successToast,
showLoading: showLoading,
tipLoading: tipLoading,
hideLoading: hideLoading,
}

View File

@@ -0,0 +1,21 @@
// import amapFile from '../../libs/amap-wx.130.js'
// const myAmapFun = new amapFile.AMapWX({
// // 申请的高德key值
// key: '4ef3b3b42d8bb823529908dc93414127'
// }); //创建一个实例化对象
// export default function wxGetAddress({longitude,latitude}) {
// //根据传递进来经纬度进行反解析,调用的是高德给的方法
// return new Promise((resolve, reject) => {
// myAmapFun.getRegeo({
// location: `${longitude},${latitude}`,
// success: (res) => {
// resolve(res[0])
// },
// fail: (err) => {
// resolve(null)
// }
// })
// })
// }