2025.02.20 工作代码提交

This commit is contained in:
sx 2025-02-21 10:03:50 +08:00
parent 3e4f7e3c09
commit c4a23be60c
14 changed files with 128 additions and 30 deletions

View File

@ -7,7 +7,6 @@ const config = {
// #endif
// #ifndef H5
host: 'http://91f.xyz:8080',
host: 'https://b433d23.r24.cpolar.top/',
// #endif
// 支付方式配置
payType: {

View File

@ -260,11 +260,11 @@ const util = {
})
},
// 替换图片的宽度为最大宽度100% (移动端解析html富文本专用)
imgReplace(value, th) {
if (!th) {
value = value.replace(/<img src="/ig, '<img src="' + util.config.host);
}
/**
* 替换图片的宽度为最大宽度100% (移动端解析html富文本专用)
* @param {Object} value 富文本
*/
imgReplace(value) {
return value.replace(/<p([\s\w"=\/\.:;]+)((?:(style="[^"]+")))/ig, '<p')
.replace(/<p>/ig, '<p style="font-size: 15px; line-height: 25px;">')
.replace(/<img([\s\w"-=\/\.:;]+)((?:(height="[^"]+")))/ig, '<img$1')

View File

@ -7,6 +7,7 @@
getCurrentInstance,
defineProps,
defineEmits,
defineExpose,
} from 'vue'
//
import util from '@/common/js/util'
@ -16,8 +17,11 @@
const {
proxy
} = getCurrentInstance()
const emits = defineEmits(['update:modelValue']);
const props = defineProps({
modelValue: String
})
//
const emit = defineEmits(['update:modelValue']);
//
const formats = reactive({})
//
@ -33,17 +37,33 @@
const colorKey = ref('forecolor')
onMounted(() => {
//
//
onEditorReady()
})
//
//
function onEditorReady() {
uni.createSelectorQuery().select('#editor').context((res) => {
editorCtx.value = res.context
}).exec()
}
//
function init(html) {
editorCtx.value.setContents({
html,
})
}
//
function getEditorContents() {
editorCtx.value.getContents({
success: rs => {
return rs
}
})
}
//
function undo() {
editorCtx.value.undo()
@ -158,6 +178,16 @@
}
})
}
//
function handleEditorInput(event) {
emit('update:modelValue', event.detail.html)
}
defineExpose({
init,
getEditorContents,
})
</script>
<template>
@ -221,9 +251,8 @@
<!-- 内容 -->
<view class="main">
<editor id="editor" class="ql-container" placeholder="在此输入产品详情" showImgSize
showImgToolbar showImgResize @statuschange="onStatusChange" @ready="onEditorReady"
@input="$emit('update:modelValue', $event.target.value)">
<editor id="editor" class="ql-container" placeholder="在此输入产品详情" showImgSize showImgToolbar showImgResize
@statuschange="onStatusChange" @ready="onEditorReady" @input="handleEditorInput">
</editor>
</view>
</view>

View File

@ -2,8 +2,8 @@
"name" : "九亿",
"appid" : "__UNI__08B31BC",
"description" : "",
"versionName" : "1.0.6",
"versionCode" : 1006,
"versionName" : "1.0.7",
"versionCode" : 1007,
"transformPx" : false,
/* 5+App */
"app-plus" : {

View File

@ -1,6 +1,6 @@
<script setup>
/**
* 账号挂失
* 账号冻结
*/
import {
ref,

View File

@ -1,6 +1,6 @@
<script setup>
/**
* 账号挂失
* 账号解冻
*/
import {
ref,

View File

@ -65,7 +65,7 @@
</view>
<view class="line" @click="link('/pages/login/unfreezeAccount')">
<view class="title">解冻账号</view>
<view class="title">账号解冻</view>
<view class="content">风险解除后可选择解除冻结</view>
</view>

View File

@ -36,7 +36,6 @@
screenHeight,
bottomSafeAreaHeight
} from '@/components/public/Mixins.js'
import JyCommonHead from '@/components/public/jy-common-head'
const PayUse = ref(false)
//

View File

@ -39,7 +39,6 @@
ref,
inject
} from 'vue'
import JyCommonHead from '@/components/public/jy-common-head'
import {
useStore
} from 'vuex'

View File

@ -2,7 +2,9 @@
//
import {
ref,
reactive
reactive,
getCurrentInstance,
nextTick
} from 'vue'
//
import {
@ -14,13 +16,16 @@
import util from '@/common/js/util.js'
//
import editorArea from '@/components/public/editor/editor'
const {
proxy
} = getCurrentInstance()
//
const form = reactive({
id: '',
categoryId: '',
sliderImage: [],
specs: [],
infoRichText: '',
})
//
const category = reactive([])
@ -49,6 +54,10 @@
form.cost = detail.cost
//
form.commission = detail.commission
//
form.infoRichText = detail.infoRichText || ''
//
proxy.$refs.editorAreaRef.init(form.infoRichText)
//
form.specs = detail.specs.map(item => {
return {
@ -177,6 +186,45 @@
const data = {
...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(',')
@ -190,6 +238,7 @@
content: '商品发布成功,请等待后台审核',
showCancel: false,
}).then(() => {
uni.$emit('updateUserProduct')
uni.navigateBack()
})
return
@ -211,7 +260,7 @@
<view class="imgList mt20">
<view class="imgs" v-for="(item,index) in form.sliderImage">
<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" />
</view>
</view>
@ -327,7 +376,7 @@
</view>
<view class="main area editor">
<!-- <editorArea v-model="form.infoRichText" /> -->
<editorArea ref="editorAreaRef" v-model="form.infoRichText" />
</view>
</view>

View File

@ -92,7 +92,10 @@
}
}).then(rs => {
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
}
util.alert({

View File

@ -6,6 +6,7 @@
} from 'vue'
import {
onLoad,
onUnload,
onReachBottom,
onPullDownRefresh
} from "@dcloudio/uni-app"
@ -26,6 +27,13 @@
onLoad(() => {
//
getList()
//
addListener()
})
onUnload(() => {
//
removeListener()
})
onReachBottom(() => {
@ -38,6 +46,19 @@
refeshList()
})
//
function addListener() {
uni.$on('updateUserProduct', () => {
//
refeshList()
})
}
//
function removeListener() {
uni.$off('updateUserProduct')
}
//
function refeshList() {
if (product.list.length >= product.total) return

View File

@ -63,7 +63,7 @@ deleteVideo 删除视频
selectAddress 选择地址
updateOrderList 更新订单列表
updateOrderDetail 更新订单详情
updateUserProduct 更新用户商品
缓存
---

View File

@ -3,8 +3,7 @@ import {
} from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
// let target = 'http://91f.xyz:8080'
let target = 'https://b433d23.r24.cpolar.top/'
let target = 'http://91f.xyz:8080'
export default defineConfig({
plugins: [uni()],