执行过npm install命令的vue-element-admin源码
康凯
2022-05-20 aa4c235a8ca67ea8b731f90c951a465e92c0a865
1
{"remainingRequest":"D:\\源码\\vue-element-admin-master\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\源码\\vue-element-admin-master\\src\\views\\example\\components\\ArticleDetail.vue?vue&type=style&index=0&id=53a465a6&lang=scss&scoped=true&","dependencies":[{"path":"D:\\源码\\vue-element-admin-master\\src\\views\\example\\components\\ArticleDetail.vue","mtime":1649647926000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\css-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\postcss-loader\\src\\index.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\sass-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\源码\\vue-element-admin-master\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKQGltcG9ydCAifkAvc3R5bGVzL21peGluLnNjc3MiOwoKLmNyZWF0ZVBvc3QtY29udGFpbmVyIHsKICBwb3NpdGlvbjogcmVsYXRpdmU7CgogIC5jcmVhdGVQb3N0LW1haW4tY29udGFpbmVyIHsKICAgIHBhZGRpbmc6IDQwcHggNDVweCAyMHB4IDUwcHg7CgogICAgLnBvc3RJbmZvLWNvbnRhaW5lciB7CiAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgQGluY2x1ZGUgY2xlYXJmaXg7CiAgICAgIG1hcmdpbi1ib3R0b206IDEwcHg7CgogICAgICAucG9zdEluZm8tY29udGFpbmVyLWl0ZW0gewogICAgICAgIGZsb2F0OiBsZWZ0OwogICAgICB9CiAgICB9CiAgfQoKICAud29yZC1jb3VudGVyIHsKICAgIHdpZHRoOiA0MHB4OwogICAgcG9zaXRpb246IGFic29sdXRlOwogICAgcmlnaHQ6IDEwcHg7CiAgICB0b3A6IDBweDsKICB9Cn0KCi5hcnRpY2xlLXRleHRhcmVhIDo6di1kZWVwIHsKICB0ZXh0YXJlYSB7CiAgICBwYWRkaW5nLXJpZ2h0OiA0MHB4OwogICAgcmVzaXplOiBub25lOwogICAgYm9yZGVyOiBub25lOwogICAgYm9yZGVyLXJhZGl1czogMHB4OwogICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICNiZmNiZDk7CiAgfQp9Cg=="},{"version":3,"sources":["ArticleDetail.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4PA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"ArticleDetail.vue","sourceRoot":"src/views/example/components","sourcesContent":["<template>\n  <div class=\"createPost-container\">\n    <el-form ref=\"postForm\" :model=\"postForm\" :rules=\"rules\" class=\"form-container\">\n\n      <sticky :z-index=\"10\" :class-name=\"'sub-navbar '+postForm.status\">\n        <CommentDropdown v-model=\"postForm.comment_disabled\" />\n        <PlatformDropdown v-model=\"postForm.platforms\" />\n        <SourceUrlDropdown v-model=\"postForm.source_uri\" />\n        <el-button v-loading=\"loading\" style=\"margin-left: 10px;\" type=\"success\" @click=\"submitForm\">\n          Publish\n        </el-button>\n        <el-button v-loading=\"loading\" type=\"warning\" @click=\"draftForm\">\n          Draft\n        </el-button>\n      </sticky>\n\n      <div class=\"createPost-main-container\">\n        <el-row>\n          <Warning />\n\n          <el-col :span=\"24\">\n            <el-form-item style=\"margin-bottom: 40px;\" prop=\"title\">\n              <MDinput v-model=\"postForm.title\" :maxlength=\"100\" name=\"name\" required>\n                Title\n              </MDinput>\n            </el-form-item>\n\n            <div class=\"postInfo-container\">\n              <el-row>\n                <el-col :span=\"8\">\n                  <el-form-item label-width=\"60px\" label=\"Author:\" class=\"postInfo-container-item\">\n                    <el-select v-model=\"postForm.author\" :remote-method=\"getRemoteUserList\" filterable default-first-option remote placeholder=\"Search user\">\n                      <el-option v-for=\"(item,index) in userListOptions\" :key=\"item+index\" :label=\"item\" :value=\"item\" />\n                    </el-select>\n                  </el-form-item>\n                </el-col>\n\n                <el-col :span=\"10\">\n                  <el-form-item label-width=\"120px\" label=\"Publish Time:\" class=\"postInfo-container-item\">\n                    <el-date-picker v-model=\"displayTime\" type=\"datetime\" format=\"yyyy-MM-dd HH:mm:ss\" placeholder=\"Select date and time\" />\n                  </el-form-item>\n                </el-col>\n\n                <el-col :span=\"6\">\n                  <el-form-item label-width=\"90px\" label=\"Importance:\" class=\"postInfo-container-item\">\n                    <el-rate\n                      v-model=\"postForm.importance\"\n                      :max=\"3\"\n                      :colors=\"['#99A9BF', '#F7BA2A', '#FF9900']\"\n                      :low-threshold=\"1\"\n                      :high-threshold=\"3\"\n                      style=\"display:inline-block\"\n                    />\n                  </el-form-item>\n                </el-col>\n              </el-row>\n            </div>\n          </el-col>\n        </el-row>\n\n        <el-form-item style=\"margin-bottom: 40px;\" label-width=\"70px\" label=\"Summary:\">\n          <el-input v-model=\"postForm.content_short\" :rows=\"1\" type=\"textarea\" class=\"article-textarea\" autosize placeholder=\"Please enter the content\" />\n          <span v-show=\"contentShortLength\" class=\"word-counter\">{{ contentShortLength }}words</span>\n        </el-form-item>\n\n        <el-form-item prop=\"content\" style=\"margin-bottom: 30px;\">\n          <Tinymce ref=\"editor\" v-model=\"postForm.content\" :height=\"400\" />\n        </el-form-item>\n\n        <el-form-item prop=\"image_uri\" style=\"margin-bottom: 30px;\">\n          <Upload v-model=\"postForm.image_uri\" />\n        </el-form-item>\n      </div>\n    </el-form>\n  </div>\n</template>\n\n<script>\nimport Tinymce from '@/components/Tinymce'\nimport Upload from '@/components/Upload/SingleImage3'\nimport MDinput from '@/components/MDinput'\nimport Sticky from '@/components/Sticky' // 粘性header组件\nimport { validURL } from '@/utils/validate'\nimport { fetchArticle } from '@/api/article'\nimport { searchUser } from '@/api/remote-search'\nimport Warning from './Warning'\nimport { CommentDropdown, PlatformDropdown, SourceUrlDropdown } from './Dropdown'\n\nconst defaultForm = {\n  status: 'draft',\n  title: '', // 文章题目\n  content: '', // 文章内容\n  content_short: '', // 文章摘要\n  source_uri: '', // 文章外链\n  image_uri: '', // 文章图片\n  display_time: undefined, // 前台展示时间\n  id: undefined,\n  platforms: ['a-platform'],\n  comment_disabled: false,\n  importance: 0\n}\n\nexport default {\n  name: 'ArticleDetail',\n  components: { Tinymce, MDinput, Upload, Sticky, Warning, CommentDropdown, PlatformDropdown, SourceUrlDropdown },\n  props: {\n    isEdit: {\n      type: Boolean,\n      default: false\n    }\n  },\n  data() {\n    const validateRequire = (rule, value, callback) => {\n      if (value === '') {\n        this.$message({\n          message: rule.field + '为必传项',\n          type: 'error'\n        })\n        callback(new Error(rule.field + '为必传项'))\n      } else {\n        callback()\n      }\n    }\n    const validateSourceUri = (rule, value, callback) => {\n      if (value) {\n        if (validURL(value)) {\n          callback()\n        } else {\n          this.$message({\n            message: '外链url填写不正确',\n            type: 'error'\n          })\n          callback(new Error('外链url填写不正确'))\n        }\n      } else {\n        callback()\n      }\n    }\n    return {\n      postForm: Object.assign({}, defaultForm),\n      loading: false,\n      userListOptions: [],\n      rules: {\n        image_uri: [{ validator: validateRequire }],\n        title: [{ validator: validateRequire }],\n        content: [{ validator: validateRequire }],\n        source_uri: [{ validator: validateSourceUri, trigger: 'blur' }]\n      },\n      tempRoute: {}\n    }\n  },\n  computed: {\n    contentShortLength() {\n      return this.postForm.content_short.length\n    },\n    displayTime: {\n      // set and get is useful when the data\n      // returned by the back end api is different from the front end\n      // back end return => \"2013-06-25 06:59:25\"\n      // front end need timestamp => 1372114765000\n      get() {\n        return (+new Date(this.postForm.display_time))\n      },\n      set(val) {\n        this.postForm.display_time = new Date(val)\n      }\n    }\n  },\n  created() {\n    if (this.isEdit) {\n      const id = this.$route.params && this.$route.params.id\n      this.fetchData(id)\n    }\n\n    // Why need to make a copy of this.$route here?\n    // Because if you enter this page and quickly switch tag, may be in the execution of the setTagsViewTitle function, this.$route is no longer pointing to the current page\n    // https://github.com/PanJiaChen/vue-element-admin/issues/1221\n    this.tempRoute = Object.assign({}, this.$route)\n  },\n  methods: {\n    fetchData(id) {\n      fetchArticle(id).then(response => {\n        this.postForm = response.data\n\n        // just for test\n        this.postForm.title += `   Article Id:${this.postForm.id}`\n        this.postForm.content_short += `   Article Id:${this.postForm.id}`\n\n        // set tagsview title\n        this.setTagsViewTitle()\n\n        // set page title\n        this.setPageTitle()\n      }).catch(err => {\n        console.log(err)\n      })\n    },\n    setTagsViewTitle() {\n      const title = 'Edit Article'\n      const route = Object.assign({}, this.tempRoute, { title: `${title}-${this.postForm.id}` })\n      this.$store.dispatch('tagsView/updateVisitedView', route)\n    },\n    setPageTitle() {\n      const title = 'Edit Article'\n      document.title = `${title} - ${this.postForm.id}`\n    },\n    submitForm() {\n      console.log(this.postForm)\n      this.$refs.postForm.validate(valid => {\n        if (valid) {\n          this.loading = true\n          this.$notify({\n            title: '成功',\n            message: '发布文章成功',\n            type: 'success',\n            duration: 2000\n          })\n          this.postForm.status = 'published'\n          this.loading = false\n        } else {\n          console.log('error submit!!')\n          return false\n        }\n      })\n    },\n    draftForm() {\n      if (this.postForm.content.length === 0 || this.postForm.title.length === 0) {\n        this.$message({\n          message: '请填写必要的标题和内容',\n          type: 'warning'\n        })\n        return\n      }\n      this.$message({\n        message: '保存成功',\n        type: 'success',\n        showClose: true,\n        duration: 1000\n      })\n      this.postForm.status = 'draft'\n    },\n    getRemoteUserList(query) {\n      searchUser(query).then(response => {\n        if (!response.data.items) return\n        this.userListOptions = response.data.items.map(v => v.name)\n      })\n    }\n  }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import \"~@/styles/mixin.scss\";\n\n.createPost-container {\n  position: relative;\n\n  .createPost-main-container {\n    padding: 40px 45px 20px 50px;\n\n    .postInfo-container {\n      position: relative;\n      @include clearfix;\n      margin-bottom: 10px;\n\n      .postInfo-container-item {\n        float: left;\n      }\n    }\n  }\n\n  .word-counter {\n    width: 40px;\n    position: absolute;\n    right: 10px;\n    top: 0px;\n  }\n}\n\n.article-textarea ::v-deep {\n  textarea {\n    padding-right: 40px;\n    resize: none;\n    border: none;\n    border-radius: 0px;\n    border-bottom: 1px solid #bfcbd9;\n  }\n}\n</style>\n"]}]}