kuaifan 5 роки тому
батько
коміт
6b4249b6ca

+ 5 - 0
app/Http/Controllers/Api/UsersController.php

@@ -175,6 +175,11 @@ class UsersController extends Controller
                 $array['profession'] = $profession;
             }
         }
+        //背景
+        $bgid = intval(Request::input('bgid'));
+        if ($bgid > 0) {
+            $array['bgid'] = $bgid;
+        }
         //
         if ($array) {
             DB::table('users')->where('id', $user['id'])->update($array);

+ 24 - 2
resources/assets/js/main/components/WContent.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="w-content">
+    <div class="w-content" :style="`background-image:${getBgUrl(bgid)}`">
         <slot/>
     </div>
 </template>
@@ -15,7 +15,6 @@
         background-repeat: no-repeat;
         background-position: center;
         background-color: #EEEEEE;
-        background-image: url("../../../statics/images/bg1.jpg");
         background-size: cover;
 
         .w-container {
@@ -26,5 +25,28 @@
 <script>
     export default {
         name: 'WContent',
+        data() {
+            return {
+                bgid: -1,
+
+                userInfo: {}
+            }
+        },
+        mounted() {
+            this.userInfo = $A.getUserInfo((res) => {
+                this.userInfo = res;
+                this.bgid = this.userInfo.bgid;
+            }, false);
+            this.bgid = this.userInfo.bgid;
+        },
+        methods: {
+            getBgUrl(id, thumb) {
+                if (id < 0) {
+                    return 'none';
+                }
+                id = Math.max(1, parseInt(id));
+                return 'url(' + window.location.origin + '/images/bg/' + (thumb ? 'thumb/' : '') + id + '.jpg' + ')';
+            },
+        }
     }
 </script>

+ 79 - 5
resources/assets/js/main/components/WHeader.vue

@@ -57,7 +57,23 @@
                         </FormItem>
                     </Form>
                 </TabPane>
-                <!--<TabPane :label="$L('偏好设置')" name="setting"></TabPane>-->
+                <TabPane :label="$L('偏好设置')" name="setting">
+                    <Form ref="formSetting" :model="formSetting" :label-width="100">
+                        <FormItem :label="$L('系统皮肤')" prop="bgid">
+                            <ul class="setting-bg">
+                                <li v-for="i in [1,2,3,4,5,6,7,8,9,10,11,12]"
+                                    :key="i"
+                                    :style="`background-image:${getBgUrl(i, true)}`"
+                                    :class="{active:formSetting.bgid==i}"
+                                    @click="formSetting.bgid=i"></li>
+                            </ul>
+                        </FormItem>
+                        <FormItem>
+                            <Button :loading="loadIng > 0" type="primary" @click="handleSubmit('formSetting')">{{$L('提交')}}</Button>
+                            <Button :loading="loadIng > 0" @click="handleReset('formSetting')" style="margin-left: 8px">{{$L('重置')}}</Button>
+                        </FormItem>
+                    </Form>
+                </TabPane>
                 <TabPane :label="$L('账号密码')" name="account">
                     <Form ref="formPass" :model="formPass" :rules="rulePass" :label-width="100">
                         <FormItem :label="$L('旧密码')" prop="oldpass">
@@ -158,6 +174,32 @@
             }
         }
     }
+    .setting-bg {
+        margin-top: 6px;
+        margin-bottom: -24px;
+        &:after,
+        &:before {
+            display: table;
+            content: "";
+        }
+        li {
+            margin: 0 16px 16px 0;
+            width: 160px;
+            height: 124px;
+            display: inline-block;
+            cursor: pointer;
+            border: solid 2px #fff;
+            background-repeat: no-repeat;
+            background-position: center;
+            background-size: cover;
+            transition: all 0.2s;
+            &.active,
+            &:hover {
+                border-color: #0396f2;
+                transform: scale(1.02);
+            }
+        }
+    }
 </style>
 <script>
     import ImgUpload from "./ImgUpload";
@@ -189,7 +231,11 @@
                     newpass: '',
                     checkpass: '',
                 },
