Browse Source

fix: 接受切换项目消息,分享项目

wrr
song 4 years ago
parent
commit
5ea2fe40ed
  1. 3
      CHANGELOG.md
  2. 6
      rest/project.http
  3. 3
      src/App.vue
  4. 149
      src/common/styles/app.scss
  5. 1
      src/components/Title/Title.vue
  6. 61
      src/components/Title/components/ShareProject.vue
  7. 19
      src/pages/project/project.vue
  8. 3
      src/store/socket/actions.js
  9. 10
      src/store/task/mutations.js
  10. 1
      src/store/task/state.js

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-09-08)
# 0.1.0 (2021-09-09)
### 🌟 新功能
范围|描述|commitId
@ -213,6 +213,7 @@
- | 整理代码 | [7a55315](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/7a55315)
- | 新建任务界面完善 | [2033b55](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/2033b55)
- | 日历的更改 | [7353ac8](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/7353ac8)
- | 日常任务样式修改 | [4628301](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/4628301)
- | 测试接口 | [215e074](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/215e074)
- | 添加弹框动画 | [8903854](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/8903854)
- | 组件文件夹新建 | [22bfe7b](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/22bfe7b)

6
rest/project.http

@ -1,7 +1,7 @@
### login
# @name login
POST https://www.tall.wiki/gateway/tall/v1.0/users/signin
POST https://test.tall.wiki/gateway/tall/v1.0/users/signin
content-type: application/json;charset=utf-8
{
@ -18,7 +18,7 @@ content-type: application/json;charset=utf-8
### 导入插件
# POST http://127.0.0.1:7220/plugin/import
POST http://www.tall.wiki/gateway/pluginshop/plugin/import
POST http://test.tall.wiki/gateway/pluginshop/plugin/import
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Authorization: Bearer {{login.response.body.$.data.token}}
@ -34,6 +34,6 @@ Content-Type: xlsx
### 更新redis内的插件信息
POST http://www.tall.wiki/gateway/pluginshop/plugin/updatePluginOfRedis
POST http://test.tall.wiki/gateway/pluginshop/plugin/updatePluginOfRedis
content-type: application/json;charset=utf-8
Authorization: Bearer {{login.response.body.$.data.token}}

3
src/App.vue

@ -19,7 +19,7 @@ export default {
if (!options.query.share) {
if (!options.query || !options.query.u) {
// u (userId)
this.$t.ui.showToast('缺少用户信息参数');
this.$t.ui.showToast(`缺少用户信息参数+${options.query.share}`);
} else {
const data = await this.getToken(options.query.u);
this.noPhone(data.phone);
@ -90,4 +90,5 @@ export default {
@import './common/styles/iconfont.scss';
@import 'uview-ui/index.scss';
@import './common/styles/app.scss';
// @import './common/styles/uni.css';
</style>

149
src/common/styles/app.scss

@ -4,3 +4,152 @@
.border-b-1 {
border-bottom-width: 1px;
}
/* 列表 */
.uni-list {
background-color: #ffffff;
position: relative;
width: 100%;
display: flex;
flex-direction: column;
border: 1px solid #afbed1;
height: 80rpx;
line-height: 80rpx;
}
.uni-list-cell {
position: relative;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.uni-list-cell-hover {
background-color: #eee;
}
.uni-list-cell-pd {
padding: 22rpx 30rpx;
}
.uni-list-cell-left {
white-space: nowrap;
font-size: 28rpx;
padding: 0 30rpx;
}
.uni-list-cell-db,
.uni-list-cell-right {
flex: 1;
}
.uni-list-cell::after {
position: absolute;
z-index: 3;
right: 0;
bottom: 0;
left: 30rpx;
height: 1px;
content: '';
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
background-color: #c8c7cc;
}
.uni-list .uni-list-cell:last-child::after {
height: 0rpx;
}
.uni-list-cell-last.uni-list-cell::after {
height: 0rpx;
}
.uni-list-cell-divider {
position: relative;
display: flex;
color: #999;
background-color: #f7f7f7;
padding: 15rpx 20rpx;
}
.uni-list-cell-divider::before {
position: absolute;
right: 0;
top: 0;
left: 0;
height: 1px;
content: '';
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
background-color: #c8c7cc;
}
.uni-list-cell-divider::after {
position: absolute;
right: 0;
bottom: 0;
left: 0rpx;
height: 1px;
content: '';
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
background-color: #c8c7cc;
}
.uni-list-cell-navigate {
font-size: 30rpx;
padding: 22rpx 30rpx;
line-height: 48rpx;
position: relative;
display: flex;
box-sizing: border-box;
width: 100%;
flex: 1;
justify-content: space-between;
align-items: center;
}
.uni-list-cell-navigate {
padding-right: 36rpx;
}
.uni-navigate-badge {
padding-right: 50rpx;
}
.uni-list-cell-navigate.uni-navigate-right:after {
font-family: uniicons;
content: '\e583';
position: absolute;
right: 24rpx;
top: 50%;
color: #bbb;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.uni-list-cell-navigate.uni-navigate-bottom:after {
font-family: uniicons;
content: '\e581';
position: absolute;
right: 24rpx;
top: 50%;
color: #bbb;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.uni-list-cell-navigate.uni-navigate-bottom.uni-active::after {
font-family: uniicons;
content: '\e580';
position: absolute;
right: 24rpx;
top: 50%;
color: #bbb;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.uni-collapse.uni-list-cell {
flex-direction: column;
}
.uni-list-cell-navigate.uni-active {
background: #eee;
}
.uni-list.uni-collapse {
box-sizing: border-box;
height: 0;
overflow: hidden;
}
.uni-collapse .uni-list-cell {
padding-left: 20rpx;
}
.uni-collapse .uni-list-cell::after {
left: 52rpx;
}
.uni-list.uni-active {
height: auto;
}

1
src/components/Title/Title.vue

@ -117,6 +117,7 @@ export default {
},
//
openIndex() {
console.log(this.$route);
this.$u.route('/', { u: this.userId });
},
//

61
src/components/Title/components/ShareProject.vue

@ -5,9 +5,16 @@
<view class="flex flex-col">
<view class="mb-1">用户以什么角色加入项目</view>
<!-- 下拉多选 -->
<u-dropdown>
<u-dropdown-item v-model="roleValue" :title="roleValue" :options="allRoles" @change="changeRole"></u-dropdown-item>
</u-dropdown>
<view class="uni-list">
<view class="uni-list-cell">
<view class="uni-list-cell-db ml-2" v-if="rolesArray.length">
<picker @change="changeRole" :value="index" :range="rolesArray">
<view class="uni-input">{{ allRolesName[index].name }}</view>
</picker>
</view>
</view>
</view>
<!-- 复制链接 -->
<view class="link flex items-center mt-4">
<view class="link-url">{{ links }}</view>
@ -22,7 +29,6 @@
复制链接
</u-button>
</view>
<view @click="select">
<!-- 全选按钮 -->
<!-- <view class="flex mt-4">
@ -59,8 +65,10 @@ import { mapGetters, mapState } from 'vuex';
export default {
data() {
return {
roleValue: '观众',
links: 'https://kdocs.cn/l/cbs', //
rolesArray: [],
allRolesName: [],
index: 0,
links: '', //
checked: false, //
//
list: [
@ -97,45 +105,44 @@ export default {
computed: {
...mapState('role', ['visibleRoles', 'invisibleRoles']),
...mapGetters('project', ['projectId']),
},
mounted() {
this.$nextTick(() => {
this.path = window.location.href.split('?')[0];
const { path, projectId } = this;
const params = { path: `${path}`, projectId, roleId: '0' };
this.creatShare(params);
});
allRoles() {
let newArr = [];
if (this.visibleRoles.length || this.invisibleRoles.length) {
const arr = this.visibleRoles.concat(this.invisibleRoles);
arr.forEach(role => {
let item = { value: '', label: '' };
let item = { id: '', name: '' };
item.id = role.id;
item.value = role.name;
item.label = role.name;
newArr.push(item);
item.name = role.name;
this.allRolesName.push(item);
this.rolesArray.push(role.name);
});
const firstItem = { id: '0', value: '观众', label: '观众' };
newArr.unshift(firstItem);
const firstItem = { id: '0', name: '观众' };
this.allRolesName.unshift(firstItem);
this.rolesArray.unshift('观众');
}
return newArr;
},
},
async created() {
this.path = window.location.href.split('?')[0];
const { path, projectId } = this;
const params = { path: `${path}share=1`, projectId, roleId: '0' };
await this.creatShare(params);
},
methods: {
//
async changeRole(value) {
this.roleValue = value;
const role = this.allRoles.find(item => item.value == value);
async changeRole(e) {
this.index = e.target.value;
const { path, projectId } = this;
const params = { path, projectId, roleId: role.id };
const params = { path, projectId, roleId: this.allRolesName[this.index].id };
await this.creatShare(params);
},
//
copySuccess() {
this.$t.ui.showToast('复制成功');
console.log('this.links: ', this.links);
},
//
copyError() {

19
src/pages/project/project.vue

@ -29,10 +29,11 @@ export default {
computed: {
...mapState('user', ['user', 'token']),
...mapState('role', ['visibleRoles', 'roleId']),
...mapState('task', ['timeNode', 'timeUnit', 'tasks', 'regularTask']),
...mapState('task', ['timeNode', 'timeUnit', 'tasks', 'regularTask', 'newProjectInfo']),
...mapState('project', ['project']),
...mapGetters('task', ['timeGranularity']),
...mapGetters('project', ['projectId']),
...mapGetters('user', ['userId']),
},
onLoad(options) {
@ -71,6 +72,17 @@ export default {
this.getPermanent(params);
}
},
//
newProjectInfo(val) {
if (val && val.projectId && val.url) {
this.$u.route('/', { u: this.userId, p: val.projectId, url: val.url });
this.clearTasksData();
this.setRoleId('');
const options = this.$route.query;
this.init(options);
}
},
},
mounted() {
@ -270,11 +282,12 @@ export default {
* @param {object | null} options
*/
init(options) {
console.log('options: ', options);
if (!this.token) {
// tokenuserIdtoken
// token userId
if (!options || !options.u) {
this.$t.ui.showToast('缺少用户信息参数'); // u (userId)
this.$t.ui.showToast('缺少用户信息参数2'); // u (userId)
} else {
this.getToken(options.u);
}
@ -284,7 +297,7 @@ export default {
options && options.pname && this.setProjectName(options.pname);
if (!options || !options.p) {
this.$t.ui.showToast('缺少项目信息参数'); // id
this.$t.ui.showToast('缺少项目信息参数3'); // id
} else {
this.getProjectById({ projectId: options.p }); // id
}

3
src/store/socket/actions.js

@ -62,6 +62,9 @@ const actions = {
case 'taskStatus': // 任务状态修改相关消息
commit('task/setTaskStatus', data.data, { root: true });
break;
case 'switchoverProject': // 打开新项目消息
commit('task/setNewProjectInfo', data.data, { root: true });
break;
// case 'Chrome': // !收到开始游戏的消息
// console.log('handleMessagesData', data);
// // @ts-ignore

10
src/store/task/mutations.js

@ -175,6 +175,16 @@ const mutations = {
item.process = data.taskStatus;
},
/**
* 收到打开新项目消息状态
* @param {Object} state
* @param {Array} data 服务端返回的模板数组
*/
setNewProjectInfo(state, data) {
console.log('data: ', data);
state.newProjectInfo = data;
},
/**
* 设置骨架屏是否显示
* @param {Object} state

1
src/store/task/state.js

@ -18,6 +18,7 @@ const state = {
dailyTasks: [], // 日常任务
tasks: [], // 所有的定期任务
showSkeleton: false, // 定期任务骨架屏
newProjectInfo: {},
};
export default state;

Loading…
Cancel
Save