contentAllPage.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. if (item.Status == 2) {
  143. uni.navigateTo({
  144. url: "/pages-purchaser/toExamine/toExamine?id=" + item.Id,
  145. });
  146. } else {
  147. uni.navigateTo({ url: "/pages-purchaser/noteAndViewpoint/noteAndViewpoint?id=" + item.Id });
  148. }
  149. },
  150. },
  151. onLoad(options) {
  152. this.tabActive = options.Status || "1";
  153. this.getDataList();
  154. },
  155. };
  156. </script>
  157. <style lang="scss" scope>
  158. .content-all-page {
  159. background-color: $uni-bg-color;
  160. .tab-content {
  161. margin-top: 1rpx;
  162. background-color: #fff;
  163. height: 96rpx;
  164. display: flex;
  165. view {
  166. flex: 1;
  167. text-align: center;
  168. line-height: 96rpx;
  169. border-bottom: 2rpx solid #e7e7e7;
  170. }
  171. .item {
  172. position: relative;
  173. .line-active {
  174. position: absolute;
  175. left: 50%;
  176. bottom: 0rpx;
  177. width: 32rpx;
  178. height: 6rpx;
  179. border-radius: 6rpx;
  180. background-color: #376cbb;
  181. transform: translateX(-50%);
  182. }
  183. }
  184. }
  185. .content-ul {
  186. padding: 30rpx;
  187. .content-li {
  188. width: 100%;
  189. height: 256rpx;
  190. padding: 20rpx;
  191. border-radius: 16rpx;
  192. border-top: 10rpx solid #e7e0cd;
  193. background-color: #fff;
  194. .type-time {
  195. display: flex;
  196. align-items: center;
  197. justify-content: space-between;
  198. color: #666666;
  199. .type {
  200. width: 110rpx;
  201. height: 42rpx;
  202. line-height: 42rpx;
  203. text-align: center;
  204. border-radius: 38rpx;
  205. color: #928563;
  206. background-color: #fff6de;
  207. font-weight: 500;
  208. }
  209. }
  210. .title-item {
  211. margin: 10rpx 0 20rpx;
  212. color: #333;
  213. font-size: 32rpx;
  214. font-weight: 500;
  215. line-height: 46rpx;
  216. }
  217. .btn-box {
  218. display: flex;
  219. justify-content: flex-end;
  220. padding-top: 5rpx;
  221. view {
  222. display: flex;
  223. align-items: center;
  224. height: 48rpx;
  225. padding: 0 24rpx;
  226. border-radius: 150rpx;
  227. margin-left: 10rpx;
  228. }
  229. .cancell-box {
  230. color: #376cbb;
  231. border: 2rpx solid #376cbb;
  232. }
  233. .edit-box {
  234. color: #fff;
  235. background-color: #376cbb;
  236. }
  237. .reject-box {
  238. color: #d54941;
  239. border: 2rpx solid #d54941;
  240. }
  241. }
  242. }
  243. }
  244. }
  245. </style>