Przeglądaj źródła

服务案例

gzb
guozhongbo 1 rok temu
rodzic
commit
0ed3b96894
5 zmienionych plików z 251 dodań i 6 usunięć
  1. 46
    0
      package-lock.json
  2. 1
    0
      package.json
  3. 28
    0
      src/api/index.js
  4. 10
    2
      src/main.js
  5. 166
    4
      src/views/service/index.vue

+ 46
- 0
package-lock.json Wyświetl plik

@@ -8,6 +8,7 @@
8 8
       "name": "schoolweb",
9 9
       "version": "3.3.0",
10 10
       "dependencies": {
11
+        "v-viewer": "^1.6.4",
11 12
         "vue-simple-uploader": "^0.7.6"
12 13
       },
13 14
       "devDependencies": {
@@ -10403,6 +10404,14 @@
10403 10404
         "node": ">= 10.13.0"
10404 10405
       }
10405 10406
     },
10407
+    "node_modules/throttle-debounce": {
10408
+      "version": "2.3.0",
10409
+      "resolved": "https://registry.npmmirror.com/throttle-debounce/-/throttle-debounce-2.3.0.tgz",
10410
+      "integrity": "sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ==",
10411
+      "engines": {
10412
+        "node": ">=8"
10413
+      }
10414
+    },
10406 10415
     "node_modules/thunky": {
10407 10416
       "version": "1.1.0",
10408 10417
       "resolved": "https://registry.npmmirror.com/thunky/-/thunky-1.1.0.tgz",
@@ -10577,6 +10586,19 @@
10577 10586
         "node": ">= 0.4.0"
10578 10587
       }
10579 10588
     },
10589
+    "node_modules/v-viewer": {
10590
+      "version": "1.6.4",
10591
+      "resolved": "https://registry.npmmirror.com/v-viewer/-/v-viewer-1.6.4.tgz",
10592
+      "integrity": "sha512-LVkiUHpmsbsZXebeNXnu8krRCi5i2n07FeLFxoIVGhw8lVvTBO0ffpbDC6mLEuacCjrIh09HjIqpciwUtWE8lQ==",
10593
+      "dependencies": {
10594
+        "throttle-debounce": "^2.0.1",
10595
+        "viewerjs": "^1.5.0"
10596
+      },
10597
+      "engines": {
10598
+        "node": ">=4",
10599
+        "npm": ">=3"
10600
+      }
10601
+    },
10580 10602
     "node_modules/v8-compile-cache": {
10581 10603
       "version": "2.3.0",
10582 10604
       "resolved": "https://registry.npmmirror.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
@@ -10602,6 +10624,11 @@
10602 10624
         "node": ">= 0.8"
10603 10625
       }
10604 10626
     },
10627
+    "node_modules/viewerjs": {
10628
+      "version": "1.11.3",
10629
+      "resolved": "https://registry.npmmirror.com/viewerjs/-/viewerjs-1.11.3.tgz",
10630
+      "integrity": "sha512-efG3U61Umuj/1x6JAtdvnY9m407C/RkrkFilsMcLEWKDivpjNU3/FeL+feCY1Vkur9aQeBJ+z6K4CCPP7hv6vA=="
10631
+    },
10605 10632
     "node_modules/vue": {
10606 10633
       "version": "2.6.11",
10607 10634
       "resolved": "https://registry.npm.taobao.org/vue/download/vue-2.6.11.tgz",
@@ -19674,6 +19701,11 @@
19674 19701
         }
19675 19702
       }
19676 19703
     },
19704
+    "throttle-debounce": {
19705
+      "version": "2.3.0",
19706
+      "resolved": "https://registry.npmmirror.com/throttle-debounce/-/throttle-debounce-2.3.0.tgz",
19707
+      "integrity": "sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ=="
19708
+    },
19677 19709
     "thunky": {
19678 19710
       "version": "1.1.0",
19679 19711
       "resolved": "https://registry.npmmirror.com/thunky/-/thunky-1.1.0.tgz",
@@ -19806,6 +19838,15 @@
19806 19838
       "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
19807 19839
       "dev": true
19808 19840
     },
