todo-list.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="doto-inner">
  3. <!-- <mescroll-body ref="mescrollRef" class="mescrollRef" @init="mescrollInit" top="0" bottom="0" :down="downOption" @down="downCallback" :up="upOption"
  4. @up="upCallback" @emptyclick="emptyClick"> -->
  5. <block v-for="(item,index) in listData" :key="index">
  6. <view class="cell">
  7. <view class="item">
  8. <view class="leftContent">
  9. <view class="top">
  10. <image class="icon" src="/static/images/home/thing_time.png"></image>
  11. <view class="content">{{ item.content }}</view>
  12. </view>
  13. <view class="date">{{ item.eventTime }}</view>
  14. </view>
  15. <view class="rightContent">
  16. <text v-if="item.status==0" class="state">未完成</text>
  17. <text v-else class="dstate">已完成</text>
  18. </view>
  19. </view>
  20. <u-line color="#eee" />
  21. </view>
  22. </block>
  23. <!-- </mescroll-body> -->
  24. <!-- <view>
  25. <view class="item">
  26. <view class="leftContent">
  27. <view class="top">
  28. <image class="icon" src="/static/images/home/thing_time.png"></image>
  29. <view class="content">打电话跟进20个意向客户</view>
  30. </view>
  31. <view class="date">2022-12-22</view>
  32. </view>
  33. <view class="rightContent">
  34. <text class="state">未完成</text>
  35. </view>
  36. </view>
  37. <u-line color="#eee" />
  38. </view> -->
  39. </view>
  40. </template>
  41. <script>
  42. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  43. export default {
  44. mixins: [MescrollMixin],
  45. name:"todo-list",
  46. props: {
  47. listData: {
  48. type: Array,
  49. default: null
  50. },
  51. isHot: {
  52. type: Boolean,
  53. default: false
  54. },
  55. permission: {
  56. type: Object,
  57. default: function(){
  58. return {};
  59. }
  60. }
  61. },
  62. data() {
  63. return {
  64. downOption: {
  65. auto: false,
  66. use:false,
  67. },
  68. upOption: {
  69. auto: false, // 不自动加载
  70. use:false,
  71. page: {
  72. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  73. size: 10 // 每页数据的数量
  74. },
  75. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  76. toTop:{
  77. width:0,
  78. }
  79. },
  80. }
  81. },
  82. methods: {
  83. clickItem(e) {
  84. try {
  85. this.$Router.push({
  86. name: "newsDetail",
  87. query: e
  88. })
  89. } catch (er) {
  90. //TODO handle the exception
  91. console.error(er)
  92. }
  93. },
  94. formatTitle(title) {
  95. if (title != undefined) {
  96. var string = this.removeHTMLTag(title);
  97. string = this.escape2Html(string);
  98. return string;
  99. }
  100. return ''
  101. },
  102. /*移除HTML标签代码*/
  103. removeHTMLTag(str) {
  104. str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag
  105. str = str.replace(/[ | ]*\n/g, ''); //去除行尾空白
  106. str = str.replace(/\n[\s| | ]*\r/g, ''); //去除多余空行
  107. str = str.replace(/&nbsp;/ig, ''); //去掉空格
  108. return str;
  109. },
  110. //转意符换成普通字符
  111. escape2Html(str) {
  112. var arrEntities = {
  113. 'lt': '<',
  114. 'gt': '>',
  115. 'nbsp': ' ',
  116. 'amp': '&',
  117. 'quot': '"'
  118. };
  119. return str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function(all, t) {
  120. return arrEntities[t];
  121. });
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="scss">
  127. .doto-inner{
  128. margin: 0rpx 0;
  129. //display: flex;
  130. //flex-wrap: wrap; //flex-wrap 设置当项目在容器中一行无法显示的时候如何处理。 nowrap 不换行 wrap://正常换行 wrap-reverse:向上换行,第一行位于下方
  131. .cell{
  132. padding-top: 22rpx;
  133. // margin-bottom: 16rpx;
  134. }
  135. .item{
  136. display: flex;
  137. flex-direction: row;
  138. align-items: center;
  139. justify-content: space-between;
  140. padding-bottom: 20rpx;
  141. .leftContent{
  142. width: calc(90% - 38rpx);
  143. .top{
  144. display: flex;
  145. flex-direction: row;
  146. }
  147. .icon{
  148. width: 28rpx;
  149. height: 28rpx;
  150. margin-left: 21rpx;
  151. margin-top: 10rpx;
  152. }
  153. .content{
  154. color: #111;
  155. font-size: 30rpx;
  156. margin-left: 20rpx;
  157. font-weight: 400;
  158. }
  159. .date{
  160. margin-top: 22rpx;
  161. font-size: 22rpx;
  162. color: #999;
  163. margin-left: 66rpx;
  164. }
  165. }
  166. .rightContent{
  167. display: flex;
  168. align-items: center;
  169. .state{
  170. // width: 92rpx;
  171. // height: 40rpx;
  172. // background-color: #eeeeee;
  173. // border-radius: 8rpx;
  174. font-size: 24rpx;
  175. text-align: center;
  176. color: #F79912;
  177. }
  178. .dstate{
  179. // width: 92rpx;
  180. // height: 40rpx;
  181. // background-color: #eeeeee;
  182. // border-radius: 8rpx;
  183. font-size: 24rpx;
  184. text-align: center;
  185. color: #FF5C03;
  186. }
  187. }
  188. }
  189. }
  190. </style>