myArticle.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="page">
  3. <view class="mainBody">
  4. <view class="menu">
  5. <view class="item" :class="{'active':tab===1}" @click="checkTab(1)">
  6. <text class="left">全部</text>
  7. <view class="line"></view>
  8. </view>
  9. <view class="item" :class="{'active':tab===2}" @click="checkTab(2)">
  10. <text class="left">待审核</text>
  11. <view class="line"></view>
  12. </view>
  13. <view class="item" :class="{'active':tab===3}" @click="checkTab(3)">
  14. <text class="left">审核通过</text>
  15. <view class="line"></view>
  16. </view>
  17. <view class="item" :class="{'active':tab===4}" @click="checkTab(4)">
  18. <text class="left">审核拒绝</text>
  19. <view class="line"></view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="list_info">
  24. <block v-for="(item,index) in list" :key="index">
  25. <view class="item">
  26. <view class="avator">
  27. <image class="icon" :src="item.avator" mode="aspectFill">
  28. </image>
  29. </view>
  30. <view class="tit">
  31. <view class="list1">
  32. <view class="name">
  33. {{item.nickname}}
  34. </view>
  35. <view class="sex2" v-if="item.sex == 2">
  36. <image class="icon" src="../../static/icon/woman.png" mode="widthFix">
  37. </image>
  38. {{item.age}}
  39. </view>
  40. <view class="sex1" v-else>
  41. <image class="icon" src="../../static/icon/man.png" mode="widthFix">
  42. </image>
  43. {{item.age}}
  44. </view>
  45. <view class="xinzuo" v-if="item.xinzuo != ''">{{item.xinzuo}}</view>
  46. </view>
  47. <view class="time">{{item.dtime}}</view>
  48. </view>
  49. <view class="state">
  50. <view class="status_1" v-if="item.status == 1">已通过</view>
  51. <view class="status_2" v-if="item.status == 2">待审核</view>
  52. <view class="status_4" v-if="item.status == 4">拒绝</view>
  53. </view>
  54. </view>
  55. <view class="content">
  56. {{item.content}}
  57. </view>
  58. <view class="photo_list">
  59. <view class="img" v-for="(item2,index2) in toArr(item.images)" :key="index2"
  60. @click="previewOpen(item.images,index2)" v-if="item2 != ''">
  61. <image class="icon" :src="item2" mode="aspectFill"></image>
  62. </view>
  63. </view>
  64. <view class="desc">
  65. <view class="addr">{{item.city}}</view>
  66. <view class="img" @click="ZhanTA(item,index)" v-if="item.is_like < 1">
  67. <image class="icon" src="../../static/icon/zan.png" mode="widthFix"></image>
  68. {{item.num_like}}
  69. </view>
  70. <view class="img" v-else>
  71. <image class="icon" src="../../static/icon/like.png" mode="widthFix"></image>
  72. {{item.num_like}}
  73. </view>
  74. <!-- <view class="img" >
  75. <image class="icon" src="../../static/icon/reply.png" mode="widthFix"></image>
  76. {{item.num_comment}}
  77. </view> -->
  78. <view class="img" @click="delArticle(item)">
  79. <image class="icon" src="../../static/icon/del.png" mode="widthFix"></image>
  80. </view>
  81. </view>
  82. </block>
  83. <view class="blankHeight"></view>
  84. </view>
  85. <DialogBoxW3 ref="DialogBoxW3"></DialogBoxW3>
  86. <ToastW3 ref="ToastW3"></ToastW3>
  87. <previewImage ref="previewImage" :opacity="0.8" :circular="true" :imgs="imgs" :descs="descs"
  88. @longPress="longPress"></previewImage>
  89. </view>
  90. </template>
  91. <script>
  92. import previewImage from '@/components/kxj-previewImage/kxj-previewImage.vue'; //引用插件
  93. export default {
  94. components: {
  95. previewImage
  96. }, //注册插件
  97. data() {
  98. return {
  99. tab: 1,
  100. list: [],
  101. stype: 'get',
  102. imgs: ['../../static/a.jpg', '../../static/b.jpg', '../../static/c.jpg', '../../static/d.jpg',
  103. '../../static/e.png'
  104. ],
  105. descs: [
  106. '人民大礼堂',
  107. '菜园坝火车站',
  108. '',
  109. '重庆大剧院由设计了中央电视台新大楼的华东设计院和德国设计公司联合设计,大剧院的设计以“孤帆远影”为主题,其建筑表面选用浅绿色的有机玻璃',
  110. '顶部底部数字都是1,超长的图片,看看能不能看到顶部和底部'
  111. ]
  112. }
  113. },
  114. onLoad() {},
  115. onShow() {
  116. let that = this;
  117. // uni.setNavigationBarTitle({
  118. // titleNView: that.titleNView
  119. // });
  120. // this.setStyle(1, '我收到的')
  121. this.loadData();
  122. },
  123. onNavigationBarButtonTap(e) {
  124. if (e.index === 0) {
  125. uni.navigateTo({
  126. url: '/pages/article/addArticle'
  127. })
  128. }
  129. },
  130. methods: {
  131. setStyle(index, text) {
  132. let pages = getCurrentPages();
  133. let page = pages[pages.length - 1];
  134. // if (text.length > 3) {
  135. // text = text.substr(0, 3) + '...';
  136. // }
  137. // #ifdef APP-PLUS
  138. let currentWebview = page.$getAppWebview();
  139. let titleNView = currentWebview.getStyle().titleNView;
  140. // 添加文字过长截取为3个字符,请根据自己业务需求更改
  141. titleNView.buttons[0].text = text;
  142. currentWebview.setStyle({
  143. titleNView: titleNView
  144. });
  145. // #endif
  146. // #ifdef H5
  147. // h5 临时方案
  148. const btn = document.getElementsByClassName('uni-btn-icon')[index]
  149. btn.innerText = text;
  150. // #endif
  151. },
  152. // 删除动态
  153. delArticle(article) {
  154. console.log(article);
  155. this.$refs['DialogBoxW3'].confirm({
  156. title: '删除动态',
  157. content: '请确认是否删除此条动态?',
  158. DialogType: 'inquiry',
  159. btn1: '取消',
  160. btn2: '删除',
  161. animation: 0
  162. }).then((res) => {
  163. uni.request({
  164. url: this.$apiHost + '/Article/doAct',
  165. data: {
  166. uuid: getApp().globalData.uuid,
  167. act: 'del',
  168. id: article.id
  169. },
  170. header: {
  171. "content-type": "application/json",
  172. 'sign': getApp().globalData.headerSign
  173. },
  174. success: (res) => {
  175. uni.showToast({
  176. title: res.data.str,
  177. icon: 'none'
  178. });
  179. if (res.data.success == 'yes') {
  180. this.loadData();
  181. }
  182. },
  183. complete: (com) => {
  184. // uni.hideLoading();
  185. },
  186. fail: (e) => {
  187. console.log("----e:", e);
  188. }
  189. });
  190. })
  191. },
  192. onClickButton1() {
  193. console.log('点击了按钮1')
  194. },
  195. onClickButton2() {
  196. console.log('点击了按钮2')
  197. },
  198. onBack() {},
  199. checkTab(tab) {
  200. this.tab = tab;
  201. this.loadData();
  202. },
  203. toArr(imgs) {
  204. let arr = imgs.split("|");
  205. return arr;
  206. },
  207. previewOpen(imgs1, index) {
  208. this.imgs = imgs1.split("|");
  209. // this.descs = [];
  210. // for (var i = 0; i < this.imgs.length; i++) {
  211. // this.descs.push(i + 1);
  212. // }
  213. // var param = e.currentTarget.dataset.src;
  214. // console.log(param);
  215. // this.imgs = ['../../static/home/avator.png', '../../static/me/sex_2.png', '../../static/home/avator.png'];
  216. setTimeout(() => this.$refs.previewImage.open(index), 0) // 传入当前选中的图片地址或序号
  217. return; //如需测试和uni原生预览差别可注释这两行
  218. },
  219. //长按事件
  220. longPress(data) {
  221. console.log(data);
  222. uni.showModal({
  223. showCancel: false,
  224. title: '长按事件',
  225. content: '已触发长按事件,你可以在这里做更多',
  226. success: showResult => {
  227. }
  228. });
  229. },
  230. loadData() {
  231. console.log("this.tab", this.tab)
  232. uni.request({
  233. url: this.$apiHost + '/Article/getlist',
  234. data: {
  235. uuid: getApp().globalData.uuid,
  236. ismy: 1,
  237. tab: this.tab
  238. },
  239. header: {
  240. "content-type": "application/json",
  241. 'sign': getApp().globalData.headerSign
  242. },
  243. success: (res) => {
  244. console.log("----:", res.data);
  245. if (res.data.list != null) {
  246. this.list = res.data.list;
  247. } else {
  248. this.list = [];
  249. }
  250. },
  251. complete: (com) => {
  252. // uni.hideLoading();
  253. },
  254. fail: (e) => {
  255. console.log("----e:", e);
  256. }
  257. });
  258. },
  259. }
  260. }
  261. </script>
  262. <style scoped lang="scss">
  263. @import 'myArticle.scss';
  264. </style>