19841
+    "v-viewer": {
19842
+      "version": "1.6.4",
19843
+      "resolved": "https://registry.npmmirror.com/v-viewer/-/v-viewer-1.6.4.tgz",
19844
+      "integrity": "sha512-LVkiUHpmsbsZXebeNXnu8krRCi5i2n07FeLFxoIVGhw8lVvTBO0ffpbDC6mLEuacCjrIh09HjIqpciwUtWE8lQ==",
19845
+      "requires": {
19846
+        "throttle-debounce": "^2.0.1",
19847
+        "viewerjs": "^1.5.0"
19848
+      }
19849
+    },
19809 19850
     "v8-compile-cache": {
19810 19851
       "version": "2.3.0",
19811 19852
       "resolved": "https://registry.npmmirror.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
@@ -19828,6 +19869,11 @@
19828 19869
       "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
19829 19870
       "dev": true
19830 19871
     },
19872
+    "viewerjs": {
19873
+      "version": "1.11.3",
19874
+      "resolved": "https://registry.npmmirror.com/viewerjs/-/viewerjs-1.11.3.tgz",
19875
+      "integrity": "sha512-efG3U61Umuj/1x6JAtdvnY9m407C/RkrkFilsMcLEWKDivpjNU3/FeL+feCY1Vkur9aQeBJ+z6K4CCPP7hv6vA=="
19876
+    },
19831 19877
     "vue": {
19832 19878
       "version": "2.6.11",
19833 19879
       "resolved": "https://registry.npm.taobao.org/vue/download/vue-2.6.11.tgz",

+ 1
- 0
package.json Wyświetl plik

@@ -8,6 +8,7 @@
8 8
     "report": "vue-cli-service build --report"
9 9
   },
10 10
   "dependencies": {
11
+    "v-viewer": "^1.6.4",
11 12
     "vue-simple-uploader": "^0.7.6"
12 13
   },
13 14
   "devDependencies": {

+ 28
- 0
src/api/index.js Wyświetl plik

@@ -7,3 +7,31 @@ export const user_login = (data) =>
7 7
     method: "post",
8 8
     data
9 9
   });
10
+// 5.1 服务案例管理列表
11
+export const sc_list = (data) =>
12
+  request({
13
+    url: window._config.baseUrl + "sc/list",
14
+    method: "post",
15
+    data
16
+  });
17
+// 5.2 添加
18
+export const sc_save = (data) =>
19
+  request({
20
+    url: window._config.baseUrl + "sc/save",
21
+    method: "post",
22
+    data
23
+  });
24
+// 5.3 修改
25
+export const sc_update = (data) =>
26
+  request({
27
+    url: window._config.baseUrl + "sc/update",
28
+    method: "post",
29
+    data
30
+  });
31
+// 5.4 删除
32
+export const sc_remove = (data) =>
33
+  request({
34
+    url: window._config.baseUrl + "sc/remove",
35
+    method: "post",
36
+    data
37
+  });

+ 10
- 2
src/main.js Wyświetl plik

@@ -4,7 +4,16 @@ import axios from "axios";
4 4
 import uploader from "vue-simple-uploader";
5 5
 import App from "./App.vue";
6 6
 import router from "./router";
7
-
7
+import VueViewer, { directive as viewerDirective } from "v-viewer";
8
+import "viewerjs/dist/viewer.css";
9
+// 使用Viewer图片预览器
10
+Vue.use(VueViewer);
11
+Vue.directive(
12
+  "viewer",
13
+  viewerDirective({
14
+    debug: true
15
+  })
16
+);
8 17
 Vue.use(ViewUI);
9 18
 Vue.prototype.$api = window._config;
10 19
 Vue.use(uploader);
@@ -13,7 +22,6 @@ Vue.config.productionTip = false;
13 22
 axios.defaults.baseURL = window._config.baseUrl;
14 23
 Vue.prototype.axios = axios;
15 24
 window.axios = axios;
