ソースを参照

前端代码整合 4.9

lyn7568 4 年 前
コミット
5937cb664c

+ 19 - 0
README.md

@ -0,0 +1,19 @@
1
## renren-fast-vue
2
- renren-fast-vue基于vue、element-ui构建开发,实现[renren-fast](https://gitee.com/renrenio/renren-fast)后台管理前端功能,提供一套更优的前端解决方案
3
- 前后端分离,通过token进行数据交互,可独立部署
4
- 主题定制,通过scss变量统一一站式定制
5
- 动态菜单,通过菜单管理统一管理访问路由
6
- 数据切换,通过mock配置对接口数据/mock模拟数据进行切换
7
- 发布时,可动态配置CDN静态资源/切换新旧版本
8
- 演示地址:[http://demo.open.renren.io/renren-fast](http://demo.open.renren.io/renren-fast) (账号密码:admin/admin)
9
10
![输入图片说明](https://images.gitee.com/uploads/images/2019/0305/133529_ff15f192_63154.png "01.png")
11
![输入图片说明](https://images.gitee.com/uploads/images/2019/0305/133537_7a1b2d85_63154.png "02.png")
12
13
14
## 说明文档
15
项目开发、部署等说明都在[wiki](https://github.com/renrenio/renren-fast-vue/wiki)中。
16
17
18
## 更新日志
19
每个版本的详细更改都记录在[release notes](https://github.com/renrenio/renren-fast-vue/releases)中。

+ 91 - 0
config/index.js

@ -0,0 +1,91 @@
1
'use strict'
2
// Template version: 1.2.5
3
// see http://vuejs-templates.github.io/webpack for documentation.
4
5
const path = require('path')
6
const devEnv = require('./dev.env')
7
8
module.exports = {
9
  dev: {
10
11
    // Paths
12
    assetsSubDirectory: 'static',
13
    assetsPublicPath: '/',
14
    // 代理列表, 是否开启代理通过[./dev.env.js]配置
15
    proxyTable: devEnv.OPEN_PROXY === false ? {} : {
16
      '/proxyApi': {
17
        target: 'http://demo.renren.io/renren-fast/',
18
        changeOrigin: true,
19
        pathRewrite: {
20
          '^/proxyApi': '/'
21
        }
22
      }
23
    },
24
25
    // Various Dev Server settings
26
    host: 'localhost', // can be overwritten by process.env.HOST
27
    port: 8003, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
28
    autoOpenBrowser: true,
29
    errorOverlay: true,
30
    notifyOnErrors: true,
31
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
32
33
    // Use Eslint Loader?
34
    // If true, your code will be linted during bundling and
35
    // linting errors and warnings will be shown in the console.
36
    useEslint: true,
37
    // If true, eslint errors and warnings will also be shown in the error overlay
38
    // in the browser.
39
    showEslintErrorsInOverlay: false,
40
41
    /**
42
     * Source Maps
43
     */
44
45
    // https://webpack.js.org/configuration/devtool/#development
46
    devtool: 'eval-source-map',
47
48
    // If you have problems debugging vue-files in devtools,
49
    // set this to false - it *may* help
50
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
51
    cacheBusting: true,
52
53
    // CSS Sourcemaps off by default because relative paths are "buggy"
54
    // with this option, according to the CSS-Loader README
55
    // (https://github.com/webpack/css-loader#sourcemaps)
56
    // In our experience, they generally work as expected,
57
    // just be aware of this issue when enabling this option.
58
    cssSourceMap: false,
59
  },
60
61
  build: {
62
    // Template for index.html
63
    index: path.resolve(__dirname, '../dist/index.html'),
64
65
    // Paths
66
    assetsRoot: path.resolve(__dirname, '../dist'),
67
    assetsSubDirectory: 'static',
68
    assetsPublicPath: './',
69
70
    /**
71
     * Source Maps
72
     */
73
74
    productionSourceMap: false,
75
    // https://webpack.js.org/configuration/devtool/#production
76
    devtool: '#source-map',
77
78
    // Gzip off by default as many popular static hosts such as
79
    // Surge or Netlify already gzip all static assets for you.
80
    // Before setting to `true`, make sure to:
81
    // npm install --save-dev compression-webpack-plugin
82
    productionGzip: false,
83
    productionGzipExtensions: ['js', 'css'],
84
85
    // Run the build command with an extra argument to
86
    // View the bundle analyzer report after build finishes:
87
    // `npm run build --report`
88
    // Set to `true` or `false` to always turn it on or off
89
    bundleAnalyzerReport: process.env.npm_config_report
90
  }
91
}

+ 12 - 59
src/router/index.js

@ -69,8 +69,7 @@ router.beforeEach((to, from, next) => {
69 69
      params: http.adornParams()
70 70
    }).then(({data}) => {
71 71
      if (data && data.code === 0) {
72
        // fnAddDynamicMenuRoutes(data.menuList)
73
        fnAddDynamicMenuRoutesMy(data.menuList)
72
        fnAddDynamicMenuRoutes(data.menuList)
74 73
        router.options.isAddDynamicMenuRoutes = true
75 74
        sessionStorage.setItem('menuList', JSON.stringify(data.menuList || '[]'))
76 75
        sessionStorage.setItem('permissions', JSON.stringify(data.permissions || '[]'))
@ -103,67 +102,13 @@ function fnCurrentRouteType (route, globalRoutes = []) {
103 102
  return temp.length >= 1 ? fnCurrentRouteType(route, temp) : 'main'
104 103
}
105 104
106
/**
107
 * 添加动态(菜单)路由
108
 * @param {*} menuList 菜单列表
109
 * @param {*} routes 递归创建的动态(菜单)路由
110
 */
111
// function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
112
//   var temp = []
113
//   for (var i = 0; i < menuList.length; i++) {
114
//     if (menuList[i].list && menuList[i].list.length >= 1) {
115
//       temp = temp.concat(menuList[i].list)
116
//     } else if (menuList[i].url && /\S/.test(menuList[i].url)) {
117
//       menuList[i].url = menuList[i].url.replace(/^\//, '')
118
//       var route = {
119
//         path: menuList[i].url.replace('/', '-'),
120
//         component: null,
121
//         name: menuList[i].url.replace('/', '-'),
122
//         meta: {
123
//           menuId: menuList[i].menuId,
124
//           title: menuList[i].name,
125
//           isDynamic: true,
126
//           isTab: true,
127
//           iframeUrl: ''
128
//         }
129
//       }
130
//       // url以http[s]://开头, 通过iframe展示
131
//       if (isURL(menuList[i].url)) {
132
//         route['path'] = `i-${menuList[i].menuId}`
133
//         route['name'] = `i-${menuList[i].menuId}`
134
//         route['meta']['iframeUrl'] = menuList[i].url
135
//       } else {
136
//         try {
137
//           route['component'] = _import(`modules/${menuList[i].url}`) || null
138
//         } catch (e) {}
139
//       }
140
141
//       routes.push(route)
142
//     }
143
//   }
144
//   if (temp.length >= 1) {
145
//     fnAddDynamicMenuRoutes(temp, routes)
146
//   } else {
147
//     mainRoutes.name = 'main-dynamic'
148
//     mainRoutes.children = routes
149
//     router.addRoutes([
150
//       mainRoutes,
151
//       { path: '*', redirect: { name: '404' } }
152
//     ])
153
//     sessionStorage.setItem('dynamicMenuRoutes', JSON.stringify(mainRoutes.children || '[]'))
154
//     console.log('\n')
155
//     console.log('%c!<-------------------- 动态(菜单)路由 s -------------------->', 'color:blue')
156
//     console.log(mainRoutes.children)
157
//     console.log('%c!<-------------------- 动态(菜单)路由 e -------------------->', 'color:blue')
158
//   }
159
// }
160
161 105
/**
162 106
 * 2020-03-11 修改动态路由
107
 * 添加动态(菜单)路由
163 108
 * @param {*} menuList 菜单列表
164 109
 * @param {*} routes 递归创建的动态(菜单)路由
165 110
 */
166
function fnAddDynamicMenuRoutesMy (menuList = [], routes = []) {
111
function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
167 112
  var temp = []
168 113
  for (var i = 0; i < menuList.length; i++) {
169 114
    if (menuList[i].list && menuList[i].list.length >= 1) {
@ -174,6 +119,9 @@ function fnAddDynamicMenuRoutesMy (menuList = [], routes = []) {
174 119
        path: addMeetingId(menuList[i].url.replace('/', '-'), menuList[i].me),
175 120
        component: null,
176 121
        name: addMeetingId(menuList[i].url.replace('/', '-'), menuList[i].me),
122
        // path: menuList[i].url.replace('/', '-'),
123
        // component: null,
124
        // name: menuList[i].url.replace('/', '-'),
177 125
        meta: {
178 126
          menuId: menuList[i].menuId,
179 127
          title: menuList[i].name,
@ -197,7 +145,7 @@ function fnAddDynamicMenuRoutesMy (menuList = [], routes = []) {
197 145
    }
198 146
  }
199 147
  if (temp.length >= 1) {
200
    fnAddDynamicMenuRoutesMy(temp, routes)
148
    fnAddDynamicMenuRoutes(temp, routes)
201 149
  } else {
202 150
    mainRoutes.name = 'main-dynamic'
203 151
    mainRoutes.children = routes
@ -213,6 +161,11 @@ function fnAddDynamicMenuRoutesMy (menuList = [], routes = []) {
213 161
  }
214 162
}
215 163
164
/**
165
 * 会议相关路由添加路由参数id
166
 * @param {*} url
167
 * @param {*} me
168
 */
216 169
function addMeetingId (url, me) {
217 170
  // console.log(url)
218 171
  if (me === 1) {

+ 3 - 3
src/views/common/home.vue

@ -92,9 +92,9 @@ export default {
92 92
        })
93 93
      }).then(({ data }) => {
94 94
        if (data && data.code === 0) {
95
          this.dataList = data.page.list;
96
          this.totalPage = data.page.totalCount;
97
          this.getHandleDataList(data.page.list);
95
          window.console.log(data)
96
          this.dataList = data.list;
97
          this.getHandleDataList(data.list);
98 98
        } else {
99 99
          this.dataList = [];
100 100
          this.totalPage = 0;

+ 472 - 0
src/views/demo/echarts.vue

@ -0,0 +1,472 @@
1
<template>
2
  <div class="mod-demo-echarts">
3
    <el-alert
4
      title="提示:"
5
      type="warning"
6
      :closable="false">
7
      <div slot-scope="description">
8
        <p class="el-alert__description">1. 此Demo只提供ECharts官方使用文档,入门部署和体验功能。具体使用请参考:http://echarts.baidu.com/index.html</p>
9
      </div>
10
    </el-alert>
11
12
    <el-row :gutter="20">
13
      <el-col :span="24">
14
        <el-card>
15
          <div id="J_chartLineBox" class="chart-box"></div>
16
        </el-card>
17
      </el-col>
18
      <el-col :span="24">
19
        <el-card>
20
          <div id="J_chartBarBox" class="chart-box"></div>
21
        </el-card>
22
      </el-col>
23
      <el-col :span="12">
24
        <el-card>
25
          <div id="J_chartPieBox" class="chart-box"></div>
26
        </el-card>
27
      </el-col>
28
      <el-col :span="12">
29
        <el-card>
30
          <div id="J_chartScatterBox" class="chart-box"></div>
31
        </el-card>
32
      </el-col>
33
    </el-row>
34
  </div>
35
</template>
36
37
<script>
38
  import echarts from 'echarts'
39
  export default {
40
    data () {
41
      return {
42
        chartLine: null,
43
        chartBar: null,
44
        chartPie: null,
45
        chartScatter: null
46
      }
47
    },
48
    mounted () {
49
      this.initChartLine()
50
      this.initChartBar()
51
      this.initChartPie()
52
      this.initChartScatter()
53
    },
54
    activated () {
55
      // 由于给echart添加了resize事件, 在组件激活时需要重新resize绘画一次, 否则出现空白bug
56
      if (this.chartLine) {
57
        this.chartLine.resize()
58
      }
59
      if (this.chartBar) {
60
        this.chartBar.resize()
61
      }
62
      if (this.chartPie) {
63
        this.chartPie.resize()
64
      }
65
      if (this.chartScatter) {
66
        this.chartScatter.resize()
67
      }
68
    },
69
    methods: {
70
      // 折线图
71
      initChartLine () {
72
        var option = {
73
          'title': {
74
            'text': '折线图堆叠'
75
          },
76
          'tooltip': {
77
            'trigger': 'axis'
78
          },
79
          'legend': {
80
            'data': [ '邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎' ]
81
          },
82
          'grid': {
83
            'left': '3%',
84
            'right': '4%',
85
            'bottom': '3%',
86
            'containLabel': true
87
          },
88
          'toolbox': {
89
            'feature': {
90
              'saveAsImage': { }
91
            }
92
          },
93
          'xAxis': {
94
            'type': 'category',
95
            'boundaryGap': false,
96
            'data': [ '周一', '周二', '周三', '周四', '周五', '周六', '周日' ]
97
          },
98
          'yAxis': {
99
            'type': 'value'
100
          },
101
          'series': [
102
            {
103
              'name': '邮件营销',
104
              'type': 'line',
105
              'stack': '总量',
106
              'data': [ 120, 132, 101, 134, 90, 230, 210 ]
107
            },
108
            {
109
              'name': '联盟广告',
110
              'type': 'line',
111
              'stack': '总量',
112
              'data': [ 220, 182, 191, 234, 290, 330, 310 ]
113
            },
114
            {
115
              'name': '视频广告',
116
              'type': 'line',
117
              'stack': '总量',
118
              'data': [ 150, 232, 201, 154, 190, 330, 410 ]
119
            },
120
            {
121
              'name': '直接访问',
122
              'type': 'line',
123
              'stack': '总量',
124
              'data': [ 320, 332, 301, 334, 390, 330, 320 ]
125
            },
126
            {
127
              'name': '搜索引擎',
128
              'type': 'line',
129
              'stack': '总量',
130
              'data': [ 820, 932, 901, 934, 1290, 1330, 1320 ]
131
            }
132
          ]
133
        }
134
        this.chartLine = echarts.init(document.getElementById('J_chartLineBox'))
135
        this.chartLine.setOption(option)
136
        window.addEventListener('resize', () => {
137
          this.chartLine.resize()
138
        })
139
      },
140
      // 柱状图
141
      initChartBar () {
142
        var option = {
143
          tooltip: {
144
            trigger: 'axis',
145
            axisPointer: {
146
              type: 'shadow'
147
            }
148
          },
149
          legend: {
150
            data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎', '百度', '谷歌', '必应', '其他']
151
          },
152
          grid: {
153
            left: '3%',
154
            right: '4%',
155
            bottom: '3%',
156
            containLabel: true
157
          },
158
          xAxis: [
159
            {
160
              type: 'category',
161
              data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
162
            }
163
          ],
164
          yAxis: [
165
            {
166
              type: 'value'
167
            }
168
          ],
169
          series: [
170
            {
171
              name: '直接访问',
172
              type: 'bar',
173
              data: [320, 332, 301, 334, 390, 330, 320]
174
            },
175
            {
176
              name: '邮件营销',
177
              type: 'bar',
178
              stack: '广告',
179
              data: [120, 132, 101, 134, 90, 230, 210]
180
            },
181
            {
182
              name: '联盟广告',
183
              type: 'bar',
184
              stack: '广告',
185
              data: [220, 182, 191, 234, 290, 330, 310]
186
            },
187
            {
188
              name: '视频广告',
189
              type: 'bar',
190
              stack: '广告',
191
              data: [150, 232, 201, 154, 190, 330, 410]
192
            },
193
            {
194
              name: '搜索引擎',
195
              type: 'bar',
196
              data: [862, 1018, 964, 1026, 1679, 1600, 1570],
197
              markLine: {
198
                lineStyle: {
199
                  normal: {
200
                    type: 'dashed'
201
                  }
202
                },
203
                data: [
204
                  [{ type: 'min' }, { type: 'max' }]
205
                ]
206
              }
207
            },
208
            {
209
              name: '百度',
210
              type: 'bar',
211
              barWidth: 5,
212
              stack: '搜索引擎',
213
              data: [620, 732, 701, 734, 1090, 1130, 1120]
214
            },
215
            {
216
              name: '谷歌',
217
              type: 'bar',
218
              stack: '搜索引擎',
219
              data: [120, 132, 101, 134, 290, 230, 220]
220
            },
221
            {
222
              name: '必应',
223
              type: 'bar',
224
              stack: '搜索引擎',
225
              data: [60, 72, 71, 74, 190, 130, 110]
226
            },
227
            {
228
              name: '其他',
229
              type: 'bar',
230
              stack: '搜索引擎',
231
              data: [62, 82, 91, 84, 109, 110, 120]
232
            }
233
          ]
234
        }
235
        this.chartBar = echarts.init(document.getElementById('J_chartBarBox'))
236
        this.chartBar.setOption(option)
237
        window.addEventListener('resize', () => {
238
          this.chartBar.resize()
239
        })
240
      },
241
      // 饼状图
242
      initChartPie () {
243
        var option = {
244
          backgroundColor: '#2c343c',
245
          title: {
246
            text: 'Customized Pie',
247
            left: 'center',
248
            top: 20,
249
            textStyle: {
250
              color: '#ccc'
251
            }
252
          },
253
          tooltip: {
254
            trigger: 'item',
255
            formatter: '{a} <br/>{b} : {c} ({d}%)'
256
          },
257
          visualMap: {
258
            show: false,
259
            min: 80,
260
            max: 600,
261
            inRange: {
262
              colorLightness: [0, 1]
263
            }
264
          },
265
          series: [
266
            {
267
              name: '访问来源',
268
              type: 'pie',
269
              radius: '55%',
270
              center: ['50%', '50%'],
271
              data: [
272
                { value: 335, name: '直接访问' },
273
                { value: 310, name: '邮件营销' },
274
                { value: 274, name: '联盟广告' },
275
                { value: 235, name: '视频广告' },
276
                { value: 400, name: '搜索引擎' }
277
              ].sort(function (a, b) { return a.value - b.value }),
278
              roseType: 'radius',
279
              label: {
280
                normal: {
281
                  textStyle: {
282
                    color: 'rgba(255, 255, 255, 0.3)'
283
                  }
284
                }
285
              },
286
              labelLine: {
287
                normal: {
288
                  lineStyle: {
289
                    color: 'rgba(255, 255, 255, 0.3)'
290
                  },
291
                  smooth: 0.2,
292
                  length: 10,
293
                  length2: 20
294
                }
295
              },
296
              itemStyle: {
297
                normal: {
298
                  color: '#c23531',
299
                  shadowBlur: 200,
300
                  shadowColor: 'rgba(0, 0, 0, 0.5)'
301
                }
302
              },
303
              animationType: 'scale',
304
              animationEasing: 'elasticOut',
305
              animationDelay: function (idx) {
306
                return Math.random() * 200
307
              }
308
            }
309
          ]
310
        }
311
        this.chartPie = echarts.init(document.getElementById('J_chartPieBox'))
312
        this.chartPie.setOption(option)
313
        window.addEventListener('resize', () => {
314
          this.chartPie.resize()
315
        })
316
      },
317
      // 散点图
318
      initChartScatter () {
319
        var option = {
320
          backgroundColor: new echarts.graphic.RadialGradient(0.3, 0.3, 0.8, [
321
            { offset: 0, color: '#f7f8fa' },
322
            { offset: 1, color: '#cdd0d5' }
323
          ]),
324
          title: {
325
            text: '1990 与 2015 年各国家人均寿命与 GDP'
326
          },
327
          legend: {
328
            right: 10,
329
            data: ['1990', '2015']
330
          },
331
          xAxis: {
332
            splitLine: {
333
              lineStyle: {
334
                type: 'dashed'
335
              }
336
            }
337
          },
338
          yAxis: {
339
            splitLine: {
340
              lineStyle: {
341
                type: 'dashed'
342
              }
343
            },
344
            scale: true
345
          },
346
          series: [
347
            {
348
              name: '1990',
349
              data: [
350
                [28604, 77, 17096869, 'Australia', 1990],
351
                [31163, 77.4, 27662440, 'Canada', 1990],
352
                [1516, 68, 1154605773, 'China', 1990],
353
                [13670, 74.7, 10582082, 'Cuba', 1990],
354
                [28599, 75, 4986705, 'Finland', 1990],
355
                [29476, 77.1, 56943299, 'France', 1990],
356
                [31476, 75.4, 78958237, 'Germany', 1990],
357
                [28666, 78.1, 254830, 'Iceland', 1990],
358
                [1777, 57.7, 870601776, 'India', 1990],
359
                [29550, 79.1, 122249285, 'Japan', 1990],
360
                [2076, 67.9, 20194354, 'North Korea', 1990],
361
                [12087, 72, 42972254, 'South Korea', 1990],
362
                [24021, 75.4, 3397534, 'New Zealand', 1990],
363
                [43296, 76.8, 4240375, 'Norway', 1990],
364
                [10088, 70.8, 38195258, 'Poland', 1990],
365
                [19349, 69.6, 147568552, 'Russia', 1990],
366
                [10670, 67.3, 53994605, 'Turkey', 1990],
367
                [26424, 75.7, 57110117, 'United Kingdom', 1990],
368
                [37062, 75.4, 252847810, 'United States', 1990]
369
              ],
370
              type: 'scatter',
371
              symbolSize: function (data) {
372
                return Math.sqrt(data[2]) / 5e2
373
              },
374
              label: {
375
                emphasis: {
376
                  show: true,
377
                  formatter: function (param) {
378
                    return param.data[3]
379
                  },
380
                  position: 'top'
381
                }
382
              },
383
              itemStyle: {
384
                normal: {
385
                  shadowBlur: 10,
386
                  shadowColor: 'rgba(120, 36, 50, 0.5)',
387
                  shadowOffsetY: 5,
388
                  color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [
389
                    { offset: 0, color: 'rgb(251, 118, 123)' },
390
                    { offset: 1, color: 'rgb(204, 46, 72)' }
391
                  ])
392
                }
393
              }
394
            },
395
            {
396
              name: '2015',
397
              data: [
398
                [44056, 81.8, 23968973, 'Australia', 2015],
399
                [43294, 81.7, 35939927, 'Canada', 2015],
400
                [13334, 76.9, 1376048943, 'China', 2015],
401
                [21291, 78.5, 11389562, 'Cuba', 2015],
402
                [38923, 80.8, 5503457, 'Finland', 2015],
403
                [37599, 81.9, 64395345, 'France', 2015],
404
                [44053, 81.1, 80688545, 'Germany', 2015],
405
                [42182, 82.8, 329425, 'Iceland', 2015],
406
                [5903, 66.8, 1311050527, 'India', 2015],
407
                [36162, 83.5, 126573481, 'Japan', 2015],
408
                [1390, 71.4, 25155317, 'North Korea', 2015],
409
                [34644, 80.7, 50293439, 'South Korea', 2015],
410
                [34186, 80.6, 4528526, 'New Zealand', 2015],
411
                [64304, 81.6, 5210967, 'Norway', 2015],
412
                [24787, 77.3, 38611794, 'Poland', 2015],
413
                [23038, 73.13, 143456918, 'Russia', 2015],
414
                [19360, 76.5, 78665830, 'Turkey', 2015],
415
                [38225, 81.4, 64715810, 'United Kingdom', 2015],
416
                [53354, 79.1, 321773631, 'United States', 2015]
417
              ],
418
              type: 'scatter',
419
              symbolSize: function (data) {
420
                return Math.sqrt(data[2]) / 5e2
421
              },
422
              label: {
423
                emphasis: {
424
                  show: true,
425
                  formatter: function (param) {
426
                    return param.data[3]
427
                  },
428
                  position: 'top'
429
                }
430
              },
431
              itemStyle: {
432
                normal: {
433
                  shadowBlur: 10,
434
                  shadowColor: 'rgba(25, 100, 150, 0.5)',
435
                  shadowOffsetY: 5,
436
                  color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [
437
                    { offset: 0, color: 'rgb(129, 227, 238)' },
438
                    { offset: 1, color: 'rgb(25, 183, 207)' }
439
                  ])
440
                }
441
              }
442
            }
443
          ]
444
        }
445
        this.chartPie = echarts.init(document.getElementById('J_chartScatterBox'))
446
        this.chartPie.setOption(option)
447
        window.addEventListener('resize', () => {
448
          this.chartPie.resize()
449
        })
450
      }
451
    }
452
  }
453
</script>
454
455
<style lang="scss">
456
  .mod-demo-echarts {
457
    > .el-alert {
458
      margin-bottom: 10px;
459
    }
460
    > .el-row {
461
      margin-top: -10px;
462
      margin-bottom: -10px;
463
      .el-col {
464
        padding-top: 10px;
465
        padding-bottom: 10px;
466
      }
467
    }
468
    .chart-box {
469
      min-height: 400px;
470
    }
471
  }
472
</style>

+ 65 - 0
src/views/demo/ueditor.vue

@ -0,0 +1,65 @@
1
<template>
2
  <div class="mod-demo-ueditor">
3
    <el-alert
4
      title="提示:"
5
      type="warning"
6
      :closable="false">
7
      <div slot-scope="description">
8
        <p class="el-alert__description">1. 此Demo只提供UEditor官方使用文档,入门部署和体验功能。具体使用请参考:http://fex.baidu.com/ueditor/</p>
9
        <p class="el-alert__description">2. 浏览器控制台报错“请求后台配置项http错误,上传功能将不能正常使用!”,此错需要后台提供上传接口方法(赋值给serverUrl属性)</p>
10
      </div>
11
    </el-alert>
12
13
    <script :id="ueId" class="ueditor-box" type="text/plain" style="width: 100%; height: 260px;">hello world!</script>
14
    
15
    <!-- 获取内容 -->
16
    <p><el-button @click="getContent()">获得内容</el-button></p>
17
    <el-dialog
18
      title="内容"
19
      :visible.sync="dialogVisible"
20
      :append-to-body="true">
21
      {{ ueContent }}
22
      <span slot="footer" class="dialog-footer">
23
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
24
      </span>
25
    </el-dialog>
26
  </div>
27
</template>
28
29
<script>
30
  import ueditor from 'ueditor'
31
  export default {
32
    data () {
33
      return {
34
        ue: null,
35
        ueId: `J_ueditorBox_${new Date().getTime()}`,
36
        ueContent: '',
37
        dialogVisible: false
38
      }
39
    },
40
    mounted () {
41
      this.ue = ueditor.getEditor(this.ueId, {
42
        // serverUrl: '', // 服务器统一请求接口路径
43
        zIndex: 3000
44
      })
45
    },
46
    methods: {
47
      getContent () {
48
        this.dialogVisible = true
49
        this.ue.ready(() => {
50
          this.ueContent = this.ue.getContent()
51
        })
52
      }
53
    }
54
  }
55
</script>
56
57
<style lang="scss">
58
  .mod-demo-ueditor {
59
    position: relative;
60
    z-index: 510;
61
    > .el-alert {
62
      margin-bottom: 10px;
63
    }
64
  }
65
</style>

+ 1 - 3
src/views/modules/admin/employee-add-or-update.vue

@ -148,7 +148,6 @@ export default {
148 148
              this.dataForm.email = data.employee.email;
149 149
              this.dataForm.createTime = data.employee.createTime;
150 150
              this.dataForm.modifyTime = data.employee.modifyTime;
151
              this.dataForm.isDel = data.employee.isDel;
152 151
            }
153 152
          });
154 153
        }
@ -170,7 +169,6 @@ export default {
170 169
          limit: this.pageSize
171 170
        })
172 171
      }).then(({ data }) => {
173
        window.console.log(data);
174 172
        if (data && data.code === 0) {
175 173
          this.dataList = data.page.list;
176 174
          this.totalPage = data.page.totalCount;
@ -192,7 +190,7 @@ export default {
192 190
            ),
193 191
            method: "post",
194 192
            data: this.$http.adornData({
195
              // id: this.dataForm.id || undefined,
193
              id: this.dataForm.id || undefined,
196 194
              username: this.dataForm.username,
197 195
              password: this.dataForm.password,
198 196
              truename: this.dataForm.truename,

+ 1 - 1
src/views/modules/admin/meeting-add-or-update.vue

@ -543,4 +543,4 @@ export default {
543 543
  height: 178px;
544 544
  display: block;
545 545
}
546
</style>
546
</style>

+ 1 - 1
src/views/modules/admin/member-add-or-update.vue

@ -284,4 +284,4 @@ export default {
284 284
  height: 178px;
285 285
  display: block;
286 286
}
287
</style>
287
</style>

+ 14 - 7
src/views/modules/admin/member.vue

@ -23,15 +23,24 @@
23 23
      style="width: 100%;"
24 24
    >
25 25
      <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
26
      <!-- <el-table-column prop="id" header-align="center" align="center" label="会员id (会员表)"></el-table-column> -->
27
      <el-table-column prop="username" header-align="center" align="center" label="用户名"></el-table-column>
26
      <!-- <el-table-column prop="id" header-align="center" align="center" label="id"></el-table-column> -->
28 27
      <el-table-column prop="truename" header-align="center" align="center" label="姓名"></el-table-column>
28
      <el-table-column prop="username" header-align="center" align="center" label="账号"></el-table-column>
29 29
      <el-table-column prop="organization" header-align="center" align="center" label="所属机构"></el-table-column>
30 30
      <el-table-column prop="position" header-align="center" align="center" label="职位"></el-table-column>
31 31
      <el-table-column prop="jobTitle" header-align="center" align="center" label="职称"></el-table-column>
32 32
      <el-table-column prop="phone" header-align="center" align="center" label="电话"></el-table-column>
33 33
      <el-table-column prop="email" header-align="center" align="center" label="邮箱"></el-table-column>
34
      <el-table-column prop="createTime" header-align="center" align="center" label="创建时间"></el-table-column>
34
      <el-table-column prop="meetingCounts" header-align="center" align="center" label="参会场次"></el-table-column>
35
      <el-table-column prop="meetingName" header-align="center" align="center" label="最后参加会议"></el-table-column>
36
      <el-table-column prop="servicerName" header-align="center" align="center" label="负责人"></el-table-column>
37
      <el-table-column
38
        prop="createTime"
39
        header-align="center"
40
        align="center"
41
        width="160"
42
        label="创建时间"
43
      ></el-table-column>
35 44
      <el-table-column prop="isCheck" header-align="center" align="center" label="是否通过审核">
36 45
        <template slot-scope="scope">
37 46
          <el-button
@ -70,7 +79,6 @@
70 79
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
71 80
  </div>
72 81
</template>
73
74 82
<script>
75 83
import AddOrUpdate from "./member-add-or-update";
76 84
export default {
@ -140,7 +148,6 @@ export default {
140 148
        this.$refs.addOrUpdate.init(id);
141 149
      });
142 150
    },
143
144 151
    // 重置密码
145 152
    repasswordHandle(id) {
146 153
      this.$http({
@ -201,7 +208,7 @@ export default {
201 208
      this.$http({
202 209
        url: this.$http.adornUrl("/admin/member/status"),
203 210
        method: "post",
204
        data: this.$http.adornData({
211
        data: this.$http.adornParams({
205 212
          id: id,
206 213
          status: status
207 214
        })
@ -229,4 +236,4 @@ export default {
229 236
    }
230 237
  }
231 238
};
232
</script>
239
</script>

+ 18 - 0
src/views/modules/admin/sign.vue

@ -57,19 +57,37 @@
57 57
        prop="typeAttenders"
58 58
        header-align="center"
59 59
        align="center"
60
<<<<<<< HEAD
60 61
        label="参会类型">
62
=======
63
        label="用户参会类型">
64
>>>>>>> b4a72a7622733ad6688835b7f0c303ebd79673f3
61 65
      </el-table-column>
62 66
      <el-table-column
63 67
        prop="isPay"
64 68
        header-align="center"
65 69
        align="center"
66 70
        label="是否已缴费">
71
<<<<<<< HEAD
72
=======
73
        <template slot-scope="scope">
74
          <span v-if="scope.row.isPay === 1">是</span>
75
          <span v-else>否</span>
76
        </template>
77
>>>>>>> b4a72a7622733ad6688835b7f0c303ebd79673f3
67 78
      </el-table-column>
68 79
      <el-table-column
69 80
        prop="status"
70 81
        header-align="center"
71 82
        align="center"
72 83
        label="签到状态">
84
<<<<<<< HEAD
85
=======
86
        <template slot-scope="scope">
87
          <span v-if="scope.row.status === 1">已签到</span>
88
          <span v-else>否</span>
89
        </template>
90
>>>>>>> b4a72a7622733ad6688835b7f0c303ebd79673f3
73 91
      </el-table-column>
74 92
      <el-table-column
75 93
        prop="badge"

+ 66 - 0
src/views/modules/admin/upload.vue

@ -0,0 +1,66 @@
1
<template>
2
  <el-dialog
3
    title="上传文件"
4
    :close-on-click-modal="false"
5
    @close="closeHandle"
6
    :visible.sync="visible">
7
    <el-upload
8
      :action="url"
9
      ref="upload"
10
      :before-upload="beforeUploadHandle"
11
      :on-success="successHandle"
12
      name="upload_file"
13
      :auto-upload="false"
14
      :data="thumb"
15
      style="text-align: center;">
16
      <i class="el-icon-upload"></i>
17
       <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
18
      <div class="el-upload__tip" slot="tip">只支持jpg、png、gif格式的图片!只能上传jpg/png文件,且不超过2M</div>
19
      <el-radio v-model="radio" label="1">是</el-radio>
20
      <el-radio v-model="radio" label="0" >否</el-radio>
21
      <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
22
    </el-upload>
23
  </el-dialog>
24
</template>
25
26
<script>
27
  export default {
28
    data () {
29
      return {
30
        visible: false,
31
        url: '',
32
        radio: '0',
33
        thumb: {'isthumb': 0}
34
      }
35
    },
36
    methods: {
37
      init (id) {
38
        this.url = this.$http.adornUrl(`/sys/filemanager/uploadimg`)
39
        this.visible = true
40
      },
41
      submitUpload () {
42
        this.$refs.upload.submit()
43
      },
44
      // 上传之前
45
      beforeUploadHandle (file) {
46
        this.thumb.isthumb = this.radio
47
        if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
48
          this.$message.error('只支持jpg、png、gif格式的图片!')
49
          return false
50
        }
51
      },
52
      // 上传成功
53
      successHandle (response) {
54
        console.log(response)
55
        if (response && response.code === 0) {
56
          this.visible = false
57
        } else {
58
          this.$message.error(response.msg)
59
        }
60
      }
61
      // // 弹窗关闭时
62
      // closeHandle () {
63
      // }
64
    }
65
  }
66
</script>

+ 156 - 0
src/views/modules/sys/adminmenu-add-or-update.vue

@ -0,0 +1,156 @@
1
<template>
2
  <el-dialog
3
    :title="!dataForm.id ? '新增' : '修改'"
4
    :close-on-click-modal="false"
5
    :visible.sync="visible">
6
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
7
    <el-form-item label="父菜单ID,一级菜单为0" prop="parentId">
8
      <el-input v-model="dataForm.parentId" placeholder="父菜单ID,一级菜单为0"></el-input>
9
    </el-form-item>
10
    <el-form-item label="菜单名称" prop="name">
11
      <el-input v-model="dataForm.name" placeholder="菜单名称"></el-input>
12
    </el-form-item>
13
    <el-form-item label="菜单URL" prop="url">
14
      <el-input v-model="dataForm.url" placeholder="菜单URL"></el-input>
15
    </el-form-item>
16
    <el-form-item label="授权(多个用逗号分隔,如:user:list,user:create)" prop="perms">
17
      <el-input v-model="dataForm.perms" placeholder="授权(多个用逗号分隔,如:user:list,user:create)"></el-input>
18
    </el-form-item>
19
    <el-form-item label="类型   0:目录   1:菜单   2:按钮" prop="type">
20
      <el-input v-model="dataForm.type" placeholder="类型   0:目录   1:菜单   2:按钮"></el-input>
21
    </el-form-item>
22
    <el-form-item label="菜单图标" prop="icon">
23
      <el-input v-model="dataForm.icon" placeholder="菜单图标"></el-input>
24
    </el-form-item>
25
    <el-form-item label="排序" prop="orderNum">
26
      <el-input v-model="dataForm.orderNum" placeholder="排序"></el-input>
27
    </el-form-item>
28
    <el-form-item label="会议目录" prop="me">
29
      <el-input v-model="dataForm.me" placeholder="会议目录"></el-input>
30
    </el-form-item>
31
    <el-form-item label="tab" prop="isTab">
32
      <el-input v-model="dataForm.isTab" placeholder="tab"></el-input>
33
    </el-form-item>
34
    </el-form>
35
    <span slot="footer" class="dialog-footer">
36
      <el-button @click="visible = false">取消</el-button>
37
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
38
    </span>
39
  </el-dialog>
40
</template>
41
42
<script>
43
  export default {
44
    data () {
45
      return {
46
        visible: false,
47
        dataForm: {
48
          menuId: 0,
49
          parentId: '',
50
          name: '',
51
          url: '',
52
          perms: '',
53
          type: '',
54
          icon: '',
55
          orderNum: '',
56
          me: '',
57
          isTab: ''
58
        },
59
        dataRule: {
60
          parentId: [
61
            { required: true, message: '父菜单ID,一级菜单为0不能为空', trigger: 'blur' }
62
          ],
63
          name: [
64
            { required: true, message: '菜单名称不能为空', trigger: 'blur' }
65
          ],
66
          url: [
67
            { required: true, message: '菜单URL不能为空', trigger: 'blur' }
68
          ],
69
          perms: [
70
            { required: true, message: '授权(多个用逗号分隔,如:user:list,user:create)不能为空', trigger: 'blur' }
71
          ],
72
          type: [
73
            { required: true, message: '类型   0:目录   1:菜单   2:按钮不能为空', trigger: 'blur' }
74
          ],
75
          icon: [
76
            { required: true, message: '菜单图标不能为空', trigger: 'blur' }
77
          ],
78
          orderNum: [
79
            { required: true, message: '排序不能为空', trigger: 'blur' }
80
          ],
81
          me: [
82
            { required: true, message: '会议目录不能为空', trigger: 'blur' }
83
          ],
84
          isTab: [
85
            { required: true, message: 'tab不能为空', trigger: 'blur' }
86
          ]
87
        }
88
      }
89
    },
90
    methods: {
91
      init (id) {
92
        this.dataForm.menuId = id || 0
93
        this.visible = true
94
        this.$nextTick(() => {
95
          this.$refs['dataForm'].resetFields()
96
          if (this.dataForm.menuId) {
97
            this.$http({
98
              url: this.$http.adornUrl(`/admin/adminmenu/info/${this.dataForm.menuId}`),
99
              method: 'get',
100
              params: this.$http.adornParams()
101
            }).then(({data}) => {
102
              if (data && data.code === 0) {
103
                this.dataForm.parentId = data.adminMenu.parentId
104
                this.dataForm.name = data.adminMenu.name
105
                this.dataForm.url = data.adminMenu.url
106
                this.dataForm.perms = data.adminMenu.perms
107
                this.dataForm.type = data.adminMenu.type
108
                this.dataForm.icon = data.adminMenu.icon
109
                this.dataForm.orderNum = data.adminMenu.orderNum
110
                this.dataForm.me = data.adminMenu.me
111
                this.dataForm.isTab = data.adminMenu.isTab
112
              }
113
            })
114
          }
115
        })
116
      },
117
      // 表单提交
118
      dataFormSubmit () {
119
        this.$refs['dataForm'].validate((valid) => {
120
          if (valid) {
121
            this.$http({
122
              url: this.$http.adornUrl(`/admin/adminmenu/${!this.dataForm.menuId ? 'save' : 'update'}`),
123
              method: 'post',
124
              data: this.$http.adornData({
125
                'menuId': this.dataForm.menuId || undefined,
126
                'parentId': this.dataForm.parentId,
127
                'name': this.dataForm.name,
128
                'url': this.dataForm.url,
129
                'perms': this.dataForm.perms,
130
                'type': this.dataForm.type,
131
                'icon': this.dataForm.icon,
132
                'orderNum': this.dataForm.orderNum,
133
                'me': this.dataForm.me,
134
                'isTab': this.dataForm.isTab
135
              })
136
            }).then(({data}) => {
137
              if (data && data.code === 0) {
138
                this.$message({
139
                  message: '操作成功',
140
                  type: 'success',
141
                  duration: 1500,
142
                  onClose: () => {
143
                    this.visible = false
144
                    this.$emit('refreshDataList')
145
                  }
146
                })
147
              } else {
148
                this.$message.error(data.msg)
149
              }
150
            })
151
          }
152
        })
153
      }
154
    }
155
  }
156
</script>

+ 211 - 0
src/views/modules/sys/adminmenu.vue

@ -0,0 +1,211 @@
1
<template>
2
  <div class="mod-config">
3
    <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
4
      <el-form-item>
5
        <el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
6
      </el-form-item>
7
      <el-form-item>
8
        <el-button @click="getDataList()">查询</el-button>
9
        <el-button v-if="isAuth('admin:adminmenu:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
10
        <el-button v-if="isAuth('admin:adminmenu:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
11
      </el-form-item>
12
    </el-form>
13
    <el-table
14
      :data="dataList"
15
      border
16
      v-loading="dataListLoading"
17
      @selection-change="selectionChangeHandle"
18
      style="width: 100%;">
19
      <el-table-column
20
        type="selection"
21
        header-align="center"
22
        align="center"
23
        width="50">
24
      </el-table-column>
25
      <el-table-column
26
        prop="menuId"
27
        header-align="center"
28
        align="center"
29
        label="">
30
      </el-table-column>
31
      <el-table-column
32
        prop="parentId"
33
        header-align="center"
34
        align="center"
35
        label="父菜单ID,一级菜单为0">
36
      </el-table-column>
37
      <el-table-column
38
        prop="name"
39
        header-align="center"
40
        align="center"
41
        label="菜单名称">
42
      </el-table-column>
43
      <el-table-column
44
        prop="url"
45
        header-align="center"
46
        align="center"
47
        label="菜单URL">
48
      </el-table-column>
49
      <el-table-column
50
        prop="perms"
51
        header-align="center"
52
        align="center"
53
        label="授权(多个用逗号分隔,如:user:list,user:create)">
54
      </el-table-column>
55
      <el-table-column
56
        prop="type"
57
        header-align="center"
58
        align="center"
59
        label="类型   0:目录   1:菜单   2:按钮">
60
      </el-table-column>
61
      <el-table-column
62
        prop="icon"
63
        header-align="center"
64
        align="center"
65
        label="菜单图标">
66
      </el-table-column>
67
      <el-table-column
68
        prop="orderNum"
69
        header-align="center"
70
        align="center"
71
        label="排序">
72
      </el-table-column>
73
      <el-table-column
74
        prop="me"
75
        header-align="center"
76
        align="center"
77
        label="会议目录">
78
      </el-table-column>
79
      <el-table-column
80
        prop="isTab"
81
        header-align="center"
82
        align="center"
83
        label="tab">
84
      </el-table-column>
85
      <el-table-column
86
        fixed="right"
87
        header-align="center"
88
        align="center"
89
        width="150"
90
        label="操作">
91
        <template slot-scope="scope">
92
          <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.menuId)">修改</el-button>
93
          <el-button type="text" size="small" @click="deleteHandle(scope.row.menuId)">删除</el-button>
94
        </template>
95
      </el-table-column>
96
    </el-table>
97
    <el-pagination
98
      @size-change="sizeChangeHandle"
99
      @current-change="currentChangeHandle"
100
      :current-page="pageIndex"
101
      :page-sizes="[10, 20, 50, 100]"
102
      :page-size="pageSize"
103
      :total="totalPage"
104
      layout="total, sizes, prev, pager, next, jumper">
105
    </el-pagination>
106
    <!-- 弹窗, 新增 / 修改 -->
107
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
108
  </div>
109
</template>
110
111
<script>
112
  import AddOrUpdate from './adminmenu-add-or-update'
113
  export default {
114
    data () {
115
      return {
116
        dataForm: {
117
          key: ''
118
        },
119
        dataList: [],
120
        pageIndex: 1,
121
        pageSize: 10,
122
        totalPage: 0,
123
        dataListLoading: false,
124
        dataListSelections: [],
125
        addOrUpdateVisible: false
126
      }
127
    },
128
    components: {
129
      AddOrUpdate
130
    },
131
    activated () {
132
      this.getDataList()
133
    },
134
    methods: {
135
      // 获取数据列表
136
      getDataList () {
137
        this.dataListLoading = true
138
        this.$http({
139
          url: this.$http.adornUrl('/admin/adminmenu/list'),
140
          method: 'get',
141
          params: this.$http.adornParams({
142
            'page': this.pageIndex,
143
            'limit': this.pageSize,
144
            'key': this.dataForm.key
145
          })
146
        }).then(({data}) => {
147
          if (data && data.code === 0) {
148
            this.dataList = data.page.list
149
            this.totalPage = data.page.totalCount
150
          } else {
151
            this.dataList = []
152
            this.totalPage = 0
153
          }
154
          this.dataListLoading = false
155
        })
156
      },
157
      // 每页数
158
      sizeChangeHandle (val) {
159
        this.pageSize = val
160
        this.pageIndex = 1
161
        this.getDataList()
162
      },
163
      // 当前页
164
      currentChangeHandle (val) {
165
        this.pageIndex = val
166
        this.getDataList()
167
      },
168
      // 多选
169
      selectionChangeHandle (val) {
170
        this.dataListSelections = val
171
      },
172
      // 新增 / 修改
173
      addOrUpdateHandle (id) {
174
        this.addOrUpdateVisible = true
175
        this.$nextTick(() => {
176
          this.$refs.addOrUpdate.init(id)
177
        })
178
      },
179
      // 删除
180
      deleteHandle (id) {
181
        var ids = id ? [id] : this.dataListSelections.map(item => {
182
          return item.menuId
183
        })
184
        this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
185
          confirmButtonText: '确定',
186
          cancelButtonText: '取消',
187
          type: 'warning'
188
        }).then(() => {
189
          this.$http({
190
            url: this.$http.adornUrl('/admin/adminmenu/delete'),
191
            method: 'post',
192
            data: this.$http.adornData(ids, false)
193
          }).then(({data}) => {
194
            if (data && data.code === 0) {
195
              this.$message({
196
                message: '操作成功',
197
                type: 'success',
198
                duration: 1500,
199
                onClose: () => {
200
                  this.getDataList()
201
                }
202
              })
203
            } else {
204
              this.$message.error(data.msg)
205
            }
206
          })
207
        })
208
      }
209
    }
210
  }
211
</script>

+ 14 - 0
static/config/index.js

@ -0,0 +1,14 @@
1
/**
2
 * 开发环境
3
 */
4
;(function () {
5
  window.SITE_CONFIG = {};
6
7
  // api接口请求地址
8
  window.SITE_CONFIG['baseUrl'] = 'http://121.42.53.174:8002/renren-fast';
9
10
  // cdn地址 = 域名 + 版本号
11
  window.SITE_CONFIG['domain']  = './'; // 域名
12
  window.SITE_CONFIG['version'] = '';   // 版本号(年月日时分)
13
  window.SITE_CONFIG['cdnUrl']  = window.SITE_CONFIG.domain + window.SITE_CONFIG.version;
14
})();

+ 378 - 0
static/plugins/ueditor-1.4.3.3/dialogs/background/background.js

@ -1,3 +1,4 @@
1
<<<<<<< HEAD
1 2
(function () {
2 3
3 4
    var onlineImage,
@ -373,4 +374,381 @@
373 374
        editor.execCommand('background', backupStyle);
374 375
    };
375 376
377
=======
378
(function () {
379
380
    var onlineImage,
381
        backupStyle = editor.queryCommandValue('background');
382
383
    window.onload = function () {
384
        initTabs();
385
        initColorSelector();
386
    };
387
388
    /* 初始化tab标签 */
389
    function initTabs(){
390
        var tabs = $G('tabHeads').children;
391
        for (var i = 0; i < tabs.length; i++) {
392
            domUtils.on(tabs[i], "click", function (e) {
393
                var target = e.target || e.srcElement;
394
                for (var j = 0; j < tabs.length; j++) {
395
                    if(tabs[j] == target){
396
                        tabs[j].className = "focus";
397
                        var contentId = tabs[j].getAttribute('data-content-id');
398
                        $G(contentId).style.display = "block";
399
                        if(contentId == 'imgManager') {
400
                            initImagePanel();
401
                        }
402
                    }else {
403
                        tabs[j].className = "";
404
                        $G(tabs[j].getAttribute('data-content-id')).style.display = "none";
405
                    }
406
                }
407
            });
408
        }
409
    }
410
411
    /* 初始化颜色设置 */
412
    function initColorSelector () {
413
        var obj = editor.queryCommandValue('background');
414
        if (obj) {
415
            var color = obj['background-color'],
416
                repeat = obj['background-repeat'] || 'repeat',
417
                image = obj['background-image'] || '',
418
                position = obj['background-position'] || 'center center',
419
                pos = position.split(' '),
420
                x = parseInt(pos[0]) || 0,
421
                y = parseInt(pos[1]) || 0;
422
423
            if(repeat == 'no-repeat' && (x || y)) repeat = 'self';
424
425
            image = image.match(/url[\s]*\(([^\)]*)\)/);
426
            image = image ? image[1]:'';
427
            updateFormState('colored', color, image, repeat, x, y);
428
        } else {
429
            updateFormState();
430
        }
431
432
        var updateHandler = function () {
433
            updateFormState();
434
            updateBackground();
435
        }
436
        domUtils.on($G('nocolorRadio'), 'click', updateBackground);
437
        domUtils.on($G('coloredRadio'), 'click', updateHandler);
438
        domUtils.on($G('url'), 'keyup', function(){
439
            if($G('url').value && $G('alignment').style.display == "none") {
440
                utils.each($G('repeatType').children, function(item){
441
                    item.selected = ('repeat' == item.getAttribute('value') ? 'selected':false);
442
                });
443
            }
444
            updateHandler();
445
        });
446
        domUtils.on($G('repeatType'), 'change', updateHandler);
447
        domUtils.on($G('x'), 'keyup', updateBackground);
448
        domUtils.on($G('y'), 'keyup', updateBackground);
449
450
        initColorPicker();
451
    }
452
453
    /* 初始化颜色选择器 */
454
    function initColorPicker() {
455
        var me = editor,
456
            cp = $G("colorPicker");
457
458
        /* 生成颜色选择器ui对象 */
459
        var popup = new UE.ui.Popup({
460
            content: new UE.ui.ColorPicker({
461
                noColorText: me.getLang("clearColor"),
462
                editor: me,
463
                onpickcolor: function (t, color) {
464
                    updateFormState('colored', color);
465
                    updateBackground();
466
                    UE.ui.Popup.postHide();
467
                },
468
                onpicknocolor: function (t, color) {
469
                    updateFormState('colored', 'transparent');
470
                    updateBackground();
471
                    UE.ui.Popup.postHide();
472
                }
473
            }),
474
            editor: me,
475
            onhide: function () {
476
            }
477
        });
478
479
        /* 设置颜色选择器 */
480
        domUtils.on(cp, "click", function () {
481
            popup.showAnchor(this);
482
        });
483
        domUtils.on(document, 'mousedown', function (evt) {
484
            var el = evt.target || evt.srcElement;
485
            UE.ui.Popup.postHide(el);
486
        });
487
        domUtils.on(window, 'scroll', function () {
488
            UE.ui.Popup.postHide();
489
        });
490
    }
491
492
    /* 初始化在线图片列表 */
493
    function initImagePanel() {
494
        onlineImage = onlineImage || new OnlineImage('imageList');
495
    }
496
497
    /* 更新背景色设置面板 */
498
    function updateFormState (radio, color, url, align, x, y) {
499
        var nocolorRadio = $G('nocolorRadio'),
500
            coloredRadio = $G('coloredRadio');
501
502
        if(radio) {
503
            nocolorRadio.checked = (radio == 'colored' ? false:'checked');
504
            coloredRadio.checked = (radio == 'colored' ? 'checked':false);
505
        }
506
        if(color) {
507
            domUtils.setStyle($G("colorPicker"), "background-color", color);
508
        }
509
510
        if(url && /^\//.test(url)) {
511
            var a = document.createElement('a');
512
            a.href = url;
513
            browser.ie && (a.href = a.href);
514
            url = browser.ie ? a.href:(a.protocol + '//' + a.host + a.pathname + a.search + a.hash);
515
        }
516
517
        if(url || url === '') {
518
            $G('url').value = url;
519
        }
520
        if(align) {
521
            utils.each($G('repeatType').children, function(item){
522
                item.selected = (align == item.getAttribute('value') ? 'selected':false);
523
            });
524
        }
525
        if(x || y) {
526
            $G('x').value = parseInt(x) || 0;
527
            $G('y').value = parseInt(y) || 0;
528
        }
529
530
        $G('alignment').style.display = coloredRadio.checked && $G('url').value ? '':'none';
531
        $G('custom').style.display = coloredRadio.checked && $G('url').value && $G('repeatType').value == 'self' ? '':'none';
532
    }
533
534
    /* 更新背景颜色 */
535
    function updateBackground () {
536
        if ($G('coloredRadio').checked) {
537
            var color = domUtils.getStyle($G("colorPicker"), "background-color"),
538
                bgimg = $G("url").value,
539
                align = $G("repeatType").value,
540
                backgroundObj = {
541
                    "background-repeat": "no-repeat",
542
                    "background-position": "center center"
543
                };
544
545
            if (color) backgroundObj["background-color"] = color;
546
            if (bgimg) backgroundObj["background-image"] = 'url(' + bgimg + ')';
547
            if (align == 'self') {
548
                backgroundObj["background-position"] = $G("x").value + "px " + $G("y").value + "px";
549
            } else if (align == 'repeat-x' || align == 'repeat-y' || align == 'repeat') {
550
                backgroundObj["background-repeat"] = align;
551
            }
552
553
            editor.execCommand('background', backgroundObj);
554
        } else {
555
            editor.execCommand('background', null);
556
        }
557
    }
558
559
560
    /* 在线图片 */
561
    function OnlineImage(target) {
562
        this.container = utils.isString(target) ? document.getElementById(target) : target;
563
        this.init();
564
    }
565
    OnlineImage.prototype = {
566
        init: function () {
567
            this.reset();
568
            this.initEvents();
569
        },
570
        /* 初始化容器 */
571
        initContainer: function () {
572
            this.container.innerHTML = '';
573
            this.list = document.createElement('ul');
574
            this.clearFloat = document.createElement('li');
575
576
            domUtils.addClass(this.list, 'list');
577
            domUtils.addClass(this.clearFloat, 'clearFloat');
578
579
            this.list.id = 'imageListUl';
580
            this.list.appendChild(this.clearFloat);
581
            this.container.appendChild(this.list);
582
        },
583
        /* 初始化滚动事件,滚动到地步自动拉取数据 */
584
        initEvents: function () {
585
            var _this = this;
586
587
            /* 滚动拉取图片 */
588
            domUtils.on($G('imageList'), 'scroll', function(e){
589
                var panel = this;
590
                if (panel.scrollHeight - (panel.offsetHeight + panel.scrollTop) < 10) {
591
                    _this.getImageData();
592
                }
593
            });
594
            /* 选中图片 */
595
            domUtils.on(this.container, 'click', function (e) {
596
                var target = e.target || e.srcElement,
597
                    li = target.parentNode,
598
                    nodes = $G('imageListUl').childNodes;
599
600
                if (li.tagName.toLowerCase() == 'li') {
601
                    updateFormState('nocolor', null, '');
602
                    for (var i = 0, node; node = nodes[i++];) {
603
                        if (node == li && !domUtils.hasClass(node, 'selected')) {
604
                            domUtils.addClass(node, 'selected');
605
                            updateFormState('colored', null, li.firstChild.getAttribute("_src"), 'repeat');
606
                        } else {
607
                            domUtils.removeClasses(node, 'selected');
608
                        }
609
                    }
610
                    updateBackground();
611
                }
612
            });
613
        },
614
        /* 初始化第一次的数据 */
615
        initData: function () {
616
617
            /* 拉取数据需要使用的值 */
618
            this.state = 0;
619
            this.listSize = editor.getOpt('imageManagerListSize');
620
            this.listIndex = 0;
621
            this.listEnd = false;
622
623
            /* 第一次拉取数据 */
624
            this.getImageData();
625
        },
626
        /* 重置界面 */
627
        reset: function() {
628
            this.initContainer();
629
            this.initData();
630
        },
631
        /* 向后台拉取图片列表数据 */
632
        getImageData: function () {
633
            var _this = this;
634
635
            if(!_this.listEnd && !this.isLoadingData) {
636
                this.isLoadingData = true;
637
                var url = editor.getActionUrl(editor.getOpt('imageManagerActionName')),
638
                    isJsonp = utils.isCrossDomainUrl(url);
639
                ajax.request(url, {
640
                    'timeout': 100000,
641
                    'dataType': isJsonp ? 'jsonp':'',
642
                    'data': utils.extend({
643
                            start: this.listIndex,
644
                            size: this.listSize
645
                        }, editor.queryCommandValue('serverparam')),
646
                    'method': 'get',
647
                    'onsuccess': function (r) {
648
                        try {
649
                            var json = isJsonp ? r:eval('(' + r.responseText + ')');
650
                            if (json.state == 'SUCCESS') {
651
                                _this.pushData(json.list);
652
                                _this.listIndex = parseInt(json.start) + parseInt(json.list.length);
653
                                if(_this.listIndex >= json.total) {
654
                                    _this.listEnd = true;
655
                                }
656
                                _this.isLoadingData = false;
657
                            }
658
                        } catch (e) {
659
                            if(r.responseText.indexOf('ue_separate_ue') != -1) {
660
                                var list = r.responseText.split(r.responseText);
661
                                _this.pushData(list);
662
                                _this.listIndex = parseInt(list.length);
663
                                _this.listEnd = true;
664
                                _this.isLoadingData = false;
665
                            }
666
                        }
667
                    },
668
                    'onerror': function () {
669
                        _this.isLoadingData = false;
670
                    }
671
                });
672
            }
673
        },
674
        /* 添加图片到列表界面上 */
675
        pushData: function (list) {
676
            var i, item, img, icon, _this = this,
677
                urlPrefix = editor.getOpt('imageManagerUrlPrefix');
678
            for (i = 0; i < list.length; i++) {
679
                if(list[i] && list[i].url) {
680
                    item = document.createElement('li');
681
                    img = document.createElement('img');
682
                    icon = document.createElement('span');
683
684
                    domUtils.on(img, 'load', (function(image){
685
                        return function(){
686
                            _this.scale(image, image.parentNode.offsetWidth, image.parentNode.offsetHeight);
687
                        }
688
                    })(img));
689
                    img.width = 113;
690
                    img.setAttribute('src', urlPrefix + list[i].url + (list[i].url.indexOf('?') == -1 ? '?noCache=':'&noCache=') + (+new Date()).toString(36) );
691
                    img.setAttribute('_src', urlPrefix + list[i].url);
692
                    domUtils.addClass(icon, 'icon');
693
694
                    item.appendChild(img);
695
                    item.appendChild(icon);
696
                    this.list.insertBefore(item, this.clearFloat);
697
                }
698
            }
699
        },
700
        /* 改变图片大小 */
701
        scale: function (img, w, h, type) {
702
            var ow = img.width,
703
                oh = img.height;
704
705
            if (type == 'justify') {
706
                if (ow >= oh) {
707
                    img.width = w;
708
                    img.height = h * oh / ow;
709
                    img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
710
                } else {
711
                    img.width = w * ow / oh;
712
                    img.height = h;
713
                    img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
714
                }
715
            } else {
716
                if (ow >= oh) {
717
                    img.width = w * ow / oh;
718
                    img.height = h;
719
                    img.style.marginLeft = '-' + parseInt((img.width - w) / 2) + 'px';
720
                } else {
721
                    img.width = w;
722
                    img.height = h * oh / ow;
723
                    img.style.marginTop = '-' + parseInt((img.height - h) / 2) + 'px';
724
                }
725
            }
726
        },
727
        getInsertList: function () {
728
            var i, lis = this.list.children, list = [], align = getAlign();
729
            for (i = 0; i < lis.length; i++) {
730
                if (domUtils.hasClass(lis[i], 'selected')) {
731
                    var img = lis[i].firstChild,
732
                        src = img.getAttribute('_src');
733
                    list.push({
734
                        src: src,
735
                        _src: src,
736
                        floatStyle: align
737
                    });
738
                }
739
740
            }
741
            return list;
742
        }
743
    };
744
745
    dialog.onok = function () {
746
        updateBackground();
747
        editor.fireEvent('saveScene');
748
    };
749
    dialog.oncancel = function () {
750
        editor.execCommand('background', backupStyle);
751
    };
752
753
>>>>>>> b4a72a7622733ad6688835b7f0c303ebd79673f3
376 754
})();

+ 78 - 0
static/plugins/ueditor-1.4.3.3/themes/default/css/ueditor.css

@ -1743,6 +1743,7 @@ div.edui-box {
1743 1743
.edui-default .edui-cellalignpicker-body td.edui-cellalign-selected .edui-right {
1744 1744
    background-position: -271px 0;
1745 1745
}
1746
<<<<<<< HEAD
1746 1747
/*分隔线*/
1747 1748
.edui-default .edui-toolbar .edui-separator {
1748 1749
    width: 2px;
@ -1818,6 +1819,83 @@ div.edui-box {
1818 1819
    padding: 0 !important;
1819 1820
    background-color: #fff5d4;
1820 1821
    border: 1px solid #dcac6c;
1822
=======
1823
/*分隔线*/
1824
.edui-default .edui-toolbar .edui-separator {
1825
    width: 2px;
1826
    height: 20px;
1827
    margin: 2px 4px 2px 3px;
1828
    background: url(../images/icons.png) -181px 0;
1829
    background: url(../images/icons.gif) -181px 0 \9;
1830
}
1831
1832
/*颜色按钮 */
1833
.edui-default .edui-toolbar .edui-colorbutton .edui-colorlump {
1834
    position: absolute;
1835
    overflow: hidden;
1836
    bottom: 1px;
1837
    left: 1px;
1838
    width: 18px;
1839
    height: 4px;
1840
}
1841
/*表情按钮及弹出菜单*/
1842
/*去除了表情的下拉箭头*/
1843
.edui-default .edui-for-emotion .edui-icon {
1844
    background-position: -60px -20px;
1845
}
1846
.edui-default .edui-for-emotion .edui-popup-content iframe
1847
{
1848
    width: 514px;
1849
    height: 380px;
1850
    overflow: hidden;
1851
}
1852
.edui-default .edui-for-emotion .edui-popup-content
1853
{
1854
    position: relative;
1855
    z-index: 555
1856
}
1857
1858
.edui-default .edui-for-emotion .edui-splitborder {
1859
    display: none
1860
}
1861
1862
.edui-default .edui-for-emotion .edui-splitbutton-body .edui-arrow
1863
{
1864
    width: 0
1865
}
1866
.edui-default .edui-toolbar .edui-for-emotion  .edui-state-active .edui-splitborder
1867
{
1868
    border-left: 1px solid transparent;
1869
}
1870
/*contextmenu*/
1871
.edui-default .edui-hassubmenu .edui-arrow {
1872
    height: 20px;
1873
    width: 20px;
1874
    float: right;
1875
    background: url("../images/icons-all.gif") no-repeat 10px -233px;
1876
}
1877
1878
.edui-default .edui-menu-body .edui-menuitem {
1879
    padding: 1px;
1880
}
1881
1882
.edui-default .edui-menuseparator {
1883
    margin: 2px 0;
1884
    height: 1px;
1885
    overflow: hidden;
1886
}
1887
1888
.edui-default .edui-menuseparator-inner {
1889
    border-bottom: 1px solid #e2e3e3;
1890
    margin-left: 29px;
1891
    margin-right: 1px;
1892
}
1893
1894
.edui-default .edui-menu-body .edui-state-hover {
1895
    padding: 0 !important;
1896
    background-color: #fff5d4;
1897
    border: 1px solid #dcac6c;
1898
>>>>>>> b4a72a7622733ad6688835b7f0c303ebd79673f3
1821 1899
}
1822 1900
/*弹出菜单*/
1823 1901
.edui-default .edui-shortcutmenu {