2025.02.20 工作代码提交
This commit is contained in:
parent
3e4f7e3c09
commit
c4a23be60c
|
@ -7,7 +7,6 @@ const config = {
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
host: 'http://91f.xyz:8080',
|
host: 'http://91f.xyz:8080',
|
||||||
host: 'https://b433d23.r24.cpolar.top/',
|
|
||||||
// #endif
|
// #endif
|
||||||
// 支付方式配置
|
// 支付方式配置
|
||||||
payType: {
|
payType: {
|
||||||
|
|
|
@ -260,11 +260,11 @@ const util = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 替换图片的宽度为最大宽度100% (移动端解析html富文本专用)
|
/**
|
||||||
imgReplace(value, th) {
|
* 替换图片的宽度为最大宽度100% (移动端解析html富文本专用)
|
||||||
if (!th) {
|
* @param {Object} value 富文本
|
||||||
value = value.replace(/<img src="/ig, '<img src="' + util.config.host);
|
*/
|
||||||
}
|
imgReplace(value) {
|
||||||
return value.replace(/<p([\s\w"=\/\.:;]+)((?:(style="[^"]+")))/ig, '<p')
|
return value.replace(/<p([\s\w"=\/\.:;]+)((?:(style="[^"]+")))/ig, '<p')
|
||||||
.replace(/<p>/ig, '<p style="font-size: 15px; line-height: 25px;">')
|
.replace(/<p>/ig, '<p style="font-size: 15px; line-height: 25px;">')
|
||||||
.replace(/<img([\s\w"-=\/\.:;]+)((?:(height="[^"]+")))/ig, '<img$1')
|
.replace(/<img([\s\w"-=\/\.:;]+)((?:(height="[^"]+")))/ig, '<img$1')
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
defineProps,
|
defineProps,
|
||||||
defineEmits,
|
defineEmits,
|
||||||
|
defineExpose,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
// 工具库
|
// 工具库
|
||||||
import util from '@/common/js/util'
|
import util from '@/common/js/util'
|
||||||
|
@ -16,8 +17,11 @@
|
||||||
const {
|
const {
|
||||||
proxy
|
proxy
|
||||||
} = getCurrentInstance()
|
} = getCurrentInstance()
|
||||||
|
const props = defineProps({
|
||||||
const emits = defineEmits(['update:modelValue']);
|
modelValue: String
|
||||||
|
})
|
||||||
|
//
|
||||||
|
const emit = defineEmits(['update:modelValue']);
|
||||||
// 编辑器内容
|
// 编辑器内容
|
||||||
const formats = reactive({})
|
const formats = reactive({})
|
||||||
// 编辑器上下文对象
|
// 编辑器上下文对象
|
||||||
|
@ -33,17 +37,33 @@
|
||||||
const colorKey = ref('forecolor')
|
const colorKey = ref('forecolor')
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 初始化
|
// 创建编辑器上下文对象
|
||||||
onEditorReady()
|
onEditorReady()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 初始化
|
// 创建编辑器上下文对象
|
||||||
function onEditorReady() {
|
function onEditorReady() {
|
||||||
uni.createSelectorQuery().select('#editor').context((res) => {
|
uni.createSelectorQuery().select('#editor').context((res) => {
|
||||||
editorCtx.value = res.context
|
editorCtx.value = res.context
|
||||||
}).exec()
|
}).exec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始化编辑器上下文对象
|
||||||
|
function init(html) {
|
||||||
|
editorCtx.value.setContents({
|
||||||
|
html,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取内容
|
||||||
|
function getEditorContents() {
|
||||||
|
editorCtx.value.getContents({
|
||||||
|
success: rs => {
|
||||||
|
return rs
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 撤销
|
// 撤销
|
||||||
function undo() {
|
function undo() {
|
||||||
editorCtx.value.undo()
|
editorCtx.value.undo()
|
||||||
|
@ -65,7 +85,7 @@
|
||||||
} = event.target.dataset
|
} = event.target.dataset
|
||||||
if (!name) return
|
if (!name) return
|
||||||
editorCtx.value.format(name, value)
|
editorCtx.value.format(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑器状态被变化
|
* 编辑器状态被变化
|
||||||
|
@ -158,6 +178,16 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 富文本编辑
|
||||||
|
function handleEditorInput(event) {
|
||||||
|
emit('update:modelValue', event.detail.html)
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
init,
|
||||||
|
getEditorContents,
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -221,9 +251,8 @@
|
||||||
|
|
||||||
<!-- 内容 -->
|
<!-- 内容 -->
|
||||||
<view class="main">
|
<view class="main">
|
||||||
<editor id="editor" class="ql-container" placeholder="在此输入产品详情" showImgSize
|
<editor id="editor" class="ql-container" placeholder="在此输入产品详情" showImgSize showImgToolbar showImgResize
|
||||||
showImgToolbar showImgResize @statuschange="onStatusChange" @ready="onEditorReady"
|
@statuschange="onStatusChange" @ready="onEditorReady" @input="handleEditorInput">
|
||||||
@input="$emit('update:modelValue', $event.target.value)">
|
|
||||||
</editor>
|
</editor>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
"name" : "九亿",
|
"name" : "九亿",
|
||||||
"appid" : "__UNI__08B31BC",
|
"appid" : "__UNI__08B31BC",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.6",
|
"versionName" : "1.0.7",
|
||||||
"versionCode" : 1006,
|
"versionCode" : 1007,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* 账号挂失
|
* 账号冻结
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* 账号挂失
|
* 账号解冻
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="line" @click="link('/pages/login/unfreezeAccount')">
|
<view class="line" @click="link('/pages/login/unfreezeAccount')">
|
||||||
<view class="title">解冻账号</view>
|
<view class="title">账号解冻</view>
|
||||||
<view class="content">风险解除后,可选择解除冻结</view>
|
<view class="content">风险解除后,可选择解除冻结</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
screenHeight,
|
screenHeight,
|
||||||
bottomSafeAreaHeight
|
bottomSafeAreaHeight
|
||||||
} from '@/components/public/Mixins.js'
|
} from '@/components/public/Mixins.js'
|
||||||
import JyCommonHead from '@/components/public/jy-common-head'
|
|
||||||
|
|
||||||
const PayUse = ref(false)
|
const PayUse = ref(false)
|
||||||
// 我是关闭服务
|
// 我是关闭服务
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
ref,
|
ref,
|
||||||
inject
|
inject
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import JyCommonHead from '@/components/public/jy-common-head'
|
|
||||||
import {
|
import {
|
||||||
useStore
|
useStore
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
// 发布商品
|
// 发布商品
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
reactive
|
reactive,
|
||||||
|
getCurrentInstance,
|
||||||
|
nextTick
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
//
|
//
|
||||||
import {
|
import {
|
||||||
|
@ -14,13 +16,16 @@
|
||||||
import util from '@/common/js/util.js'
|
import util from '@/common/js/util.js'
|
||||||
// 编辑器
|
// 编辑器
|
||||||
import editorArea from '@/components/public/editor/editor'
|
import editorArea from '@/components/public/editor/editor'
|
||||||
|
const {
|
||||||
|
proxy
|
||||||
|
} = getCurrentInstance()
|
||||||
// 表单
|
// 表单
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
categoryId: '',
|
categoryId: '',
|
||||||
sliderImage: [],
|
sliderImage: [],
|
||||||
specs: [],
|
specs: [],
|
||||||
|
infoRichText: '',
|
||||||
})
|
})
|
||||||
// 分类
|
// 分类
|
||||||
const category = reactive([])
|
const category = reactive([])
|
||||||
|
@ -49,6 +54,10 @@
|
||||||
form.cost = detail.cost
|
form.cost = detail.cost
|
||||||
// 商品佣金
|
// 商品佣金
|
||||||
form.commission = detail.commission
|
form.commission = detail.commission
|
||||||
|
// 商品详情
|
||||||
|
form.infoRichText = detail.infoRichText || ''
|
||||||
|
// 富文本编辑器初始化
|
||||||
|
proxy.$refs.editorAreaRef.init(form.infoRichText)
|
||||||
// 规格
|
// 规格
|
||||||
form.specs = detail.specs.map(item => {
|
form.specs = detail.specs.map(item => {
|
||||||
return {
|
return {
|
||||||
|
@ -177,6 +186,45 @@
|
||||||
const data = {
|
const data = {
|
||||||
...form
|
...form
|
||||||
}
|
}
|
||||||
|
console.log('data', data)
|
||||||
|
|
||||||
|
if (!data.sliderImage[0]) {
|
||||||
|
util.alert('商品图片不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!data.categoryId) {
|
||||||
|
util.alert('商品类目不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!data.specs[0]) {
|
||||||
|
util.alert('商品规格不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!data.price) {
|
||||||
|
util.alert('商品价格不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!data.cost) {
|
||||||
|
util.alert('商品成本价不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找规格是否有空值
|
||||||
|
for (let i = 0; i < data.specs.length; i++) {
|
||||||
|
let item = data.specs[i]
|
||||||
|
if (!item.image) {
|
||||||
|
util.alert('规格图片不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!item.sku) {
|
||||||
|
util.alert('规格名称不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!item.stock) {
|
||||||
|
util.alert('规格库存不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 轮播图
|
// 轮播图
|
||||||
data.sliderImage = data.sliderImage.join(',')
|
data.sliderImage = data.sliderImage.join(',')
|
||||||
|
@ -190,6 +238,7 @@
|
||||||
content: '商品发布成功,请等待后台审核',
|
content: '商品发布成功,请等待后台审核',
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
uni.$emit('updateUserProduct')
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
@ -211,7 +260,7 @@
|
||||||
<view class="imgList mt20">
|
<view class="imgList mt20">
|
||||||
<view class="imgs" v-for="(item,index) in form.sliderImage">
|
<view class="imgs" v-for="(item,index) in form.sliderImage">
|
||||||
<image class="wh120 br10" :src="item" mode="aspectFill" />
|
<image class="wh120 br10" :src="item" mode="aspectFill" />
|
||||||
<view class="close">
|
<view class="close" @click="removeImage(index)">
|
||||||
<uni-icons type="clear" color="#f00" size="40rpx" />
|
<uni-icons type="clear" color="#f00" size="40rpx" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -327,7 +376,7 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="main area editor">
|
<view class="main area editor">
|
||||||
<!-- <editorArea v-model="form.infoRichText" /> -->
|
<editorArea ref="editorAreaRef" v-model="form.infoRichText" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,10 @@
|
||||||
}
|
}
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
Object.assign(detail, {}, rs.data)
|
//
|
||||||
|
const result = rs.data
|
||||||
|
if (result.infoRichText) result.infoRichText = util.imgReplace(result.infoRichText)
|
||||||
|
Object.assign(detail, {}, result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.alert({
|
util.alert({
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
|
onUnload,
|
||||||
onReachBottom,
|
onReachBottom,
|
||||||
onPullDownRefresh
|
onPullDownRefresh
|
||||||
} from "@dcloudio/uni-app"
|
} from "@dcloudio/uni-app"
|
||||||
|
@ -26,8 +27,15 @@
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
// 获取列表
|
// 获取列表
|
||||||
getList()
|
getList()
|
||||||
|
// 开启监听
|
||||||
|
addListener()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onUnload(() => {
|
||||||
|
// 关闭监听
|
||||||
|
removeListener()
|
||||||
|
})
|
||||||
|
|
||||||
onReachBottom(() => {
|
onReachBottom(() => {
|
||||||
// 获取更多商品
|
// 获取更多商品
|
||||||
getMoreList()
|
getMoreList()
|
||||||
|
@ -38,6 +46,19 @@
|
||||||
refeshList()
|
refeshList()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 开启监听
|
||||||
|
function addListener() {
|
||||||
|
uni.$on('updateUserProduct', () => {
|
||||||
|
// 重载商品列表
|
||||||
|
refeshList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭监听
|
||||||
|
function removeListener() {
|
||||||
|
uni.$off('updateUserProduct')
|
||||||
|
}
|
||||||
|
|
||||||
// 重载商品列表
|
// 重载商品列表
|
||||||
function refeshList() {
|
function refeshList() {
|
||||||
if (product.list.length >= product.total) return
|
if (product.list.length >= product.total) return
|
||||||
|
|
|
@ -63,7 +63,7 @@ deleteVideo 删除视频
|
||||||
selectAddress 选择地址
|
selectAddress 选择地址
|
||||||
updateOrderList 更新订单列表
|
updateOrderList 更新订单列表
|
||||||
updateOrderDetail 更新订单详情
|
updateOrderDetail 更新订单详情
|
||||||
|
updateUserProduct 更新用户商品
|
||||||
|
|
||||||
缓存
|
缓存
|
||||||
---
|
---
|
||||||
|
|
|
@ -3,8 +3,7 @@ import {
|
||||||
} from 'vite';
|
} from 'vite';
|
||||||
import uni from '@dcloudio/vite-plugin-uni';
|
import uni from '@dcloudio/vite-plugin-uni';
|
||||||
|
|
||||||
// let target = 'http://91f.xyz:8080'
|
let target = 'http://91f.xyz:8080'
|
||||||
let target = 'https://b433d23.r24.cpolar.top/'
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [uni()],
|
plugins: [uni()],
|
||||||
|
|
Loading…
Reference in New Issue