contentAllPage.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="container content-all-page">
  3. <view class="tab-content">
  4. <view class="item" v-for="item in tabList" :key="item.value" @click="tabClickHandler(item)">
  5. {{ item.name }}
  6. <view class="line-active" v-if="tabActive == item.value"> </view>
  7. </view>
  8. </view>
  9. <view class="content-ul" v-if="specialCenter && specialCenter.length > 0">
  10. <view class="content-li" v-for="item in specialCenter" :key="item.Id" @click="toExamineHandler(item)">
  11. <view class="type-time">
  12. <view class="type"> {{ item.Type == 1 ? "笔 记" : "观 点" }} </view>
  13. <view class="time"> {{ tabActive == 1 ? item.ModifyTime : item.PublishTime }}</view>
  14. </view>
  15. <view class="title-item" @click="goDetail(item)"> {{ item.Title }}</view>
  16. <view class="btn-box">
  17. <view class="reject-box" v-if="tabActive == 1" @click.stop="deleteHandler(item)"> 删除</view>
  18. <view class="cancell-box" v-if="tabActive == 3" @click.stop="unpublishHandler(item)"> 取消发布</view>
  19. <view class="reject-box" v-if="tabActive == 4" @click.stop="rejectHandler(item)"> 驳回理由</view>
  20. <view class="edit-box" v-if="tabActive == 1 || tabActive == 4" @click.stop="modifyHandler(item)"> 修改 </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="nodata" v-else>
  25. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  26. <view class="nodata-text">暂无内容</view>
  27. </view>
  28. <Loading />
  29. </view>
  30. </template>
  31. <script>
  32. import { purchaserApi } from "@/config/api";
  33. export default {
  34. data() {
  35. return {
  36. tabList: [
  37. { name: "草稿箱", value: "1" },
  38. { name: "已发布", value: "3" },
  39. { name: "审核中", value: "2" },
  40. { name: "已驳回", value: "4" },
  41. ],
  42. tabActive: "",
  43. specialCenter: [],
  44. };
  45. },
  46. methods: {
  47. // top标签点击事件
  48. tabClickHandler(item) {
  49. if (this.tabActive === item.value) return;
  50. this.specialCenter = [];
  51. this.tabActive = item.value;
  52. this.getDataList();
  53. },
  54. // 获取内容中心的数据
  55. async getDataList() {
  56. const res = await purchaserApi.yanxuanSpecialCenter({
  57. Status: this.tabActive,
  58. });
  59. if (res.Ret === 200) {
  60. this.specialCenter = res.Data || [];
  61. }
  62. },
  63. // 点击了修改
  64. modifyHandler(item) {
  65. if (item.ContentHasStyle) {
  66. uni.showModal({
  67. content: "此内容包含较多文本格式或文档,请前往网页版编辑",
  68. confirmColor: "#376cbb",
  69. confirmText: "知道了",
  70. showCancel: false,
  71. cancelColor: "#606266",
  72. });
  73. return;
  74. }
  75. uni.navigateTo({
  76. url: "/pages-purchaser/writeNote/writeNote?id=" + item.Id,
  77. });
  78. },
  79. // 点击驳回
  80. rejectHandler(item) {
  81. uni.showModal({
  82. title: "驳回理由",
  83. content: item.Reason,
  84. confirmColor: "#376cbb",
  85. confirmText: "知道了",
  86. showCancel: false,
  87. cancelColor: "#606266",
  88. });
  89. },
  90. // 取消发布
  91. unpublishHandler(item) {
  92. uni.showModal({
  93. title: "提醒",
  94. content: "取消发布后,内容将进入草稿箱,想要重新发布需重新提交审核,确定要取消发布吗?",
  95. confirmColor: "#376cbb",
  96. cancelColor: "#606266",
  97. success: async (res) => {
  98. if (res.confirm) {
  99. const resCancel = await purchaserApi.yanxuanSpecialCancel({
  100. Id: item.Id,
  101. });
  102. if (resCancel.Ret == 200) {
  103. uni.showToast({
  104. title: "已取消发布",
  105. duration: 2000,
  106. });
  107. this.getDataList();
  108. }
  109. }
  110. },
  111. });
  112. },
  113. // 去往审核页面
  114. toExamineHandler(item) {
  115. if (item.Status == 2) {
  116. uni.navigateTo({
  117. url: "/pages-purchaser/toExamine/toExamine?id=" + item.Id,
  118. });
  119. }
  120. },
  121. // 删除
  122. async deleteHandler(item) {
  123. uni.showModal({
  124. content: "确定要删除此内容吗?",
  125. confirmColor: "#376cbb",
  126. cancelColor: "#606266",
  127. success: async (res) => {
  128. if (res.confirm) {
  129. const resCancel = await purchaserApi.yanxuanSpecialDel({
  130. Id: item.Id,
  131. });
  132. if (resCancel.Ret == 200) {
  133. this.$util.toast("已删除");
  134. this.getDataList();
  135. }
  136. }
  137. },
  138. });
  139. },
  140. // 去往详情
  141. goDetail(item) {
  142. uni.navigateTo({ url: "/pages-purchaser/noteAndViewpoint/noteAndViewpoint?id=" + item.Id });
  143. },
  144. },
  145. onLoad(options) {
  146. this.tabActive = options.Status || "1";
  147. this.getDataList();
  148. },
  149. };
  150. </script>
  151. <style lang="scss" scope>
  152. .content-all-page {
  153. background-color: $uni-bg-color;
  154. .tab-content {
  155. margin-top: 1rpx;
  156. background-color: #fff;
  157. height: 96rpx;
  158. display: flex;
  159. view {
  160. flex: 1;
  161. text-align: center;
  162. line-height: 96rpx;
  163. border-bottom: 2rpx solid #e7e7e7;
  164. }
  165. .item {
  166. position: relative;
  167. .line-active {
  168. position: absolute;
  169. left: 50%;
  170. bottom: 0rpx;
  171. width: 32rpx;
  172. height: 6rpx;
  173. border-radius: 6rpx;
  174. background-color: #376cbb;
  175. transform: translateX(-50%);
  176. }
  177. }
  178. }
  179. .content-ul {
  180. padding: 30rpx;
  181. .content-li {
  182. width: 100%;
  183. height: 256rpx;
  184. padding: 20rpx;
  185. border-radius: 16rpx;
  186. border-top: 10rpx solid #e7e0cd;
  187. background-color: #fff;
  188. .type-time {
  189. display: flex;
  190. align-items: center;
  191. justify-content: space-between;
  192. color: #666666;
  193. .type {
  194. width: 110rpx;
  195. height: 42rpx;
  196. line-height: 42rpx;
  197. text-align: center;
  198. border-radius: 38rpx;
  199. color: #928563;
  200. background-color: #fff6de;
  201. font-weight: 500;
  202. }
  203. }
  204. .title-item {
  205. margin: 10rpx 0 20rpx;
  206. color: #333;
  207. font-size: 32rpx;
  208. font-weight: 500;
  209. line-height: 46rpx;
  210. }
  211. .btn-box {
  212. display: flex;
  213. justify-content: flex-end;
  214. padding-top: 5rpx;
  215. view {
  216. display: flex;
  217. align-items: center;
  218. height: 48rpx;
  219. padding: 0 24rpx;
  220. border-radius: 150rpx;
  221. margin-left: 10rpx;
  222. }
  223. .cancell-box {
  224. color: #376cbb;
  225. border: 2rpx solid #376cbb;
  226. }
  227. .edit-box {
  228. color: #fff;
  229. background-color: #376cbb;
  230. }
  231. .reject-box {
  232. color: #d54941;
  233. border: 2rpx solid #d54941;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. </style>