16
-
17 25
 window.vue = new Vue({
18 26
   router,
19 27
   render: (h) => h(App)

+ 166
- 4
src/views/service/index.vue Wyświetl plik

@@ -1,14 +1,176 @@
1 1
 <template>
2
-  <div>user</div>
2
+  <div class="service">
3
+    <div class="header">
4
+      <div>
5
+        <RadioGroup v-model="form_search.ltype" @on-change="init">
6
+          <Radio :label="1" :value="1">中文</Radio>
7
+          <Radio :label="2" :value="2">英文</Radio>
8
+        </RadioGroup>
9
+        <Input
10
+          style="width: 200px; margin-left: 20px"
11
+          placeholder="请输入服务名称"
12
+          @on-enter="init"
13
+          @on-search="init"
14
+          search
15
+          v-model="form_search.scname"
16
+        />
17
+      </div>
18
+      <Button @click="add" type="primary"> 添加 </Button>
19
+    </div>
20
+    <div>
21
+      <Table border :data="service.list" :columns="columns">
22
+        <template slot-scope="{ row }" slot="scpic">
23
+          <img class="img" v-if="row.scpic" :src="row.scpic" v-viewer />
24
+        </template>
25
+      </Table>
26
+    </div>
27
+  </div>
3 28
 </template>
4 29
 
5 30
 <script>
31
+import { sc_list } from "@/api/index";
32
+import { dateFormat } from "@/utils/index";
6 33
 export default {
7 34
   data() {
8
-    return {};
35
+    return {
36
+      form_search: {
37
+        page: 1,
38
+        size: 10,
39
+        scname: "",
40
+        ltype: 1 //1中文2英文
41
+      },
42
+      service: {
43
+        total: 0,
44
+        list: []
45
+      },
46
+      columns: [
47
+        {
48
+          title: "序号",
49
+          align: "center",
50
+          key: "scorder",
51
+          width: 70
52
+        },
53
+        {
54
+          title: "服务名称",
55
+          key: "scname",
56
+          align: "center"
57
+        },
58
+        {
59
+          title: "服务地址",
60
+          slot: "scpic",
61
+          align: "center"
62
+        },
63
+        {
64
+          title: "创建人",
65
+          key: "createname",
66
+          align: "center",
67
+          width: 140
68
+        },
69
+        {
70
+          title: "创建时间",
71
+          key: "createtime",
72
+          width: 180,
73
+          align: "center"
74
+        },
75
+        {
76
+          title: "操作",
77
+          key: "action",
78
+          align: "center",
79
+          width: 150,
80
+          render: (h, params) => {
81
+            return h("div", [
82
+              h(
83
+                "span",
84
+                {
85
+                  style: {
86
+                    cursor: "pointer"
87
+                  },
88
+                  class: "theme_color",
89
+                  on: {
90
+                    click: () => {}
91
+                  }
92
+                },
93
+                "修改"
94
+              ),
95
+              h(
96
+                "span",
97
+                {
98
+                  style: {
99
+                    margin: "0 10px"
100
+                  },
101
+                  class: "theme_color"
102
+                },
103
+                "|"
104
+              ),
105
+              h(
106
+                "span",
107
+                {
108
+                  style: {
109
+                    cursor: "pointer"
110
+                  },
111
+                  class: "red",
112
+                  on: {
113
+                    click: () => {
114
+                      let content = "您确定要删除吗?";
115
+                      this.$Modal.confirm({
116
+                        title: "提示",
117
+                        content: content,
118
+                        onOk: () => {},
119
+                        onCancel: () => {}
120
+                      });
121
+                    }
122
+                  }
123
+                },
124
+                "删除"
125
+              )
126
+            ]);
127
+          }
128
+        }
129
+      ] //列表表格
130
+    };
9 131
   },
10
-  methods: {}
132
+  mounted() {
133
+    console.log(this.form_search);
134
+    this.init();
135
+  },
136
+  methods: {
137
+    init() {
138
+      sc_list(this.form_search).then((res) => {
139
+        if (res.code == 0) {
140
+          this.service.list = res.obj.list.map((v) => {
141
+            v.createtime = dateFormat(v.createtime);
142
+            v.scpic = this.$api.showImageUrl + v.scpic;
143
+            return v;
144
+          });
145
+        } else {
146
+          this.$Message.error(res.msg);
147
+        }
148
+        console.log(res);
149
+      });
150
+    },
151
+    add() {
152
+
153
+    }
154
+  }
11 155
 };
12 156
 </script>
13 157
 
14
-<style scoped lang="less"></style>
158
+<style scoped lang="less">
159
+.header {
160
+  display: flex;
161
+  justify-content: space-between;
162
+  margin: 20px 0;
163
+}
164
+/deep/ .theme_color {
165
+  color: #2d8cf0;
166
+}
167
+/deep/ .red {
168
+  color: red;
169
+}
170
+.img {
171
+  width: 60px;
172
+  height: 60px;
173
+  cursor: pointer;
174
+  margin-top: 5px;
175
+}
176
+</style>

Ładowanie…
Anuluj
Zapisz