gy-webcode2 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,8 +145,10 @@ export default {
145
145
  }
146
146
  },
147
147
  beforeDestroy(){
148
- let rIndex = this.breadcrumb_list[this.fullPath].findIndex(i => i.id == this.myID)
149
- this.breadcrumb_list[this.fullPath].splice(rIndex,1)
148
+ if(this.breadcrumb_list[this.fullPath]){
149
+ let rIndex = this.breadcrumb_list[this.fullPath].findIndex(i => i.id == this.myID)
150
+ this.breadcrumb_list[this.fullPath].splice(rIndex,1)
151
+ }
150
152
 
151
153
  }
152
154
  }
@@ -1,22 +1,39 @@
1
1
  <template>
2
2
  <scrollBar left="24px" top="10px" right="24px">
3
3
  <div class="pageStyle">
4
- <div class="row1">
5
- 整体风格设置
6
- </div>
4
+ <div class="row1">整体风格设置</div>
7
5
  <div class="stylPreview">
8
- <div class="item" @click="changeTheme(item.value)" :class="[`item_${item.id}`,{active:themeName == item.value}]" v-for="item,index in themeList" :key="item.id">
6
+ <div
7
+ class="item"
8
+ @click="changeTheme(item.value)"
9
+ :class="[
10
+ `item_${item.id}`,
11
+ { active: themeName == item.value },
12
+ ]"
13
+ v-for="(item, index) in themeList"
14
+ :key="item.id"
15
+ >
9
16
  <div class="iconBox">
10
17
  <i class="el-icon-check"></i>
11
18
  </div>
12
19
  </div>
13
20
  </div>
14
- <div class="row1 mar_t_10">
15
- 主题色
16
- </div>
21
+ <div class="row1 mar_t_10">主题色</div>
17
22
  <div class="themeColors">
18
- <el-tooltip v-for="item,index in themeColorList" :key="item.id" :open-delay="200" effect="dark" :content="item.name" placement="top">
19
- <div class="item" @click="changeThemeColor(item.value)" :class="{active:themeColor == item.value}" :style="`background-color:${item.color}`">
23
+ <el-tooltip
24
+ v-for="(item, index) in themeColorList"
25
+ :key="item.id"
26
+ :open-delay="200"
27
+ effect="dark"
28
+ :content="item.name"
29
+ placement="top"
30
+ >
31
+ <div
32
+ class="item"
33
+ @click="changeThemeColor(item.value)"
34
+ :class="{ active: themeColor == item.value }"
35
+ :style="`background-color:${item.color}`"
36
+ >
20
37
  <div class="iconBox">
21
38
  <i class="el-icon-check"></i>
22
39
  </div>
@@ -24,9 +41,7 @@
24
41
  </el-tooltip>
25
42
  </div>
26
43
  <el-divider></el-divider>
27
- <div class="row1 mar_t_10">
28
- 内容区域
29
- </div>
44
+ <div class="row1 mar_t_10">内容区域</div>
30
45
  <!-- <div class="flex aic jcb pad_t_10 pad_b_10">
31
46
  <div>水印</div>
32
47
  <div>
@@ -36,154 +51,187 @@
36
51
  <div class="flex aic jcb pad_t_10 pad_b_10">
37
52
  <div>面包屑</div>
38
53
  <div>
39
- <el-switch @change="(value)=>{setPageStyle('breadcrumbShow',value)}" v-model="$store.state.vuex_breadcrumbShow"></el-switch>
54
+ <el-switch
55
+ @change="
56
+ (value) => {
57
+ setPageStyle('breadcrumbShow', value);
58
+ }
59
+ "
60
+ v-model="$store.state.vuex_breadcrumbShow"
61
+ ></el-switch>
62
+ </div>
63
+ </div>
64
+ <div class="flex aic jcb pad_t_10 pad_b_10">
65
+ <div>页面选项卡</div>
66
+ <div>
67
+ <el-switch
68
+ v-model="routeTabsShow"
69
+ @change="tabsChange"
70
+ ></el-switch>
40
71
  </div>
41
72
  </div>
42
73
  </div>
43
-
44
74
  </scrollBar>
45
75
  </template>
46
76
 
47
77
  <script>
