Browse Source

Project Init

yigeren911 2 years ago
parent
commit
f67408fa69
6 changed files with 191 additions and 58 deletions
  1. 18 0
      .eslintignore
  2. 63 0
      .eslintrc.js
  3. 36 0
      .prettierrc.js
  4. 15 0
      plopfile.js
  5. 1 0
      src/assets/icons/community.svg
  6. 58 58
      src/views/backend/enterprise/community/index.vue

+ 18 - 0
.eslintignore

@@ -0,0 +1,18 @@
+
+*.sh
+node_modules
+lib
+*.md
+*.scss
+*.woff
+*.ttf
+.vscode
+.idea
+dist
+mock
+public
+bin
+build
+config
+index.html
+src/assets

+ 63 - 0
.eslintrc.js

@@ -0,0 +1,63 @@
+module.exports = {
+    root: true,
+    env: {
+        browser: true,
+        es2021: true,
+        node: true,
+    },
+    parser: 'vue-eslint-parser',
+    parserOptions: {
+        ecmaVersion: 12,
+        parser: '@typescript-eslint/parser',
+        sourceType: 'module',
+    },
+    extends: ['plugin:vue/vue3-essential', 'plugin:vue/essential', 'eslint:recommended'],
+    plugins: ['vue', '@typescript-eslint'],
+    rules: {
+        // http://eslint.cn/docs/rules/
+        // https://eslint.vuejs.org/rules/
+        '@type-eslint/ban-ts-ignore': 'off',
+        '@type-eslint/explicit-function-return-type': 'off',
+        '@type-eslint/no-explicit-any': 'off',
+        '@type-eslint/no-var-requires': 'off',
+        '@type-eslint/no-empty-function': 'off',
+        '@type-eslint/no-use-before-define': 'off',
+        '@type-eslint/ban-ts-comment': 'off',
+        '@type-eslint/ban-types': 'off',
+        '@type-eslint/no-non-null-assertion': 'off',
+        '@type-eslint/explicit-module-boundary-types': 'off',
+        'vue/custom-event-name-casing': 'off',
+        'vue/attributes-order': 'off',
+        'vue/one-component-per-file': 'off',
+        'vue/html-closing-bracket-newline': 'off',
+        'vue/max-attributes-per-line': 'off',
+        'vue/multiline-html-element-content-newline': 'off',
+        'vue/singleline-html-element-content-newline': 'off',
+        'vue/attribute-hyphenation': 'off',
+        'vue/html-self-closing': 'off',
+        'vue/no-multiple-template-root': 'off',
+        'vue/require-default-prop': 'off',
+        'vue/no-v-model-argument': 'off',
+        'vue/no-arrow-functions-in-watch': 'off',
+        'vue/no-template-key': 'off',
+        'vue/no-v-html': 'off',
+        'vue/comment-directive': 'off',
+        'vue/no-parsing-error': 'off',
+        'vue/no-deprecated-v-on-native-modifier': 'off',
+        'vue/multi-word-component-names': 'off',
+        'no-useless-escape': 'off',
+        'no-sparse-arrays': 'off',
+        'no-prototype-builtins': 'off',
+        'no-constant-condition': 'off',
+        'no-use-before-define': 'off',
+        'no-restricted-globals': 'off',
+        'no-restricted-syntax': 'off',
+        'generator-star-spacing': 'off',
+        'no-unreachable': 'off',
+        'no-multiple-template-root': 'off',
+        'no-unused-vars': 'error',
+        'no-v-model-argument': 'off',
+        'no-case-declarations': 'off',
+        'no-console': 'off',
+    },
+}

+ 36 - 0
.prettierrc.js

