AddArticle.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <style lang="scss" scoped>
  2. .preview {
  3. .aname{
  4. text-align: center;
  5. margin-bottom: 20px;
  6. color: #333;
  7. font-size: 16px;
  8. }
  9. .ainfo{
  10. display: flex;
  11. margin-bottom: 10px;
  12. p{
  13. width: 60%;
  14. margin-left: 15px;
  15. line-height: 26px;
  16. }
  17. }
  18. b{
  19. color: #333;
  20. }
  21. div{
  22. line-height: 26px;
  23. margin-bottom: 10px;
  24. overflow: auto;
  25. }
  26. }
  27. .content .title {
  28. height: 32px;
  29. font-size: 14px;
  30. font-weight: bold;
  31. color: #333333;
  32. border-bottom: 1px solid #d8d8d8;
  33. margin-bottom: 25px;
  34. }
  35. .el-form {
  36. font-size: 14px;
  37. font-weight: 400;
  38. color: #666666;
  39. .el-select,
  40. .el-range-editor--small.el-input__inner {
  41. width: 100%;
  42. }
  43. }
  44. /deep/.el-tabs__header {
  45. margin: 0;
  46. .el-tabs__active-bar {
  47. height: 0px;
  48. }
  49. .el-tabs__item {
  50. width: 160px;
  51. height: 40px;
  52. text-align: center;
  53. border-radius: 8px 8px 0px 0px;
  54. color: #333333;
  55. background: #ececec;
  56. margin-right: 10px;
  57. }
  58. .el-tabs__item.is-active {
  59. background: #3895fe;
  60. color: #ffffff;
  61. }
  62. }
  63. .el-button {
  64. width: 120px;
  65. height: 36px;
  66. }
  67. // 上传
  68. /deep/.avatar-uploader .el-upload {
  69. width: 148px;
  70. height: 148px;
  71. line-height: 148px;
  72. border: 1px dashed #d9d9d9;
  73. border-radius: 6px;
  74. cursor: pointer;
  75. position: relative;
  76. overflow: hidden;
  77. .avatar {
  78. width: 100%;
  79. height: 100%;
  80. }
  81. }
  82. .avatar-uploader .el-upload:hover {
  83. border-color: #409eff;
  84. }
  85. .avatar-uploader-icon {
  86. font-size: 28px;
  87. color: #8c939d;
  88. width: 68px;
  89. height: 68px;
  90. line-height: 68px;
  91. text-align: center;
  92. }
  93. .avatar {
  94. width: 68px;
  95. height: 68px;
  96. display: block;
  97. }
  98. /deep/.speaker_avatar .el-upload {
  99. width: 80px;
  100. height: 80px;
  101. line-height: 80px;
  102. }
  103. .hotel_imgs {
  104. /deep/.el-upload--picture-card {
  105. width: 79px;
  106. height: 79px;
  107. line-height: 79px;
  108. }
  109. }
  110. </style>
  111. <template>
  112. <section>
  113. <p><span>作业管理></span>查看作业</p>
  114. <div class="content" v-loading='loading' element-loading-background="rgba(0, 0, 0, 0)">
  115. <el-form ref="form" :model="form" label-width="80px">
  116. <el-row :gutter="10">
  117. <el-col :span="12">
  118. <el-form-item label="作业名称">
  119. <el-input v-model="form.filename" placeholder=""></el-input>
  120. </el-form-item>
  121. </el-col>
  122. <el-col :span="12">
  123. <a :href="form.dlink" target="_blank"><el-button type="primary">下載</el-button></a>
  124. </el-col>
  125. </el-row>
  126. <el-row :gutter="10">
  127. <el-col :span="12">
  128. <el-form-item label="狀態">
  129. <el-select v-model="form.status" placeholder="">
  130. <el-option label="未批改" :value="0"></el-option>
  131. <el-option label="已批改" :value="1"></el-option>
  132. </el-select>
  133. </el-form-item>
  134. </el-col>
  135. </el-row>
  136. <el-row :gutter="10">
  137. <el-col :span="4" :offset="20">
  138. <el-button type="primary" @click="save">保存</el-button>
  139. <el-button type="normal" @click='$router.go(-1)'>返回</el-button>
  140. </el-col>
  141. </el-row>
  142. </el-form>
  143. </div>
  144. </section>
  145. </template>
  146. <script>
  147. export default {
  148. components: {
  149. },
  150. data() {
  151. return {
  152. loading:false,
  153. form:{}
  154. };
  155. },
  156. methods: {
  157. getData(){
  158. let id = this.$route.query.id;
  159. if (id) {
  160. this.loading = true;
  161. this.$api.getHomeWorkInfo({ id: id }).then((res) => {
  162. this.form = res.data.data;
  163. this.$api.getWorkInfo({fsid:res.data.data.fs_id}).then((res)=>{
  164. this.form.dlink = res.data.data.dlink;
  165. this.loading = false;
  166. })
  167. });
  168. }
  169. },
  170. save(status) {
  171. let id = this.$route.query.id;
  172. let parm = this.form;
  173. this.$refs["form"].validate((valid) => {
  174. if (valid) {
  175. if (id) {
  176. parm.id = id;
  177. parm.status = String(parm.status)
  178. this.$api.updateHomeWork(parm).then((res) => {
  179. if (res.data.code == 0) {
  180. this.$message({
  181. type: "success",
  182. message: status==1?"保存成功!":"发布成功!",
  183. });
  184. this.$router.go(-1)
  185. } else {
  186. this.$message.error(status==1?"保存失败!":"发布失败!");
  187. }
  188. });
  189. }
  190. } else {
  191. this.$message.error("有必填项没有填!");
  192. }
  193. });
  194. },
  195. },
  196. created() {
  197. this.getData()
  198. },
  199. };
  200. </script>