Skip to content

Commit

Permalink
Merge pull request #42 from luoqiz/feat-update-windows-title
Browse files Browse the repository at this point in the history
feat: 添加用户头像显示 close #41
  • Loading branch information
lich0821 authored Oct 10, 2024
2 parents 8633d71 + 93f37a5 commit 441a390
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src-tauri/config.json5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cburl":[],"http_server_port":10080,"wsurl":"","file_dir":"","front_msg_show":true}
{"cburl":[],"http_server_port":10010,"wsurl":"","file_dir":"","front_msg_show":true}
1 change: 1 addition & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare module 'vue' {
404: typeof import('./components/404.vue')['default']
BaseHeader: typeof import('./components/layouts/BaseHeader.vue')['default']
ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer']
ElAvatar: typeof import('element-plus/es')['ElAvatar']
ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard']
ElCol: typeof import('element-plus/es')['ElCol']
Expand Down
12 changes: 7 additions & 5 deletions src/components/layouts/BaseHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ const startOrStop = async () => {
await wechatStore.stop();
} else {
await wechatStore.start();
var getUserInfoTask = window.setInterval(async function logname() {
await wechatStore.updateSlefInfo();
clearInterval(getUserInfoTask)
}, 5000);
}
} catch (err: any) {
console.error(err);
Expand Down Expand Up @@ -72,11 +76,9 @@ onMounted(async () => {
<i inline-flex i="dark:ep-moon ep-sunny" />
</button>
</el-menu-item>
<!-- <el-menu-item>
<a-link href="https://github.com/lich0821/WeChatFerry" status="success" target="_blank">
<icon-github :style="{ fontSize: '32px' }" />
</a-link>
</el-menu-item> -->
<el-menu-item v-if="!!wechatStore.selfInfo.small_head_url">
<el-avatar shape="square" :size="36" :src="wechatStore.selfInfo.small_head_url" />
</el-menu-item>
</el-menu>
</div>
</template>
Expand Down
9 changes: 7 additions & 2 deletions src/store/modules/wechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,23 @@ export const useWechatStore = defineStore('wechat', {
this.selfInfo = selfInfo;
sessionStorage.setItem('selfInfo', JSON.stringify(selfInfo));
},
async updateSlefInfo() {
if(this.isServerRunning){
this.selfInfo = await wcf_api.userinfo();
console.log(this.selfInfo);
}
},
async getRunningFlag() {
this.isServerRunning = await wcf.is_http_server_running();
},
async start() {
await wcf.start_server('0.0.0.0', 10010);
this.isServerRunning = await wcf.is_http_server_running();
this.selfInfo = await wcf_api.userinfo();
console.log(this.selfInfo);
},
async stop() {
await wcf.stop_server();
this.isServerRunning = await wcf.is_http_server_running();
this.setSelfInfo({});
},
},
});
Expand Down

0 comments on commit 441a390

Please sign in to comment.