48
- export default {
49
- props:['wrapStyle_dialog'],
50
- data(){
51
- return {
52
- themeList:[
53
- {
54
- name:"默认",
55
- id:"1",
56
- value:"default",
57
- img:"pageStyle_1.png"
58
- },
59
- {
60
- name:"深蓝",
61
- id:"2",
62
- value:"shenlan",
63
- img:"pageStyle_2.png"
64
- },
65
- {
66
- name:"海蓝",
67
- id:"3",
68
- value:"hailan",
69
- img:"pageStyle_3.png"
70
- },
71
- // {
72
- // name:"绿",
73
- // id:"4",
74
- // value:"lv"
75
- // },
76
- ],
78
+ export default {
79
+ props: ["wrapStyle_dialog"],
80
+ data() {
81
+ return {
82
+ themeList: [
83
+ {
84
+ name: "默认",
85
+ id: "1",
86
+ value: "default",
87
+ img: "pageStyle_1.png",
88
+ },
89
+ {
90
+ name: "深蓝",
91
+ id: "2",
92
+ value: "shenlan",
93
+ img: "pageStyle_2.png",
94
+ },
95
+ {
96
+ name: "海蓝",
97
+ id: "3",
98
+ value: "hailan",
99
+ img: "pageStyle_3.png",
100
+ },
101
+ // {
102
+ // name:"绿",
103
+ // id:"4",
104
+ // value:"lv"
105
+ // },
106
+ ],
77
107
 
78
- themeColorList:[
79
- {
80
- name:"拂晓蓝(默认)",
81
- value:"lan",
82
- id:1,
83
- color:"#1890ff"
84
- },
85
- {
86
- name:"薄暮",
87
- value:"hong",
88
- id:2,
89
- color:"#f5222d"
90
- },
91
- {
92
- name:"火山",
93
- value:"cheng",
94
- id:3,
95
- color:"#fb551b"
96
- },
97
- {
98
- name:"日暮",
99
- value:"huang",
100
- id:4,
101
- color:"#fa8c16"
102
- },
103
- {
104
- name:"明青",
105
- value:"qing",
106
- id:5,
107
- color:"#15c3c1"
108
- },
109
- {
110
- name:"极光绿",
111
- value:"lv",
112
- id:6,
113
- color:"#52c41a"
114
- },
115
- {
116
- name:"极客蓝",
117
- value:"shenaln",
118
- id:7,
119
- color:"#2f54eb"
120
- },
121
- {
122
- name:"酱紫",
123
- value:"zi",
124
- id:8,
125
- color:"#722ed1"
126
- },
127
- ],
128
- }
108
+ themeColorList: [
109
+ {
110
+ name: "拂晓蓝(默认)",
111
+ value: "lan",
112
+ id: 1,
113
+ color: "#1890ff",
114
+ },
115
+ {
116
+ name: "薄暮",
117
+ value: "hong",
118
+ id: 2,
119
+ color: "#f5222d",
120
+ },
121
+ {
122
+ name: "火山",
123
+ value: "cheng",
124
+ id: 3,
125
+ color: "#fb551b",
126
+ },
127
+ {
128
+ name: "日暮",
129
+ value: "huang",
130
+ id: 4,
131
+ color: "#fa8c16",
132
+ },
133
+ {
134
+ name: "明青",
135
+ value: "qing",
136
+ id: 5,
137
+ color: "#15c3c1",
138
+ },
139
+ {
140
+ name: "极光绿",
141
+ value: "lv",
142
+ id: 6,
143
+ color: "#52c41a",
144
+ },
145
+ {
146
+ name: "极客蓝",
147
+ value: "shenaln",
148
+ id: 7,
149
+ color: "#2f54eb",
150
+ },
151
+ {
152
+ name: "酱紫",
153
+ value: "zi",
154
+ id: 8,
155
+ color: "#722ed1",
156
+ },
157
+ ],
158
+ routeTabsShow:false,
159
+ };
160
+ },
161
+ computed: {
162
+ themeName() {
163
+ return this.$store.state.vuex_themeName;
129
164
  },
130
- computed:{
131
- themeName(){
132
- return this.$store.state.vuex_themeName
133
- },
134
- themeColor(){
135
- return this.$store.state.vuex_themeColor
136
- },
165
+ themeColor() {
166
+ return this.$store.state.vuex_themeColor;
137
167
  },
138
- methods:{
139
- changeTheme(value){
140
- this.$store.state.vuex_themeName = value;
141
- window.document.body.setAttribute('data-theme', value)
142
- this.setPageStyle('themeName',value)
143
- },
144
- changeThemeColor(value){
145
- this.$store.state.vuex_themeColor = value;
146
- window.document.body.setAttribute('data-theme-color', value)
147
- this.setPageStyle('themeColor',value)
148
- },
149
- setPageStyle(key,val){
150
- let gyPageStyle = localStorage.getItem('gy_pageStyle');
151
- if(gyPageStyle){
152
- gyPageStyle =JSON.parse(gyPageStyle)
153
- }
154
- else{
155
- gyPageStyle = {}
156
- }
157
- // console.log(gyPageStyle);
158
- // console.log(key,val);
159
- gyPageStyle[key] = val;
160
- localStorage.setItem('gy_pageStyle',JSON.stringify(gyPageStyle))
168
+ },
169
+ created(){
170
+ this.routeTabsShow = this.$store.state.vuex_routeTabsShow
171
+ },
172
+ methods: {
173
+ tabsChange(value){
174
+ this.$confirm('修改后需要刷新浏览器,确定修改吗?', '提示', {
175
+ confirmButtonText: '确定',
176
+ cancelButtonText: '取消',
177
+ type: 'warning'
178
+ }).then(() => {
179
+ window.location.reload()
180
+ // this.themeStore.setTheme('routeTabsShow',val)
181
+ // this.$store.state.vuex_themeName = value;
182
+ this.setPageStyle("routeTabsShow", value);
183
+
184
+ }).catch(() => {
185
+ this.routeTabsShow = !value;
186
+ });
187
+ },
188
+ changeTheme(value) {
189
+ this.$store.state.vuex_themeName = value;
190
+ window.document.body.setAttribute("data-theme", value);
191
+ this.setPageStyle("themeName", value);
192
+ },
193
+ changeThemeColor(value) {
194
+ this.$store.state.vuex_themeColor = value;
195
+ window.document.body.setAttribute("data-theme-color", value);
196
+ this.setPageStyle("themeColor", value);
197
+ },
198
+ setPageStyle(key, val) {
199
+ let gyPageStyle = localStorage.getItem("gy_pageStyle");
200
+ if (gyPageStyle) {
201
+ gyPageStyle = JSON.parse(gyPageStyle);
202
+ } else {
203
+ gyPageStyle = {};
161
204
  }
162
- }
163
- }
205
+ // console.log(gyPageStyle);
206
+ // console.log(key,val);
207
+ gyPageStyle[key] = val;
208
+ localStorage.setItem("gy_pageStyle", JSON.stringify(gyPageStyle));
209
+ },
210
+ },
211
+ };
164
212
  </script>
165
213
 
166
214
  <style lang="scss" scoped>
167
- .pageStyle{
215
+ .pageStyle {
168
216
  position: relative;
169
- .row1{
217
+ .row1 {
170
218
  padding: 10px 0;
171
219
  // padding: 10px 0 5px 0;
172
220
  font-weight: bold;
173
221
  }
174
- .stylPreview{
222
+ .stylPreview {
175
223
  display: flex;
176
224
  padding: 10px 0;
177
- .item{
225
+ .item {
178
226
  position: relative;
179
227
  width: 64px;
180
228
  height: 48px;
181
229
  margin-right: 16px;
182
230
  box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.1);
183
231
  cursor: pointer;
184
- .iconBox{
232
+ .iconBox {
185
233
  display: none;
186
- color: #1890ff ;
234
+ color: #1890ff;
187
235
  font-size: 20px;
188
236
  width: 20px;
189
237
  height: 20px;
@@ -191,24 +239,24 @@
191
239
  left: 30px;
192
240
  top: 22px;
193
241
  }
194
- &.active .iconBox{
242
+ &.active .iconBox {
195
243
  display: block;
196
244
  }
197
- &.item_1{
245
+ &.item_1 {
198
246
  background-image: url("~gy-webcode2/img/theme/pageStyle_1.png");
199
247
  }
200
- &.item_2{
248
+ &.item_2 {
201
249
  background-image: url("~gy-webcode2/img/theme/pageStyle_2.png");
202
250
  }
203
- &.item_3{
251
+ &.item_3 {
204
252
  background-image: url("~gy-webcode2/img/theme/pageStyle_3.png");
205
253
  }
206
254
  }
207
255
  }
208
- .themeColors{
256
+ .themeColors {
209
257
  display: flex;
210
258
  padding: 10px 0;
211
- .item{
259
+ .item {
212
260
  width: 20px;
213
261
  height: 20px;
214
262
  background: #000;
@@ -222,14 +270,13 @@
222
270
  color: #fff;
223
271
  font-size: 12px;
224
272
  cursor: pointer;
225
- .iconBox{
226
- display: none;
273
+ .iconBox {
274
+ display: none;
227
275
  }
228
- &.active .iconBox{
276
+ &.active .iconBox {
229
277
  display: block;
230
278
  }
231
279
  }
232
280
  }
233
-
234
281
  }
235
282
  </style>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div >
3
+ <router-view/>
4
+ <div class="canvas_syBox " :style="`background-image:url(${vuex_watermarkImg})`" ref="canvasBox">
5
+ </div>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ export default {
10
+ data() {
11
+ return {
12
+ }
13
+ },
14
+ components: {
15
+ // dashboards
16
+ },
17
+ created(){
18
+ },
19
+ computed:{
20
+ data() {
21
+ return this.$store.state.menu.data;
22
+ }
23
+ },
24
+ watch:{
25
+ },
26
+ methods:{
27
+ },
28
+
29
+ }
30
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div>
3
+ </div>
4
+ </template>
5
+
6
+ <script>
7
+
8
+ export default {
9
+ data() {
10
+ return {}
11
+ },
12
+ computed: {
13
+ menuListAll() {
14
+ return this.$store.state.menu.data;
15
+ },
16
+ },
17
+ watch: {
18
+ },
19
+
20
+ created() {
21
+ let redirect = this.$route.query.redirect;
22
+ if(redirect && redirect != '/' && redirect != '/login'){
23
+
24
+ let myPath = this.$router.resolve(redirect);
25
+ this.$router.replace(myPath).catch(()=>{})
26
+
27
+ // let query = {...this.$route.query}
28
+ // delete query.redirect;
29
+ // this.$router.replace({
30
+ // path: redirect,
31
+ // query:query
32
+ // }).catch(()=>{})
33
+ }
34
+ else if(this.menuListAll.length > 0){
35
+ this.$router.replace({
36
+ path:this.menuListAll[0].list[0].list[0].list[0].path
37
+ }).catch(err => ()=>{})
38
+ }
39
+
40
+ },
41
+ mounted() {
42
+ },
43
+ components: {
44
+ },
45
+ }
46
+ </script>
47
+
48
+ <style lang="scss" scoped>
49
+ </style>
@@ -0,0 +1,227 @@
1
+ <template>
2
+ <div v-if="showHtml">
3
+ <div class="loginBody" ref="loginBody">
4
+ <canvas ref="Mycanvas" border='0'></canvas>
5
+ <div class="loginBox">
6
+ <div class="logo" :style="`background-image:url(${logoURL})`"></div>
7
+ <div class="projectName">
8
+ {{projectName}}
9
+ </div>
10
+ <div class="nrBox">
11
+ <div v-show="loginOption == 2">
12
+ <div class="login_inputBox">
13
+ <input autocomplete="text" @keyup="username_error=false" @keyup.13="login()"
14
+ v-model="username" id="username" placeholder="请输入用户名" type="text"/>
15
+ <div class="inputInfo">
16
+ <div class="error" v-show="username_error" id="username_error">{{errorText}}
17
+ </div>
18
+ </div>
19
+ </div>
20
+ <div class="login_inputBox">
21
+ <input autocomplete="password" @keyup.13="login()" @keyup="user_pwd_error=false" v-model="user_pwd" id="user_pwd" placeholder="请输入密码" type="password"/>
22
+ <div class="inputInfo">
23
+ <div class="error fl" v-show="user_pwd_error" id="user_pwd_error">{{errorText}}
24
+ </div>
25
+ <div class="fr">
26
+ <!-- <a href="#" class="wjmm">忘记密码?</a> -->
27
+ </div>
28
+ </div>
29
+ </div>
30
+ <el-button type="primary" class="login_btn" @click="login()">登录</el-button>
31
+ <!-- <input type="button" class="login_btn cp" value="登录"> -->
32
+ </div>
33
+ </div>
34
+ <!-- <div class="tr loginOption">
35
+ <i v-show="loginOption!=1" @click="loginOption = 1" class="common_iconfont common_icon-saoma"></i>
36
+ <i v-show="loginOption!= 2" @click="loginOption = 2" class="common_iconfont common_icon-yonghu"></i>
37
+ <i v-show="loginOption!=3" @click="loginOption = 3" class="common_iconfont common_icon-phone"></i>
38
+ </div> -->
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </template>
43
+
44
+ <script>
45
+ import md5 from '@/assets/scripts/md5'
46
+ import crypto from "gy-webcode2/scripts/crypto"
47
+ import canvasBg from '@/assets/scripts/canvasBg'
48
+
49
+ export default {
50
+ data() {
51
+ return {
52
+ showHtml: true,
53
+ username: "",
54
+ user_pwd: "",
55
+ username_error: false,
56
+ user_pwd_error: false,
57
+ errorText: "",
58
+ slogan: "",
59
+ yyname: defaultConfig.yyName ? defaultConfig.yyName : '',
60
+ logoURL: defaultConfig.logoURL ? defaultConfig.logoURL : '/static/img/yh_logo_white.png',
61
+ projectName: defaultConfig.ProjectName ? defaultConfig.ProjectName : "医院数据治理平台",
62
+ loginOption: 2,
63
+ phone: "",
64
+ yzm: ""
65
+ }
66
+ },
67
+ created() {
68
+ if (defaultConfig.loginLogoURL) {
69
+ this.logoURL = defaultConfig.loginLogoURL
70
+ } else if (defaultConfig.logoURL) {
71
+ this.logoURL = defaultConfig.logoURL;
72
+ } else {
73
+ this.logoURL = '/static/img/yh_logo_white.png';
74
+ }
75
+ if (singin) { //开启单点登录1
76
+ var utype = this.getUrlKey("utype");
77
+ var userid = this.getUrlKey("userid");
78
+
79
+ var token2 = this.getUrlKey("token");
80
+ var appId = this.getUrlKey("appId");
81
+
82
+ if ((this.singinCompany != "") && token2 && appId) {
83
+ this.showHtml = false;
84
+ this.$http.get(interfaceUrl + "/login/getThirdUser", {
85
+ params: {token: token2, appId: appId, url: singinUrl}
86
+ }).then((data) => {
87
+ if (data.status == 200) {
88
+ this.mmlogin(data.data);
89
+ } else {
90
+ this.showHtml = true;
91
+ this.$message.error("登录失败,请输入用户名密码登录!");
92
+ }
93
+ });
94
+ } else if (utype == 1) {//允许单点免密码登录,密码默认123
95
+ this.showHtml = false;
96
+ if (userid == null) {
97
+ this.$message.error("用户名不能为空!");
98
+ this.showHtml = true;
99
+ return false;
100
+ }
101
+ this.mmlogin(userid);
102
+ } else {
103
+ this.showHtml = true;
104
+ }
105
+ }
106
+ },
107
+ mounted() {
108
+ },
109
+ methods: {
110
+ login() {
111
+ var username = $.trim(this.username);
112
+ var user_pwd = this.user_pwd;
113
+ if (!username || !user_pwd) {
114
+
115
+ if (!username) {
116
+ this.username_error = true;
117
+ this.errorText = "请输入用户名";
118
+ // $("#username_error").show();
119
+ // $("#username_error").html("请输入用户名");
120
+ }
121
+ if (!user_pwd) {
122
+ this.user_pwd_error = true;
123
+ this.errorText = "请输入密码";
124
+ }
125
+
126
+ return false;
127
+ }
128
+ var postJSON = {
129
+ userid: username,
130
+ password: md5(user_pwd)
131
+ }
132
+
133
+
134
+ var vueThis = this;
135
+ var json = new URLSearchParams();
136
+ json.append("userid", username);
137
+ json.append("password", md5(user_pwd));
138
+
139
+ this.$http.post(interfaceUrl + "/login/exitLogin",
140
+ {
141
+ data: crypto.encrypt(JSON.stringify(postJSON))
142
+ }
143
+ ).then((json) => {
144
+ // console.log(JSON.parse(crypto.decrypt(json.data)));
145
+ json = JSON.parse(crypto.decrypt(json.data))
146
+
147
+ var logJson = {operationtype: 5, pagecode: "login", pagename: "登录页面"};
148
+ if (json.status == 200) {
149
+ Cookies.set('gy_login', JSON.stringify(json.data));
150
+ userInfo = json.data;
151
+
152
+ logJson.status = json.status;
153
+ let redirect = this.$route.query.redirect;
154
+ if (redirect) {
155
+ this.$router.push({
156
+ path: redirect
157
+ })
158
+ } else {
159
+ this.$router.push({
160
+ path: '/'
161
+ })
162
+ }
163
+
164
+ } else {
165
+ logJson.status = json.status;
166
+ logJson.errormsg = json.message;
167
+ vueThis.username_error = true;
168
+ vueThis.errorText = json.message;
169
+ }
170
+ golLog.setMenuLog(logJson, vueThis, userInfo);
171
+ });
172
+ },
173
+ mmlogin(userid) {
174
+ var vueThis = this;
175
+ var postJSON = {
176
+ userid: userid
177
+ }
178
+ this.$http.post(interfaceUrl + "/login/ssoLogin",
179
+ postJSON
180
+ ).then((json) => {
181
+ // console.log(JSON.parse(crypto.decrypt(json.data)));
182
+ // json = JSON.parse(crypto.decrypt(json.data))
183
+ if (json.data == null) {
184
+ this.$message.error("该用户不存在!");
185
+ this.showHtml = true;
186
+ return;
187
+ }
188
+ var logJson = {operationtype: 5, pagecode: "login", pagename: "登录页面"};
189
+ if (json.status == 200) {
190
+ Cookies.set('gy_login', JSON.stringify(json.data));
191
+ userInfo = json.data;
192
+
193
+ logJson.status = json.status;
194
+ let redirect = this.$route.query.redirect;
195
+ if (redirect) {
196
+ this.$router.push({
197
+ path: redirect
198
+ })
199
+ } else {
200
+ this.$router.push({
201
+ path: '/'
202
+ })
203
+ }
204
+
205
+ } else {
206
+ logJson.status = json.status;
207
+ logJson.errormsg = json.message;
208
+ vueThis.username_error = true;
209
+ vueThis.errorText = json.message;
210
+ }
211
+ golLog.setMenuLog(logJson, vueThis, userInfo);
212
+
213
+ });
214
+
215
+ },
216
+ getUrlKey: function (name) {
217
+ return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null;
218
+ }
219
+ },
220
+
221
+
222
+ }
223
+ </script>
224
+ <style lang="scss" src="gy-webcode2/css/login.scss" scoped></style>
225
+ <style lang="scss" scoped>
226
+
227
+ </style>
@@ -0,0 +1,362 @@
1
+ <template>
2
+ <div class="wrapper " :class="{hideMenuAll:$route.query.hideMenuAll == 1}" v-if="data.length > 0">
3
+ <headComponent></headComponent>
4
+ <div class="wrapper_body" :class="{max : leftMenu_show}" >
5
+ <sidebarComponent></sidebarComponent>
6
+
7
+ <div class="flex_1 flex_column" v-if="isInitRouteTab()">
8
+ <div class="routerTabs">
9
+ <div class="menuBtn mar_r_4" ref="menuNext">
10
+ <i class="el-icon-arrow-left"></i>
11
+ </div>
12
+ <div class="flex_1 pr">
13
+ <div class="swiper-container mySwiper pa0 oh" ref="swiper_el" >
14
+ <div class="swiper-wrapper">
15
+ <div class="swiper-slide" v-for="item,index in openRouters" :key="item.fullPath">
16
+ <div class="item" @contextmenu.prevent.stop="rightClick($event,item,index)" @click="tabClick(item)" :class="{active:$route.fullPath.includes(item.fullPath)}" >
17
+ <div class="name tesr1">
18
+ {{item.name}}
19
+ </div>
20
+ <div class="other hover2" v-if="openRouters.length > 1">
21
+ <i class="el-icon-close" @click.stop="removeOpenRouter(item,index)"></i>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <div class="menuBtn mar_l_4" ref="tabsPrev">
29
+ <i class="el-icon-arrow-right"></i>
30
+ </div>
31
+ </div>
32
+ <div class="wrapper_main">
33
+ <template v-for="item,index in openRouters" >
34
+ <component :key="item.fullPath" v-if="item.isLoad" :is="item.component" v-show="$route.fullPath.includes(item.fullPath)" />
35
+ </template>
36
+ </div>
37
+ </div>
38
+ <div class="wrapper_main" v-else>
39
+ <router-view />
40
+ </div>
41
+ </div>
42
+
43
+ <div class="rightMenuBox" ref="rightMenuBox" v-show="rightMenuShow">
44
+ <div class="item" @click.stop="menuClick(0)">
45
+ <div class="icon">
46
+ <i class="el-icon-refresh"></i>
47
+ </div>
48
+ <div class="name">
49
+ 刷新
50
+ </div>
51
+ </div>
52
+ <div class="item" v-show="openRouters.length > 1" @click.stop="menuClick(1)">
53
+ <div class="icon">
54
+ <i class="el-icon-close"></i>
55
+ </div>
56
+ <div class="name">
57
+ 关闭当前
58
+ </div>
59
+ </div>
60
+ <div class="item" v-show="openRouters.length > 1" @click.stop="menuClick(2)">
61
+ <div class="icon">
62
+ <i class="el-icon-folder-delete"></i>
63
+ </div>
64
+ <div class="name">
65
+ 关闭其他
66
+ </div>
67
+ </div>
68
+ <div class="item" v-show="openRouters.length > 1" @click.stop="menuClick(3)">
69
+ <div class="icon">
70
+ <i class="el-icon-back"></i>
71
+ </div>
72
+ <div class="name">
73
+ 关闭左侧
74
+ </div>
75
+ </div>
76
+ <div class="item" v-show="openRouters.length > 1" @click.stop="menuClick(4)">
77
+ <div class="icon">
78
+ <i class="el-icon-right"></i>
79
+ </div>
80
+ <div class="name">
81
+ 关闭右侧
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </template>
87
+
88
+ <script>
89
+ import {computed,provide, watch,defineAsyncComponent, ref, reactive,shallowRef, nextTick,onMounted} from "vue"
90
+ import headComponent from '@/components/head.vue';
91
+ import sidebarComponent from '@/components/sidebar'
92
+ import watermark from "gy-webcode2/scripts/watermark"
93
+ import Swiper from "swiper/bundle";
94
+ import "swiper/css/bundle";
95
+ export default {
96
+ name:"myIndex",
97
+ data(){
98
+ return {
99
+ transitionName:"",
100
+ tabsSwiper:null,
101
+ rightMenuShow:false,
102
+ rightMenuActive:null,
103
+ }
104
+ },
105
+ created(){
106
+ },
107
+ computed:{
108
+ menuPath(){
109
+ return this.$store.state.menu.menuPath
110
+ },
111
+ openRouters(){
112
+ return this.vuex_openRouters
113
+ },
114
+ leftMenu_show(){
115
+ return this.$store.state.leftMenu_show;
116
+ },
117
+ data() {
118
+ return this.$store.state.menu.data;
119
+ },
120
+ },
121
+ watch:{
122
+ '$route':function(){
123
+ // console.log(this.$route);
124
+ this.getRouterTabs()
125
+
126
+ }
127
+ },
128
+ mounted(){
129
+ let username=userInfo.username;
130
+ let usercode=userInfo.usercode;
131
+ this.$vuex('vuex_watermarkImg',watermark({
132
+ text:`${username}(${usercode})`
133
+ }))
134
+ this.getRouterTabs()
135
+ this.initTabsSwiper()
136
+
137
+ $("body").on("click",()=>{
138
+ this.rightMenuShow = false
139
+ })
140
+
141
+ },
142
+ methods:{
143
+ isInitRouteTab(){
144
+ if(this.$route.query.hideMenuAll == 1){
145
+ return false;
146
+ }
147
+ if(this.vuex_routeTabsShow){
148
+ return true;
149
+ }
150
+ return false;
151
+ },
152
+ rightClick(event,data,index){
153
+ event.stopPropagation()
154
+ // console.log(event);
155
+ // if(this.openRouters.length <= 1){
156
+ // return;
157
+ // }
158
+
159
+ this.rightMenuActive = index;
160
+ this.rightMenuShow = true;
161
+
162
+ $(this.$refs.rightMenuBox).css({
163
+ left:event.pageX,
164
+ top:event.pageY
165
+ })
166
+ // alert(1)
167
+ },
168
+ menuClick(val){
169
+ let data = this.openRouters[this.rightMenuActive];
170
+ if(val == 0){
171
+ data.isLoad = false;
172
+ setTimeout(() => {
173
+ data.isLoad = true;
174
+ }, 10);
175
+ }
176
+ // 关闭当前
177
+ if(val == 1){
178
+ this.openRouters.splice(this.rightMenuActive,1);
179
+ if(this.$route.fullPath.includes(data.fullPath)){
180
+ if(this.rightMenuActive != 0){
181
+ this.$router.replace(this.openRouters[this.rightMenuActive-1].fullPath)
182
+ }
183
+ else {
184
+ this.$router.replace(this.openRouters[this.rightMenuActive].fullPath)
185
+ }
186
+ }
187
+ }
188
+ // 关闭其他
189
+ else if(val == 2){
190
+ if(!this.$route.fullPath.includes(data.fullPath)){
191
+ this.$router.replace(this.openRouters[this.rightMenuActive].fullPath)
192
+ }
193
+ this.$store.state.vuex_openRouters = this.$store.state.vuex_openRouters.filter(i => i.fullPath == data.fullPath)
194
+ }
195
+
196
+ // 关闭左侧
197
+ else if(val == 3){
198
+ if(!this.$route.path.includes(data.fullPath)){
199
+ this.$router.replace(this.openRouters[this.rightMenuActive].fullPath)
200
+ }
201
+ this.$store.state.vuex_openRouters = this.$store.state.vuex_openRouters.slice(this.rightMenuActive)
202
+ }
203
+ // 关闭右侧
204
+ else if(val == 4){
205
+ if(!this.$route.path.includes(data.fullPath)){
206
+ this.$router.replace(this.openRouters[this.rightMenuActive].fullPath)
207
+ }
208
+ this.$store.state.vuex_openRouters = this.$store.state.vuex_openRouters.slice(0,this.rightMenuActive+1)
209
+ }
210
+ this.tabsSwiper.update()
211
+ this.rightMenuShow = false;
212
+ },
213
+
214
+ initTabsSwiper(){
215
+ if(!this.isInitRouteTab()){
216
+ return;
217
+ }
218
+
219
+ this.tabsSwiper = new Swiper(this.$refs.swiper_el, {
220
+ // modules: [Navigation, Pagination],
221
+ slidesPerView:'auto',
222
+ spaceBetween: 0,
223
+ navigation: {
224
+ nextEl: this.$refs.tabsPrev,
225
+ prevEl: this.$refs.menuNext,
226
+ },
227
+ });
228
+ },
229
+ tabClick(item){
230
+ // console.log(item);
231
+ if(this.$route.fullPath != item.fullPath){
232
+ this.$router.push(item.fullPath)
233
+ }
234
+ },
235
+ getRoute(){
236
+ // console.log(this.$route.matched[0]);
237
+ // console.log(this.$router.options.routes);
238
+ // console.log("___");
239
+ // // console.log(this.$router.options.routes.find(i => i.path == '/ysj'));
240
+ const router_ysj = this.$router.options.routes.find(i => i.path == this.$route.matched[0].path)
241
+ // console.log(router_ysj);
242
+ let myRoute = router_ysj.children.find(i => i.path == this.$route.path)
243
+ if(myRoute){
244
+ return myRoute;
245
+ }
246
+ },
247
+ async getRouterTabs(){
248
+ if(!this.isInitRouteTab()){
249
+ return;
250
+ }
251
+ let myRoute = this.getRoute()
252
+ let isFind = this.openRouters.findIndex(i => this.$route.fullPath.includes(i.fullPath) || this.$route.path == i.path);
253
+ // console.log(isFind);
254
+
255
+ let findName = this.openRouters.find(i => this.$route.path == i.path);
256
+ // // console.log(this.openRouters);
257
+ // // console.log(this.$route.name);
258
+ // // console.log(findName,isFind);
259
+ if(findName && findName.fullPath != this.$route.fullPath){
260
+ // console.log(findName);
261
+ this.openRouters[isFind].fullPath = this.$route.fullPath
262
+
263
+ }
264
+ // console.log(isFind);
265
+
266
+ if(isFind ==-1 && myRoute.path != 'refresh'){
267
+ let routerMsg = Object.keys(this.menuPath).find(i => decodeURIComponent(this.$route.fullPath).includes(i))
268
+ // console.log(routerMsg);
269
+ // console.log(this.menuPath[routerMsg]);
270
+ this.openRouters.push({
271
+ name:this.menuPath[routerMsg].name,
272
+ path:this.$route.path,
273
+ fullPath:this.$route.fullPath,
274
+ isLoad:true,
275
+ component:myRoute.component
276
+ // component:shallowRef(defineAsyncComponent(myRoute.component))
277
+ })
278
+ // console.log(this.openRouters);
279
+ await nextTick()
280
+ if(this.tabsSwiper){
281
+ this.tabsSwiper.navigation.update();
282
+ }
283
+ this.tabsSwiper.update()
284
+ this.tabsSwiper.slideTo(this.openRouters.length);
285
+ }
286
+ else{
287
+ this.tabsSwiper.slideTo(isFind);
288
+ }
289
+ },
290
+ async removeOpenRouter(item,index){
291
+ this.openRouters.splice(index,1);
292
+ await nextTick()
293
+ if(this.$route.fullPath.includes(item.fullPath)){
294
+ if(index != 0){
295
+ this.$router.replace(this.openRouters[index-1].fullPath)
296
+ }
297
+ else {
298
+ this.$router.replace(this.openRouters[index].fullPath)
299
+ }
300
+ }
301
+ this.tabsSwiper.update()
302
+ },
303
+ },
304
+ components: {
305
+ sidebarComponent,headComponent,
306
+ },
307
+
308
+ beforeRouteUpdate (to, from, next) {
309
+ this.$http.removePending('all');
310
+ next()
311
+ // 在当前路由改变,但是该组件被复用时调用
312
+ // 举例来说,对于一个带有动态参数的路径 /foo/:id,在 /foo/1 和 /foo/2 之间跳转的时候,
313
+ // 由于会渲染同样的 Foo 组件,因此组件实例会被复用。而这个钩子就会在这个情况下被调用。
314
+ // 可以访问组件实例 `this`
315
+ },
316
+ }
317
+ </script>
318
+
319
+ <style lang="scss" scoped>
320
+ .hideMenuAll{
321
+ .wrapper_header{
322
+ display: none;
323
+ }
324
+ .wrapper_body{
325
+ .sidebarBox {
326
+ display: none;
327
+ }
328
+ .routerTabs{
329
+ display: none;
330
+ }
331
+ }
332
+ }
333
+ .rightMenuBox{
334
+ position: fixed;
335
+ width: 100px;
336
+ // height: 200px;
337
+ padding:5px 0;
338
+ background: #fff;
339
+ left: 10px;
340
+ top: 10px;
341
+ z-index: 999;
342
+ // box-shadow: 0 0 10px 3px #aaa;
343
+ box-shadow: 0 0 10px 0px #aaa ;
344
+ border-radius:4px;
345
+ .item{
346
+ display: flex;
347
+ align-items: center;
348
+ font-size: 12px;
349
+ height: 30px;
350
+ // border: 1px solid #000;
351
+ padding-left: 12px;
352
+ cursor: pointer;
353
+ .icon{
354
+ margin-right: 5px;
355
+ }
356
+ &:hover{
357
+ // color: #009499;
358
+ @include themeColor("color",'hover')
359
+ }
360
+ }
361
+ }
362
+ </style>
@@ -0,0 +1,18 @@
1
+ <template>
2
+
3
+ </template>
4
+ <script>
5
+ export default {
6
+ beforeRouteEnter(to, from, next) {
7
+ next(vm => {
8
+ vm.$router.replace({
9
+ path:from.path,
10
+ query:from.query
11
+ })
12
+ })
13
+ }
14
+ }
15
+ </script>
16
+ <style lang="scss" scoped>
17
+
18
+ </style>
package/index.js CHANGED
@@ -15,5 +15,5 @@
15
15
 
16
16
  // 1.2.0 breadcrumb 使用store的menuPath了
17
17
  module.exports = {
18
- version :'1.2.0',
18
+ version :'1.2.1',
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gy-webcode2",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "gy前端公共代码",
5
5
  "main": "index.js",
6
6
  "scripts": {