content.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view class="oa-notice-detail">
  3. <view class="covers-body covers-uploader oa-uploader">
  4. <view>
  5. <view style="text-align: center;font-size: 1.2rem;">{{content.tatle}}</view>
  6. <view class="u-border-bottom">
  7. <span>发布人:{{content.createBy || '无'}}</span><span style="margin-left: 1rem;">发布时间:{{content.createTime | time}}</span>
  8. </view>
  9. <!-- <u-line class="u-line"></u-line> -->
  10. <view class="input-title">
  11. <mp-html :content="content.fileDetails" />
  12. <!-- <view class="input-content" v-html="content.fileDetails"></view> -->
  13. </view>
  14. </view>
  15. </view>
  16. <view class="covers-body covers-uploader oa-uploader" v-if="file.length>0">
  17. <view class="input-title">
  18. <view>附件:</view>
  19. <view class="uni-uploader">
  20. <view class="uni-uploader-body" v-for="(item,i) in file" :key="i">
  21. <view class="uni-uploader_files" @click="showFile(item.path)">
  22. <block>
  23. <view class="uni-uploader__file" style="position: relative;">
  24. {{item.name}}
  25. </view>
  26. </block>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import moment from '@/common/moment';
  36. import mpHtml from '@/components/mp-html/mp-html'
  37. export default {
  38. components:{
  39. mpHtml
  40. },
  41. data() {
  42. return {
  43. id: '',
  44. content: {},
  45. file: {},
  46. ismine: false,
  47. }
  48. },
  49. filters: {
  50. time(val) {
  51. var date = new Date(val);
  52. // return moment(date).format('YYYY-MM-DD HH:mm:ss');
  53. return moment(date).format('YYYY-MM-DD HH:mm');
  54. }
  55. },
  56. onLoad: function(opt) {
  57. this.id = opt.id;
  58. this.initData();
  59. },
  60. methods: {
  61. // 数据初始化
  62. initData() {
  63. this.getContent();
  64. uni.setNavigationBarColor({
  65. frontColor: '#ffffff',
  66. backgroundColor: this.themeColor.color,
  67. animation: {
  68. duration: 400,
  69. timingFunc: 'easeIn'
  70. }
  71. })
  72. },
  73. getContent() {
  74. var url = this.$mConfig.baseUrl + '/system/mes/' + this.id;
  75. var token = this.$preToken + ' ' + this.$store.state.accessToken;
  76. var that = this;
  77. this.$http.request({
  78. url: url,
  79. header: {
  80. 'content-type': 'application/json',
  81. 'Authorization': token
  82. }
  83. }).then(r => {
  84. if (r.code == "200") {
  85. that.content = r.data;
  86. var arr = [];
  87. if (r.data.remark) var contentfilelist = r.data.remark.split(',');
  88. else var contentfilelist = [];
  89. for (var i = 0; i < contentfilelist.length; i++) {
  90. arr.push({
  91. "name": contentfilelist[i],
  92. "path": r.data.putFilePath.split(',')[i]
  93. });
  94. }
  95. that.file = arr;
  96. } else {
  97. }
  98. })
  99. },
  100. showFile(path) {
  101. var type = path.split('.')[1].toLocaleLowerCase();
  102. var url = this.$mConfig.baseUrl + path;
  103. if (type == 'jpg' || type == 'jpeg' || type == 'bmp' || type == 'gif' || type == 'png') {
  104. var arr = [];
  105. arr.push(url);
  106. uni.previewImage({
  107. urls: arr
  108. });
  109. } else if (type == 'doc' || type == 'xls' || type == 'ppt' || type == 'pdf' || type == 'docx' || type ==
  110. 'xlsx' || type == 'pptx') {
  111. uni.downloadFile({
  112. url: url,
  113. success: function(res) {
  114. var filePath = res.tempFilePath;
  115. uni.openDocument({
  116. filePath: filePath,
  117. success: function(res) {
  118. console.log(res);
  119. }
  120. });
  121. }
  122. });
  123. } else {
  124. uni.downloadFile({
  125. url: url,
  126. success: (res) => {
  127. if (res.statusCode === 200) {
  128. var tempFilePaths = res.tempFilePath;
  129. uni.saveFile({
  130. tempFilePath: tempFilePaths[0],
  131. success: function(res) {
  132. var savedFilePath = res.savedFilePath;
  133. toastMsg('success', "已保存文件至:" + savedFilePath);
  134. }
  135. });
  136. }
  137. }
  138. })
  139. }
  140. },
  141. handleWorksOperation(path) {
  142. var url = this.$mConfig.baseUrl + path;
  143. var qianshouUrl = this.$mConfig.baseUrl + '/fw/submitToDoItem/' + this.taskid;
  144. var token = this.$preToken + ' ' + this.$store.state.accessToken;
  145. var that = this;
  146. this.$http.request({
  147. url: url,
  148. method: "POST",
  149. header: {
  150. 'content-type': 'application/json',
  151. 'Authorization': token
  152. },
  153. params: {
  154. id: that.id
  155. }
  156. }).then(r => {
  157. if (r.code = "200") {
  158. this.$http.request({
  159. url: qianshouUrl,
  160. method: "PUT",
  161. header: {
  162. 'content-type': 'application/json',
  163. 'Authorization': token
  164. },
  165. data: {
  166. SelectUserType: "end",
  167. sendUser: "",
  168. sendUserRealName: ""
  169. }
  170. }).then(res => {
  171. if (res.code == "200") {
  172. that.qianshou = true;
  173. that.content.updateTime = new Date();
  174. }
  175. })
  176. }
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .oa-notice-detail {
  184. .uni-timeline {
  185. padding: $spacing-lg;
  186. background-color: $color-white;
  187. }
  188. .feedback-title {
  189. display: flex;
  190. flex-direction: row;
  191. justify-content: space-between;
  192. align-items: center;
  193. padding: $spacing-base;
  194. margin-top: $spacing-base;
  195. font-size: $font-base;
  196. }
  197. .feedback-star-view.feedback-title {
  198. justify-content: flex-start;
  199. margin: 0;
  200. }
  201. .feedback-quick {
  202. position: relative;
  203. padding-right: 40upx;
  204. .iconfont {
  205. font-size: $font-sm;
  206. }
  207. }
  208. .u-border-bottom{
  209. border-bottom:1px solid #E5E5E5;
  210. text-align: center;
  211. margin-top: 10px;
  212. font-size: 0.9rem;
  213. color: #999;
  214. }
  215. .feedback-body {
  216. background: $color-white;
  217. padding: $spacing-sm $spacing-base;
  218. .gender-item {
  219. margin-right: 20upx;
  220. .gender-item-text {
  221. padding-left: 10upx;
  222. }
  223. radio .wx-radio-input.wx-radio-input-checked {
  224. background: $uni-color-primary;
  225. border-color: $uni-color-primary;
  226. }
  227. }
  228. }
  229. .feedback-textare {
  230. height: 200upx;
  231. font-size: 34upx;
  232. line-height: 50upx;
  233. width: 100%;
  234. box-sizing: border-box;
  235. padding: 20upx 30upx 0;
  236. }
  237. .footer {
  238. position: fixed;
  239. left: 0;
  240. bottom: 0;
  241. z-index: 98;
  242. width: 100%;
  243. background-color: $color-white;
  244. color: $font-color-base;
  245. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  246. display: flex;
  247. justify-content: flex-end;
  248. align-items: center;
  249. padding: 15upx $spacing-base;
  250. .action-btn {
  251. font-size: $font-sm;
  252. margin: 0 0 0 15upx;
  253. padding: 0 $spacing-lg;
  254. text-align: center;
  255. height: 60upx;
  256. line-height: 60upx;
  257. }
  258. }
  259. .banner {
  260. overflow: hidden;
  261. position: relative;
  262. background-color: #ccc;
  263. .banner-img {
  264. height: 300upx;
  265. width: 100%;
  266. }
  267. .banner-title {
  268. max-height: 84upx;
  269. overflow: hidden;
  270. position: absolute;
  271. bottom: 0;
  272. width: 100%;
  273. font-size: 32upx;
  274. font-weight: 400;
  275. line-height: 42upx;
  276. color: white;
  277. z-index: 11;
  278. background-color: rgba(0, 0, 0, 0.25);
  279. padding: 4upx 20upx;
  280. }
  281. }
  282. .banner-title {
  283. padding: $spacing-lg $spacing-lg 0;
  284. font-size: $font-lg;
  285. }
  286. .article-meta {
  287. padding: 20upx 40upx;
  288. display: flex;
  289. flex-direction: row;
  290. justify-content: flex-start;
  291. color: gray;
  292. .article-text {
  293. font-size: 26upx;
  294. line-height: 50upx;
  295. margin: 0 20upx;
  296. }
  297. .article-author,
  298. .article-time {
  299. font-size: 30upx;
  300. }
  301. }
  302. .article-content {
  303. padding: 0 30upx;
  304. overflow: hidden;
  305. font-size: 30upx;
  306. margin-bottom: 30upx;
  307. }
  308. .input-title {
  309. display: flex;
  310. flex-direction: row;
  311. justify-content: space-between;
  312. align-items: center;
  313. padding: $spacing-base;
  314. margin-top: $spacing-base;
  315. font-size: $font-base;
  316. }
  317. .input-body {
  318. background: $color-white;
  319. padding: $spacing-sm $spacing-base;
  320. }
  321. .covers-title {
  322. display: flex;
  323. flex-direction: row;
  324. justify-content: space-between;
  325. align-items: center;
  326. padding: $spacing-base;
  327. margin-top: $spacing-base;
  328. font-size: $font-base;
  329. }
  330. .covers-body {
  331. background: $color-white;
  332. padding: $spacing-sm $spacing-base;
  333. .gender-item {
  334. margin-right: 20upx;
  335. .gender-item-text {
  336. padding-left: 10upx;
  337. }
  338. radio .wx-radio-input.wx-radio-input-checked {
  339. background: $uni-color-primary;
  340. border-color: $uni-color-primary;
  341. }
  342. }
  343. }
  344. .covers-uploader {
  345. padding: 22upx 20upx;
  346. margin: 22upx 20upx;
  347. }
  348. }
  349. .input-content {
  350. overflow: hidden;
  351. width: 100%;
  352. }
  353. .input-content /deep/ img {
  354. max-width: 100%;
  355. }
  356. </style>