Browse Source

feat: 退出登录,其他细节调整

PC
wally 4 years ago
parent
commit
8c657d5d85
  1. 2
      .env.development
  2. 2
      .env.production
  3. 3
      CHANGELOG.md
  4. 1
      package.json
  5. 0
      src/components/ChangePassword/ChangePassword.vue
  6. 5
      src/components/Upload/Upload.vue
  7. 2
      src/components/login/login.vue
  8. 2
      src/manifest.json
  9. 78
      src/pages.json
  10. 10
      src/pages/project-webview/project-webview.vue
  11. 13
      src/pages/right-window/right-window.vue
  12. 23
      src/pages/top-window/top-window.vue
  13. 9
      src/store/project/mutations.js
  14. 1
      src/store/project/state.js
  15. 6
      src/store/user/mutations.js

2
.env.development

@ -3,5 +3,5 @@ VUE_APP_BASE_URL=https://test.tall.wiki
VUE_APP_API_URL=https://test.tall.wiki/gateway
VUE_APP_MSG_URL=wss://test.tall.wiki/websocket/message/v4.0/ws
VUE_APP_PROJECT_PATH=https://test.tall.wiki/tall-project
VUE_APP_VERSION=v3.2.0
VUE_APP_VERSION=iacd
VUE_APP_DOMAIN=sports

2
.env.production

@ -3,5 +3,5 @@ VUE_APP_BASE_URL=https://www.tall.wiki
VUE_APP_API_URL=https://www.tall.wiki/gateway
VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws
VUE_APP_PROJECT_PATH=https://www.tall.wiki/tall-project
VUE_APP_VERSION=v3.2.0
VUE_APP_VERSION=iacd
VUE_APP_DOMAIN=sports

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-11-09)
# 0.1.0 (2021-11-10)
### 🌟 新功能
范围|描述|commitId
@ -182,6 +182,7 @@
范围|描述|commitId
--|--|--
calendar | 日历细节调整 | 1a8d6bf
- | p-task-title 接受消息处理url调整 | a88a2f6
- | project 代码健壮性完善 | a3202c5
store/home | 删除store/home | db8a3b4
task beginTime | 格式化任务开始时间 | fbc0301

1
package.json

@ -9,6 +9,7 @@
"fix": "vue-cli-service lint --fix",
"test": "npm run test:h5",
"dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve --mode development",
"dev:local": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve --mode local",
"dev:h5-pro": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve --mode production",
"build:h5-test": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build --mode development",
"build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build --mode production",

0
src/components/change-password/change-password.vue → src/components/ChangePassword/ChangePassword.vue

5
src/components/Upload/Upload.vue

