123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <template>
- <view class="page">
- <!-- <view class="nav-bar">
- <view class="left">
- <view class="uni-btn-icon" @click="goBack"></view>
- </view>
- <view class="center">管理</view>
- <view class="right">
- <view class="btn" @click="onManage">管理</view>
- <view class="btn" @click="onSubmit">发布</view>
- </view>
- </view> -->
- <view class="list">
- <view class="article-item" v-for="(item, index) in articleList" :key="index">
- <view class="article-content">
- <image class="article-image" :src="item.image" mode="aspectFill"></image>
- <view class="article-info">
- <view class="article-title">{{item.title}}</view>
- <view class="article-desc">{{item.content}}</view>
- <view class="article-meta">
- <text class="time">{{item.create_time}}</text>
- <text class="status" :class="item.status === 1 ? 'published' : 'draft'">
- {{item.status === 1 ? '已发布' : '待审核'}}
- </text>
- </view>
- </view>
- </view>
- <view class="article-actions">
- <view class="action-btn edit" @click="onEdit(item)">编辑</view>
- <view class="action-btn delete" @click="onDelete(item)">删除</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- skey: '',
- uinfo: {},
- articleList: [], // 文章列表数据
- }
- },
- onLoad(params) {
- if (getApp().globalData.skey != "") {
- this.skey = getApp().globalData.skey;
- } else {
- this.skey = params.skey || ''; //1234567xef
- }
- this.id = params.id || '';
- let that = this;
- // this.getCate();
- // that.getInfo();
- },
- onShow() {
- let that = this;
- this.getArticleList();
- },
- methods: {
- goBack() {
- uni.navigateBack();
- },
- onPublish() {
- this.onSubmit();
- },
- getInfo() {
- },
- onEdit(item) {
- uni.navigateTo({
- url: `/pages/make/fabuArticle?id=${item.id}`
- });
- },
- onDelete(item) {
- uni.showModal({
- title: '提示',
- content: '确定要删除这篇文章吗?',
- success: (res) => {
- if (res.confirm) {
- uni.request({
- url: this.$apiHost + '/Article/doAct',
- data: {
- uuid: getApp().globalData.uuid,
- act: 'del',
- id: item.id
- },
- header: {
- 'content-type': 'application/json',
- 'sign': getApp().globalData.headerSign
- },
- success: (res) => {
- if (res.data.success === 'yes') {
- uni.showToast({
- title: '删除成功',
- icon: 'success'
- });
- // 重新获取列表
- this.getArticleList();
- } else {
- uni.showToast({
- title: res.data.str || '删除失败',
- icon: 'none'
- });
- }
- }
- });
- }
- }
- });
- },
- getArticleList() {
- var that = this;
- uni.request({
- url: this.$apiHost + '/Article/getlist', //仅为示例,并非真实接口地址。
- data: {
- uuid: getApp().globalData.uuid,
- type: "my"
- },
- header: {
- 'content-type': 'application/json',
- 'sign': getApp().globalData.headerSign
- },
- success: (res) => {
- console.log("====", res.data);
- that.articleList = res.data.list;
- }
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- @import 'manageArticle.scss';
- </style>
|