完善未完成功能:修复关注列表/评论发布/编辑器草稿等页面

This commit is contained in:
2026-08-06 00:10:19 +08:00
parent b3c6fc67c9
commit 315bc474d6
28 changed files with 2979 additions and 4276 deletions
+249 -368
View File
@@ -13,20 +13,6 @@
<view class="v-preview" v-if="temp && temp.temptele_src">
<image :src="temp.temptele_src" alt="" class="img" mode="widthFix" />
<!-- <view class="btn-area">
<view class="red-btn-area">
<button class="red-btn" @click="btn(0)">老兵直播</button>
<button class="red-btn" @click="btn(1)">老兵故事</button>
<button class="red-btn" @click="btn(2)">在线注册</button>
</view>
<view class="red-btn-plain-area">
<view class="red-btn-plain" @click="btn(3)">新四军</view>
<view class="red-btn-plain" @click="btn(4)">抗美援朝</view>
<view class="red-btn-plain" @click="btn(5)">抗美援越</view>
<view class="red-btn-plain" @click="btn(6)">对越自卫反击战</view>
<view class="red-btn-plain" @click="btn(7)">和平时期退役兵</view>
</view>
</view> -->
</view>
<view class="" :style="backgrond_color">
@@ -34,19 +20,14 @@
<view class="">
<view class="meta">
<view class="author">
<cloud-image
height="64rpx" width="64rpx" borderRadius="50%"
:src="userInfo.avatar_file.url"></cloud-image>
<text class="at" :style="color">{{ userInfo.nickname || '' }}</text>
<text class="split">·</text>
<text class="date" :style="color">刚刚</text>
</view>
</view>
<view class="">
<view class="" v-for="(item, index) in cms.cmsLst" :key="index">
@@ -65,12 +46,6 @@
</view>
<view class="" v-if="item.type === 'video'"
style="width: 100wv;margin-top: 30rpx;margin-bottom: 30rpx;">
<!-- <cloud-image
width="100%"
height="500rpx"
mode="aspectFit"
:src="item.video.poster">
</cloud-image> -->
<video
style="width: 100%; height: 500rpx;"
:src="item.video.src"
@@ -78,7 +53,6 @@
danmu-btn
controls>
</video>
</view>
<view class="" v-if="item.type === 'vote'">
@@ -145,8 +119,6 @@
</u-checkbox-group>
</view>
<view class=""
v-if="isExpired"
:disabled="isExpired || !selectedValue"
@@ -162,20 +134,15 @@
text-align: center;;">
{{ isExpired ? '已截止' : '点击登录后投票' }}
</view>
</view>
</uni-card>
</view>
</uni-card>
</view>
</view>
</view>
</view>
</view>
</view>
<u-tabbar
:value="tabbarValue"
>
@@ -185,48 +152,31 @@
@click="tabbarClick"
:text="item.text">
</u-tabbar-item>
</u-tabbar>
<hqs-popup :title="tabbarText[tabbarValue].text" :from="popFrom" :mask-click="maskClick"
@back="onBack"
v-model="showPop">
<view class="page-container" v-if="tabbarText[tabbarValue].text === '模板'">
<media-list
:dataType="'template'"
:pageSize="12"
:currentTemplate="updateTemplateConfig"
@update="updateTemplate"
/>
</view>
<view class="page-container" v-if="tabbarText[tabbarValue].text === '音乐'">
<media-list
:dataType="'music'"
:pageSize="12"
:currentTemplate="updateTemplateConfig"
@update="updateTemplate"
/>
</view>
<!-- <view class="page-container" v-if="tabbarText[tabbarValue].text === '字体'">
<media-list
:dataType="'font'"
:pageSize="12"
:currentTemplate="updateTemplateConfig"
@update="updateTemplate"
/>
</view> -->
<view class="page-container" v-if="tabbarText[tabbarValue].text === '排版'">
<!-- <media-list
:dataType="'font'"
:pageSize="12"
:currentTemplate="updateTemplateConfig"
@update="updateTemplate"
/> -->
</view>
<view class="page-container" v-if="tabbarText[tabbarValue].text === '模板'">
<media-list
:dataType="'template'"
:pageSize="12"
:currentTemplate="updateTemplateConfig"
@update="updateTemplate"
/>
</view>
<view class="page-container" v-if="tabbarText[tabbarValue].text === '音乐'">
<media-list
:dataType="'music'"
:pageSize="12"
:currentTemplate="updateTemplateConfig"
@update="updateTemplate"
/>
</view>
<view class="page-container" v-if="tabbarText[tabbarValue].text === '排版'">
</view>
</hqs-popup>
<uni-grid :column="3" :highlight="true" @change="change" :show-border="false">
@@ -244,101 +194,19 @@
</template>
<script>
const uniIdCo = uniCloud.importObject("uni-id-co")
import {
store,
mutations
} from '@/pages3/uni_modules/uni-id-pages/common/store.js';
import uRadioGroup from "@/uni_modules/uview-ui/components/u-radio-group/u-radio-group.vue";
import uRadio from "@/uni_modules/uview-ui/components/u-radio/u-radio.vue";
import uParse from "@/uni_modules/uview-ui/components/u-parse/u-parse.vue";
import uTabbar from "@/uni_modules/uview-ui/components/u-tabbar/u-tabbar.vue";
import uTabbarItem from "@/uni_modules/uview-ui/components/u-tabbar-item/u-tabbar-item.vue";
import mediaList from "@/components/image-grid/media-list.vue";
import cloudImage from "@/components/cloud-image.vue";
import uCheckboxGroup from "@/uni_modules/uview-ui/components/u-checkbox-group/u-checkbox-group.vue";
import uCheckbox from "@/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue";
import { ref, computed, onShow } from 'vue'
import { store } from '@/pages3/uni_modules/uni-id-pages/common/store.js'
import uRadioGroup from "@/uni_modules/uview-ui/components/u-radio-group/u-radio-group.vue"
import uRadio from "@/uni_modules/uview-ui/components/u-radio/u-radio.vue"
import uParse from "@/uni_modules/uview-ui/components/u-parse/u-parse.vue"
import uTabbar from "@/uni_modules/uview-ui/components/u-tabbar/u-tabbar.vue"
import uTabbarItem from "@/uni_modules/uview-ui/components/u-tabbar-item/u-tabbar-item.vue"
import mediaList from "@/components/image-grid/media-list.vue"
import cloudImage from "@/components/cloud-image.vue"
import uCheckboxGroup from "@/uni_modules/uview-ui/components/u-checkbox-group/u-checkbox-group.vue"
import uCheckbox from "@/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue"
export default {
computed: {
btn_send_commends_color() {
if (!this.temp) {
return "";
}
return `background-color: ${this.temp.btn_send_commends_color};`
},
btn_send_commends_font_color() {
if (!this.temp) {
return "";
}
return `color: ${this.temp.btn_send_commends_font_color};`
},
btn_color() {
if (!this.temp) {
return "";
}
return `color: ${this.temp.btn_color}`
},
select_icon_color() {
if (!this.temp) {
return "";
}
return `${this.temp.select_icon_color};`
},
icon_color() {
if (!this.temp) {
return "";
}
return `${this.temp.icon_color};`
},
icon_font_color() {
if (!this.temp) {
return "";
}
return `color:${this.temp.icon_color};`
},
select_font_color() {
if (!this.temp) {
return "";
}
return `color: ${this.temp.select_icon_color};`
},
backgrond_color() {
if (!this.temp) {
return "";
}
return `background-color: ${this.temp.backgrond_color};`
},
color() {
if (!this.temp) {
return "";
}
return `color: ${this.temp.font_color};`
},
userInfo() {
return store.userInfo
},
realNameStatus() {
if (!this.userInfo.realNameAuth) {
return 0
}
return this.userInfo.realNameAuth.authStatus
},
isExpired(voteEndTime) {
return new Date() > new Date(voteEndTime);
},
},
async onShow() {
let cms = uni.getStorageSync("cms");
this.titleContent = cms.title_html;
this.cms = cms;
await this.getTemp();
},
components: {
uTabbar,
uTabbarItem,
@@ -350,216 +218,230 @@
uCheckboxGroup,
uCheckbox
},
data() {
return {
voteType: [
"单选(默认)",
"多选,无限制",
"多选, 最多两项"
],
voteEndTime: '2025-04-20 23:59:59', // 截止时间
cms:{},
temp: {},
titleContent:"",
con: "<p>露从今夜白,月是故乡明</p>",
tabbarValue: 0,
tabbarText: [
{
text: "模板",
},
{
text: "音乐"
},
{
text: "排版"
}
],
currentTemplate: "",
templateConfig: [
],
showPop: false,
popFrom: 'bottom',
list: new Array(20).fill(0),
maskClick: true,
}
},
methods: {
isCheckboxDisabled(arr, name) {
console.log(arr, name)
if (arr.length < 2 || arr.includes(name)) {
return false;
setup() {
const voteType = ref(["单选(默认)", "多选,无限制", "多选, 最多两项"])
const voteEndTime = ref('2025-04-20 23:59:59')
const cms = ref({})
const temp = ref({})
const titleContent = ref("")
const tabbarValue = ref(0)
const showPop = ref(false)
const maskClick = ref(true)
const popFrom = ref('bottom')
const list = ref(new Array(20).fill(0))
const currentTemplate = ref("")
const tabbarText = ref([
{ text: "模板" },
{ text: "音乐" },
{ text: "排版" }
])
const userInfo = computed(() => store.userInfo)
const isExpired = computed(() => new Date() > new Date(voteEndTime.value))
const btn_send_commends_color = computed(() => {
if (!temp.value) return ""
return `background-color: ${temp.value.btn_send_commends_color};`
})
const backgrond_color = computed(() => {
if (!temp.value) return ""
return `background-color: ${temp.value.backgrond_color};`
})
const color = computed(() => {
if (!temp.value) return ""
return `color: ${temp.value.font_color};`
})
const select_icon_color = computed(() => {
if (!temp.value) return ""
return `${temp.value.select_icon_color};`
})
const icon_color = computed(() => {
if (!temp.value) return ""
return `${temp.value.icon_color};`
})
onShow(async () => {
let storedCms = uni.getStorageSync("cms")
titleContent.value = storedCms.title_html
cms.value = storedCms
await getTemp()
})
async function getTemp() {
if (currentTemplate.value === "not_image") {
temp.value = {}
}
return true;
},
checkboxChange(e) {
console.log(e)
},
groupChange(n) {
console.log('groupChange', n);
},
radioChange(n) {
console.log('radioChange', n);
},
formatDate(date, format) {
const map = {
'yyyy': date.getFullYear(),
'MM': String(date.getMonth() + 1).padStart(2, '0'),
'dd': String(date.getDate()).padStart(2, '0'),
'HH': String(date.getHours()).padStart(2, '0'),
'mm': String(date.getMinutes()).padStart(2, '0'),
'ss': String(date.getSeconds()).padStart(2, '0')
};
return format.replace(
/yyyy|MM|dd|HH|mm|ss/g,
matched => map[matched]
);
},
// 时间格式化
formatTime() {
return this.formatDate(new Date(), 'yyyy-MM-dd HH:mm');
},
async getTemp() {
console.log(this.currentTemplate)
if (this.currentTemplate === "not_image") {
this.temp = {};
}
if (!this.currentTemplate) {
this.temp = {};
if (!currentTemplate.value) {
temp.value = {}
return
}
const temp = await uniCloud.importObject("uni-cms-articles").getTemp({
temp_id: this.currentTemplate
const res = await uniCloud.importObject("uni-cms-articles").getTemp({
temp_id: currentTemplate.value
})
console.log(temp);
if (temp.code === 200) {
this.temp = temp.data;
if (res.code === 200) {
temp.value = res.data
}
},
async updateTemplate(e) {
console.log(e);
this.currentTemplate = e;
await this.getTemp();
},
onBack() {
uni.showToast({
title: 'test',
})
},
onShowPopup(e) {
this.showPop = e.detail.value
},
onMaskClick(e) {
this.maskClick = e.detail.value
},
showPopupFrom(from) {
this.showPop = true
},
tabbarClick(e) {
}
async function updateTemplate(e) {
currentTemplate.value = e
await getTemp()
}
function onBack() {
uni.showToast({ title: 'test' })
}
function tabbarClick(e) {
tabbarValue.value = e
showPopupFrom()
}
function showPopupFrom() {
showPop.value = true
}
function isCheckboxDisabled(arr, name) {
if (arr.length < 2 || arr.includes(name)) {
return false
}
return true
}
function checkboxChange(e) {
console.log(e)
this.tabbarValue = e;
this.showPopupFrom();
},
async success() {
let cms = uni.getStorageSync("cms");
let id = cms._id;
let title = cms.title;
let title_html = cms.title_html;
let title_delta = cms.title_delta;
let temp_id = this.currentTemplate;
let music_url_id = "";
let edit_type = "mobile";
let view_count = 0;
let article_status = 1;
let user_id = this.userInfo._id;
let cmsLst = cms.cmsLst;
let excerpt = "";
// let publish_date = new Date();
// let last_modify_date = new Date();
let res = await uniCloud.importObject("user-info").getIP({uid: this.userInfo._id});
let last_modify_ip = res.code === 200 ? res.data.last_login_ip : "";
console.log(last_modify_ip)
console.log(this.userInfo)
console.log(cms);
console.log(id);
// return;
}
function groupChange(n) {
console.log('groupChange', n)
}
function radioChange(n) {
console.log('radioChange', n)
}
function formatDate(date, format) {
const map = {
'yyyy': date.getFullYear(),
'MM': String(date.getMonth() + 1).padStart(2, '0'),
'dd': String(date.getDate()).padStart(2, '0'),
'HH': String(date.getHours()).padStart(2, '0'),
'mm': String(date.getMinutes()).padStart(2, '0'),
'ss': String(date.getSeconds()).padStart(2, '0')
}
return format.replace(/yyyy|MM|dd|HH|mm|ss/g, matched => map[matched])
}
function formatTime() {
return formatDate(new Date(), 'yyyy-MM-dd HH:mm')
}
async function success() {
let storedCms = uni.getStorageSync("cms")
let id = storedCms._id
let title = storedCms.title
let title_html = storedCms.title_html
let title_delta = storedCms.title_delta
let temp_id = currentTemplate.value
let edit_type = "mobile"
let view_count = 0
let article_status = 1
let user_id = userInfo.value._id
let cmsLst = storedCms.cmsLst
let excerpt = ""
let res = await uniCloud.importObject("user-info").getIP({ uid: userInfo.value._id })
let last_modify_ip = res.code === 200 ? res.data.last_login_ip : ""
if (id) {
let query = {};
query.id = id;
query.title = cms.title;
query.user_id = user_id;
query.title_html = cms.title_html;
query.title_delta = cms.title_delta;
query.thumbnail = cms.thumbnail;
query.p_type = cms.p_type;
query.category_id = cms.category_id;
query.temp_id = temp_id;
query.edit_type = edit_type;
query.view_count = view_count;
query.cmsLst = cms.cmsLst;
query.excerpt = excerpt;
// query.publish_date = publish_date;
// query.last_modify_date = last_modify_date;
query.last_modify_ip = last_modify_ip;
query.article_status = article_status;
let r = await uniCloud.importObject("uni-cms-articles").update_cms_articles(query);
console.log(r)
let query = {
id,
title: storedCms.title,
user_id,
title_html: storedCms.title_html,
title_delta: storedCms.title_delta,
thumbnail: storedCms.thumbnail,
p_type: storedCms.p_type,
category_id: storedCms.category_id,
temp_id,
edit_type,
view_count,
cmsLst: storedCms.cmsLst,
excerpt,
last_modify_ip,
article_status,
}
await uniCloud.importObject("uni-cms-articles").update_cms_articles(query)
} else {
let query = {};
query.title = cms.title;
query.user_id = user_id;
query.title_html = cms.title_html;
query.title_delta = cms.title_delta;
query.thumbnail = cms.thumbnail;
query.p_type = cms.p_type;
query.category_id = cms.category_id;
query.temp_id = temp_id;
query.edit_type = edit_type;
query.view_count = view_count;
query.cmsLst = cms.cmsLst;
query.excerpt = excerpt;
// query.publish_date = publish_date;
// query.last_modify_date = last_modify_date;
query.last_modify_ip = last_modify_ip;
query.article_status = article_status;
console.log(query)
let r = await uniCloud.importObject("uni-cms-articles").add_cms_articles(query);
console.log(r)
let query = {
title: storedCms.title,
user_id,
title_html: storedCms.title_html,
title_delta: storedCms.title_delta,
thumbnail: storedCms.thumbnail,
p_type: storedCms.p_type,
category_id: storedCms.category_id,
temp_id,
edit_type,
view_count,
cmsLst: storedCms.cmsLst,
excerpt,
last_modify_ip,
article_status,
}
await uniCloud.importObject("uni-cms-articles").add_cms_articles(query)
}
uni.setStorageSync("cms", "")
uni.switchTab({
url:"/pages/my/my"
})
},
async back() {
uni.switchTab({ url: "/pages/my/my" })
}
async function back() {
uni.navigateBack({
delta: 1,
fail: (err) => {
uni.navigateTo({
url:"/pages2/editCms/editCms"
})
uni.navigateTo({ url: "/pages2/editCms/editCms" })
}
});
})
}
return {
voteType,
voteEndTime,
cms,
temp,
titleContent,
tabbarValue,
showPop,
maskClick,
popFrom,
list,
currentTemplate,
tabbarText,
userInfo,
isExpired,
btn_send_commends_color,
backgrond_color,
color,
select_icon_color,
icon_color,
getTemp,
updateTemplate,
onBack,
tabbarClick,
showPopupFrom,
isCheckboxDisabled,
checkboxChange,
groupChange,
radioChange,
formatDate,
formatTime,
success,
back,
}
}
}
@@ -569,15 +451,15 @@
.grid-container {
display: flex;
gap: 10px; /* 列间距 */
gap: 10px;
padding: 15px;
background: #f5f5f5;
}
.grid-item {
flex: 1; /* 等分容器宽度 */
min-width: 0; /* 防止内容溢出 */
aspect-ratio: 1; /* 默认正方形 */
flex: 1;
min-width: 0;
aspect-ratio: 1;
background: white;
border-radius: 8px;
overflow: hidden;
@@ -591,7 +473,7 @@
width: 100%;
height: 100%;
object-fit: cover;
aspect-ratio: 16/9; /* 设置长方形比例 */
aspect-ratio: 16/9;
}
.meta {
@@ -706,7 +588,6 @@
margin-left: 10rpx;
&::before {
// border-left: 2px solid #f44336;
content: "";
position: absolute;
left: 0;