@ -5,11 +5,13 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { mapGetters, mapMutations } from 'vuex';
export default {
computed: mapGetters('user', ['userId']),
methods: {
...mapMutations('project', ['setProject']),
// wbs
async handleUpload() {
try {
@ -19,6 +21,7 @@ export default {
this.$emit('success');
data.url && (uni.$t.domain = data.url);
setTimeout(() => {
this.setProject({ name: data.pname, id: data.id });
this.$u.route('/pages/project-webview/project-webview', {
u: this.userId,
p: data.id,

2
src/components/login/login.vue

@ -1,7 +1,7 @@
<template>
<view class="wrap flex justify-center items-center">
<view class="wrap-con">
<h1 class="text-3xl text-center mb-10">{{ project && project.id ? project.name : '时物链条' }}</h1>
<h1 class="text-3xl text-center mb-10">{{ project && project.id ? project.name : '智能大气腐蚀检测平台' }}</h1>
<u-form :model="form" ref="uForm" :errorType="errorType">
<!-- 手机号 -->
<u-form-item :rightIconStyle="{ color: '#888', fontSize: '32rpx' }" prop="account" label-width="160" class="bg-white">

2
src/manifest.json

@ -66,7 +66,7 @@
"h5": {
"router": {
"base": "/tall/v3.2.0"
"base": "/tall/iacd"
},
"title": "时物链条",
"sdkConfigs": {

78
src/pages.json

@ -1,48 +1,48 @@
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarText": "TALL"
}
},
{
"path": "pages/phone-bind/phone-bind",
"style": {
"navigationBarTitleText": "绑定手机号"
}
},
{
"path": "pages/project-webview/project-webview",
"style": {
"navigationBarTitleText": "项目详情页"
}
}
],
"topWindow": {
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarText": "TALL"
}
},
{
"path": "pages/phone-bind/phone-bind",
"style": {
"navigationBarTitleText": "绑定手机号"
}
},
{
"path": "pages/project-webview/project-webview",
"style": {
"navigationBarTitleText": "项目详情页"
}
}
],
"topWindow": {
"path": "pages/top-window/top-window.vue",
"style": {
"height": "62px"
"height": "48px"
}
},
"rightWindow": {
"path": "pages/right-window/right-window.vue"
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "TALL",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"navigationStyle": "custom",
"app-plus": {
"titleNView": false
}
},
"easycom": {
"autoscan": true,
"custom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
"^p-(.*)": "@/plugins/p-$1/p-$1.vue"
}
}
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "TALL",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"navigationStyle": "custom",
"app-plus": {
"titleNView": false
}
},
"easycom": {
"autoscan": true,
"custom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
"^p-(.*)": "@/plugins/p-$1/p-$1.vue"
}
}
}

10
src/pages/project-webview/project-webview.vue

@ -22,7 +22,7 @@ export default {
computed: mapState('user', ['isPC']),
methods: {
...mapMutations('project', ['setTaskDetailUrl']),
...mapMutations('project', ['setTaskDetailUrl', 'setLocal']),
//
serUrl(options) {
@ -41,8 +41,7 @@ export default {
return;
}
// const baseUrl = process.env.VUE_APP_PROJECT_PATH;
const baseUrl = 'http://localhost:9000/tall-project';
const baseUrl = process.env.VUE_APP_PROJECT_PATH;
this.src = `${baseUrl}/${this.$t.app.version}/#/?u=${u}&p=${p}&url=${url}&pname=${pname}`;
},
@ -52,14 +51,15 @@ export default {
window.addEventListener(
'message',
e => {
console.log('e: ', e);
// REVIEW:
if (e.data.event === 'openDetail') {
if (!e.data.data) return;
if (e.data.local) {
// TODO:
// local singin
this.setLocal(true);
this.setTaskDetailUrl(e.data.data);
} else {
this.setLocal(false);
// : urlproject
// e.data.data url
if (this.isPC) {

13
src/pages/right-window/right-window.vue

@ -3,16 +3,16 @@
<!-- 未登录状态下 -->
<view class="w-full h-full" v-if="!user || !token">
<!-- 登录 -->
<login v-if="!show" @changeShow="show = true"></login>
<Login v-if="!show" @changeShow="show = true" />
<!-- 修改密码 -->
<change-password v-else @changeShow="show = false"></change-password>
<ChangePassword v-else @changeShow="show = false" />
</view>
<!-- 已登录 -->
<view v-else class="w-full h-full">
<iframe v-if="!show" id="iframe" :src="src" frameborder="0" width="100%" height="100%"></iframe>
<change-password v-else @changeShow="show = false" :showBack="false"></change-password>
<ChangePassword v-else @changeShow="show = false" :showBack="false" />
</view>
</view>
</template>
@ -26,15 +26,14 @@ export default {
},
computed: {
...mapState('project', ['project', 'taskDetailUrl']),
...mapState('project', ['project', 'taskDetailUrl', 'local']),
...mapState('user', ['user', 'token']),
},
watch: {
taskDetailUrl(val) {
if (val && val.split('?')[0] === 'change-password') {
this.show = true;
} else {
this.show = this.local;
if (!this.local) {
this.src = val;
this.show = false;
}

23
src/pages/top-window/top-window.vue

@ -1,15 +1,20 @@
<template>
<view class="w-full h-full bg-black flex justify-between items-center">
<view class="font-bold text-xl text-gray-300 m-3">{{ project && project.id ? project.name : '时物链条' }}</view>
<view class="w-full h-full bg-gray-50 u-border-bottom flex justify-between text-gray-600 items-center px-5">
<view class="font-medium text-xl">
<!-- <u-icon name="list" class="mr-3"></u-icon> -->
{{ project && project.id ? project.name : '智能大气腐蚀检测平台' }}
</view>
<view class="flex items-center">
<u-avatar :src="user && user.wxInfo && user.wxInfo.headImgUrl ? user.wxInfo.headImgUrl : src" :size="56"></u-avatar>
<text class="ml-3 mr-5 text-gray-400 text-sm">{{ user && user.account ? user.account : '未登录' }}</text>
<text class="ml-3">{{ user && user.account ? user.account : '未登录' }}</text>
<text class="ml-4 text-red-600 text-sm" style="cursor: pointer" @click="signOut">退出登录</text>
</view>
</view>
</template>
<script>
import { mapState } from 'vuex';
import { mapMutations, mapState } from 'vuex';
export default {
data() {
@ -24,5 +29,15 @@ export default {
onLoad(options) {
console.log('options: ', options);
},
methods: {
...mapMutations('user', ['setToken', 'setUser']),
// 退
// token user login
signOut() {
this.setToken(null);
this.setUser(null);
},
},
};
</script>

9
src/store/project/mutations.js

@ -66,6 +66,15 @@ const mutations = {
setTaskDetailUrl(state, data) {
state.taskDetailUrl = data;
},
/**
* 设置right-window 是否是本地
* @param {object} state
* @param {boolean} local
*/
setLocal(state, local) {
state.local = local;
},
};
export default mutations;

1
src/store/project/state.js

@ -4,6 +4,7 @@ const state = {
projects: [], // 项目列表
dotList: [], // 小红点
taskDetailUrl: '', // 任务详情页路径
local: true, //
};
export default state;

6
src/store/user/mutations.js

@ -15,7 +15,11 @@ const mutations = {
* @param {object} user
*/
setUser(state, user) {
if (!user) return;
if (!user) {
state.user = null;
uni.$t.storage.setStorageSync('user', '');
return;
}
state.user = { ...user };
uni.$t.storage.setStorageSync('user', JSON.stringify(user));
},

Loading…
Cancel
Save