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

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
+95 -93
View File
@@ -85,111 +85,113 @@
</template>
<script>
import { ref, computed, onMounted } from 'vue'
import cloudImage from "@/components/cloud-image.vue"
import uSubsection from "@/uni_modules/uview-ui/components/u-subsection/u-subsection.vue"
import uPopup from "@/uni_modules/uview-ui/components/u-popup/u-popup.vue"
const uniIdCo = uniCloud.importObject("uni-id-co")
import {
store,
mutations
} from '@/pages3/uni_modules/uni-id-pages/common/store.js'
import { store } from '@/pages3/uni_modules/uni-id-pages/common/store.js'
export default {
data() {
return {
list: ['动态', '作品', '相册', '收藏'],
current: 1,
show: false,
iconList: {
delete : {
color: '#f55',
size: '22',
type: 'closeempty'
},
setting: {
color: '#888',
size: '22',
type: 'gear-filled'
},
edit: {
color: '#888',
size: '22',
type: 'compose'
}
},
cms_list: [],
selectIndex: 0,
};
},
computed: {
userInfo() {
return store.userInfo
},
realNameStatus() {
if (!this.userInfo.realNameAuth) {
return 0
}
return this.userInfo.realNameAuth.authStatus
},
},
components:{
components: {
uSubsection,
cloudImage,
uPopup
},
async onLoad() {
console.log(this.userInfo);
let res = await uniCloud.importObject("uni-cms-articles")
.get_cms_articles_for_userId({user_id: this.userInfo._id});
console.log(res);
this.cms_list = res.data;
},
methods:{
sectionChange(index) {
console.log(index)
this.current = index;
},
selectMore(index) {
console.log(index)
this.show = true;
this.selectIndex = index;
},
close() {
this.show = false;
},
open() {
this.show = true;
},
onClick(e) {
console.log(e)
},
async deleteItem(index) {
console.log(index)
console.log(this.cms_list[index]);
let res = await uniCloud.importObject("uni-cms-articles").del_cms_articles({id: this.cms_list[index]._id});
console.log(res)
if (res.code === 200) {
this.cms_list.splice(index, 1)
setup() {
const list = ref(['动态', '作品', '相册', '收藏'])
const current = ref(1)
const show = ref(false)
const selectIndex = ref(0)
const cms_list = ref([])
const iconList = {
delete: { color: '#f55', size: '22', type: 'closeempty' },
setting: { color: '#888', size: '22', type: 'gear-filled' },
edit: { color: '#888', size: '22', type: 'compose' }
}
const userInfo = computed(() => store.userInfo)
onMounted(async () => {
if (!userInfo.value._id) {
uni.showToast({ title: '请先登录', icon: 'none' })
setTimeout(() => uni.navigateBack(), 1000)
return
}
this.close()
},
async editItem(index) {
console.log(index);
let cms = this.cms_list[index];
console.log(cms);
uni.setStorageSync("cms", cms);
await this.toCmsEdit(cms.id);
},
async toCmsEdit(id) {
uni.showLoading({ title: '加载中' })
try {
let res = await uniCloud.importObject("uni-cms-articles")
.get_cms_articles_for_userId({ user_id: userInfo.value._id })
cms_list.value = res.data || []
} catch (e) {
console.error(e)
uni.showToast({ title: '加载失败,请重试', icon: 'none' })
} finally {
uni.hideLoading()
}
})
function sectionChange(index) {
current.value = index
}
function selectMore(index) {
show.value = true
selectIndex.value = index
}
function close() {
show.value = false
}
function open() {
show.value = true
}
async function deleteItem(index) {
let res = await uniCloud.importObject("uni-cms-articles").del_cms_articles({ id: cms_list.value[index]._id })
if (res.code === 200) {
cms_list.value.splice(index, 1)
}
close()
}
async function editItem(index) {
let cms = cms_list.value[index]
if (!cms) return
uni.setStorageSync("cms", cms)
await toCmsEdit(cms._id)
}
async function toCmsEdit(id) {
uni.navigateTo({
url: "/pages2/editCms/editCms?id=" + id
});
},
settingItem(index) {
console.log("setting")
})
}
function settingItem(index) {
let cms = cms_list.value[index]
if (!cms) return
uni.setStorageSync("cms", cms)
uni.navigateTo({ url: "/pages2/editCms/editSetting" })
}
return {
list,
current,
show,
selectIndex,
cms_list,
iconList,
userInfo,
sectionChange,
selectMore,
close,
open,
deleteItem,
editItem,
toCmsEdit,
settingItem
}
}
}