Parcourir la source

适配移动端

kuaifan il y a 5 ans
Parent
commit
e793da06b3

+ 1 - 1
resources/assets/js/main/App.vue

@@ -179,7 +179,7 @@
                     $A.WSOB.close();
                 } else {
                     $A.WSOB.setOnMsgListener("app", (msgDetail) => {
-                        if (msgDetail.username == $A.getUserName()) {
+                        if (msgDetail.username == this.usrName) {
                             return;
                         }
                         switch (msgDetail.messageType) {

+ 9 - 7
resources/assets/js/main/components/WContent.vue

@@ -28,16 +28,18 @@
         data() {
             return {
                 bgid: -1,
-
-                userInfo: {}
             }
         },
         mounted() {
-            this.userInfo = $A.getUserInfo((res) => {
-                this.userInfo = res;
-                this.bgid = $A.runNum(this.userInfo.bgid);
-            }, false);
-            this.bgid = $A.runNum(this.userInfo.bgid);
+            this.bgid = $A.runNum(this.usrInfo.bgid);
+        },
+        watch: {
+            usrInfo: {
+                handler(info) {
+                    this.bgid = $A.runNum(info.bgid);
+                },
+                deep: true
+            }
         },
         methods: {
             getBgUrl(id, thumb) {

+ 23 - 24
resources/assets/js/main/components/WHeader.vue

@@ -26,8 +26,8 @@
             <div class="w-header-row-right">
                 <Dropdown class="right-info" trigger="click" @on-click="setRightSelect" placement="bottom-end" transfer>
                    <div>
-                       <UserImg class="userimg" :info="userInfo"/>
-                       <span class="username">{{$L('欢迎您')}}, {{(userInfo.nickname || userInfo.username) || $L('尊敬的会员')}}</span>
+                       <UserImg class="userimg" :info="usrInfo"/>
+                       <span class="username">{{$L('欢迎您')}}, {{(usrInfo.nickname || usrInfo.username) || $L('尊敬的会员')}}</span>
                        <Icon type="md-arrow-dropdown"/>
                    </div>
                     <Dropdown-menu slot="list">
@@ -103,7 +103,7 @@
                             <span style="color:#777">{{$L('建议尺寸:%', '200x200')}}</span>
                         </FormItem>
                         <FormItem :label="$L('账号')">
-                            <Input v-model="userInfo.username" :disabled="true"></Input>
+                            <Input v-model="usrInfo.username" :disabled="true"></Input>
                         </FormItem>
                         <FormItem :label="$L('昵称')" prop="nickname">
                             <Input v-model="formDatum.nickname"></Input>
@@ -135,7 +135,7 @@
                     </Form>
                 </TabPane>
                 <TabPane :label="$L('账号密码')" name="account">
-                    <Alert v-if="userInfo.changepass" type="warning" showIcon>{{$L('请先修改登录密码!')}}</Alert>
+                    <Alert v-if="usrInfo.changepass" type="warning" showIcon>{{$L('请先修改登录密码!')}}</Alert>
                     <Form ref="formPass" :model="formPass" :rules="rulePass" :label-width="100" @submit.native.prevent>
                         <FormItem :label="$L('旧密码')" prop="oldpass">
                             <Input v-model="formPass.oldpass" type="password"></Input>
@@ -376,7 +376,6 @@
                 tabActive: '',
 
                 loadIng: 0,
-                userInfo: {},
                 isAdmin: false,
 
                 systemDrawerShow: false,
@@ -461,23 +460,8 @@
             };
         },
         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.formDatum__reset = $A.cloneData(this.formDatum);
-                this.formSetting__reset = $A.cloneData(this.formSetting);
-                this.formPass__reset = $A.cloneData(this.formPass);
-                this.changepass();
-            };
-            this.userInfo = $A.getUserInfo((res) => {
-                this.userInfo = res;
-                this.isAdmin = $A.identity('admin');
-                resCall();
-            }, false);
             this.isAdmin = $A.identity('admin');
-            resCall();
+            this.formatDatum();
             //
             this.tabActive = this.$route.meta.tabActive;
             //
@@ -490,14 +474,29 @@
                 this.tabActive = this.$route.meta.tabActive;
                 this.systemDrawerShow = false;
                 this.chatDrawerShow = $A.urlParameter("open") === 'chat' && $A.getToken() !== false;
-                if (!this.userInfo.changepass) {
+                if (!this.usrInfo.changepass) {
                     this.userDrawerShow = false;
                 }
+            },
+            usrName() {
+                this.isAdmin = $A.identity('admin');
+                this.formatDatum();
             }
         },
         methods: {
+            formatDatum() {
+                this.$set(this.formDatum, 'userimg', this.usrInfo.userimg)
+                this.$set(this.formDatum, 'nickname', this.usrInfo.nickname)
+                this.$set(this.formDatum, 'profession', this.usrInfo.profession)
+                this.$set(this.formSetting, 'bgid', this.usrInfo.bgid)
+                this.formDatum__reset = $A.cloneData(this.formDatum);
+                this.formSetting__reset = $A.cloneData(this.formSetting);
+                this.formPass__reset = $A.cloneData(this.formPass);
+                this.changepass();
+            },
+
             changepass() {
-                if (this.userInfo.changepass) {
+                if (this.usrInfo.changepass) {
                     this.userDrawerShow = true;
                     this.userDrawerTab = 'account';
                     setTimeout(() => {
@@ -586,7 +585,7 @@
                                     success: (res) => {
                                         if (res.ret === 1) {
                                             $A.getUserInfo(true);
-                                            $A.getUserBasic(this.userInfo.username, () => {}, 0);
+                                            $A.getUserBasic(this.usrInfo.username, () => {}, 0);
                                             this.$Message.success(this.$L('修改成功'));
                                         } else {
                                             this.$Modal.error({title: this.$L('温馨提示'), content: res.msg });

+ 21 - 24
resources/assets/js/main/components/chat/Index.vue

@@ -946,29 +946,7 @@
         },
 
         mounted() {
-            let resCall = () => {
-                if ($A.getToken() === false) {
-                    return;
-                }
-                $A.WSOB.sendTo('unread', (res) => {
-                    if (res.status === 1) {
-                        this.unreadTotal = $A.runNum(res.message);
-                    } else {
-                        this.unreadTotal = 0;
-                    }
-                });
-                this.getDialogLists();
-                this.messageBottomAuto();
-            };
-            this.userInfo = $A.getUserInfo((res, isLogin) => {
-                if (this.userInfo.id != res.id) {
-                    this.userInfo = res;
-                    resCall();
-                } else {
-                    this.userInfo = res;
-                }
-            }, false);
-            resCall();
+            this.formatCall();
             this.getSetting();
             //
             window.onChatOpenUserName = (username) => {
@@ -985,7 +963,7 @@
             }
             //
             $A.WSOB.setOnMsgListener("chat/index", (msgDetail) => {
-                if (msgDetail.username == $A.getUserName()) {
+                if (msgDetail.username == this.usrName) {
                     return;
                 }
                 switch (msgDetail.messageType) {
@@ -1068,6 +1046,10 @@
         },
 
         watch: {
+            usrName() {
+                this.formatCall();
+            },
+
             chatTap(val) {
                 if (val === 'team' && this.teamReady == false) {
                     this.teamReady = true;
@@ -1142,6 +1124,21 @@
         },
 
         methods: {
+            formatCall() {
+                if ($A.getToken() === false) {
+                    return;
+                }
+                $A.WSOB.sendTo('unread', (res) => {
+                    if (res.status === 1) {
+                        this.unreadTotal = $A.runNum(res.message);
+                    } else {
+                        this.unreadTotal = 0;
+                    }
+                });
+                this.getDialogLists();
+                this.messageBottomAuto();
+            },
+
             getSetting() {
                 $A.apiAjax({
                     url: 'system/setting',

+ 1 - 1
resources/assets/js/main/components/docs/users.vue

@@ -234,7 +234,7 @@
                                 props: {
                                     value: this.userValue,
                                     multiple: true,
-                                    nousername: $A.getUserName(),
+                                    nousername: this.usrName,
                                     nobookid: this.id,
                                     placeholder: this.$L('请输入昵称/用户名搜索')
                                 },

+ 1 - 1
resources/assets/js/main/components/project/header/archived.vue

@@ -153,7 +153,7 @@
                 this.getLists(true);
             }
             $A.setOnTaskInfoListener('components/project/header/archived', (act, detail) => {
-                if (detail.username != $A.getUserName()) {
+                if (detail.username != this.usrName) {
                     this.lists.some((task, i) => {
                         if (task.id == detail.id) {
                             this.lists.splice(i, 1);

+ 1 - 1
resources/assets/js/main/components/project/header/create.vue

@@ -97,7 +97,7 @@
                 this.getLists(true);
             }
             $A.setOnTaskInfoListener('components/project/header/create',(act, detail) => {
-                if (detail.createuser != $A.getUserName()) {
+                if (detail.createuser != this.usrName) {
                     return;
                 }
                 //

+ 2 - 7
resources/assets/js/main/components/project/task/add.vue

@@ -220,20 +220,15 @@
                 addFocus: false,
 
                 nameTipDisabled: false,
-
-                userInfo: {},
             }
         },
         mounted() {
-            this.userInfo = $A.getUserInfo((res, isLogin) => {
-                this.userInfo = res;
-            }, false);
-            this.addUserInfo = $A.cloneData(this.userInfo);
+            this.addUserInfo = $A.cloneData(this.usrInfo);
         },
         methods: {
             changeUser(user) {
                 if (typeof user.username === "undefined") {
-                    this.addUserInfo = $A.cloneData(this.userInfo);
+                    this.addUserInfo = $A.cloneData(this.usrInfo);
                 } else {
                     this.addUserInfo = user;
                 }

+ 3 - 3
resources/assets/js/main/components/project/task/detail/detail.vue

@@ -48,7 +48,7 @@
                                 <Button :loading="!!loadData.claim" class="uname-button" type="primary" size="small" @click="handleTask('claimb')">{{$L('认领任务')}}</Button>
                             </em>
                             <em v-if="detail.type=='assign' && !detail.reassign">
-                                <Button v-if="detail.username==$A.getUserName()" class="uname-button" type="success" size="small" @click="handleTask('reassign')">{{$L('确认接收')}}</Button>
+                                <Button v-if="detail.username==usrName" class="uname-button" type="success" size="small" @click="handleTask('reassign')">{{$L('确认接收')}}</Button>
                                 <div v-else class="uname-text">[{{$L('等待确认')}}]</div>
                             </em>
                         </template>
@@ -339,11 +339,11 @@
                 }, 0)
             });
             this.bakData = cloneDeep(this.detail);
-            this.myUsername = $A.getUserName();
+            this.myUsername = this.usrName;
             this.getTaskDetail();
             //
             $A.setOnUserInfoListener("components/project/task/detail", () => {
-                this.myUsername = $A.getUserName();
+                this.myUsername = this.usrName;
             });
             $A.setOnTaskInfoListener('components/project/task/detail',(act, detail) => {
                 if (detail.id != this.taskid) {

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

@@ -328,7 +328,7 @@
             uploadList(files) {
                 files.forEach((file) => {
                     if (typeof file.username === "undefined") {
-                        file.username = $A.getUserName();
+                        file.username = this.usrName;
                         file.indate = Math.round(new Date().getTime()/1000);
                         this.lists.unshift(file);
                         this.$emit('change', 'up');

+ 2 - 2
resources/assets/js/main/components/project/todo/attention.vue

@@ -108,7 +108,7 @@
                 this.getLists(true);
             }
             $A.setOnTaskInfoListener('components/project/todo/attention', (act, detail) => {
-                if (detail.follower.indexOf($A.getUserName()) === -1) {
+                if (detail.follower.indexOf(this.usrName) === -1) {
                     this.lists.some((task, i) => {
                         if (task.id == detail.id) {
                             this.lists.splice(i, 1);
@@ -137,7 +137,7 @@
                         break;
 
                     case "attention":       // 添加关注
-                        let username = $A.getUserName();
+                        let username = this.usrName;
                         if (detail.follower.filter((uname) => { return uname == username }).length == 0) {
                             return;
                         }

+ 1 - 1
resources/assets/js/main/components/project/todo/calendar.vue

@@ -40,7 +40,7 @@
         },
         mounted() {
             $A.setOnTaskInfoListener('components/project/todo/calendar',(act, detail) => {
-                if (detail.username != $A.getUserName()) {
+                if (detail.username != this.usrName) {
                     this.lists.some((task, i) => {
                         if (task.id == detail.id) {
                             this.lists.splice(i, 1);

+ 1 - 1
resources/assets/js/main/components/project/todo/complete.vue

@@ -94,7 +94,7 @@
                 this.getLists(true);
             }
             $A.setOnTaskInfoListener('components/project/todo/complete',(act, detail) => {
-                if (detail.username != $A.getUserName()) {
+                if (detail.username != this.usrName) {
                     this.lists.some((task, i) => {
                         if (task.id == detail.id) {
                             this.lists.splice(i, 1);

+ 1 - 1
resources/assets/js/main/components/report/add.vue

@@ -12,7 +12,7 @@
             </div>
             <t-editor class="add-edit" v-model="dataDetail.content" height="100%"></t-editor>
             <div class="add-input">
-                <UserInput v-model="dataDetail.ccuser" :nousername="$A.getUserName()" :placeholder="$L('输入关键词搜索')" multiple><span slot="prepend">{{$L('抄送人')}}</span></UserInput>
+                <UserInput v-model="dataDetail.ccuser" :nousername="usrName" :placeholder="$L('输入关键词搜索')" multiple><span slot="prepend">{{$L('抄送人')}}</span></UserInput>
                 <div class="add-prev-btn" @click="getPrevCc">{{$L('使用我上次抄送的人')}}</div>
             </div>
             <div class="add-footer">

+ 2 - 3
resources/assets/js/main/components/report/my.vue

@@ -281,11 +281,10 @@
                                     }
                                 }, 350);
                                 //
-                                let userInfo = $A.getUserInfo();
                                 let msgData = {
                                     type: 'report',
-                                    username: userInfo.username,
-                                    userimg: userInfo.userimg,
+                                    username: this.usrInfo.username,
+                                    userimg: this.usrInfo.userimg,
                                     indate: Math.round(new Date().getTime() / 1000),
                                     text: res.data.ccuserAgain ? this.$L('修改了工作报告') : this.$L('发送了工作报告'),
                                     other: {

+ 4 - 10
resources/assets/js/main/pages/docs.vue

@@ -238,8 +238,6 @@
             return {
                 loadIng: 0,
 
-                userInfo: {},
-
                 bookLists: [],
                 bookListPage: 1,
                 bookListTotal: 0,
@@ -303,14 +301,6 @@
 
         mounted() {
             this.getBookLists(true);
-            this.userInfo = $A.getUserInfo((res, isLogin) => {
-                if (this.userInfo.id != res.id) {
-                    this.userInfo = res;
-                    isLogin && this.getBookLists(true);
-                } else {
-                    this.userInfo = res;
-                }
-            }, false);
         },
 
         deactivated() {
@@ -323,6 +313,10 @@
         },
 
         watch: {
+            usrName() {
+                this.usrLogin && this.getBookLists(true);
+            },
+
             addBookShow(val) {
                 if (val && this.addBookId > 0) {
                     let tempLists = this.bookLists.filter((res) => { return res.id == this.addBookId });

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

@@ -356,8 +356,6 @@
                 historyLists: [],
                 historyNoDataText: "",
 
-                userInfo: {},
-
                 routeName: '',
                 synergyNum: 0,
                 synchUsers: [],
@@ -420,9 +418,6 @@
         },
         mounted() {
             this.routeName = this.$route.name;
-            this.userInfo = $A.getUserInfo((res, isLogin) => {
-                this.userInfo = res;
-            }, false);
             //
             setInterval(() => {
                 if (this.routeName === this.$route.name) {
@@ -504,7 +499,7 @@
             document.addEventListener("keydown", this.keySave);
         },
         deactivated() {
-            if (this.isLock && this.docDetail.lockname == this.userInfo.username) {
+            if (this.isLock && this.docDetail.lockname == this.usrInfo.username) {
                 this.docDetail.lockname = '';
                 this.handleClick('unlock');
             }
@@ -636,7 +631,7 @@
                     $A.WSOB.sendTo('docs', {
                         type: 'quit',
                         sid: this.sid,
-                        username: this.userInfo.username,
+                        username: this.usrInfo.username,
                     });
                 } else {
                     if (this.routeName !== this.$route.name) {
@@ -651,9 +646,9 @@
                         $A.WSOB.sendTo('docs', null, {
                             type: enter === true ? 'enter' : 'refresh',
                             sid: this.sid,
-                            nickname: this.userInfo.nickname,
-                            username: this.userInfo.username,
-                            userimg: this.userInfo.userimg,
+                            nickname: this.usrInfo.nickname,
+                            username: this.usrInfo.username,
+                            userimg: this.usrInfo.userimg,
                             indate: Math.round(new Date().getTime() / 1000),
                         }, (res) => {
                             this.synchUsers = res.status === 1 ? res.message : [];
@@ -746,7 +741,7 @@
             },
 
             handleSynch(username) {
-                if (username == this.userInfo.username) {
+                if (username == this.usrInfo.username) {
                     return;
                 }
                 if (typeof window.onChatOpenUserName === "function") {
@@ -879,7 +874,7 @@
                 if (!this.isLock) {
                     return;
                 }
-                if (this.docDetail.lockname != this.userInfo.username) {
+                if (this.docDetail.lockname != this.usrInfo.username) {
                     return;
                 }
                 this.__continueLock = $A.randomString(6);
@@ -891,7 +886,7 @@
                     if (!this.isLock) {
                         return;
                     }
-                    if (this.docDetail.lockname != this.userInfo.username) {
+                    if (this.docDetail.lockname != this.usrInfo.username) {
                         return;
                     }
                     this.handleClick('lock');

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

@@ -184,8 +184,6 @@
                 sectionLists: [],
                 sectionNoDataText: "",
 
-                userInfo: {},
-
                 routeName: '',
 
                 isBook: false,
@@ -194,9 +192,6 @@
         },
         mounted() {
             this.routeName = this.$route.name;
-            this.userInfo = $A.getUserInfo((res, isLogin) => {
-                this.userInfo = res;
-            }, false);
             //
             document.addEventListener("fullscreenchange", () => {
                 this.isFullscreen = !!document.fullscreenElement;

+ 5 - 10
resources/assets/js/main/pages/project.vue

@@ -307,8 +307,6 @@
             return {
                 loadIng: 0,
 
-                userInfo: {},
-
                 addShow: false,
                 formAdd: {
                     title: '',
@@ -353,14 +351,6 @@
         },
         mounted() {
             this.getLists(true);
-            this.userInfo = $A.getUserInfo((res, isLogin) => {
-                if (this.userInfo.id != res.id) {
-                    this.userInfo = res;
-                    isLogin && this.getLists(true);
-                } else {
-                    this.userInfo = res;
-                }
-            }, false);
             //
             $A.setOnTaskInfoListener('pages/project',(act, detail) => {
                 let item = this.lists.find((item) => { return item.id == detail.projectid });
@@ -406,6 +396,11 @@
             this.projectDrawerShow = false;
             this.projectListDrawerShow = false;
         },
+        watch: {
+            usrName() {
+                this.usrLogin && this.getLists(true);
+            },
+        },
         methods: {
             setPage(page) {
                 this.listPage = page;

+ 4 - 9
resources/assets/js/main/pages/project/panel.vue

@@ -522,17 +522,12 @@
 
                 projectGanttShow: false,
 
-                userInfo: {},
-
                 filtrTask: '',
                 routeName: '',
             }
         },
         mounted() {
             this.routeName = this.$route.name;
-            this.userInfo = $A.getUserInfo((res) => {
-                this.userInfo = res;
-            }, false);
             $A.setOnTaskInfoListener('pages/project-panel',(act, detail) => {
                 if (detail.projectid != this.projectid) {
                     return;
@@ -562,7 +557,7 @@
 
                     case "labelsort":       // 调整分类排序
                     case "tasksort":        // 调整任务排序
-                        if (detail.__modifyUsername != $A.getUserName()) {
+                        if (detail.__modifyUsername != this.usrName) {
                             if (this.routeName == this.$route.name) {
                                 this.$Modal.confirm({
                                     title: this.$L("更新提示"),
@@ -1065,15 +1060,15 @@
             },
 
             isPersonsTask(task) {
-                return task.persons && !!task.persons.find(({username}) => username == this.userInfo.username);
+                return task.persons && !!task.persons.find(({username}) => username == this.usrInfo.username);
             },
 
             isFollowerTask(task) {
-                return task.follower && task.follower.indexOf(this.userInfo.username) !== -1;
+                return task.follower && task.follower.indexOf(this.usrInfo.username) !== -1;
             },
 
             isCreateTask(task) {
-                return task.createuser == this.userInfo.username;
+                return task.createuser == this.usrInfo.username;
             }
         },
     }

+ 8 - 12
resources/assets/js/main/pages/team.vue

@@ -130,7 +130,6 @@
             return {
                 loadIng: 0,
 
-                userInfo: {},
                 isAdmin: false,
 
                 columns: [],
@@ -180,7 +179,7 @@
                 "ellipsis": true,
                 render: (h, params) => {
                     let arr = [];
-                    if (params.row.username == $A.getUserName()) {
+                    if (params.row.username == this.usrName) {
                         arr.push(h('span', {
                             style: {
                                 color: '#ff0000',
@@ -292,18 +291,15 @@
         },
         mounted() {
             this.getLists(true);
-            this.userInfo = $A.getUserInfo((res, isLogin) => {
-                if (this.userInfo.id != res.id) {
-                    this.userInfo = res;
-                    isLogin && this.getLists(true);
-                } else {
-                    this.userInfo = res;
-                }
-            }, false);
         },
         deactivated() {
             this.addShow = false;
         },
+        watch: {
+            usrName() {
+                this.usrLogin && this.getLists(true);
+            }
+        },
         methods: {
             setPage(page) {
                 this.listPage = page;
@@ -445,8 +441,8 @@
                                             if (res.data.up === 1) {
                                                 let data = {
                                                     type: 'text',
-                                                    username: this.userInfo.username,
-                                                    userimg: this.userInfo.userimg,
+                                                    username: this.usrInfo.username,
+                                                    userimg: this.usrInfo.userimg,
                                                     indate: Math.round(new Date().getTime() / 1000),
                                                     text: this.$L(act=='deladmin' ? '您的管理员身份已被撤销。' : '恭喜您成为管理员。')
                                                 };

+ 5 - 13
resources/assets/js/main/pages/todo.vue

@@ -374,8 +374,6 @@
             return {
                 loadIng: 0,
 
-                userInfo: {},
-
                 taskDatas: {
                     "1": {lists: [], hasMorePages: false},
                     "2": {lists: [], hasMorePages: false},
@@ -399,17 +397,9 @@
                 return;
             }
             this.refreshTask();
-            this.userInfo = $A.getUserInfo((res, isLogin) => {
-                if (this.userInfo.id != res.id) {
-                    this.userInfo = res;
-                    isLogin && this.refreshTask();
-                } else {
-                    this.userInfo = res;
-                }
-            }, false);
             //
             $A.setOnTaskInfoListener('pages/todo',(act, detail) => {
-                if (detail.username != $A.getUserName()) {
+                if (detail.username != this.usrName) {
                     for (let level in this.taskDatas) {
                         this.taskDatas[level].lists.some((task, i) => {
                             if (task.id == detail.id) {
@@ -504,7 +494,7 @@
 
                     case "create":          // 创建任务
                     case "username":        // 负责人
-                        addOrDelete(detail.username == $A.getUserName());
+                        addOrDelete(detail.username == this.usrName);
                         break;
 
                     case "delete":          // 删除任务
@@ -526,7 +516,9 @@
 
         },
         watch: {
-
+            usrName() {
+                this.usrLogin && this.refreshTask();
+            }
         },
         methods: {
             pTitle(p) {