图片路径

This commit is contained in:
szdot 2024-04-26 23:07:51 +08:00
parent 4e8605989a
commit 18e8f158a4
10 changed files with 48 additions and 15 deletions

View File

@ -7,7 +7,7 @@
</el-option>
<el-option v-for="item in shopList" :key="item.id" :label="item.name" :value="item.shop_id">
<el-avatar v-if="item.logo != ''" class="vm" shape="square" :size="25"
:src="$store.state.settings.host + '/Data/UploadFiles/logo/' + item.logo">
:src="item.logo[0]">
</el-avatar>
<el-avatar v-else :size="25" class="vm" icon="iconfont icon-tuxiang"></el-avatar>
<span class="rspan">{{ item.name }}</span>

View File

@ -1,8 +1,11 @@
const host = 'https://www.szdot.top'
const baseURL = host + '/flycube.php'
const listPath = host + '/Data/UploadFiles/category/'
const spuPath = host + '/Data/UploadFiles/spu/'
const skuPath = host + '/Data/UploadFiles/sku/'
const listPath = host + '/Data/UploadFiles/category/'// 分类列表图标
const spuPath = host + '/Data/UploadFiles/spu/'// spu图
const skuPath = host + '/Data/UploadFiles/sku/' // sku图
const logoPath = host + '/Data/UploadFiles/logo/' // 商铺图标
const photoPath = host + '/Data/UploadFiles/photo/'// 管理员图标
const tempPath = host + '/Data/UploadFiles/temp/' // 临时图片路径
export default {
/**
@ -14,6 +17,12 @@ export default {
* @description: api服务器
* host 主站
* api接口地址
* 分类图标 路径
* spu图 路径
* sku图 路径
* 商铺图标 路径
* 管理员头像 路径
* 临时图片 路径
* api飞机控制终端接口路径
* api小程序后台接口路径
* api登录接口路径
@ -23,6 +32,9 @@ export default {
listPath: listPath,
spuPath: spuPath,
skuPath: skuPath,
logoPath: logoPath,
photoPath: photoPath,
tempPath: tempPath,
apiPlanePath: '/mpApi/Plane/',
apiAdminPath: '/mpApi/Admin/',
apiLoginPath: '/mpApi/Login/',

View File

@ -99,6 +99,12 @@ const store = new Vuex.Store({
async fetchShopList ({ commit }) {
const res = await api.get('getShopList', 'Admin')
if (res.data.status === 1) {
res.data.shopList.forEach((shop, index) => {
shop.logo = JSON.parse(shop.logo)// 反序列化 photo字段
shop.logo.forEach((logo, i) => {
res.data.shopList[index].logo[i] = settings.state.logoPath + logo // 把绝对路径加上
})
})
commit('setShopList', res.data.shopList)
} else {
commit('setShopList', [])
@ -167,10 +173,16 @@ const store = new Vuex.Store({
async fetchAdminList ({ commit }) {
const res = await api.get('getAdminList', 'Admin')
if (res.data.status === 1) {
res.data.adminList.forEach(item => { // 判断如果是当前登录用户 最后登录时间字段 从本地缓存中获取 PS:既登陆前缓存到本地的“最后登陆时间” 因为登录后 服务端会把当前登录的时间刷到lasttime字段
res.data.adminList.forEach((item, index) => {
// 判断如果是当前登录用户 最后登录时间字段 从本地缓存中获取 PS:既登陆前缓存到本地的“最后登陆时间” 因为登录后 服务端会把当前登录的时间刷到lasttime字段
if (item.shop_id === store.state.user.shop_id) {
item.lasttime = store.state.user.lasttime
}
// 头像字段反序列化
item.photo = JSON.parse(item.photo)// 反序列化 photo字段
item.photo.forEach((photo, i) => {
res.data.adminList[index].photo[i] = settings.state.photoPath + photo // 把绝对路径加上
})
})
commit('setAdminList', res.data.adminList)
} else {
@ -643,6 +655,8 @@ const store = new Vuex.Store({
const res = await api.get('getSpuList', 'Admin')
if (res.data.status === 1) {
res.data.spuList.forEach((spu, index) => {
spu.pro_tag = JSON.parse(spu.pro_tag)// 反序列化 pro_tag字段
spu.bind_sku = JSON.parse(spu.bind_sku)// 反序列化 bind_sku字段
spu.photo = JSON.parse(spu.photo)// 反序列化 photo字段
spu.photo.forEach((photo, i) => {
res.data.spuList[index].photo[i] = settings.state.spuPath + photo // 把绝对路径加上

View File

@ -7,6 +7,9 @@ const {
listPath,
spuPath,
skuPath,
logoPath,
photoPath,
tempPath,
apiPlanePath,
apiAdminPath,
apiLoginPath,
@ -23,6 +26,9 @@ const state = {
listPath: listPath,
spuPath: spuPath,
skuPath: skuPath,
logoPath: logoPath,
photoPath: photoPath,
tempPath: tempPath,
apiPlanePath: apiPlanePath,
apiAdminPath: apiAdminPath,
apiLoginPath: apiLoginPath,

View File

@ -129,7 +129,7 @@ export default {
* @description: 用户头像地址
*/
avatar () {
return this.$store.state.settings.host + this.$store.state.user.photo
return this.$store.state.settings.photoPath + this.$store.state.user.photo
},
/**
* @description: 获取订单列表

View File

@ -26,9 +26,9 @@
:show-file-list="false" :on-success="handleUpSuccess" :on-error="handleUpErr"
:before-upload="beforeAvatarUpload">
<img v-if="form.upFile != ''"
:src="$store.state.settings.host + '/Data/UploadFiles/temp/' + form.upFile" class="avatar" />
<img v-else-if="form.oldFile != '' && form.upFile == ''"
:src="$store.state.settings.host + '/Data/UploadFiles/photo/' + form.oldFile" class="avatar" />
:src="$store.state.settings.tempPath + form.upFile" class="avatar" />
<img v-else-if="form.oldFile != [] && form.upFile == ''"
:src="form.oldFile[0]" class="avatar" />
<template v-else>
<i class="el-icon-plus f-s-30 m-t-70 seatFontColor"></i>
<div class="el-upload__text"><em>建议100*100像素 <br> jpg png gif </em></div>

View File

@ -72,7 +72,7 @@
:show-file-list="false" :on-success="handleUpSuccess" :on-error="handleUpErr"
:before-upload="beforeAvatarUpload">
<img v-if="form.upFile != ''"
:src="$store.state.settings.host + '/Data/UploadFiles/temp/' + form.upFile" class="avatar" />
:src="$store.state.settings.tempPath + form.upFile" class="avatar" />
<img v-else-if="form.oldFile != [] && form.upFile == ''"
:src="form.oldFile[0]" class="avatar" />
<template v-else>

View File

@ -300,6 +300,7 @@ export default {
if (Object.keys(this.orderDetails).length > 0) {
this.statusToStr(this.orderDetails)
}
console.log(this.orderList)
},
filters: {
parseTime

View File

@ -239,8 +239,8 @@ export default {
hot: this.spu.hot,
recommend: this.spu.recommend === '1',
show: this.spu.show === '1',
pro_tag: JSON.parse(this.spu.pro_tag) || [],
bind_sku: JSON.parse(this.spu.bind_sku) || [],
pro_tag: this.spu.pro_tag,
bind_sku: this.spu.bind_sku,
oldFile: this.spu.photo
}
this.setForm(data)

View File

@ -51,9 +51,9 @@
:show-file-list="false" :on-success="handleUpSuccess" :on-error="handleUpErr"
:before-upload="beforeAvatarUpload">
<img v-if="form.upFile != ''"
:src="$store.state.settings.host + '/Data/UploadFiles/temp/' + form.upFile" class="avatar" />
<img v-else-if="form.oldFile != '' && form.upFile == ''"
:src="$store.state.settings.host + '/Data/UploadFiles/logo/' + form.oldFile" class="avatar" />
:src="$store.state.settings.tempPath + form.upFile" class="avatar" />
<img v-else-if="form.oldFile != [] && form.upFile == ''"
:src="form.oldFile[0]" class="avatar" />
<template v-else>
<i class="el-icon-plus f-s-30 m-t-70 seatFontColor"></i>
<div class="el-upload__text"><em>建议200*200像素 <br> jpg png gif </em></div>