增加APP下载
Showing
5 changed files
with
20 additions
and
10 deletions
| ... | @@ -4,9 +4,11 @@ | ... | @@ -4,9 +4,11 @@ | 
| 4 | <button title="刷新列表" @click="handleRefresh"> | 4 | <button title="刷新列表" @click="handleRefresh"> | 
| 5 | <i class="tim-icon-refresh"></i> | 5 | <i class="tim-icon-refresh"></i> | 
| 6 | </button> | 6 | </button> | 
| 7 | <!-- <button title="创建会话" @click="handleAddButtonClick">--> | 7 | <el-button icon="el-icon-mobile-phone" :round="true" title="下载APP" @click="handleDownload"/> | 
| 8 | <!-- <i class="tim-icon-add"></i>--> | 8 | |
| 9 | <!-- </button>--> | 9 | <!-- <button title="创建会话" @click="handleAddButtonClick">--> | 
| 10 | <!-- <i class="tim-icon-add"></i>--> | ||
| 11 | <!-- </button>--> | ||
| 10 | </div> | 12 | </div> | 
| 11 | <div class="scroll-container"> | 13 | <div class="scroll-container"> | 
| 12 | <conversation-item | 14 | <conversation-item | 
| ... | @@ -139,6 +141,9 @@ export default { | ... | @@ -139,6 +141,9 @@ export default { | 
| 139 | .catch(() => { | 141 | .catch(() => { | 
| 140 | this.isCheckouting = false | 142 | this.isCheckouting = false | 
| 141 | }) | 143 | }) | 
| 144 | }, | ||
| 145 | handleDownload() { | ||
| 146 | window.open('https://www.pgyer.com/5CqL', 'target') | ||
| 142 | } | 147 | } | 
| 143 | } | 148 | } | 
| 144 | } | 149 | } | ... | ... | 
| ... | @@ -59,6 +59,9 @@ export default { | ... | @@ -59,6 +59,9 @@ export default { | 
| 59 | // ElAutocomplete: Autocomplete | 59 | // ElAutocomplete: Autocomplete | 
| 60 | }, | 60 | }, | 
| 61 | computed: { | 61 | computed: { | 
| 62 | isLogin: function () { | ||
| 63 | return this.$store.state.user.isLogin | ||
| 64 | }, | ||
| 62 | groupList: function () { | 65 | groupList: function () { | 
| 63 | return this.$store.state.group.groupList | 66 | return this.$store.state.group.groupList | 
| 64 | }, | 67 | }, | 
| ... | @@ -68,8 +71,10 @@ export default { | ... | @@ -68,8 +71,10 @@ export default { | 
| 68 | } | 71 | } | 
| 69 | }) | 72 | }) | 
| 70 | }, | 73 | }, | 
| 71 | created() { | 74 | mounted() { | 
| 75 | if (this.isLogin) { | ||
| 72 | this.fetch() | 76 | this.fetch() | 
| 77 | } | ||
| 73 | }, | 78 | }, | 
| 74 | methods: { | 79 | methods: { | 
| 75 | fetch() { | 80 | fetch() { | ... | ... | 
| ... | @@ -68,6 +68,7 @@ export default { | ... | @@ -68,6 +68,7 @@ export default { | 
| 68 | created() { | 68 | created() { | 
| 69 | Helper.verifyToken().then(user => this.tim.login({userID: user.id, userSig: user.sign}) | 69 | Helper.verifyToken().then(user => this.tim.login({userID: user.id, userSig: user.sign}) | 
| 70 | .then(() => { | 70 | .then(() => { | 
| 71 | console.log('gooo') | ||
| 71 | this.loading = false | 72 | this.loading = false | 
| 72 | this.$store.commit('toggleIsLogin', true) | 73 | this.$store.commit('toggleIsLogin', true) | 
| 73 | this.$store.commit('startComputeCurrent') | 74 | this.$store.commit('startComputeCurrent') | 
| ... | @@ -82,6 +83,7 @@ export default { | ... | @@ -82,6 +83,7 @@ export default { | 
| 82 | // this.$store.commit('showMessage', {type: 'success', message: '登录成功'}) | 83 | // this.$store.commit('showMessage', {type: 'success', message: '登录成功'}) | 
| 83 | }) | 84 | }) | 
| 84 | .catch(error => { | 85 | .catch(error => { | 
| 86 | console.log(1111) | ||
| 85 | this.loading = false | 87 | this.loading = false | 
| 86 | this.$store.commit('showMessage', {message: '登录失败:' + error.message, type: 'error'}) | 88 | this.$store.commit('showMessage', {message: '登录失败:' + error.message, type: 'error'}) | 
| 87 | })) | 89 | })) | ... | ... | 
| 1 | import Store from '../store/index' | ||
| 2 | import request from './request' | 1 | import request from './request' | 
| 3 | 2 | ||
| 4 | export default class Helper { | 3 | export default class Helper { | 
| ... | @@ -13,12 +12,11 @@ export default class Helper { | ... | @@ -13,12 +12,11 @@ export default class Helper { | 
| 13 | return this.getUrlKey('token') | 12 | return this.getUrlKey('token') | 
| 14 | } | 13 | } | 
| 15 | 14 | ||
| 15 | /** | ||
| 16 | * | ||
| 17 | * @returns {Promise<never>|Promise<{sign, id}>} | ||
| 18 | */ | ||
| 16 | static verifyToken() { | 19 | static verifyToken() { | 
| 17 | const token = this.getToken() | ||
| 18 | if (!token) { | ||
| 19 | return Store.commit('showMessage', {type: 'error', message: '非法访问'}) | ||
| 20 | } | ||
| 21 | |||
| 22 | return request.get('auth').then(res => { | 20 | return request.get('auth').then(res => { | 
| 23 | const {esm_id} = res.data | 21 | const {esm_id} = res.data | 
| 24 | return Promise.resolve({id: esm_id, sign: window.genTestUserSig(esm_id).userSig}) | 22 | return Promise.resolve({id: esm_id, sign: window.genTestUserSig(esm_id).userSig}) | ... | ... | 
- 
Please register or sign in to post a comment