This commit is contained in:
2026-02-25 15:13:47 +08:00
parent 6d7d06cd2a
commit 57568a3a7c
7 changed files with 151 additions and 26 deletions

View File

@@ -391,6 +391,12 @@
computed,
getCurrentInstance
} from 'vue'
const props = defineProps({
content: {
type: String,
},
})
const emit = defineEmits(['init-data'])
// 页面元素
const {
@@ -441,7 +447,7 @@
editorCtx.value = res.context
// 初始化HTML内容
editorCtx.value.setContents({//赋值
html: editorContent.html
html: props.content?props.content:editorContent.html
})
}).exec()
// #endif

View File

@@ -6,9 +6,9 @@
<input class="input-con" v-model="fromValue.title" placeholder="请输入标题" />
</view>
<view class="content-input">
<view class="input-titile"><text class="input-required">*</text>联系人</view>
<view class="input-titile"><text class="input-required">*</text>内容</view>
<!-- <input class="input-con" v-model="fromValue.contactName" placeholder="请输入联系人" /> -->
<unieditor @init-data="receiveInitData"/>
<unieditor v-if="shows" @init-data="receiveInitData" :content="fromValue.content" />
</view>
<view class="content-input">
<view class="input-titile">备注</view>
@@ -47,13 +47,20 @@ let fromValue = reactive({
status:'0',
});
let type=ref('add')
onLoad((options = {}) => {
let id=ref('')
let shows=ref(false)
onLoad((options) => {
id.value=options.id
if(options.id){
type.value='edit'
getDetail()
}else{
getInfo()
}
});
// 监听页面显示,接收从技能查询页面返回的数据
onShow(() => {
getDetail()
// 通过事件总线接收技能选择结果
// uni.$on('skillSelected', handleSkillSelected);
});
@@ -65,10 +72,14 @@ onShow(() => {
// 监听字典数据加载完成,自动更新学历显示
const receiveInitData = (initData) => {
fromValue.content=initData.value;
if(initData.value=="<p><br></p>"){
}else{
fromValue.content=initData.value;
}
console.log('子组件初始化数据:', initData)
}
function getDetail(){
function getInfo(){
// if(userInfo.userId){
$api.myRequest("/train/public/train/organ/getTrainByUnifiedSocialCreditCode", {
tags: "913700001630477270",
@@ -80,13 +91,32 @@ function getDetail(){
fromValue.entProvince = res.data.organProvince;
fromValue.entCounty = res.data.organCounty;
fromValue.entCity = res.data.organCity;
shows.value=true;
}
})
// }else{
// $api.msg('请先登录');
// }
}
function getDetail(){
$api.myRequest("/train/public/announcement/selectById", {
id: id.value,
}, "GET", 9100, {
Authorization: `Bearer ${uni.getStorageSync('token')}`,
'Content-Type': "application/x-www-form-urlencoded"
}).then((res) => {
if (res.code === 200) {
fromValue.id = res.data.id;
fromValue.title = res.data.title;
fromValue.content= res.data.content;
fromValue.remark= res.data.remark;
fromValue.entProvince = res.data.entProvince;
fromValue.entCounty = res.data.entCounty;
fromValue.entCity = res.data.entCity;
shows.value=true;
}
})
}
const confirm = () => {
if (!fromValue.title) {
@@ -98,6 +128,7 @@ const confirm = () => {
const params = {
...fromValue,
};
debugger
if(type.value=='add'){
$api.myRequest('/train/public/announcement/add', {
...fromValue,

View File

@@ -46,8 +46,8 @@
<div class="flooter">
<div v-if="item.status == '0' && item.shenhe == '1'" @click="handlePublishClick(scope.row,2)" >发布</div>
<div v-else @click="handlePublishClick(item,0)" >取消发布</div>
<div>查看</div>
<div v-if="item.status == '0'" @click="handleEditClick(item)">编辑</div>
<!-- <div>查看</div> -->
<div v-if="item.status == '0'" @click="handleOperation(item)">编辑</div>
<div v-if="item.status == '0'" @click="handleDeleteClick(item)">删除</div>
</div>
</div>
@@ -166,8 +166,11 @@ function handleDeleteClick(row) {
});
}
function handleOperation(row) {
navTo(`/packageB/notice/evaluateAnnouncement/evaluateEdit`);
// navTo(`/packageB/institution/trainingInstitutionDetail?organId=${row.organId}`);
if(row){
navTo(`/packageB/notice/evaluateAnnouncement/evaluateEdit?id=${row.id}`);
}else{
navTo(`/packageB/notice/evaluateAnnouncement/evaluateEdit`);
}
}
</script>

View File

@@ -6,9 +6,9 @@
<input class="input-con" v-model="fromValue.title" placeholder="请输入标题" />
</view>
<view class="content-input">
<view class="input-titile"><text class="input-required">*</text>联系人</view>
<view class="input-titile"><text class="input-required">*</text>内容</view>
<!-- <input class="input-con" v-model="fromValue.contactName" placeholder="请输入联系人" /> -->
<unieditor @init-data="receiveInitData"/>
<unieditor v-if="shows" @init-data="receiveInitData" :content="fromValue.content"/>
</view>
<view class="content-input">
<view class="input-titile">备注</view>
@@ -38,6 +38,7 @@ const dictStore = useDictStore();
const { dictLabel, oneDictData, complete: dictComplete, getDictSelectOption } = dictStore;
let fromValue = reactive({
id:'',
title: '',
content:'',
remark:'',
@@ -47,13 +48,20 @@ let fromValue = reactive({
status:'0',
});
let type=ref('add')
onLoad((options = {}) => {
let id=ref('')
let shows=ref(false)
onLoad((options) => {
id.value=options.id
if(options.id){
type.value='edit'
getDetail()
}else{
getInfo()
}
});
// 监听页面显示,接收从技能查询页面返回的数据
onShow(() => {
getDetail()
// 通过事件总线接收技能选择结果
// uni.$on('skillSelected', handleSkillSelected);
});
@@ -65,10 +73,14 @@ onShow(() => {
// 监听字典数据加载完成,自动更新学历显示
const receiveInitData = (initData) => {
fromValue.content=initData.value;
if(initData.value=="<p><br></p>"){
}else{
fromValue.content=initData.value;
}
console.log('子组件初始化数据:', initData)
}
function getDetail(){
function getInfo(){
// if(userInfo.userId){
$api.myRequest("/train/public/train/organ/getTrainByUnifiedSocialCreditCode", {
tags: "913700001630477270",
@@ -80,13 +92,36 @@ function getDetail(){
fromValue.entProvince = res.data.organProvince;
fromValue.entCounty = res.data.organCounty;
fromValue.entCity = res.data.organCity;
shows.value=true;
}
})
// }else{
// $api.msg('请先登录');
// }
}
function getDetail(){
$api.myRequest("/train/public/announcement/selectById", {
id: id.value,
}, "GET", 9100, {
Authorization: `Bearer ${uni.getStorageSync('token')}`,
'Content-Type': "application/x-www-form-urlencoded"
}).then((res) => {
if (res.code === 200) {
fromValue.id = res.data.id;
fromValue.title = res.data.title;
fromValue.content= res.data.content;
fromValue.remark= res.data.remark;
fromValue.entProvince = res.data.entProvince;
fromValue.entCounty = res.data.entCounty;
fromValue.entCity = res.data.entCity;
// fromValue = {
// ...fromValue,
// ...res.data,
// };
shows.value=true;
}
})
}
const confirm = () => {
if (!fromValue.title) {

View File

@@ -46,8 +46,8 @@
<div class="flooter">
<div v-if="item.status == '0' && item.shenhe == '1'" @click="handlePublishClick(scope.row,2)" >发布</div>
<div v-else @click="handlePublishClick(item,0)" >取消发布</div>
<div>查看</div>
<div v-if="item.status == '0'" @click="handleEditClick(item)">编辑</div>
<!-- <div>查看</div> -->
<div v-if="item.status == '0'" @click="handleOperation(item)">编辑</div>
<div v-if="item.status == '0'" @click="handleDeleteClick(item)">删除</div>
</div>
</div>
@@ -166,8 +166,11 @@ function handleDeleteClick(row) {
});
}
function handleOperation(row) {
navTo(`/packageB/notice/trainingAnnouncement/postedEdit`);
// navTo(`/packageB/institution/trainingInstitutionDetail?organId=${row.organId}`);
if(row){
navTo(`/packageB/notice/trainingAnnouncement/postedEdit?id=${row.id}`);
}else{
navTo(`/packageB/notice/trainingAnnouncement/postedEdit`);
}
}
</script>