|
@@ -1,39 +1,106 @@
|
|
|
// pages/admin/index.js
|
|
|
+import {
|
|
|
+ ajax
|
|
|
+} from "../../utils/util";
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- list: [
|
|
|
- {
|
|
|
- works: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/R-C.jfif",
|
|
|
- name: "张云翔",
|
|
|
- birthday: "2015-03-03",
|
|
|
- teacher: "李勇利",
|
|
|
- school: "清华",
|
|
|
- articleGroup: "书法",
|
|
|
- articleName: "兰亭序",
|
|
|
- articleDescribe: "展现了中国传统艺术的魅力。墨色浓淡相间,笔触流畅而有力,每一字之间形成和谐的整体。作品中融入了经典诗句,传递出深邃的哲理和人生感悟。每一个字都经过精心构思和书写,字体大小和间距恰到好处,整个作品看起来平衡而舒适。",
|
|
|
- },
|
|
|
- {
|
|
|
- works: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/R-C.jfif",
|
|
|
- name: "张云翔",
|
|
|
- birthday: "2015-03-03",
|
|
|
- teacher: "李勇利",
|
|
|
- school: "清华",
|
|
|
- articleGroup: "书法",
|
|
|
- articleName: "兰亭序",
|
|
|
- articleDescribe: "展现了中国传统艺术的魅力。墨色浓淡相间,笔触流畅而有力,每一字之间形成和谐的整体。作品中融入了经典诗句,传递出深邃的哲理和人生感悟。每一个字都经过精心构思和书写,字体大小和间距恰到好处,整个作品看起来平衡而舒适。",
|
|
|
+ list: []
|
|
|
+ },
|
|
|
+ page: 1,
|
|
|
+ size: 2,
|
|
|
+ total: 0,
|
|
|
+ T: undefined,
|
|
|
+ conclusion(e) {
|
|
|
+ if (this.T) clearTimeout(this.T);
|
|
|
+ setTimeout(() => {
|
|
|
+ if (this.T) clearTimeout(this.T);
|
|
|
+ if (!e.currentTarget.dataset.conclusion) {
|
|
|
+ wx.showModal({
|
|
|
+ title: '请输入评语',
|
|
|
+ editable: true,
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ this.uploadConclusion(e.currentTarget.dataset.id, e.currentTarget.dataset.conclusion, res.content, e.currentTarget.dataset.index)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.uploadConclusion(e.currentTarget.dataset.id, e.currentTarget.dataset.conclusion, "", e.currentTarget.dataset.index);
|
|
|
+ }
|
|
|
+ }, 200);
|
|
|
+
|
|
|
+ },
|
|
|
+ uploadConclusion(articleId, ok, message, index) {
|
|
|
+ ajax({
|
|
|
+ urlType: "apiurl",
|
|
|
+ api: "/article/audit",
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ articleId,
|
|
|
+ ok,
|
|
|
+ message
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code !== 0) return wx.showToast({
|
|
|
+ title: res.message || '审核失败',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ const {
|
|
|
+ list
|
|
|
+ } = this.data;
|
|
|
+ if (ok) {
|
|
|
+ list.splice(index, 1);
|
|
|
+ this.setData({
|
|
|
+ list
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ list[index].message = message;
|
|
|
}
|
|
|
- ]
|
|
|
+ if (index >= list.length - 2) this.getData();
|
|
|
+ wx.showToast({
|
|
|
+ title: '审核成功',
|
|
|
+ icon: "success"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getData() {
|
|
|
+ ajax({
|
|
|
+ urlType: "apiurl",
|
|
|
+ api: "/article/list-audit",
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ page: this.page,
|
|
|
+ size: this.size
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code !== 0) return wx.showToast({
|
|
|
+ title: '请求失败',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ const data = res.data || {};
|
|
|
+ data.data.length && (this.page += 1);
|
|
|
+ this.total = data.total;
|
|
|
+ this.setData({
|
|
|
+ list: [...this.data.list, ...data.data]
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ change(e) {
|
|
|
+ const T = setTimeout(() => {
|
|
|
+ clearTimeout(T);
|
|
|
+ if (e.detail.current >= this.data.list.length - 1) this.getData();
|
|
|
+ }, 500);
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
-
|
|
|
+ this.getData()
|
|
|
},
|
|
|
|
|
|
/**
|