@@ -0,0 +1,36 @@
+module.exports = {
+    printWidth: 150,
+    // 指定每个缩进级别的空格数
+    tabWidth: 4,
+    // 使用制表符而不是空格缩进行
+    useTabs: false,
+    // 在语句末尾打印分号
+    semi: false,
+    // 使用单引号而不是双引号
+    singleQuote: true,
+    // 更改引用对象属性的时间 可选值"<as-needed|consistent|preserve>"
+    quoteProps: 'as-needed',
+    // 在JSX中使用单引号而不是双引号
+    jsxSingleQuote: false,
+    // 多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"<none|es5|all>",默认none
+    trailingComma: 'es5',
+    // 在对象文字中的括号之间打印空格
+    bracketSpacing: true,
+    // 在单独的箭头函数参数周围包括括号 always:(x) => x \ avoid:x => x
+    arrowParens: 'always',
+    // 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码
+    rangeStart: 0,
+    rangeEnd: Infinity,
+    // 指定要使用的解析器,不需要写文件开头的 @prettier
+    requirePragma: false,
+    // 不需要自动在文件开头插入 @prettier
+    insertPragma: false,
+    // 使用默认的折行标准 always\never\preserve
+    proseWrap: 'preserve',
+    // 指定HTML文件的全局空格敏感度 css\strict\ignore
+    htmlWhitespaceSensitivity: 'css',
+    // Vue文件脚本和样式标签缩进
+    vueIndentScriptAndStyle: false,
+    // 换行符使用 lf 结尾是 可选值"<auto|lf|crlf|cr>"
+    endOfLine: 'lf',
+}

+ 15 - 0
plopfile.js

@@ -0,0 +1,15 @@
+/*
+ * @Description:: 请补充填写
+ * @Version: 请配置版本号
+ * @Author: 舟舟
+ * @Date: 2022-07-31 09:12:48
+ * @LastEditors: 舟舟
+ * @LastEditTime: 2022-07-31 09:18:05
+ * @FilePath: /ouicai_web_framework_vite_ep_nolang/plopfile.js
+ */
+const routerGenerator = require('./plop-templates/view/prompt');	//指定一个模块目录(根据自己目录)
+
+module.exports = function (plop) {
+    plop.setGenerator('view', routerGenerator);//引入模块,可以多个
+    //如果模块多个,启动时,控制台可以选择
+};

+ 1 - 0
src/assets/icons/community.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1680954564949" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2712" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M934.595 924.661V573.725L700.608 368.817V47.321H115.684v877.34H57.255v58.52h936.13v-58.52z m-292.507 0H174.204v-818.82h467.884z m233.988 0H700.608V462.376l175.378 146.48zM525.14 339.828H291.152v58.43H525.14z m0 175.468H291.152v58.43H525.14z m0 175.468H291.152v58.79H525.14z m292.416 0h-58.429v58.79h58.43z" p-id="2713"></path></svg>

+ 58 - 58
src/views/backend/enterprise/community/index.vue

@@ -1,111 +1,111 @@
 <template>
     <div class="default-main ba-table-box">
         <el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info"
-                  show-icon/>
+                  show-icon />
         <el-row>
             <el-col :span="24">
                 <!-- 表格顶部菜单 -->
                 <TableHeader :buttons="['refresh', 'add', 'edit', 'delete', 'comSearch']"
                              quick-search-placeholder="通过标题模糊搜索"
-                             @action="baTable.onTableHeaderAction"/>
+                             @action="baTable.onTableHeaderAction" />
                 <!-- 表格 -->
                 <!-- 要使用`el-table`组件原有的属性,直接加在Table标签上即可 -->
-                <Table @action="baTable.onTableAction"/>
+                <Table @action="baTable.onTableAction" />
 
             </el-col>
         </el-row>
 
         <!-- 表单 -->
-        <PopupForm ref="formRef"/>
+        <PopupForm ref="formRef" />
 
     </div>
 </template>
 
 <script setup>