-                rulePass: { }
+                rulePass: { },
+
+                formSetting: {
+                    bgid: 0,
+                },
             }
         },
         created() {
@@ -239,14 +285,23 @@
             };
         },
         mounted() {
+            let resCall = () => {
+                this.$set(this.formDatum, 'userimg', this.userInfo.userimg)
+                this.$set(this.formDatum, 'nickname', this.userInfo.nickname)
+                this.$set(this.formDatum, 'profession', this.userInfo.profession)
+                this.$set(this.formSetting, 'bgid', this.userInfo.bgid)
+            };
             this.userInfo = $A.getUserInfo((res) => {
                 this.userInfo = res;
-                this.$set(this.formDatum, 'userimg', res.userimg)
-                this.$set(this.formDatum, 'nickname', res.nickname)
-                this.$set(this.formDatum, 'profession', res.profession)
+                resCall();
             }, false);
+            resCall();
         },
         methods: {
+            getBgUrl(id, thumb) {
+                id = Math.max(1, parseInt(id));
+                return 'url(' + window.location.origin + '/images/bg/' + (thumb ? 'thumb/' : '') + id + '.jpg' + ')';
+            },
             tabPage(path) {
                 this.goForward({path: '/' + path});
             },
@@ -314,6 +369,25 @@
                                 });
                                 break;
                             }
+                            case "formSetting": {
+                                this.loadIng++;
+                                $A.aAjax({
+                                    url: 'users/editdata',
+                                    data: this.formSetting,
+                                    complete: () => {
+                                        this.loadIng--;
+                                    },
+                                    success: (res) => {
+                                        if (res.ret === 1) {
+                                            $A.getUserInfo(true);
+                                            this.$Message.success(this.$L('修改成功'));
+                                        } else {
+                                            this.$Modal.error({title: this.$L('温馨提示'), content: res.msg });
+                                        }
+                                    }
+                                });
+                                break;
+                            }
                         }
                     }
                 })

Різницю між файлами не показано, бо вона завелика
+ 42 - 5
resources/assets/js/main/components/docs/NestedDraggable.vue


+ 2 - 1
resources/assets/js/main/components/project/task/logs.vue

@@ -13,7 +13,7 @@
                                 <div class="log-summary">
                                     <span class="log-creator">{{item.username}}</span>
                                     <span class="log-text-secondary">{{item.detail}}</span>
-                                    <span v-if="item.other.type=='task' && taskid == 0" class="log-text-link">{{item.other.title}}</span>
+                                    <span v-if="item.other.type=='task' && taskid == 0" class="log-text-link" @click="taskDetail(item.other.id)">{{item.other.title}}</span>
                                     <a v-if="item.other.type=='file'" class="log-text-link" target="_blank" :href="fileDownUrl(item.other.id)">{{item.other.name}}</a>
                                     <span class="log-text-info">{{item.timeData.ymd}} {{item.timeData.segment}} {{item.timeData.hi}}</span></div>
                             </TimelineItem>
