feat(store): 添加上传接口后台配置字段
fix(axios): 更新开发环境测试session值 fix(public-list-item): 修复location为0时的显示问题 fix(edit): 修复location为0时的显示问题并优化上传逻辑 refactor(main): 优化代码格式并添加上传配置初始化
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -1,4 +1,4 @@
|
||||
<!doctype html><html lang=""><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="icon" href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/favicon.ico"/><title>港校租房</title><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/js/chunk-vendors.5bed831c.js"></script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/js/app.e9d2b4e0.js"></script><link href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/css/chunk-vendors.7885d77e.css" rel="stylesheet"><link href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/css/app.0cfa5b10.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but zufang doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><script src="https://app.gter.net/bottom?tpl=header&menukey=fang"></script><div id="app"></div><div style="display: none;"><script>var _hmt = _hmt || []
|
||||
<!doctype html><html lang=""><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="icon" href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/favicon.ico"/><title>港校租房</title><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/js/chunk-vendors.5bed831c.js"></script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/js/app.25e16fe9.js"></script><link href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/css/chunk-vendors.7885d77e.css" rel="stylesheet"><link href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/fang/css/app.0cfa5b10.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but zufang doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><script src="https://app.gter.net/bottom?tpl=header&menukey=fang"></script><div id="app"></div><div style="display: none;"><script>var _hmt = _hmt || []
|
||||
;(function () {
|
||||
var hm = document.createElement("script")
|
||||
hm.src = "//hm.baidu.com/hm.js?4bd66cbe45a640b607fe46c48f658746"
|
||||
|
||||
1
dist/js/app.25e16fe9.js
vendored
Normal file
1
dist/js/app.25e16fe9.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/js/app.e9d2b4e0.js
vendored
1
dist/js/app.e9d2b4e0.js
vendored
File diff suppressed because one or more lines are too long
1
dist/js/edit.9bf3a96d.js
vendored
1
dist/js/edit.9bf3a96d.js
vendored
File diff suppressed because one or more lines are too long
1
dist/js/edit.e9945c28.js
vendored
Normal file
1
dist/js/edit.e9945c28.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -33,7 +33,7 @@
|
||||
<!-- {{ data.rentalduration == 0 ? '不限' : -->
|
||||
<!-- listData['rentalduration'][data.rentalduration] }} -->
|
||||
</div>
|
||||
<div class="address-text dis-f al-item" v-if="item['location']">
|
||||
<div class="address-text dis-f al-item" v-if="item['location'] && item['location'] !== '0'">
|
||||
<template v-if="Array.isArray(item['location'])">
|
||||
<template v-for="(it, i) in item['location']" :key="i">
|
||||
<div class="address-item flexacenter" v-if="it">
|
||||
|
||||
151
src/main.js
151
src/main.js
@@ -1,7 +1,7 @@
|
||||
import { createApp } from "vue"
|
||||
import App from "./App.vue"
|
||||
import router from "./router"
|
||||
import store from "./store"
|
||||
import { createApp } from "vue";
|
||||
import App from "./App.vue";
|
||||
import router from "./router";
|
||||
import store from "./store";
|
||||
// import ElementPlus from 'element-plus'
|
||||
// import { ElButton, ElInput } from 'element-plus'
|
||||
|
||||
@@ -28,110 +28,113 @@ import {
|
||||
ElProgress,
|
||||
ElScrollbar,
|
||||
// 其他需要的组件
|
||||
} from "element-plus"
|
||||
} from "element-plus";
|
||||
|
||||
import "element-plus/theme-chalk/index.css"
|
||||
import "element-plus/dist/index.css"
|
||||
import "element-plus/theme-chalk/index.css"
|
||||
import locale from "element-plus/lib/locale/lang/zh-cn"
|
||||
import "element-plus/theme-chalk/index.css";
|
||||
import "element-plus/dist/index.css";
|
||||
import "element-plus/theme-chalk/index.css";
|
||||
import locale from "element-plus/lib/locale/lang/zh-cn";
|
||||
|
||||
import zhCn from "element-plus/dist/locale/zh-cn.mjs"
|
||||
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
|
||||
|
||||
import lazyPlugin from "vue3-lazyload"
|
||||
import lazyPlugin from "vue3-lazyload";
|
||||
|
||||
// import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
||||
import api from "./utils/api"
|
||||
import api from "./utils/api";
|
||||
|
||||
//引入封装Axios请求
|
||||
import Axios from "@/utils/axios"
|
||||
import Axios from "@/utils/axios";
|
||||
|
||||
const app = createApp(App)
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(ElButton)
|
||||
app.use(ElInput)
|
||||
app.use(ElSelect)
|
||||
app.use(ElOption)
|
||||
app.use(ElLoading)
|
||||
app.use(ElCheckbox)
|
||||
app.use(ElCheckboxGroup)
|
||||
app.use(ElCarousel)
|
||||
app.use(ElCarouselItem)
|
||||
app.use(ElBadge)
|
||||
app.use(ElDropdown)
|
||||
app.use(ElPopover)
|
||||
app.use(ElButton);
|
||||
app.use(ElInput);
|
||||
app.use(ElSelect);
|
||||
app.use(ElOption);
|
||||
app.use(ElLoading);
|
||||
app.use(ElCheckbox);
|
||||
app.use(ElCheckboxGroup);
|
||||
app.use(ElCarousel);
|
||||
app.use(ElCarouselItem);
|
||||
app.use(ElBadge);
|
||||
app.use(ElDropdown);
|
||||
app.use(ElPopover);
|
||||
app.use(ElDatePicker, {
|
||||
locale: zhCn,
|
||||
})
|
||||
app.use(ElSkeleton)
|
||||
app.use(ElSkeletonItem)
|
||||
app.use(ElMessage)
|
||||
app.use(ElBreadcrumb)
|
||||
app.use(ElAffix)
|
||||
app.use(ElProgress)
|
||||
});
|
||||
app.use(ElSkeleton);
|
||||
app.use(ElSkeletonItem);
|
||||
app.use(ElMessage);
|
||||
app.use(ElBreadcrumb);
|
||||
app.use(ElAffix);
|
||||
app.use(ElProgress);
|
||||
|
||||
app.use(ElConfigProvider)
|
||||
app.use(ElScrollbar)
|
||||
app.use(ElConfigProvider);
|
||||
app.use(ElScrollbar);
|
||||
|
||||
app.use(lazyPlugin)
|
||||
app.use(lazyPlugin);
|
||||
|
||||
app.use(store).use(router).use(Axios)
|
||||
app.use(store).use(router).use(Axios);
|
||||
|
||||
api.index()
|
||||
.then(res => {
|
||||
const data = res.data
|
||||
.then((res) => {
|
||||
const data = res.data;
|
||||
// const url = import("@/assets/homeImage/informationO.png")
|
||||
store.state.seachTypeData = data.combination
|
||||
store.state.indexData = data
|
||||
store.state.ListSelectBtn = data.recommendedTab
|
||||
store.state.user = data.user
|
||||
store.state.nav = data.nav
|
||||
store.state.wechat = data.wechat
|
||||
store.state.apartment = data.config.apartment
|
||||
store.state.schoolList = data.schoolList
|
||||
store.state.advData = data.adv
|
||||
store.state.typeKey = data.config.type
|
||||
store.state.locationKey = data.config.location
|
||||
console.log("data", data);
|
||||
|
||||
store.state.seachTypeData = data.combination;
|
||||
store.state.indexData = data;
|
||||
store.state.ListSelectBtn = data.recommendedTab;
|
||||
store.state.user = data.user;
|
||||
store.state.nav = data.nav;
|
||||
store.state.wechat = data.wechat;
|
||||
store.state.apartment = data.config.apartment;
|
||||
store.state.schoolList = data.schoolList;
|
||||
store.state.advData = data.adv;
|
||||
store.state.typeKey = data.config.type;
|
||||
store.state.locationKey = data.config.location;
|
||||
|
||||
// 将 location 转换为对象 好用于级联选择器
|
||||
const location = data.config.location || {}
|
||||
const type = data.config.type || {}
|
||||
const location = data.config.location || {};
|
||||
const type = data.config.type || {};
|
||||
|
||||
store.state.locationObj = optimalValue(location)
|
||||
store.state.typeObj = optimalValue(type)
|
||||
store.state.locationObj = optimalValue(location);
|
||||
store.state.typeObj = optimalValue(type);
|
||||
|
||||
store.state.brandKey = optimalValueArray(data.config.apartment.brand || [])
|
||||
store.state.roomTypeKey = optimalValueArray(data.config.apartment.roomtype || [])
|
||||
store.state.roomlistingsKey = optimalValueArray(data.config.apartment.roomlistings || [])
|
||||
store.state.brandKey = optimalValueArray(data.config.apartment.brand || []);
|
||||
store.state.roomTypeKey = optimalValueArray(data.config.apartment.roomtype || []);
|
||||
store.state.roomlistingsKey = optimalValueArray(data.config.apartment.roomlistings || []);
|
||||
store.state.upload = data.upload || {};
|
||||
})
|
||||
.finally(() => {
|
||||
app.mount("#app")
|
||||
})
|
||||
app.mount("#app");
|
||||
});
|
||||
|
||||
// 优化值 1 1.1 1.2 类似的值
|
||||
const optimalValue = data => {
|
||||
let obj = {}
|
||||
const optimalValue = (data) => {
|
||||
let obj = {};
|
||||
for (const key in data) {
|
||||
const [parentKey, childKey] = key.split(".")
|
||||
const [parentKey, childKey] = key.split(".");
|
||||
|
||||
if (!childKey) {
|
||||
obj[parentKey] = {
|
||||
name: data[key],
|
||||
children: {},
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (!obj[parentKey].children) obj[parentKey].children = {}
|
||||
obj[parentKey].children[key] = data[key]
|
||||
if (!obj[parentKey].children) obj[parentKey].children = {};
|
||||
obj[parentKey].children[key] = data[key];
|
||||
}
|
||||
}
|
||||
|
||||
return obj || {}
|
||||
}
|
||||
return obj || {};
|
||||
};
|
||||
|
||||
// 优化值 数组 转对象
|
||||
const optimalValueArray = data => {
|
||||
let obj = {}
|
||||
data.forEach(item => {
|
||||
obj[item.id] = item.name
|
||||
})
|
||||
return obj
|
||||
}
|
||||
const optimalValueArray = (data) => {
|
||||
let obj = {};
|
||||
data.forEach((item) => {
|
||||
obj[item.id] = item.name;
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
|
||||
@@ -33,6 +33,9 @@ export default createStore({
|
||||
|
||||
userInfoWin: {},
|
||||
realname: 1, // 是否已经实名
|
||||
|
||||
upload: {}, // 上传 接口后台配置
|
||||
|
||||
},
|
||||
getters: {},
|
||||
mutations: {
|
||||
|
||||
@@ -20,7 +20,7 @@ axios.interceptors.request.use(
|
||||
if (config.url != "/tenement/pc/api/user/operation" && !noMask) showFullScreenLoading()
|
||||
// 开发时登录用的,可以直接替换小程序的 authorization
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
const miucms_session = "nlwy6wa5rqr6csaic4u6aqb08bjmqqbg";
|
||||
const miucms_session = "z5Qz9m995zGmhmq95hpsQ9PeQm90HhHVCcCmUhm5";
|
||||
document.cookie = "miucms_session=" + miucms_session;
|
||||
config["headers"]["authorization"] = miucms_session;
|
||||
}
|
||||
|
||||
@@ -314,10 +314,10 @@
|
||||
<el-popover v-model:visible="areaPopState" placement="bottom" :width="640" :show-arrow="false" trigger="click" popper-style="padding:0; border-radius:16px !important;" :disabled="verified == 1">
|
||||
<template #reference>
|
||||
<div ref="location" class="modeOne-item flexacenter" :class="{ disabled: verified == 1 }" style="width: 640px">
|
||||
<div class="modeOne-text flexacenter" v-if="info['location']">
|
||||
{{ locationData[Math.floor(info.location)].name }}
|
||||
<div class="modeOne-text flexacenter" v-if="info['location'] && info['location'] !== '0'">
|
||||
{{ locationData[Math.floor(info.location)]?.name }}
|
||||
<img class="form-arrows form-arrows-disabled" src="@/assets/img/edit/thin-arrow-disabled.svg" />
|
||||
{{ locationData[Math.floor(info.location)].data[info.location] }}
|
||||
{{ locationData[Math.floor(info.location)]?.data[info.location] }}
|
||||
</div>
|
||||
<div class="modeOne-text flexacenter" style="color: #aaaaaa" v-else>请选择</div>
|
||||
<img class="arrows-icon" src="@/assets/img/edit/arrows.svg" />
|
||||
@@ -934,7 +934,7 @@ export default {
|
||||
if (info["floor"]) info["floor"] = Number(info["floor"]);
|
||||
if (info["rentalduration"]) info["rentalduration"] = Number(info["rentalduration"]);
|
||||
}
|
||||
|
||||
|
||||
this.fieldinfo = fieldinfo;
|
||||
this.typeData = typeData;
|
||||
this.locationData = locationData;
|
||||
@@ -954,6 +954,7 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.info = info;
|
||||
this.verified = data.verified;
|
||||
@@ -1077,7 +1078,6 @@ export default {
|
||||
const formData = new FormData();
|
||||
formData.append("files", file); // 将文件添加到 formData 中
|
||||
formData.append("data", this.uploadData); // 添加额外的数据参数 data: uploadData
|
||||
// this.$post("/tenement/pc/api/publish/uploadweixinqrcode",
|
||||
this.$axios
|
||||
.post(
|
||||
"https://oss.gter.net/upload/qrcode",
|
||||
@@ -1149,16 +1149,20 @@ export default {
|
||||
this.uploadVideo(type, target);
|
||||
},
|
||||
|
||||
// 上传视频
|
||||
// 上传视频 和 图片
|
||||
uploadVideo(type, target) {
|
||||
let config = this.$store.state.upload;
|
||||
console.log("config",config);
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("files", target); // 文件数据
|
||||
formData.append(config.requestName, target); // 文件数据
|
||||
formData.append("name", target.name); // 文件名
|
||||
formData.append("type", type); // 文件名
|
||||
formData.append("data", this.uploadData); // 文件名
|
||||
formData.append("data", config.params.data); // 文件名
|
||||
|
||||
// this.$axios.post('/tenement/pc/api/publish/upload', formData).then(res => {
|
||||
this.$axios
|
||||
.post("https://oss.gter.net/upload", formData)
|
||||
.post(config.url, formData)
|
||||
.then((res) => {
|
||||
res = res["data"];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user