-import {ref, onMounted, provide} from 'vue'
-import {advertisement, document} from '/@/api/controllerUrls'
-import Table from '/@/components/table/index.vue'
-import TableHeader from '/@/components/table/header/index.vue'
-import PopupForm from './popupForm.vue'
-import {baTableApi} from '/@/api/common'
-import baTableClass from '/@/utils/baTable'
+import { ref, onMounted, provide } from "vue";
+import { advertisement, document } from "/@/api/controllerUrls";
+import Table from "/@/components/table/index.vue";
+import TableHeader from "/@/components/table/header/index.vue";
+import PopupForm from "./popupForm.vue";
+import { baTableApi } from "/@/api/common";
+import baTableClass from "/@/utils/baTable";
 import { defaultOptButtons } from "/@/components/table";
 
 
 const baTable = new baTableClass(
     new baTableApi(advertisement),
     {
-        dblClickNotEditColumn: [undefined, 'status'],
+        dblClickNotEditColumn: [undefined, "status"],
         column: [
-            {type: 'selection', align: 'center', operator: false},
-            {label: '标题', prop: 'adTitle', align: 'left', operator: 'LIKE'},
+            { type: "selection", align: "center", operator: false },
+            { label: "标题", prop: "adTitle", align: "left", operator: "LIKE" },
             {
-                label: '场景',
-                prop: 'sceneType',
-                align: 'center',
-                width: '120',
-                render: 'tag',
-                operator: '=',
-                replaceValue:{0:'开机',1:'轮播'}
+                label: "场景",
+                prop: "sceneType",
+                align: "center",
+                width: "120",
+                render: "tag",
+                operator: "=",
+                replaceValue: { 0: "开机", 1: "轮播" }
             },
             {
-                label: '类型',
-                prop: 'adType',
-                align: 'center',
-                width: '120',
-                render: 'tag',
-                operator: '=',
-                custom: { 0: '', 1: '' ,2:''},
-                replaceValue:{0:'展示',1:'推广',2:'好物'}
+                label: "类型",
+                prop: "adType",
+                align: "center",
+                width: "120",
+                render: "tag",
+                operator: "=",
+                custom: { 0: "", 1: "", 2: "" },
+                replaceValue: { 0: "展示", 1: "推广", 2: "好物" }
             },
             {
-                label: '曝光量',
-                prop: 'viewCount',
-                align: 'center',
-                width: '120',
+                label: "曝光量",
+                prop: "viewCount",
+                align: "center",
+                width: "120",
                 operator: false
             },
             {
-                label: '是否上架',
-                prop: 'adStatus',
-                align: 'center',
-                width: '120',
-                render: 'tag',
-                operator: '=',
-                custom: { 0: 'success', 1: 'info' },
-                replaceValue:{0:'上架',1:'下架'}
+                label: "是否上架",
+                prop: "adStatus",
+                align: "center",
+                width: "120",
+                render: "tag",
+                operator: "=",
+                custom: { 0: "success", 1: "info" },
+                replaceValue: { 0: "上架", 1: "下架" }
             },
-            {label: '创建人', prop: 'creatorName', align: 'center', width: '120', operator: false},
-            {label: '创建时间', prop: 'createTime', align: 'center', width: '160', operator: false},
+            { label: "创建人", prop: "creatorName", align: "center", width: "120", operator: false },
+            { label: "创建时间", prop: "createTime", align: "center", width: "160", operator: false },
             {
-                label: '操作',
-                align: 'center',
-                width: '160',
-                render: 'buttons',
+                label: "操作",
+                align: "center",
+                width: "160",
+                render: "buttons",
                 buttons: defaultOptButtons(),
                 operator: false
-            },
-        ],
+            }
+        ]
     },
     {
         defaultItems: {
-            sceneType:0
-        },
+            sceneType: 0
+        }
     },
     {
         // 获得编辑数据后
         requestEdit: () => {
-            if (baTable.form.items && !baTable.form.items.icon) baTable.form.items.icon = 'el-icon-Minus'
-        },
+            if (baTable.form.items && !baTable.form.items.icon) baTable.form.items.icon = "el-icon-Minus";
+        }
     }
-)
+);
 
 
-provide('baTable', baTable)
+provide("baTable", baTable);
 onMounted(() => {
-    baTable.mount()
-    baTable.getIndex()
-})
+    baTable.mount();
+    baTable.getIndex();
+});
 
 
 </script>