@@ -101,6 +101,7 @@
                     }
                     .log-text-link {
                         color: #048be0;
+                        cursor: pointer;
                     }
                     .log-text-info {
                         color: rgba(0,0,0,.36);

+ 7 - 2
resources/assets/js/main/pages/docs.vue

@@ -196,6 +196,8 @@
             return {
                 loadIng: 0,
 
+                userInfo: {},
+
                 bookLists: [],
                 bookListPage: 1,
                 bookListTotal: 0,
@@ -251,8 +253,11 @@
 
         mounted() {
             this.getBookLists(true);
-            $A.getUserInfo((res, isLogin) => {
-                isLogin && this.getBookLists(true);
+            this.userInfo = $A.getUserInfo((res, isLogin) => {
+                if (this.userInfo.id != res.id) {
+                    this.userInfo = res;
+                    isLogin && this.getBookLists(true);
+                }
             }, false);
         },
 

+ 5 - 5
resources/assets/js/main/pages/docs/edit.vue

@@ -7,8 +7,8 @@
             <div class="edit-header">
                 <div class="header-menu active" @click="handleClick('back')"><Icon type="md-arrow-back" /></div>
                 <div class="header-menu" @click="handleClick('menu')"><Icon type="md-menu" /></div>
-                <div class="header-menu" @click="handleClick('share')"><Icon type="md-share" /></div>
-                <div class="header-menu" @click="handleClick('view')"><Icon type="md-eye" /></div>
+                <!--<div class="header-menu" @click="handleClick('share')"><Icon type="md-share" /></div>
+                <div class="header-menu" @click="handleClick('view')"><Icon type="md-eye" /></div>-->
                 <div class="header-menu" @click="handleClick('history')"><Icon type="md-time" /></div>
                 <div class="header-title">{{docDetail.title}}</div>
                 <div v-if="docDetail.type=='mind'" class="header-hint">选中节点,按enter键添加子节点,tab键添加同级节点</div>
@@ -24,11 +24,11 @@
 
         <Drawer v-model="docDrawerShow" width="450">
             <Tabs v-if="docDrawerShow" v-model="docDrawerTab">
-                <TabPane :label="$L('目录')" name="menu">
-                    <nested-draggable :lists="sectionLists" :readonly="true" @change="handleSection"></nested-draggable>
+                <TabPane :label="$L('知识库目录')" name="menu">
+                    <nested-draggable :lists="sectionLists" :readonly="true" :activeid="sid" @change="handleSection"></nested-draggable>
                     <div v-if="sectionLists.length == 0" style="color:#888;padding:32px;text-align:center">{{sectionNoDataText}}</div>
                 </TabPane>
-                <TabPane :label="$L('历史版本')" name="history">
+                <TabPane :label="$L('文档历史版本')" name="history">
                     <Table class="tableFill" :columns="historyColumns" :data="historyLists" :no-data-text="historyNoDataText" size="small" stripe></Table>
                 </TabPane>
             </Tabs>

+ 7 - 2
resources/assets/js/main/pages/project.vue

@@ -294,6 +294,8 @@
             return {
                 loadIng: 0,
 
+                userInfo: {},
+
                 addShow: false,
                 formAdd: {
                     title: '',
@@ -336,8 +338,11 @@
         },
         mounted() {
             this.getLists(true);
-            $A.getUserInfo((res, isLogin) => {
-                isLogin && this.getLists(true);
+            this.userInfo = $A.getUserInfo((res, isLogin) => {
+                if (this.userInfo.id != res.id) {
+                    this.userInfo = res;
+                    isLogin && this.getLists(true);
+                }
             }, false);
             //
             $A.setOnTaskInfoListener('pages/project',(act, detail) => {

+ 7 - 2
resources/assets/js/main/pages/team.vue

@@ -97,6 +97,8 @@
             return {
                 loadIng: 0,
 
+                userInfo: {},
+
                 columns: [],
 
                 lists: [],
@@ -242,8 +244,11 @@
         },
         mounted() {
             this.getLists(true);
-            $A.getUserInfo((res, isLogin) => {
-                isLogin && this.getLists(true);
+            this.userInfo = $A.getUserInfo((res, isLogin) => {
+                if (this.userInfo.id != res.id) {
+                    this.userInfo = res;
+                    isLogin && this.getLists(true);
+                }
             }, false);
         },
         deactivated() {

+ 7 - 2
resources/assets/js/main/pages/todo.vue

@@ -340,6 +340,8 @@
             return {
                 loadIng: 0,
 
+                userInfo: {},
+
                 taskDatas: {
                     "1": {lists: [], hasMorePages: false},
                     "2": {lists: [], hasMorePages: false},
@@ -359,8 +361,11 @@
         },
         mounted() {
             this.refreshTask();
-            $A.getUserInfo((res, isLogin) => {
-                isLogin && this.refreshTask();
+            this.userInfo = $A.getUserInfo((res, isLogin) => {
+                if (this.userInfo.id != res.id) {
+                    this.userInfo = res;
+                    isLogin && this.refreshTask();
+                }
             }, false);
             //
             $A.setOnTaskInfoListener('pages/todo',(act, detail) => {