Browse Source

feat: 插件的填写提交,编辑与删除

test2
Min5203 4 years ago
parent
commit
5452e6d29f
  1. 149
      .drone.yml
  2. 4
      App.vue
  3. 1
      CHANGELOG.md
  4. 3
      README.md
  5. 21
      apis/plugin.js
  6. 4
      apis/tall.js
  7. 2
      apis/wbs.js
  8. 12
      common/styles/tailwind.scss
  9. 12
      common/styles/theme/default.scss
  10. 3
      common/styles/theme/test.scss
  11. 89
      components/ChooseChecker/ChooseChecker.vue
  12. 6
      components/Globals/Globals.vue
  13. 104
      components/Plugin/Plugin.vue
  14. 122
      components/Render/Render.vue
  15. 2
      components/TimeLine/TimeLine.vue
  16. 40
      components/TimeLine/component/TimeBox.vue
  17. 3
      components/Tips/Tips.vue
  18. 2
      components/Title/Title.vue
  19. 5
      components/Upload/Upload.vue
  20. 22
      components/uni-popup/message.js
  21. 23
      components/uni-popup/popup.js
  22. 246
      components/uni-popup/uni-popup-dialog.vue
  23. 115
      components/uni-popup/uni-popup-message.vue
  24. 171
      components/uni-popup/uni-popup-share.vue
  25. 289
      components/uni-popup/uni-popup.vue
  26. 97
      config/plugin.js
  27. 4
      hooks/project/useInit.js
  28. 185
      hooks/user/userMixin.js
  29. 5
      main.js
  30. 40
      manifest.json
  31. 25
      pages.json
  32. 28
      pages/index/index.vue
  33. 5
      pages/project/project.vue
  34. 65
      pages/user/accountLogin.vue
  35. 18
      pages/user/agreement.vue
  36. 8
      pages/user/forgetPassword.vue
  37. 142
      pages/user/login.vue
  38. 266
      pages/user/mixin.js
  39. 159
      pages/user/rigister.vue
  40. 70
      plugins/p-deliver-check/p-deliver-check.vue
  41. 236
      plugins/p-deliver/p-deliver.vue
  42. 141
      plugins/p-delivery-history/p-delivery-history.vue
  43. 17
      plugins/p-manage-member/p-manage-member.vue
  44. 17
      plugins/p-manage-project/p-manage-project.vue
  45. 17
      plugins/p-manage-role/p-manage-role.vue
  46. 17
      plugins/p-manage-task/p-manage-task.vue
  47. 61
      plugins/p-subproject/p-subproject.vue
  48. 38
      plugins/p-subtasks/p-subtasks.vue
  49. 19
      plugins/p-task-countdown/p-task-countdown.vue
  50. 20
      plugins/p-task-description/p-task-description.vue
  51. 32
      plugins/p-task-duration-delay/p-task-duration-delay.vue
  52. 29
      plugins/p-task-start-time-delay/p-task-start-time-delay.vue
  53. 14
      plugins/p-task-title/p-task-title.vue
  54. 97
      plugins/p-upload-deliverable/p-upload-deliverable.vue
  55. 80
      plugins/p-wbs-import/p-wbs-import.vue
  56. 4
      store/task/actions.js
  57. 9
      store/task/mutations.js
  58. 1
      store/task/state.js
  59. 20
      store/user/actions.js
  60. 2
      utils/cacheAndRequest.js
  61. 2
      utils/upload.js

149
.drone.yml

@ -0,0 +1,149 @@
---
kind: pipeline
type: docker
name: dev
# 挂载的主机卷,可以映射到docker容器中
volumes:
# maven构建缓存(宿主机目录)
- name: ssh_key
host:
path: /root/.ssh/
- name: cache
host:
path: /var/lib/cache
- name: data
host:
path: /var/lib/data
steps:
# - name: restore-cache
# image: drillster/drone-volume-cache
# volumes:
# - name: cache
# path: /cache
# settings:
# restore: true
# mount:
# - ./node_modules
- name: build
image: node:latest
pull: if-not-exists # default always
# volumes:
# - name: cache
# path: /root/.m2
commands:
- npm config set registry http://registry.npm.taobao.org
- npm i
- npm run test
# - name: rebuild-cache
# image: drillster/drone-volume-cache
# volumes:
# - name: cache
# path: /cache
# settings:
# rebuild: true
# mount:
# - ./node_modules
- name: deploy-scp
image: appleboy/drone-scp
pull: if-not-exists
volumes:
- name: ssh_key
path: /root/.ssh/
settings:
host: test.tall.wiki
port: 22
username: root
key_path: /root/.ssh/id_rsa
rm: true # true则会删除目标目录重建
target: /home/tall/v4.0.0
source: dist/*
strip_components: 1 # 去除的目录层数,如果没有该选项,则拷贝过去是 target/xxx.jar,1代表去除target
# - name: run-ssh
# image: appleboy/drone-ssh
# pull: if-not-exists
# volumes:
# - name: ssh_key
# path: /root/.ssh/
# settings:
# settings:
# host: test.tall.wiki
# port: 22
# username: root
# key_path: /root/.ssh/id_rsa
# script_stop: true # stop script after first failure
# #command_timeout: 30s # 30seconds, the maximum amount of time for the execute commands, default is 10 minutes.
# script:
# - cd /home/iacd-platform-drone
# - ./re.sh > /dev/null 2> /dev/null &
- name: notify-email
image: drillster/drone-email
pull: if-not-exists
settings:
host: smtp.qiye.aliyun.com #例如 smtp.qq.com
port: 465 #例如QQ邮箱端口465
username: devops@ccsens.com #邮箱用户名
password: #邮箱密码
from_secret: orgsecret_password_mail_devops
from: devops@ccsens.com
recipients: weizezhao@ccsens.com #收件人,多个用,隔开
when: #执行条件
status:
- success
- changed
- failure
- name: notify-wechatwork
image: fifsky/drone-wechat-work
pull: if-not-exists
settings:
url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b2b93e9a-128b-41d4-8dce-12004e3f48b9
msgtype: markdown
content: |
{{if eq .Status "success" }}
#### 🎉 ${DRONE_REPO} 构建成功
> Commit: [${DRONE_COMMIT_MESSAGE}](${DRONE_COMMIT_LINK})
> Author: ${DRONE_COMMIT_AUTHOR}
> [点击查看](${DRONE_BUILD_LINK})
{{else}}
#### ❌ ${DRONE_REPO} 构建失败
> Commit: [${DRONE_COMMIT_MESSAGE}](${DRONE_COMMIT_LINK})
> Author: ${DRONE_COMMIT_AUTHOR}
> 请立即修复!!!
> [点击查看](${DRONE_BUILD_LINK})
{{end}}
when:
status:
- failure
- success
trigger:
branch: feat
# - name: notify-dingtalk
# image: lddsb/drone-dingtalk-message
# environment:
# PASSWORD:
# from_secret: password_mail_devops
# settings:
# token: your-dingtalk-robot-access-token
# type: markdown
# message_color: true
# message_pic: true
# sha_link: true
# -name: notify-slack
# image: plugins/slack
# webhook: https://hooks.slack.com/ www.dijiuyy.com services/xxx/xxx/xxx
# channel: dev
# template: >
# {{#success build.status}}
# build {{build.number}} succeeded. Good job.
# {{else}}
# build {{build.number}} failed. Fix me please.
# {{/success}}

4
App.vue

@ -43,7 +43,7 @@ export default {
if (token && tokenIsAvailable) {
// 1.1 storetoken 使storetoken
return token;
} else {
}
// 2. userIdtoken
if (userId) {
try {
@ -56,7 +56,6 @@ export default {
} else {
return null;
}
}
},
/**
@ -166,4 +165,5 @@ export default {
page {
height: 100%;
}
</style>

1
CHANGELOG.md

@ -4,6 +4,7 @@
范围|描述|commitId
--|--|--
- | 表单验证 | [8f3bc1e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8f3bc1e)
- | 插件的填写与提交,修改与删除 | [d461252](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d461252)
- | 更新代码 | [392c8cc](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/392c8cc)
- | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6)
- | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91)

3
README.md

@ -0,0 +1,3 @@
# 时物链条
[![Build Status](http://101.201.226.163:3001/api/badges/TALL/TALL-MUI-4/status.svg)](http://101.201.226.163:3001/TALL/TALL-MUI-4)

21
apis/plugin.js

@ -0,0 +1,21 @@
import Config from '@/common/js/config.js'
const apiUrl = Config.apiUrl;
const defaultwbs = `${apiUrl}/defaultwbs`;
export function setupPlugin(app) {
uni.$u.api = { ...uni.$u.api } || {};
// 获取插件信息
uni.$u.api.getOtherPlugin = param => uni.$u.post(`${apiUrl}/pluginshop/plugin/query?pluginId=${param.pluginId}&styleType=${param.styleType}`);
// 查询子任务
uni.$u.api.findSonTask = param => uni.$u.post(`${defaultwbs}/task/findSonTask`, param);
// 查询子项目
uni.$u.api.findSonProject = param => uni.$u.post(`${defaultwbs}/project/findSonProject`, param);
// 提交交付物
uni.$u.api.saveDeliver = param => uni.$u.post(`${defaultwbs}/deliver/save`, param);
// 查询任务的交付物历史记录
uni.$u.api.queryDeliverOfTask = param => uni.$u.post(`${defaultwbs}/deliver/queryDeliverOfTask`, param);
// 检查交付物
uni.$u.api.checkDeliver = param => uni.$u.post(`${defaultwbs}/deliver/checkDeliver`, param);
};

4
apis/tall.js

@ -2,12 +2,14 @@ import Config from '@/common/js/config.js'
const apiUrl = Config.apiUrl;
const tall = `${apiUrl}/tall3/v3.0`;
const tall1 = `http://101.201.226.163/gateway/ptos`;
export function setupTall(app) {
uni.$u.api = { ...uni.$u.api } || {};
// 登录
// uni.$u.api.signin = params => login.index(params);
uni.$u.api.signin = params => uni.$u.http.post(`${tall}/users/signin`, params); // 登录
// 注册
uni.$u.api.signup = params => uni.$u.http.post(`${tall}/users/signup`, params); // 登录
// 获取图片验证码
uni.$u.api.getImageCode = () => uni.$u.get(`${tall}/users/code`);
// 获取短信验证码

2
apis/wbs.js

@ -3,5 +3,5 @@ import Config from "@/common/js/config.js"
export function setupWbs(app) {
uni.$u.api = { ...uni.$u.api } || {};
// 导入wbs
uni.$u.api.import = formData => this.$upload.chooseAndUpload(`${Config.apiUrl}/wbs`, formData);
uni.$u.api.import = formData => uni.$upload.chooseAndUpload(`${Config.apiUrl}/wbs`, formData);
}

12
common/styles/tailwind.scss

@ -2433,6 +2433,18 @@
grid-auto-flow: column dense;
}
.gap-1{
gap: 0.25rem;
}
.gap-2{
gap: 0.5rem;
}
.gap-3{
gap: 0.75rem;
}
.auto-rows-auto {
grid-auto-rows: auto;
}

12
common/styles/theme/default.scss

@ -1,6 +1,8 @@
// 默认主题文件
.theme-default {
background-color: #F3F3F3;
background-color: #007aff;
// color: #fff;
.u-card {
font-size: 16px !important;
background-color: #F3F3F3 !important;
@ -23,4 +25,14 @@
z-index: 100;
}
}
.u-navbar {
background-color: #007aff !important;
color: #fff;
.uicon-nav-back {
color: #fff !important;
}
}
button{
border: none!important;
}
}

3
common/styles/theme/test.scss

@ -5,4 +5,7 @@
font-size: 24px !important;
background-color: #ff0 !important;
}
.u-navbar {
background-color: #ff0 !important;
}
}

89
components/ChooseChecker/ChooseChecker.vue

@ -0,0 +1,89 @@
<template>
<view class="my-3" v-if="data.allMembers && data.allMembers.length">
<view class="flex justify-between">
<view class="flex flex-wrap text-center items-center">
<u-tag
:type="member.checked ? 'primary' : 'info'"
:mode="member.checked ? 'dark' : 'light'"
v-for="(member, index) in data.topMembers"
:key="member.memberId"
class="mb-2 mr-3"
style="width: 60px"
:text="member.name"
:closeable="false"
@click="tagClick(index, member, 'topMembers')"
/>
<span class="ml-2" v-if="!data.show" @click="data.show = true">...</span>
</view>
</view>
<!-- 折叠起来的 -->
<view class="flex flex-wrap text-center items-center" v-if="data.show">
<u-tag
:type="member.checked ? 'primary' : 'info'"
:mode="member.checked ? 'dark' : 'light'"
v-for="(member, index) in data.bottomMembers"
:key="member.memberId"
class="mb-2 mr-3"
style="width: 60px"
:text="member.name"
:closeable="false"
@click="tagClick(index, member, 'bottomMembers')"
/>
<u-icon class="ml-2" name="arrow-up" v-if="data.show" size="26" @click="data.show = false"></u-icon>
</view>
</view>
</template>
<script setup>
import { reactive, computed, onMounted } from 'vue';
import { useStore } from 'vuex';
const props = defineProps({
checkerList: {
default: () => [],
type: Array,
},
});
const data = reactive({
allMembers: [],
show: false,
topMembers: [],
bottomMembers: [],
});
const store = useStore();
const members = computed(() => store.state.role.members);
const emit = defineEmits(['setCheckerList']);
onMounted(() => {
if (members.value && members.value.length) {
data.allMembers = members.value;
// TODO:
data.allMembers.forEach(item => {
item.checked = false;
});
data.topMembers = members.value.slice(0, 3);
data.bottomMembers = members.value.slice(3);
}
});
function tagClick(index, item, membersType) {
//
const arr = uni.$u.deepClone(data[membersType]);
arr[index].checked = !arr[index].checked;
data[membersType] = [...arr];
// idcheckerList
emit('setCheckerList', arr[index].checked, item);
}
//
function clearChecked() {
for (let i = 0; i < data.topMembers.length; i++) {
data.topMembers[i].checked = false;
}
for (let i = 0; i < data.bottomMembers.length; i++) {
data.bottomMembers[i].checked = false;
}
}
</script>

6
components/Globals/Globals.vue

@ -11,8 +11,12 @@
>
<template v-slot:body>
<scroll-view :scrollY="true" :style="{ 'max-height': globalsHeight - 30 + 'px' }">
<<<<<<< HEAD
<!-- <skeleton :banner="false" :loading="!globals.length" :row="3" animate class="u-line-2 skeleton"></skeleton> -->
=======
<skeleton :banner="false" :loading="showGlobalSkeleton" :row="3" animate class="u-line-2 skeleton"></skeleton>
>>>>>>> 68e9189bbf20721e757578b15d349abd9ef295d0
<view class="grid gap-2">
<view v-for="item in globals" :key="item.id">
<template v-if="item.plugins && item.plugins.length">
@ -53,8 +57,8 @@ const sysHeight = uni.getSystemInfoSync().screenHeight; // 屏幕的高度
const globalsHeight = Math.floor(((sysHeight - 44 - 30 - 10) / 5) * 4); //
const store = useStore();
const isShrink = computed(() => store.state.task.isShrink); //
const showGlobalSkeleton = computed(() => store.state.task.showGlobalSkeleton); //
const globals = computed(() => store.getters['task/globals']);
console.log('globals: ', globals.value);
//
function openCard() {

104
components/Plugin/Plugin.vue

@ -1,29 +1,10 @@
<template>
<view class="u-font-14" style="height: 100%">
插件面板
<!-- <view v-if="data.pluginContent" @click="setStorage">
<view
:data-did="task.detailId"
:data-param="param"
:data-pdu="task.planDuration"
:data-pid="projectId"
:data-pstart="task.planStart"
:data-rdu="task.realDuration"
:data-rid="roleId"
:data-tid="task.id"
:data-tname="task.name"
:data-token="token"
:data-rstart="task.realStart"
:data-uid="userId"
style="height: 100%"
v-html="data.pluginContent"
></view>
</view> -->
<!-- <view v-else @click="setStorage"> -->
<view @click="setStorage">
<Render :task="task" :pluginId="pluginId" :styleType="styleType" :pluginTaskId="pluginTaskId" :param="param" />
<!-- <plugin-default /> -->
<!-- <component :task="task" :is="pluginComponent"></component> -->
<!-- <p-task-title :task="task" v-if="pluginId === '1'" />
<p-task-title :task="task" v-if="pluginId === '1'" />
<p-task-description :task="task" v-if="pluginId === '2'" />
<p-task-duration-delay :task="task" v-if="pluginId === '3'" />
<p-task-start-time-delay :task="task" v-if="pluginId === '4'" />
@ -37,13 +18,13 @@
<p-manage-member :task="task" v-if="pluginId === '11'" />
<p-manage-task :task="task" v-if="pluginId === '12'" />
<p-wbs-import :task="task" v-if="pluginId === '13' || pluginId === '14'" />
<p-deliver-check :task="task" v-if="pluginId === '15'" /> -->
<!-- </view> -->
<p-deliver-check :task="task" v-if="pluginId === '15'" />
</view>
</view>
</template>
<script setup>
import { reactive, nextTick, computed } from 'vue';
import { computed } from 'vue';
import { useStore } from 'vuex';
const props = defineProps({
@ -54,83 +35,22 @@ const props = defineProps({
param: { type: String, default: '' },
});
// const data = reactive({ pluginContent: null });
const store = useStore();
const roleId = computed(() => store.state.role.roleId);
// const token = computed(() => store.state.user.token);
// const userId = computed(() => store.getters['user/userId']);
const token = computed(() => store.state.user.token);
const userId = computed(() => store.getters['user/userId']);
const projectId = computed(() => store.getters['project/projectId']);
// const isMine = computed(() => store.getters['role/isMine']);
const isMine = computed(() => store.getters['role/isMine']);
//
// pluginComponent() {
// const target = this.$t.plugin.defaults.find(item => item.id === +this.pluginId);
// const pluginComponent = computed(() => {
// const target = uni.$pluginConfig.defaults.find(item => item.id === +props.pluginId);
// if (!target) return '';
// return target.component;
// },
// script dom
// function handleDom(js) {
// const domList = Array.from(document.getElementsByTagName('script'));
// const index = domList.findIndex(item => item.id === `p${props.pluginTaskId}`);
// if (index >= 0) {
// document.body.removeChild(document.getElementById(`p${props.pluginTaskId}`));
// }
// const scriptDom = document.createElement('script');
// scriptDom.id = `p${props.pluginTaskId}`;
// scriptDom.setAttribute('data-type', 'plugin');
// scriptDom.innerHTML = js;
// nextTick(() => {
// document.body.append(scriptDom);
// });
// }
//
// async function getPlugin() {
// const params = { pluginId: props.pluginId, styleType: props.styleType };
// uni.$catchReq.getOtherPlugin(params, (err, data) => {
// if (err) {
// console.error('err: ', err);
// } else {
// if (!data || !data.id) return;
// const reg = /data-root=["|']?(\w+)["|']?/gi;
// let uuid = '';
// // FIXME: js, html
// if (data.html) {
// // data-root=xxx xxx pluginTaskId
// if (reg.test(data.html)) {
// uuid = RegExp.$1;
// const str = data.html.replace(new RegExp(uuid, 'g'), `p${props.pluginTaskId}`);
// data.pluginContent = str;
// } else {
// data.pluginContent = data.html;
// }
// const str = data.js.replace(new RegExp(uuid, 'g'), `p${props.pluginTaskId}`);
// handleDom(str);
// }
// }
// });
// if (data.js) {
// if (reg.test(data.js)) {
// const uuid = RegExp.$1;
// const str = data.js.replace(new RegExp(uuid, 'g'), `p${this.pluginTaskId}`);
// this.handleDom(str);
// } else {
// this.handleDom(data.js);
// }
// }
// }
// });
console.log('props.pluginId: ', props.pluginId);
if (props.pluginId === '5') {
// id
store.dispatch('role/getAllMembers', { projectId: projectId.value });
}
// getPlugin();
// storage
async function setStorage() {

122
components/Render/Render.vue

@ -0,0 +1,122 @@
<template>
<view class="render-box shadow-lg" v-if="show">
<!-- #ifdef H5 -->
<view
class="content"
style="border-radius: 8px;"
id="project"
:data-did="task.detailId"
:data-param="param"
:data-pdu="task.planDuration"
:data-pid="projectId"
:data-pstart="task.planStart"
:data-rdu="task.realDuration"
:data-rid="roleId"
:data-tid="task.id"
:data-tname="task.name"
:data-token="token"
:data-rstart="task.realStart"
:data-uid="userId"
></view>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view
class="content"
id="project"
:data-did="task.detailId"
:data-param="param"
:data-pdu="task.planDuration"
:data-pid="projectId"
:data-pstart="task.planStart"
:data-rdu="task.realDuration"
:data-rid="roleId"
:data-tid="task.id"
:data-tname="task.name"
:data-token="token"
:data-rstart="task.realStart"
:data-uid="userId"
></view>
<!-- #endif -->
</view>
</template>
<script setup>
import { computed, reactive } from 'vue';
import { useStore } from 'vuex';
defineProps({
task: { default: () => {}, type: Object },
pluginId: { default: '1', type: String },
styleType: { default: 0, type: Number },
pluginTaskId: { default: '', type: String },
param: { type: String, default: '' },
});
const data = reactive({ show: true });
const store = useStore();
const roleId = computed(() => store.state.role.roleId);
const token = computed(() => store.state.user.token);
const userId = computed(() => store.getters['user/userId']);
const projectId = computed(() => store.getters['project/projectId']);
</script>
<script module="project" lang="renderjs">
export default {
data() {
return {
pluginContent: null,
pluginJs: null,
show: false,
};
},
mounted() {
this.$nextTick(() => {
this.getPlugin();
});
},
methods: {
//
async getPlugin() {
const params = { pluginId: this.pluginId, styleType: this.styleType };
this.$catchReq.getOtherPlugin(params, (err, res) => {
if (err) {
console.error('err: ', err);
} else {
if (!res || !res.id) return;
if (res.html && res.js) {
this.show = true;
this.$nextTick(() => {
this.init(res);
});
}
}
});
},
init(res) {
const content = document.querySelector('.content');
content.innerHTML = res.html;
const script = document.createElement('script');
script.innerHTML = res.js;
document.body.appendChild(script);
},
},
};
</script>
<style scoped lang="scss">
.render-box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
button{
border: none!important;
}
</style>

2
components/TimeLine/TimeLine.vue

@ -22,7 +22,7 @@
</template>
<script setup>
import { reactive, computed, defineExpose, defineEmits } from 'vue';
import { reactive, computed } from 'vue';
import { useStore } from 'vuex';
// import Barrier from './component/Barrier.vue';
import dayjs from 'dayjs';

40
components/TimeLine/component/TimeBox.vue

@ -1,6 +1,6 @@
<template>
<!-- v-finger:pinch="pinchHandler" -->
<view class="column" >
<!-- v-finger:pinch="pinchHandler" -->
<view class="column">
<view v-if="tasks && tasks.length">
<view :key="task.id" v-for="task in tasks" :id="`a${task.id}`">
<view class="flex">
@ -15,29 +15,27 @@
</view>
<view class="plugin">
<view class="h-3" v-if="task.process === 4"></view>
<view class="ml-3 overflow-hidden shadow-lg task-box">
<!-- <view class="ml-3 overflow-hidden shadow-lg task-box"> -->
<view class="ml-3">
<u-card :show-foot="false" :show-head="false" :style="{ height: setHeight(task.panel) }" class="h-16" margin="0" v-if="showSkeleton">
<view slot="body">
<view>
<skeleton :banner="false" :loading="true" :row="4" animate class="mt-2 u-line-2 skeleton"></skeleton>
</view>
<view><skeleton :banner="false" :loading="true" :row="4" animate class="mt-2 u-line-2 skeleton"></skeleton></view>
</view>
</u-card>
<u-card
<!-- <u-card
@click="onClickTask(task.planStart - 0, task.id)"
:style="{ height: setHeight(task.panel) }"
:show-foot="false"
:show-head="false"
:style="{ height: setHeight(task.panel) }"
class="h-16"
margin="0"
v-if="tasks && tasks.length && task.process !== 4 && !showSkeleton"
>
<!-- 任务面板插件 -->
<view slot="body">
<view class="p-0 u-col-between">
<template v-slot:body> -->
<view class="h-16" v-if="tasks && tasks.length && task.process !== 4 && !showSkeleton" @click="onClickTask(task.planStart - 0, task.id)">
<view class="p-0 u-col-between grid gap-3">
<view :key="pIndex" v-for="(row, pIndex) in task.plugins">
<!-- <view class="grid gap-2 grid-cols-1" v-if="row.length">
<view class="grid gap-2 grid-cols-1" v-if="row.length">
<Plugin
:class="[`row-span-${plugin.row}`, `col-span-${plugin.col}`]"
:task="task"
@ -48,17 +46,18 @@
:style-type="data.styleType || 0"
v-for="plugin in row"
/>
</view> -->
</view>
</view>
</view>
</u-card>
</view>
<!-- </template>
</u-card> -->
</view>
</view>
</view>
</view>
<!-- 局部弹框操作栏 -->
<!-- <Tips /> -->
<Tips />
</view>
</template>
@ -67,11 +66,12 @@ import { useStore } from 'vuex';
import { computed, reactive } from 'vue';
import TimeStatus from './TimeStatus.vue';
import TaskTools from './TaskTools.vue';
import Skeleton from '@/components/Skeleton/Skeleton.vue';
// const data = reactive({
// currentComponent: '',
// styleType: 0,
// });
const data = reactive({
currentComponent: '',
styleType: 0,
});
const store = useStore();
const roleId = computed(() => store.state.role.roleId);

3
components/Tips/Tips.vue

@ -24,7 +24,8 @@
</template>
<script setup>
import { useStore, onMounted, computed, reactive } from 'vuex';
import { onMounted, computed, reactive } from 'vue';
import { useStore } from 'vuex';
defineProps({ title: { default: '提示', type: String } });

2
components/Title/Title.vue

@ -1,4 +1,5 @@
<template>
<theme>
<view>
<!-- :is-back="false" -->
<u-navbar :custom-back="onBack" class="overflow-hidden">
@ -45,6 +46,7 @@
<u-picker title="开始时间" mode="time" v-model="data.showStart" :params="data.params" @confirm="confirmStartTime"></u-picker>
<u-picker title="结束时间" mode="time" v-model="data.showEnd" :params="data.params" @confirm="confirmEndTime"></u-picker>
</view>
</theme>
</template>
<script setup>

5
components/Upload/Upload.vue

@ -7,6 +7,7 @@
<script setup>
import { computed } from 'vue';
import { useStore } from 'vuex';
import Config from '@/common/js/config.js';
const emit = defineEmits(['success', 'error']);
@ -20,7 +21,9 @@ const handleUpload = async cur => {
// WBS
//
emit('success');
res.url && (uni.$t.domain = res.url);
const { apiUrl } = Config;
const defaultwbs = `${apiUrl}/defaultwbs`;
res.url && (defaultwbs = res.url);
setTimeout(() => {
uni.navigateTo({ url: `/pages/project/project?u=${userId.value}&p=${res.id}&pname=${res.pname}&url=${res.url}` });
}, 2000);

22
components/uni-popup/message.js

@ -0,0 +1,22 @@
export default {
created() {
if (this.type === 'message') {
// 不显示遮罩
this.maskShow = false;
// 获取子组件对象
this.childrenMsg = null;
}
},
methods: {
customOpen() {
if (this.childrenMsg) {
this.childrenMsg.open();
}
},
customClose() {
if (this.childrenMsg) {
this.childrenMsg.close();
}
},
},
};

23
components/uni-popup/popup.js

@ -0,0 +1,23 @@
import message from './message.js';
// 定义 type 类型:弹出类型:top/bottom/center
const config = {
// 顶部弹出
top: 'top',
// 底部弹出
bottom: 'bottom',
// 居中弹出
center: 'center',
// 消息提示
message: 'top',
// 对话框
dialog: 'center',
// 分享
share: 'bottom',
};
export default {
data() {
return { config: config };
},
mixins: [message],
};

246
components/uni-popup/uni-popup-dialog.vue

@ -0,0 +1,246 @@
<template>
<view class="uni-popup-dialog">
<view class="uni-dialog-title">
<text class="uni-dialog-title-text" :class="['uni-popup__' + dialogType]">{{ title }}</text>
</view>
<view class="uni-dialog-content">
<text class="uni-dialog-content-text" v-if="mode === 'base'">{{ content }}</text>
<input v-else class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholder" :focus="focus" />
</view>
<view class="uni-dialog-button-group">
<view class="uni-dialog-button" @click="close">
<text class="uni-dialog-button-text">取消</text>
</view>
<view class="uni-dialog-button uni-border-left" @click="onOk">
<text class="uni-dialog-button-text uni-button-color">确定</text>
</view>
</view>
</view>
</template>
<script>
/**
* PopUp 弹出层-对话框样式
* @description 弹出层-对话框样式
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
* @property {String} value input 模式下的默认值
* @property {String} placeholder input 模式下输入提示
* @property {String} type = [success|warning|info|error] 主题样式
* @value success 成功
* @value warning 提示
* @value info 消息
* @value error 错误
* @property {String} mode = [base|input] 模式
* @value base 基础对话框
* @value input 可输入对话框
* @property {String} content 对话框内容
* @property {Boolean} beforeClose 是否拦截取消事件
* @event {Function} confirm 点击确认按钮触发
* @event {Function} close 点击取消按钮触发
*/
export default {
name: 'uniPopupDialog',
props: {
value: {
type: [String, Number],
default: '',
},
placeholder: {
type: [String, Number],
default: '请输入内容',
},
/**
* 对话框主题 success/warning/info/error 默认 success
*/
type: {
type: String,
default: 'error',
},
/**
* 对话框模式 base/input
*/
mode: {
type: String,
default: 'base',
},
/**
* 对话框标题
*/
title: {
type: String,
default: '提示',
},
/**
* 对话框内容
*/
content: {
type: String,
default: '',
},
/**
* 拦截取消事件 如果拦截取消事件必须监听close事件执行 done()
*/
beforeClose: {
type: Boolean,
default: false,
},
},
data() {
return {
dialogType: 'error',
focus: false,
val: '',
};
},
inject: ['popup'],
watch: {
type(val) {
this.dialogType = val;
},
mode(val) {
if (val === 'input') {
this.dialogType = 'info';
}
},
value(val) {
this.val = val;
},
},
created() {
//
this.popup.mkclick = false;
if (this.mode === 'input') {
this.dialogType = 'info';
this.val = this.value;
} else {
this.dialogType = this.type;
}
},
mounted() {
this.focus = true;
},
methods: {
/**
* 点击确认按钮
*/
onOk() {
this.$emit(
'confirm',
() => {
this.popup.close();
if (this.mode === 'input') this.val = this.value;
},
this.mode === 'input' ? this.val : '',
);
},
/**
* 点击取消按钮
*/
close() {
if (this.beforeClose) {
this.$emit('close', () => {
this.popup.close();
});
return;
}
this.popup.close();
},
},
};
</script>
<style lang="scss" scoped>
.uni-popup-dialog {
width: 300px;
border-radius: 15px;
background-color: #fff;
}
.uni-dialog-title {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
padding-top: 15px;
padding-bottom: 5px;
}
.uni-dialog-title-text {
font-size: 16px;
font-weight: 500;
}
.uni-dialog-content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
align-items: center;
padding: 5px 15px 15px 15px;
}
.uni-dialog-content-text {
font-size: 14px;
color: #6e6e6e;
}
.uni-dialog-button-group {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
border-top-color: #f5f5f5;
border-top-style: solid;
border-top-width: 1px;
}
.uni-dialog-button {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex: 1;
flex-direction: row;
justify-content: center;
align-items: center;
height: 45px;
}
.uni-border-left {
border-left-color: #f0f0f0;
border-left-style: solid;
border-left-width: 1px;
}
.uni-dialog-button-text {
font-size: 14px;
}
.uni-button-color {
color: $uni-color-primary;
}
.uni-dialog-input {
flex: 1;
font-size: 14px;
}
.uni-popup__success {
color: $uni-color-success;
}
.uni-popup__warn {
color: $uni-color-warning;
}
.uni-popup__error {
color: $uni-color-error;
}
.uni-popup__info {
color: #909399;
}
</style>

115
components/uni-popup/uni-popup-message.vue

@ -0,0 +1,115 @@
<template>
<view class="uni-popup-message" :class="'uni-popup__' + [type]">
<text class="uni-popup-message-text" :class="'uni-popup__' + [type] + '-text'">{{ message }}</text>
</view>
</template>
<script>
/**
* PopUp 弹出层-消息提示
* @description 弹出层-消息提示
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
* @property {String} type = [success|warning|info|error] 主题样式
* @value success 成功
* @value warning 提示
* @value info 消息
* @value error 错误
* @property {String} message 消息提示文字
* @property {String} duration 显示时间设置为 0 则不会自动关闭
*/
export default {
name: 'UniPopupMessage',
props: {
/**
* 主题 success/warning/info/error 默认 success
*/
type: {
type: String,
default: 'success',
},
/**
* 消息文字
*/
message: {
type: String,
default: '',
},
/**
* 显示时间设置为 0 则不会自动关闭
*/
duration: {
type: Number,
default: 3000,
},
},
inject: ['popup'],
data() {
return {};
},
created() {
this.popup.childrenMsg = this;
},
methods: {
open() {
if (this.duration === 0) return;
clearTimeout(this.popuptimer);
this.popuptimer = setTimeout(() => {
this.popup.close();
}, this.duration);
},
close() {
clearTimeout(this.popuptimer);
},
},
};
</script>
<style lang="scss" scoped>
.uni-popup-message {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
background-color: #e1f3d8;
padding: 10px 15px;
border-color: #eee;
border-style: solid;
border-width: 1px;
}
.uni-popup-message-text {
font-size: 14px;
padding: 0;
}
.uni-popup__success {
background-color: #e1f3d8;
}
.uni-popup__success-text {
color: #67c23a;
}
.uni-popup__warn {
background-color: #faecd8;
}
.uni-popup__warn-text {
color: #e6a23c;
}
.uni-popup__error {
background-color: #fde2e2;
}
.uni-popup__error-text {
color: #f56c6c;
}
.uni-popup__info {
background-color: #f2f6fc;
}
.uni-popup__info-text {
color: #909399;
}
</style>

171
components/uni-popup/uni-popup-share.vue

@ -0,0 +1,171 @@
<template>
<view class="uni-popup-share">
<view class="uni-share-title">
<text class="uni-share-title-text">{{ title }}</text>
</view>
<view class="uni-share-content">
<view class="uni-share-content-box">
<view class="uni-share-content-item" v-for="(item, index) in bottomData" :key="index" @click.stop="select(item, index)">
<image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
<text class="uni-share-text">{{ item.text }}</text>
</view>
</view>
</view>
<view class="uni-share-button-box">
<button class="uni-share-button" @click="close">取消</button>
</view>
</view>
</template>
<script>
export default {
name: 'UniPopupShare',
props: {
title: {
type: String,
default: '分享到',
},
},
inject: ['popup'],
data() {
return {
bottomData: [
{
text: '微信',
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-2.png',
name: 'wx',
},
{
text: '支付宝',
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-8.png',
name: 'wx',
},
{
text: 'QQ',
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/gird-3.png',
name: 'qq',
},
{
text: '新浪',
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-1.png',
name: 'sina',
},
{
text: '百度',
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-7.png',
name: 'copy',
},
{
text: '其他',
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-5.png',
name: 'more',
},
],
};
},
created() {},
methods: {
/**
* 选择内容
*/
select(item, index) {
this.$emit(
'select',
{
item,
index,
},
() => {
this.popup.close();
},
);
},
/**
* 关闭窗口
*/
close() {
this.popup.close();
},
},
};
</script>
<style lang="scss" scoped>
.uni-popup-share {
background-color: #fff;
}
.uni-share-title {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
height: 40px;
}
.uni-share-title-text {
font-size: 14px;
color: #666;
}
.uni-share-content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
padding-top: 10px;
}
.uni-share-content-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: wrap;
width: 360px;
}
.uni-share-content-item {
width: 90px;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
padding: 10px 0;
align-items: center;
}
.uni-share-content-item:active {
background-color: #f5f5f5;
}
.uni-share-image {
width: 30px;
height: 30px;
}
.uni-share-text {
margin-top: 10px;
font-size: 14px;
color: #3b4144;
}
.uni-share-button-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
padding: 10px 15px;
}
.uni-share-button {
flex: 1;
border-radius: 50px;
color: #666;
font-size: 16px;
}
.uni-share-button::after {
border-radius: 50px;
}
</style>

289
components/uni-popup/uni-popup.vue

@ -0,0 +1,289 @@
<template>
<view v-if="showPopup" class="uni-popup" :class="[popupstyle]" @touchmove.stop.prevent="clear">
<uni-transition v-if="maskShow" :mode-class="['fade']" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" />
<uni-transition :mode-class="ani" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
<view class="uni-popup__wrapper-box" @click.stop="clear">
<slot />
</view>
</uni-transition>
</view>
</template>
<script>
import uniTransition from '../uni-transition/uni-transition.vue';
import popup from './popup.js';
/**
* PopUp 弹出层
* @description 弹出层组件为了解决遮罩弹层的问题
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
* @property {String} type = [top|center|bottom] 弹出方式
* @value top 顶部弹出
* @value center 中间弹出
* @value bottom 底部弹出
* @value message 消息提示
* @value dialog 对话框
* @value share 底部分享示例
* @property {Boolean} animation = [ture|false] 是否开启动画
* @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
* @event {Function} change 打开关闭弹窗触发e={show: false}
*/
export default {
name: 'UniPopup',
components: { uniTransition },
props: {
//
animation: {
type: Boolean,
default: true,
},
// top: bottomcenter
// message: ; dialog :
type: {
type: String,
default: 'center',
},
// maskClick
maskClick: {
type: Boolean,
default: true,
},
},
provide() {
return { popup: this };
},
mixins: [popup],
watch: {
/**
* 监听type类型
*/
type: {
handler: function (newVal) {
this[this.config[newVal]]();
},
immediate: true,
},
/**
* 监听遮罩是否可点击
* @param {Object} val
*/
maskClick(val) {
this.mkclick = val;
},
},
data() {
return {
duration: 300,
ani: [],
showPopup: false,
showTrans: false,
maskClass: {
position: 'fixed',
bottom: 0,
top: 0,
left: 0,
right: 0,
backgroundColor: 'rgba(0, 0, 0, 0.4)',
},
transClass: {
position: 'fixed',
left: 0,
right: 0,
},
maskShow: true,
mkclick: true,
popupstyle: 'top',
};
},
created() {
this.mkclick = this.maskClick;
if (this.animation) {
this.duration = 300;
} else {
this.duration = 0;
}
},
methods: {
clear(e) {
// TODO nvue
e.stopPropagation();
},
open() {
this.showPopup = true;
this.$nextTick(() => {
new Promise(resolve => {
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.showTrans = true;
// fixed by mehaotian app
this.$nextTick(() => {
resolve();
});
}, 50);
}).then(res => {
console.log('res: ', res);
//
clearTimeout(this.msgtimer);
this.msgtimer = setTimeout(() => {
this.customOpen && this.customOpen();
}, 100);
this.$emit('change', {
show: true,
type: this.type,
});
});
});
},
close(type) {
this.showTrans = false;
this.$nextTick(() => {
this.$emit('change', {
show: false,
type,
});
clearTimeout(this.timer);
//
this.customOpen && this.customClose();
this.timer = setTimeout(() => {
this.showPopup = false;
}, 300);
});
},
onTap() {
if (!this.mkclick) return;
this.close();
},
/**
* 顶部弹出样式处理
*/
top() {
this.popupstyle = 'top';
this.ani = ['slide-top'];
this.transClass = {
position: 'fixed',
left: 0,
right: 0,
};
},
/**
* 底部弹出样式处理
*/
bottom() {
this.popupstyle = 'bottom';
this.ani = ['slide-bottom'];
this.transClass = {
position: 'fixed',
left: 0,
right: 0,
bottom: 0,
};
},
/**
* 中间弹出样式处理
*/
center() {
this.popupstyle = 'center';
this.ani = ['zoom-out', 'fade'];
this.transClass = {
position: 'fixed',
/* #ifndef APP-NVUE */
display: 'flex',
flexDirection: 'column',
/* #endif */
bottom: 0,
left: 0,
right: 0,
top: 0,
justifyContent: 'center',
alignItems: 'center',
};
},
},
};
</script>
<style lang="scss" scoped>
.uni-popup {
position: fixed;
/* #ifndef APP-NVUE */
z-index: 99;
/* #endif */
}
.uni-popup__mask {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: $uni-bg-color-mask;
opacity: 0;
}
.mask-ani {
transition-property: opacity;
transition-duration: 0.2s;
}
.uni-top-mask {
opacity: 1;
}
.uni-bottom-mask {
opacity: 1;
}
.uni-center-mask {
opacity: 1;
}
.uni-popup__wrapper {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: absolute;
}
.top {
/* #ifdef H5 */
top: var(--window-top);
/* #endif */
/* #ifndef H5 */
top: 0;
/* #endif */
}
.bottom {
bottom: 0;
}
.uni-popup__wrapper-box {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: relative;
/* iphonex 等安全区设置,底部安全区适配 */
/* #ifndef APP-NVUE */
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
/* #endif */
}
.content-ani {
// transition: transform 0.3s;
transition-property: transform, opacity;
transition-duration: 0.2s;
}
.uni-top-content {
transform: translateY(0);
}
.uni-bottom-content {
transform: translateY(0);
}
.uni-center-content {
transform: scale(1);
opacity: 1;
}
</style>

97
config/plugin.js

@ -0,0 +1,97 @@
// 定义插件相关信息
/* eslint-disable */
export default {
defaults: [
{
id: 1,
name: 'TASK_NAME',
description: '任务名插件',
component: 'p-task-title',
},
{
id: 2,
name: 'TASK_DESCRIPTION',
description: '任务描述插件',
component: 'p-task-description',
},
{
id: 3,
name: 'TASK_DURATION_DELAY',
description: '任务时长延迟插件(+-1min)时间格式可设置',
component: 'p-task-duration-delay',
},
{
id: 4,
name: 'TASK_START_TIME_DELAY',
description: '任务开始时间延迟插件(+-1hour)',
component: 'p-task-start-time-delay',
},
{
id: 5,
name: 'DELIVERABLE',
description: '交付物插件(人 + 交付物)可配置【仅人】 or 【仅交付物】 or 【人+交付物】',
component: 'p-deliverable',
},
{
id: 6,
name: 'SUBTASKS',
description: '子任务插件:显示子任务',
component: 'p-subtasks',
},
{
id: 7,
name: 'SUB_PROJECT',
description: '子项目插件:显示子项目',
component: 'p-sub-project',
},
{
id: 8,
name: 'TASK_COUNTDOWN',
description: '任务倒计时插件',
component: 'p-task-countdown',
},
{
id: 9,
name: 'MANAGE_PROJECT',
description: '项目信息管理插件',
component: 'p-manage-project',
},
{
id: 10,
name: 'MANAGE_ROLE',
description: '角色信息管理插件',
component: 'p-manage-role',
},
{
id: 11,
name: 'MANAGE_MEMBER',
description: '成员信息管理插件',
component: 'p-manage-member',
},
{
id: 12,
name: 'MANAGE_TASK',
description: '任务信息管理插件',
component: 'p-manage-task',
},
{
id: 13,
name: 'WBS_IMPORT',
description: '导入WBS新建项目',
component: 'p-wbs-import',
},
{
id: 14,
name: 'WBS_IMPORT_UPDATE',
description: '导入WBS更新项目',
component: 'p-wbs-update',
},
{
id: 15,
name: 'DELIVER_CHECK',
description: '交付物检查',
component: 'p-deliver-check',
},
], // 默认插件id列表
};

4
hooks/project/useInit.js

@ -14,10 +14,6 @@ export default function useInit() {
}
});
// onMounted(() => {
// const system = uni.getSystemInfoSync();
// height.value = `${system.windowHeight}px`;
// });
/**
* 通过项目id获取项目信息

185
hooks/user/userMixin.js

@ -1,11 +1,12 @@
import { ref, computed } from 'vue';
import { ref, computed, reactive } from 'vue';
import { useStore } from 'vuex';
import clipboard from "@/common/js/dc-clipboard/clipboard.js"
import clipboard from "@/common/js/dc-clipboard/clipboard.js";
import Config from '@/common/js/config.js'
export default function userMixin() {
const store = useStore();
const user = computed(() => store.state.user.user);
const rules = ref({
const rules = {
phone: [{
required: true,
message: '请输入手机号',
@ -14,7 +15,7 @@ export default function userMixin() {
{
validator: (rule, value, callback) => {
// 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
return this.$u.test.mobile(value);
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
// 触发器可以同时用blur和change,二者之间用英文逗号隔开
@ -78,46 +79,156 @@ export default function userMixin() {
trigger: ['change', 'blur'],
}
],
});
const errorType = ['message'];
const labelPosition = 'left';
const border = false;
const smsCode = ref(''); // 短信验证码
const showInterval = ref(false);
const interval = ref(120);
};
const smsCode = ref(null); // 短信验证码
// const showInterval = ref(false);
// const interval = ref(120);
const codeTimer = ref(null);
const showPaste = ref(false);
// const showPaste = ref(false);
const dataObj = reactive({
showInterval: false,
interval: 60,
showPaste: false
});
//有图片验证码的值
function hasvalue(form, renderData) {
if(form.smsCode || form.showPaste) return
if (!verifyPhone(form.phone)) {
uni.$ui.showToast('请输入正确的手机号');
return;
}
if (!form.verificationCodeValue) {
uni.$ui.showToast('请输入图形验证码');
return;
}
// 获取图形验证码
async function getImageCode() {
console.log('5555')
uni.$ui.showLoading();
if (!dataObj.showInterval) {
getCode(form, renderData);
}
}
// 获取验证码
async function getCode(form, renderData) {
try {
const data = await uni.$u.api.getImageCode();
const { imageBase64, verificationCodeId } = data;
imageBase64 = imageBase64 || '';
verificationCodeId = verificationCodeId || '';
uni.$ui.hideLoading();
} catch (error) {
uni.$ui.hideLoading();
uni.$ui.showToast(error);
if (!renderData.verificationCodeId || !form.verificationCodeValue) {
uni.$ui.showToast('缺少图形验证码参数');
return;
}
const params = {
phone: form.phone,
verificationCodeId: renderData.verificationCodeId,
verificationCodeValue: form.verificationCodeValue,
};
const date = await store.dispatch('user/sendCode', params);
getCodeInterval();
dataObj.showPaste = true;
} catch (err) {
dataObj.showPaste = false;
throw err;
}
}
// 获取验证码倒计时
function getCodeInterval() {
dataObj.showInterval = true;
codeTimer.value = setInterval(() => {
if (dataObj.interval === 0) {
clearInterval(codeTimer.value);
codeTimer.value = null;
dataObj.showInterval = false;
dataObj.interval = 60;
return;
}
dataObj.interval = dataObj.interval - 1;
}, 1000);
}
// 粘贴
function setCode() {
// 获取粘贴板内容
// 小程序平台
//#ifdef MP-WEIXIN
uni.getClipboardData({
success (res) {
smsCode.value = res.data;
}
});
//#endif
// 非小程序平台
//#ifndef MP-WEIXIN
getClipboardContents()
//#endif
}
// 非小程序平台粘贴
async function getClipboardContents() {
try {
const text = await navigator.clipboard.readText();
smsCode.value = text;
} catch (err) {
console.error('Failed to read clipboard contents: ', err);
}
}
// 验证信息
function checkRules() {
if (!verifyPhone(phone.value)) {
uni.$ui.showToast('请输入正确的手机号');
return false;
}
if (!smsCode.value) {
uni.$ui.showToast('验证码无效');
return false;
}
if (phone.value === user.value.phone) {
uni.$ui.showToast('新手机号不能与旧手机号相同');
return;
}
return true;
}
/**
* 验证手机号格式
* @param {string} phone 手机号
*/
function verifyPhone(phone) {
const phoneExg = /^1\d{10}$/;
return phoneExg.test(phone);
}
/**
* 验证账号/密码 格式
* @param {string} account 账号
*/
function verifyLoginname(account) {
const accountExg = /^[a-zA-Z0-9._-]{2,20}$/;
return accountExg.test(account);
}
// 微信登录
function handleWxLogin() {
const origin = `${Config.baseUrl}/pt-mui`; // 测试
const appid = 'wxd1842e073e0e6d91';
const state = 'wx_web';
const href = 'https://open.weixin.qq.com/connect/qrconnect';
// eslint-disable-next-line
window.location.href =
`${href}?appid=${appid}&redirect_uri=${origin}&response_type=code&scope=snsapi_login&state=${state}#wechat_redirect`;
}
return {
rules,
errorType,
labelPosition,
border,
getImageCode,
// hasvalue,
// getCode,
// getCodeInterval,
// checkRules,
// setCode,
// getClipboardContents,
// verifyPhone,
// verifyLoginname,
// handleWxLogin
// showPaste,
// showInterval,
// interval,
dataObj,
hasvalue,
checkRules,
setCode,
verifyLoginname,
handleWxLogin
}
}

5
main.js

@ -9,12 +9,14 @@ import { setupRole } from '@/apis/role.js';
import { setupTall } from '@/apis/tall.js';
import { setupTask } from '@/apis/task.js';
import { setupWbs } from '@/apis/wbs.js';
import { setupPlugin } from '@/apis/plugin.js';
import storage from '@/utils/storage.js';
import store from './store';
import task from '@/utils/task.js';
import time from '@/utils/time.js';
import timeConfig from '@/config/time';
import taskConfig from '@/config/task';
import pluginConfig from '@/config/plugin';
import uView from './uni_modules/vk-uview-ui'; // 引入 uView UI
import ui from '@/utils/ui.js';
import upload from '@/utils/upload.js';
@ -31,6 +33,7 @@ export function createApp() {
app.config.globalProperties.$task = task;
app.config.globalProperties.$timeConfig = timeConfig;
app.config.globalProperties.$taskConfig = taskConfig;
app.config.globalProperties.$pluginConfig = pluginConfig;
uni.$cache = cache;
uni.$catchReq = cacheAndRequest;
@ -41,6 +44,7 @@ export function createApp() {
uni.$task = task;
uni.$timeConfig = timeConfig;
uni.$taskConfig = taskConfig;
uni.$pluginConfig = pluginConfig;
setupDayjs(app);
app.use(uView); // 使用 uView UI
@ -51,6 +55,7 @@ export function createApp() {
setupRole(app);
setupTask(app);
setupWbs(app);
setupPlugin(app);
return {
app,

40
manifest.json

@ -1,6 +1,6 @@
{
"name" : "tall-4-project",
"appid" : "__UNI__1EC8558",
"name" : "时物链条",
"appid" : "__UNI__3CBCFFF",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
@ -43,7 +43,41 @@
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {}
"sdkConfigs" : {
"ad" : {}
},
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
}
}
},
/* */

25
pages.json

@ -13,12 +13,37 @@
"navigationBarTextStyle": "white"
}
},
//
{
"path": "pages/user/accountLogin",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
},
//
{
"path": "pages/user/login",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
},
//
{
"path": "pages/user/rigister",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
},
//
{
"path": "pages/user/agreement",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
}
,{
"path" : "pages/submitList/submitList",

28
pages/index/index.vue

@ -7,7 +7,7 @@
<!-- 上传 导入wbs -->
<Upload @success="onUploadSuccess" @error="onUploadError" />
</view>
<u-button @click="toLogin">登录</u-button>
<!-- 项目列表 -->
<Projects @getProjects="getProjects" class="flex-1 overflow-y-auto" />
@ -75,20 +75,22 @@ const onDateChange = event => {
//
const onUploadSuccess = () => {
uTips.show({
title: '导入成功,即将打开新项目',
type: 'success',
duration: '3000',
});
uni.$ui.showToast('导入成功,即将打开新项目', 3000);
// uTips.show({
// title: '',
// type: 'success',
// duration: '3000',
// });
};
//
const onUploadError = error => {
uTips.show({
title: error || '导入失败',
type: 'error',
duration: '6000',
});
uni.$ui.showToast('导入失败', 6000);
// uTips.show({
// title: error || '',
// type: 'error',
// duration: '6000',
// });
};
// /
@ -104,6 +106,10 @@ function onMove(event) {
prevY = y;
data.value.calendar.initDate();
}
function toLogin() {
uni.navigateTo({ url: '/pages/user/accountLogin' })
}
</script>
<style>

5
pages/project/project.vue

@ -1,5 +1,5 @@
<template>
<view :style="{ height: height }" class="flex flex-col overflow-hidden u-font-14">
<theme :style="{ height: height }" class="flex flex-col overflow-hidden u-font-14">
<!-- 标题栏 -->
<Title />
@ -16,7 +16,7 @@
<!-- TODO: DEBUG: -->
<u-button @click="$store.commit('setTheme', 'theme-test')">测试切换主题</u-button>
</view>
</view>
</theme>
</template>
<script setup>
@ -76,7 +76,6 @@ watch(timeNode, newValue => {
console.log('当时间基准点发生变化时');
clearTasksData();
getGlobalData(); //
// initPlanTasks(); //
getTasksHook.initPlanTasks(); //
//

65
pages/user/accountLogin.vue

@ -1,11 +1,11 @@
<template>
<view class="u-p-l-50 u-p-r-50 u-p-t-30">
<u-form :model="model" ref="loginForm" :rules="mixinInit.rules" :error-type="mixinInit.errorType">
<u-form-item :label-position="mixinInit.labelPosition" label="用户名" prop="account" label-width="150">
<u-input :border="mixinInit.border" placeholder="请输入用户名" v-model="model.account" type="text"></u-input>
<u-form :model="form" ref="loginForm" :error-type="['message']">
<u-form-item label="用户名" prop="account" label-width="150">
<u-input placeholder="请输入用户名" v-model="form.account" type="text"></u-input>
</u-form-item>
<u-form-item :label-position="mixinInit.labelPosition" label="密码" prop="password" label-width="150">
<u-input :password-icon="true" :border="mixinInit.border" type="password" v-model="model.password" placeholder="请输入密码">
<u-form-item label="密码" prop="password" label-width="150">
<u-input :password-icon="true" type="password" v-model="form.password" placeholder="请输入密码">
</u-input>
</u-form-item>
<view class="flex flex-nowrap">
@ -26,70 +26,79 @@
<view style="margin-top: 200rpx;text-align: center; color: #999999;font-size: 35rpx;">
快速登录
</view>
<view style="text-align: center; margin-top: 20rpx;">
<view style="text-align: center; margin-top: 20rpx;" @click="mixinInit.handleWxLogin">
<image src="/common/img/weixinIcon.png" mode="" style="width: 85rpx;height: 85rpx;"></image>
</view>
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, reactive } from 'vue';
import { useStore } from 'vuex';
import { onReady} from '@dcloudio/uni-app';
import userMixin from '@/hooks/user/userMixin'
const store = useStore();
const mixinInit = userMixin();
const userInfo = uni.$storage.getStorageSync('user');
const user = ref({});
const loginForm = ref(null);
const model = ref({
const form = reactive({
account: '',
password: ''
})
if (userInfo) {
user.value = JSON.parse(userInfo);
}
onReady(() => {
loginForm.value.setRules(mixinInit.rules);
});
const submit = () => {
loginForm.value.validate(data => {
console.log(data);
loginForm.value.validate(valid => {
if (valid) {
login()
}
});
}
async function login() {
try {
uni.$ui.showLoading();
if (account.value === user.value.account) {
uni.$ui.showToast('当前账户已登录');
} else {
const params = ref({
client: 1,
try {
// #ifdef H5
const client = 0;
// #endif
// #ifdef APP-PLUS
const client = 1;
// #endif
const params = reactive({
client: client,
data: {
identifier: account.value,
credential: password.value,
identifier: form.account,
credential: form.password,
},
type: 3,
});
let res = await uni.$u.api.signin(params.value);
let res = await uni.$u.api.signin(params);
store.commit('user/setToken', res.token);
store.commit('user/setUser', res);
uni.$storage.setStorageSync('anyringToken', res.token || '');
uni.$storage.setStorageSync('user', JSON.stringify(res));
}
uni.$ui.hideLoading();
uni.navigateTo({
url: '/pages/index/index'
});
uni.$ui.hideLoading();
} catch (error) {
uni.$ui.hideLoading();
uni.$ui.showToast(error);
}
}
function openPage(url) {
uni.navigateTo({
url: url
})
}
</script>
<style>

18
pages/user/agreement.vue

@ -0,0 +1,18 @@
<template>
<view>
<web-view class="webview" src="https://www.yuque.com/docs/share/2de362e1-33fb-460a-92ca-5e8ef57f6d59?# 《时物链条用户协议》"></web-view>
<!-- <u-modal title="时物链条用户协议" v-model="showAgreement" show-cancel-button @confirm="$emit('confirm')" @cancel="$emit('cancel')">
<iframe
src="https://www.yuque.com/docs/share/2de362e1-33fb-460a-92ca-5e8ef57f6d59?# 《时物链条用户协议》"
frameborder="0"
scrolling="no"
style="width: 100%;height: 100%"
></iframe>
</u-modal> -->
</view>
</template>
<script>
</script>
<style></style>

8
pages/user/forgetPassword.vue

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

142
pages/user/login.vue

@ -1,8 +1,146 @@
<template>
<view class="u-p-l-50 u-p-r-50 u-p-t-30">
<u-form :model="form" ref="phoneLoginForm" :error-type="['message']">
<u-form-item label="手机号码" prop="phone" label-width="160">
<u-input placeholder="请输入手机号" v-model="form.phone" type="number"></u-input>
</u-form-item>
<u-form-item label="图形验证码" prop="verificationCodeValue" label-width="160">
<u-input placeholder="请输入计算结果" v-model="form.verificationCodeValue" type="number"></u-input>
<image slot="right" :src="renderData.imageBase64" mode="aspectFit" class="code-image" @click="getImageCode"></image>
</u-form-item>
<u-form-item label="验证码" prop="smsCode" label-width="160">
<u-input @focus="mixinInit.hasvalue(form, renderData)" placeholder="请输入验证码" v-model="form.smsCode" type="text"></u-input>
<u-button slot="right" type="primary" size="mini" v-show="mixinInit.dataObj.showPaste" @click="mixinInit.setCode" class="u-m-r-20">粘贴</u-button>
<u-button slot="right" size="mini" v-if="mixinInit.dataObj.showInterval">{{ mixinInit.dataObj.interval }}</u-button>
</u-form-item>
<view class="flex flex-nowrap">
<view class="flex-sub"></view>
<view class="u-m-t-30 u-font-12 text-gray-400" @click="openPage('/pages/user/forgetPassword')">忘记密码</view>
</view>
</u-form>
<view class="u-m-t-50">
<u-button @click="submitLogin" type="primary">立即登录</u-button>
</view>
<view class="flex justify-between">
<view class="u-m-t-30" style="color: #2885ED;" @click="openPage('/pages/user/rigister')">新用户注册</view>
<view class="u-m-t-30" style="color: #2885ED;" @click="openPage('/pages/user/accountLogin')">用户名登录</view>
</view>
<view style="margin-top: 200rpx;text-align: center; color: #999999;font-size: 35rpx;">
快速登录
</view>
<view style="text-align: center; margin-top: 20rpx;" @click="mixinInit.handleWxLogin">
<image src="/common/img/weixinIcon.png" mode="" style="width: 85rpx;height: 85rpx;"></image>
</view>
</view>
</template>
<script>
<script setup>
import { ref, computed, reactive } from 'vue';
import { useStore } from 'vuex';
import { onReady } from '@dcloudio/uni-app';
import userMixin from '@/hooks/user/userMixin'
const store = useStore();
const mixinInit = userMixin();
const phoneLoginForm = ref(null);
const form = reactive({
phone: '',
verificationCodeValue: '', //
smsCode: ''
});
const renderData = reactive({
verificationCodeId: '', // id
imageBase64: '' //
})
onReady(() => {
phoneLoginForm.value.setRules(mixinInit.rules);
});
getImageCode(); //
//
const submitLogin = () => {
console.log('111111')
phoneLoginForm.value.validate(valid => {
console.log('2222', valid)
if (valid) {
login()
}
});
}
/**
* 登录
*/
async function login() {
uni.$ui.showLoading();
try {
// #ifdef H5
const client = 0;
// #endif
// #ifdef APP-PLUS
const client = 1;
// #endif
const params = reactive({
client: client,
data: {
identifier: form.phone,
credential: form.smsCode,
},
type: 1,
});
let res = await uni.$u.api.signin(params);
store.commit('user/setToken', res.token);
store.commit('user/setUser', res);
uni.$storage.setStorageSync('anyringToken', res.token || '');
uni.$storage.setStorageSync('user', JSON.stringify(res));
uni.$ui.hideLoading();
uni.navigateTo({
url: '/pages/index/index'
});
} catch (error) {
uni.$ui.hideLoading();
uni.$ui.showToast(error);
}
}
//
async function getImageCode() {
uni.$ui.showLoading();
try {
const data = await uni.$u.api.getImageCode();
renderData.imageBase64 = data.imageBase64 || '';
renderData.verificationCodeId = data.verificationCodeId || '';
uni.$ui.hideLoading();
} catch (error) {
uni.$ui.hideLoading();
uni.$ui.showToast(error);
}
}
//
function openPage(url) {
uni.navigateTo({
url: url
})
}
</script>
<style>
<style lang="scss" scoped>
.code-image {
width: 200rpx;
height: 70rpx;
}
</style>

266
pages/user/mixin.js

@ -1,266 +0,0 @@
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import clipboard from "@/common/js/dc-clipboard/clipboard.js"
export default function mixinInit {
const store = useStore();
const user = computed(() => store.state.user.user);
const rules = ref({
phone: [
{
required: true,
message: '请输入手机号',
trigger: ['change','blur'],
},
{
validator: (rule, value, callback) => {
// 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
return this.$u.test.mobile(value);
},
message: '手机号码不正确',
// 触发器可以同时用blur和change,二者之间用英文逗号隔开
trigger: ['change','blur'],
}
],
verificationCodeValue: [
{
required: true,
message: '请输入图形验证码',
trigger: ['change','blur'],
},
{
type: 'number',
message: '图形验证码只能为数字',
trigger: ['change','blur'],
}
],
smsCode: [
{
required: true,
message: '请输入验证码',
trigger: ['change','blur'],
},
{
type: 'number',
message: '验证码只能为数字',
trigger: ['change','blur'],
}
],
account: [
{
required: true,
message: '请输入用户名',
trigger: ['change','blur'],
},
{
min: 2,
max: 20,
message: '用户名长度在2到20个字符',
trigger: ['change','blur'],
},
{
pattern: /^[a-zA-Z0-9._-]{2,20}$/,
message: '请输入2-20位字母、数字、汉字或字符"_ - ."',
trigger: ['change','blur'],
}
],
password: [
{
required: true,
message: '请输入密码',
trigger: ['change','blur'],
},
{
min: 6,
max: 20,
message: '密码长度在6到20个字符',
trigger: ['change','blur'],
},
{
// 正则不能含有两边的引号
pattern: /^[a-zA-Z0-9._-]{6,20}$/,
message: '请输入6-20位字母、数字、汉字或字符"_ - ."',
trigger: ['change','blur'],
}
],
});
const errorType = ref(['message']);
const labelPosition = ref('left');
const border = ref(false);
const smsCode = ref(''); // 短信验证码
const showInterval = ref(false);
const interval = ref(120);
const codeTimer = ref(null);
const showPaste = ref(false);
return {
errorType,
// getImageCode,
// hasvalue,
// getCode,
// getCodeInterval,
// checkRules,
// setCode,
// getClipboardContents,
// verifyPhone,
// verifyLoginname,
// handleWxLogin
}
}
// const mixin = {
// computed: mapState('user', ['user']),
// onReady() {
// this.$refs.uForm.setRules(this.rules);
// },
// methods: {
// ...mapActions('user', ['sendCode']),
// 获取图形验证码
// async getImageCode() {
// this.$util.showLoading();
// try {
// const data = await uni.$u.api.getImageCode();
// const { imageBase64, verificationCodeId } = data;
// this.imageBase64 = imageBase64 || '';
// this.verificationCodeId = verificationCodeId || '';
// uni.hideLoading();
// } catch (error) {
// uni.hideLoading();
// uni.$ui.showToast(error);
// }
// },
// //有图片验证码的值
// hasvalue() {
// if(this.model.smsCode || this.model.showPaste) return
// if (!this.verifyPhone(this.model.phone)) {
// uni.$ui.showToast('请输入正确的手机号');
// return;
// }
// if (!this.model.verificationCodeValue) {
// uni.$ui.showToast('请输入图形验证码');
// return;
// }
// this.getCode();
// },
// // 获取验证码
// async getCode() {
// try {
// const { phone, verificationCodeValue } = this.model;
// const { verificationCodeId } = this;
// if (!verificationCodeId || !verificationCodeValue) {
// uni.$ui.showToast('缺少图形验证码参数');
// return;
// }
// const params = {
// phone,
// verificationCodeId,
// verificationCodeValue,
// };
// const date = await store.dispatch('user/sendCode', params);
// getCodeInterval();
// showPaste.value = true;
// } catch (err) {
// throw err;
// }
// },
// // 获取验证码倒计时
// getCodeInterval() {
// this.showInterval = true;
// this.codeTimer = setInterval(() => {
// if (this.interval === 0) {
// clearInterval(this.codeTimer);
// this.codeTimer = null;
// this.showInterval = false;
// this.interval = 120;
// return;
// }
// this.interval = this.interval - 1;
// }, 1000);
// },
// // 验证信息
// checkRules() {
// // const { smsCode, phone, user } = this;
// if (!this.verifyPhone(phone.value)) {
// uni.$ui.showToast('请输入正确的手机号');
// return false;
// }
// if (!smsCode.value) {
// uni.$ui.showToast('验证码无效');
// return false;
// }
// if (phone.value === user.value.phone) {
// uni.$ui.showToast('新手机号不能与旧手机号相同');
// return;
// }
// return true;
// },
// // 粘贴
// setCode() {
// // 获取粘贴板内容
// // 小程序平台
// //#ifdef MP-WEIXIN
// var _this = this
// uni.getClipboardData({
// success (res) {
// _this.smsCode = res.data;
// }
// });
// //#endif
// // 非小程序平台
// //#ifndef MP-WEIXIN
// this.getClipboardContents()
// //#endif
// },
// // 非小程序平台粘贴
// async getClipboardContents() {
// try {
// const text = await navigator.clipboard.readText();
// this.smsCode = text;
// } catch (err) {
// console.error('Failed to read clipboard contents: ', err);
// }
// },
// /**
// * 验证手机号格式
// * @param {string} phone 手机号
// */
// verifyPhone(phone) {
// const phoneExg = /^1\d{10}$/;
// return phoneExg.test(phone);
// },
// /**
// * 验证账号/密码 格式
// * @param {string} account 账号
// */
// verifyLoginname(account) {
// const accountExg = /^[a-zA-Z0-9._-]{2,20}$/;
// return accountExg.test(account);
// },
// // 微信登录
// handleWxLogin() {
// const origin = 'https://test.tall.wiki/pt-mui'; // 测试
// const appid = 'wxd1842e073e0e6d91';
// const state = 'wx_web';
// const href = 'https://open.weixin.qq.com/connect/qrconnect';
// // eslint-disable-next-line
// window.location.href =
// `${href}?appid=${appid}&redirect_uri=${origin}&response_type=code&scope=snsapi_login&state=${state}#wechat_redirect`;
// },
// // }
// };

159
pages/user/rigister.vue

@ -0,0 +1,159 @@
<template>
<view class="u-p-l-50 u-p-r-50 u-p-t-30">
<u-form :model="form" ref="signUpForm" :error-type="['message']">
<u-form-item label="手机号码" prop="phone" label-width="160">
<u-input placeholder="请输入手机号" v-model="form.phone" type="number"></u-input>
</u-form-item>
<u-form-item label="图形验证码" prop="verificationCodeValue" label-width="160">
<u-input placeholder="请输入计算结果" v-model="form.verificationCodeValue" type="number"></u-input>
<image slot="right" :src="renderData.imageBase64" mode="aspectFit" class="code-image" @click="getImageCode"></image>
</u-form-item>
<u-form-item label="验证码" prop="smsCode" label-width="160">
<u-input @focus="mixinInit.hasvalue(form, renderData)" placeholder="请输入验证码" v-model="form.smsCode" type="text"></u-input>
<u-button slot="right" type="primary" size="mini" v-show="mixinInit.dataObj.showPaste" @click="mixinInit.setCode" class="u-m-r-20">粘贴</u-button>
<u-button slot="right" size="mini" v-if="mixinInit.dataObj.showInterval">{{ mixinInit.dataObj.interval }}</u-button>
</u-form-item>
<u-form-item label="用户名" prop="account" label-width="160">
<u-input placeholder="请输入用户名" v-model="form.account" type="text"></u-input>
</u-form-item>
<u-form-item label="密码" prop="password" label-width="160">
<u-input :password-icon="true" type="password" v-model="form.password" placeholder="请输入密码"></u-input>
</u-form-item>
<view class="flex flex-nowrap">
<view class="flex-sub"></view>
<view class="u-m-t-30 u-font-12 text-gray-400" @click="openPage('/pages/user/forgetPassword')">忘记密码</view>
</view>
</u-form>
<view class="u-m-t-50">
<u-button @click="submit" type="primary">立即注册</u-button>
</view>
<view class="flex flex-direction u-m-t-30">
<view class="flex flex-nowrap u-m-b-20">
<u-checkbox v-model="renderData.checked" @change="changeChecked"></u-checkbox>
<view class="agreement-text">
已阅读并同意使用
<span class="text-blue" @click="openPage('/pages/user/agreement')">时物链条用户协议</span>
</view>
</view>
<p class="text-blue u-m-l-70">没有套路真实需求</p>
</view>
<view class="flex flex-nowrap">
<view class="flex-1"></view>
<view class="u-m-t-60 text-blue" @click="openPage('/pages/user/accountLogin')">已有账号去登录</view>
</view>
</view>
</template>
<script setup>
import { ref, computed, reactive } from 'vue';
import { useStore } from 'vuex';
import { onReady } from '@dcloudio/uni-app';
import userMixin from '@/hooks/user/userMixin'
const store = useStore();
const mixinInit = userMixin();
const signUpForm = ref(null);
const form = reactive({
phone: '',
verificationCodeValue: '', //
smsCode: '',
account: '',
password: ''
})
const renderData = reactive({
verificationCodeId: '', // id
imageBase64: '', //
checked: false
})
onReady(() => {
signUpForm.value.setRules(mixinInit.rules);
});
getImageCode(); //
const submit = () => {
signUpForm.value.validate(valid => {
if (valid) {
signUp()
}
});
}
async function signUp() {
uni.$ui.showLoading();
try {
if (!renderData.checked) {
uni.$ui.showToast('请阅读并同意使用用户协议');
return;
}
const params = {
account: form.account,
password: form.password,
phone: form.phone,
smsCode: form.smsCode
};
let res = await uni.$u.api.signup(params);
store.commit('user/setToken', res.token);
store.commit('user/setUser', res);
uni.$storage.setStorageSync('anyringToken', res.token || '');
uni.$storage.setStorageSync('user', JSON.stringify(res));
uni.$ui.hideLoading();
uni.navigateTo({
url: '/pages/index/index'
});
} catch (error) {
uni.$ui.hideLoading();
uni.$ui.showToast(error);
}
}
//
async function getImageCode() {
uni.$ui.showLoading();
try {
const data = await uni.$u.api.getImageCode();
renderData.imageBase64 = data.imageBase64 || '';
renderData.verificationCodeId = data.verificationCodeId || '';
uni.$ui.hideLoading();
} catch (error) {
uni.$ui.hideLoading();
uni.$ui.showToast(error);
}
}
//
function changeChecked() {
renderData.checked = !renderData.checked;
}
function openPage(url) {
uni.navigateTo({
url: url
})
}
</script>
<style>
.code-image {
width: 200rpx;
height: 70rpx;
}
.text-blue {
color: #0081ff;
}
</style>

70
plugins/p-deliver-check/p-deliver-check.vue

@ -0,0 +1,70 @@
<template>
<!-- 上传交付物 -->
<view class="box shadow-lg">
<view class="px-3 py-6 bg-white">
<u-input :auto-height="autoHeight" :border="border" :height="height" :type="type" placeholder="输入备注" v-model="remark" />
<view class="flex flex-row-reverse text-xs text-gray-400 mt-2">{{ wordNum }}/140</view>
<!-- 评分 -->
<view class="flex justify-between mt-3">
<slider :value="score" @change="sliderChange" max="100" min="0" show-value style="width: 60%" />
<u-input :border="border" :type="type1" @input="changeNumber" maxlength="100" placeholder="输入分数" v-model="score" />
</view>
<view class="flex flex-col justify-center mt-5">
<u-button @click="submit" size="medium" type="primary">提交</u-button>
<u-button @click="$emit('closeScore')" class="mt-2" size="medium">取消</u-button>
</view>
</view>
</view>
</template>
<script setup>
import { reactive, watchEffect } from 'vue';
const data = reactive({
remark: '',
type: 'textarea',
border: true,
height: 100,
autoHeight: true,
wordNum: 0,
score: 0,
type1: 'number',
});
const emit = defineEmits(['submit']);
watchEffect(() => {
if (remark) {
data.wordNum = remark.value.length;
}
if (score) {
data.score1 = score.value;
}
});
//
function submit() {
emit('submit', this.remark, this.score);
}
function sliderChange(e) {
data.score = e.detail.value;
}
function changeNumber(e) {
if (e > 100) {
data.score = 100;
}
}
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

236
plugins/p-deliver/p-deliver.vue

@ -3,26 +3,25 @@
<view class="my-2 bg-white p-2 rounded-md relative" @longpress="logoTime" v-if="deliverRef">
<!-- 插件名称输入和提交 -->
<view class=" flex item-center justify-between py-3 pl-2" :class="inputRef">
<view class="flex item-center justify-between py-3 pl-2" :class="inputRef">
<u-input v-model="iptValue" type="text" :border="false" placeholder="请编辑交付物名称" />
<view class="self-center" :class="viewRef">{{iptValue}}</view>
<view class="self-center" :class="viewRef">{{ iptValue }}</view>
<u-button type="primary" size="mini" @click="submit" class="self-center" :disabled="sbumitState">提交</u-button>
<u-icon v-show="historyIcon" name="arrow-right" class="ml-1" @click="historical"></u-icon>
</view>
<view :class="viewRef" class="py-3 pl-2">
<span class="relative px-1">
<u-badge :is-dot="true" is-center></u-badge>
{{iptValue}}
{{ iptValue }}
</span>
</view>
<!-- 插件上传方式 -->
<view>
<u-input v-model="linkValue" type="text" :border="true" placeholder="请输入交付物地址/链接">
</u-input>
<u-input v-model="linkValue" type="text" :border="true" placeholder="请输入交付物地址/链接"> </u-input>
<view class="btns flexitems-start mt-3">
<u-button size="mini" :plain="true" style="color: #007AFF;" class="mr-3" @click="paste">粘贴</u-button>
<u-button size="mini" :plain="true" style="color: #007AFF;" class="mr-3" @click="getfile">文件</u-button>
<u-button size="mini" :plain="true" style="color: #007AFF;" class="mr-3" @click="photos">拍照</u-button>
<u-button size="mini" :plain="true" style="color: #007aff" class="mr-3" @click="paste">粘贴</u-button>
<u-button size="mini" :plain="true" style="color: #007aff" class="mr-3" @click="getfile">文件</u-button>
<u-button size="mini" :plain="true" style="color: #007aff" class="mr-3" @click="photos">拍照</u-button>
</view>
</view>
<!-- 提示框 -->
@ -32,171 +31,168 @@
<u-mask :show="showRef" @click="showRef = false">
<view class="warp">
<view class="rect rounded-md" @tap.stop>
<view class="text-center my-7 font-semibold">
交付物标题名称
</view>
<view class="text-center my-7 font-semibold"> 交付物标题名称 </view>
<view class="">
<u-input :border="true" class="m-5" placeholder="请输入交付物名称" v-model="newInputRef"/>
</view>
<view class="flex justify-around h-12 mt-7 justify-self-stretch" style="border-top: 1px solid #D1D5DB;">
<view class="leading-12 flex-1 text-center" style="border-right: 1px solid #D1D5DB;" @click="cancelClick">
取消
</view>
<view class="text-blue-700 leading-12 flex-1 text-center" @click="sureClick">
确定
<u-input :border="true" class="m-5" placeholder="请输入交付物名称" v-model="newInputRef" />
</view>
<view class="flex justify-around h-12 mt-7 justify-self-stretch" style="border-top: 1px solid #d1d5db">
<view class="leading-12 flex-1 text-center" style="border-right: 1px solid #d1d5db" @click="cancelClick"> 取消 </view>
<view class="text-blue-700 leading-12 flex-1 text-center" @click="sureClick"> 确定 </view>
</view>
</view>
</view>
</u-mask>
<!-- 编辑和删除的遮罩层 -->
<view class="mask flex items-center justify-center bg-grey" :class="maskRef" @click="close" >
<view class="mask flex items-center justify-center bg-grey" :class="maskRef" @click="close">
<view class="bg-yellow-500 text-white w-12 h-12 text-center leading-12 rounded-w-12 mx-8" @click="revisePlugin" @tap.stop>修改</view>
<view class="bg-red-500 text-white w-12 h-12 text-center leading-12 rounded-w-12 mx-8" @click="deletePlugin" @tap.stop>删除</view>
</view>
<!-- 插件审核人员选择 -->
<Reviewer/>
<Reviewer />
</view>
<view class="box shadow-lg">
<view class="deliver-container">p-deliver</view>
</view>
</template>
<script setup>
import {ref,computed,reactive} from 'vue'
//
const deliverRef = ref(true)
const iptValue = ref('')
const linkValue = ref('')
const historyIcon = ref(false)
const tips = ref('')
const showRef = ref(false)
const maskRef = ref('hidden')
const inputRef = ref('block')
const viewRef = ref('hidden')
const newInputRef = ref('')
const submitHistory = reactive([])
//
const sbumitState = computed(()=>!(iptValue.value && linkValue.value))
//
function getTime(){
const MM = uni.$dayjs().$M+1
const DD = uni.$dayjs().$D
const HH = uni.$dayjs().$H
const mm = uni.$dayjs().$m
const getTime = MM + '/' + DD + ' ' + HH + ':' + (mm < 10 ? '0' + mm : mm)
return getTime
}
//
function submit(){
const reg=/^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?$/;
if(!reg.test(linkValue.value)){
import { ref, computed, reactive } from 'vue';
//
const deliverRef = ref(true);
const iptValue = ref('');
const linkValue = ref('');
const historyIcon = ref(false);
const tips = ref('');
const showRef = ref(false);
const maskRef = ref('hidden');
const inputRef = ref('block');
const viewRef = ref('hidden');
const newInputRef = ref('');
const submitHistory = reactive([]);
//
const sbumitState = computed(() => !(iptValue.value && linkValue.value));
//
function getTime() {
const MM = uni.$dayjs().$M + 1;
const DD = uni.$dayjs().$D;
const HH = uni.$dayjs().$H;
const mm = uni.$dayjs().$m;
const getTime = `${MM}/${DD} ${HH}:${mm < 10 ? `0${mm}` : mm}`;
return getTime;
}
//
function submit() {
const reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?$/;
if (!reg.test(linkValue.value)) {
// toast
uni.$ui.showToast('请输入正确的链接')
}else{
inputRef.value = 'hidden'
viewRef.value = 'block'
const time = getTime()
const obj = {}
obj.name = iptValue.value
obj.time = time
obj.link = linkValue.value
submitHistory.push(obj)
console.log(submitHistory)
uni.$ui.showToast('请输入正确的链接');
} else {
inputRef.value = 'hidden';
viewRef.value = 'block';
const time = getTime();
const obj = {};
obj.name = iptValue.value;
obj.time = time;
obj.link = linkValue.value;
submitHistory.push(obj);
console.log(submitHistory);
}
}
//
function historical(){
uni.navigateTo({
url: '/pages/submitList/submitList'
});
}
}
//
function historical() {
uni.navigateTo({ url: '/pages/submitList/submitList' });
}
//
function paste(){
//
function paste() {
uni.getClipboardData({
success: function (res) {
linkValue.value = res.data
}
success(res) {
linkValue.value = res.data;
},
});
}
}
//
function getfile (){
//
function getfile() {
uni.chooseFile({
count: 1, //100
extension:['.zip','.doc'],
success: function (res) {
linkValue.value = JSON.stringify(res.tempFilePaths)
}
count: 1, // 100
extension: ['.zip', '.doc'],
success(res) {
linkValue.value = JSON.stringify(res.tempFilePaths);
},
});
}
}
//
function photos (){
//
function photos() {
uni.chooseImage({
count: 1, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album','camera'], //
success: function (res) {
linkValue.value = JSON.stringify(res.tempFilePaths)
}
count: 1, // 9
sizeType: ['original', 'compressed'], //
sourceType: ['album', 'camera'], //
success(res) {
linkValue.value = JSON.stringify(res.tempFilePaths);
},
});
}
function close(){
maskRef.value = 'hidden'
}
function close() {
maskRef.value = 'hidden';
}
//
function logoTime(){
if( viewRef.value === 'block'){
maskRef.value = 'block'
function logoTime() {
if (viewRef.value === 'block') {
maskRef.value = 'block';
}
}
//
function revisePlugin(){
showRef.value = true
function revisePlugin() {
showRef.value = true;
}
//
function cancelClick(){
showRef.value = false
function cancelClick() {
showRef.value = false;
// maskRef.value = 'hidden'
}
//
function sureClick (){
iptValue.value = newInputRef.value
newInputRef.value = ''
inputRef.value = 'block'
viewRef.value = 'hidden'
historyIcon.value = true
showRef.value = false
maskRef.value = 'hidden'
function sureClick() {
iptValue.value = newInputRef.value;
newInputRef.value = '';
inputRef.value = 'block';
viewRef.value = 'hidden';
historyIcon.value = true;
showRef.value = false;
maskRef.value = 'hidden';
}
//
function deletePlugin(){
deliverRef.value = false
function deletePlugin() {
deliverRef.value = false;
}
</script>
<style lang="scss">
.warp {
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 80%;
}
.rect {
}
.rect {
width: 80%;
height: 380rpx;
background-color: #fff;
}
}
.box {
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

141
plugins/p-delivery-history/p-delivery-history.vue

@ -0,0 +1,141 @@
<template>
<!-- 交付物 -->
<view class="box shadow-lg">
<view class="mt-3">
<view v-if="data.lists && data.lists.length">
<view :key="list.id" v-for="list in data.lists">
<view class="p-3 mt-3 shadow">
<view class="text-gray-400 pb-2">
<span class="mr-4">{{ list.name }}</span>
<span>{{ $moment(+list.time).format('YYYY-MM-DD HH:mm:ss') }}</span>
</view>
<view class="pb-2 flex flex-wrap overflow-hidden" v-if="list.content">
<a :href="list.content" class="text-blue-500" target="_blank" v-if="CheckUrl(list.content)">{{ list.content }}</a>
<span v-else>{{ list.content }}</span>
</view>
<view :key="checker.checkerId" v-for="checker in list.checkerList" class="mb-2">
<view class="flex justify-between">
<view class="font-bold">
{{ checker.checkerName }}
<span v-if="checker.isMine">()</span>
</view>
<view>
<span class="text-blue-500" v-if="checker.status === 1">通过</span>
<span class="text-red-500" v-if="checker.status === 2">驳回</span>
<span class="ml-4" v-if="checker.status !== 0">{{ checker.score }}</span>
<span class="text-gray-400" v-if="checker.status === 0 && !checker.isMine">未审核</span>
<view v-if="checker.status === 0 && checker.isMine">
<u-button @click="showScore(checker.checkId, 2)" class="mr-3" plain size="mini" type="error">驳回</u-button>
<u-button @click="showScore(checker.checkId, 1)" plain size="mini" type="primary">通过</u-button>
</view>
</view>
</view>
<view class="text-gray-400 text-xs mt-1">{{ checker.remark }}</view>
</view>
</view>
</view>
</view>
<u-empty icon-size="90" mode="history" text="暂未上传交付物" v-else></u-empty>
<!-- 评分 -->
<!-- <uni-popup :maskClick="false" background-color="#fff" ref="popup" type="bottom"><PDeliverCheck @closeScore="closeScore" @submit="submit"></PDeliverCheck></uni-popup> -->
</view>
</view>
</template>
<script setup>
import { ref, reactive, onMounted, computed } from 'vue';
import { useStore } from 'vuex';
// import UniPopup from '../../components/uni-popup/uni-popup.vue';
import PDeliverCheck from '../p-deliver-check/p-deliver-check.vue';
const props = defineProps({ task: { type: Object, default: null } });
const data = reactive({
lists: [],
show: false,
options: null,
loading: true, //
});
const store = useStore();
const projectId = computed(() => store.getters['project/projectId']);
const popup = ref(null);
onMounted(() => {
getDeliverOfTask();
});
async function getDeliverOfTask() {
try {
const params = { projectId: projectId.value, taskSubId: props.task.id };
const res = await uni.$u.api.queryDeliverOfTask(params);
data.lists = res;
} catch (error) {
console.error('p-delivery-history.vue getDeliverOfTask error: ', error);
uni.$ui.showToast(error.msg || '提交失败');
}
}
function showScore(checkId, status) {
// refuni-popup , type ['top','left','bottom','right','center']
popup.open('bottom');
data.options = { checkId, status };
}
function closeScore() {
popup.close('bottom');
}
async function submit(remark, score) {
try {
await checkDeliver(remark, score);
closeScore();
} catch (error) {
console.error('error: ', error);
}
}
/**
* 检查交付物
* @param {string} checkId 检查记录id
* @param {string} projectId 项目id
* @param {string} remark 评论
* @param {number} score 分数
* @param {number} status 检查状态(1-通过,2-驳回)
*/
async function checkDeliver(remark, score) {
try {
data.show = true;
const { checkId, status } = data.options;
const params = { checkId, projectId: projectId.value, status, remark, score };
await uni.$u.api.checkDeliver(params);
uni.$ui.showToast('交付物检查成功');
data.options = null;
getDeliverOfTask();
} catch (error) {
console.error('p-delivery-history.vue checkDeliver error: ', error);
uni.$t.ui.showToast('交付物检查失败,请稍后重试');
data.options = null;
}
}
//
function CheckUrl(url) {
const reg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(.)+$/;
if (!reg.test(url)) {
return false;
}
return true;
}
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

17
plugins/p-manage-member/p-manage-member.vue

@ -0,0 +1,17 @@
<template>
<view class="box shadow-lg">
<view>成员管理</view>
</view>
</template>
<script setup>
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

17
plugins/p-manage-project/p-manage-project.vue

@ -0,0 +1,17 @@
<template>
<view class="box shadow-lg">
<view>项目管理</view>
</view>
</template>
<script setup>
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

17
plugins/p-manage-role/p-manage-role.vue

@ -0,0 +1,17 @@
<template>
<view class="box shadow-lg">
<view>角色管理</view>
</view>
</template>
<script setup>
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

17
plugins/p-manage-task/p-manage-task.vue

@ -0,0 +1,17 @@
<template>
<view class="box shadow-lg">
<view>任务管理</view>
</view>
</template>
<script setup>
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

61
plugins/p-subproject/p-subproject.vue

@ -0,0 +1,61 @@
<template>
<!-- 子项目插件 -->
<view class="box shadow-lg">
<view v-for="item in data.sonProject" :key="item.detailId">
<span class="text-xs text-blue-500" @click="openProject(item)">{{ item.name }}</span>
</view>
</view>
</template>
<script setup>
import { onMounted } from 'vue';
import Config from '@/common/js/config.js';
const props = defineProps({
task: {
type: Object,
default: () => {},
},
});
const data = reactive({ sonProject: [] });
onMounted(() => {
getSonProject();
});
async function getSonProject() {
try {
const data = await uni.$u.api.findSonProject({ projectId: props.task.detailId });
data.sonProject = data;
} catch (error) {
console.error('p-subproject.vue getSonProject error: ', error);
}
}
/**
* 打开项目
* @param {object} project 所点击的项目的信息
*/
function openProject(project) {
const { name, id, url } = project;
const { apiUrl } = Config;
const defaultwbs = `${apiUrl}/defaultwbs`;
url && (defaultwbs = url);
uni.$u.route('pages/project/project', {
u: userId.value,
p: id,
pname: name,
url: encodeURIComponent(url),
});
}
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

38
plugins/p-subtasks/p-subtasks.vue

@ -0,0 +1,38 @@
<template>
<view class="box shadow-lg">
<view v-for="item in data.sonTask" :key="item.detailId">
<span class="text-xs text-gray-500">{{ item.name }}</span>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue';
const props = defineProps({
task: {
type: Object,
default: () => {},
},
});
const data = reactive({ sonTask: [] });
async function getSonTask() {
try {
const res = await uni.$u.api.findSonTask({ detailId: props.task.detailId });
data.sonTask = res;
} catch (error) {
console.error('p-subtasks.vue getSonTask error: ', error);
}
}
getSonTask();
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

19
plugins/p-task-countdown/p-task-countdown.vue

@ -0,0 +1,19 @@
<template>
<!-- 任务倒计时插件 -->
<view class="box shadow-lg">
<view>任务倒计时插件</view>
</view>
</template>
<script setup>
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

20
plugins/p-task-description/p-task-description.vue

@ -0,0 +1,20 @@
<template>
<!-- 任务描述 -->
<view class="box shadow-lg">
<view>{{ task.description }}</view>
</view>
</template>
<script setup>
defineProps({ task: { default: () => {}, type: Object } });
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

32
plugins/p-task-duration-delay/p-task-duration-delay.vue

@ -0,0 +1,32 @@
<template>
<view v-if="realDuration && planDuration" class="box shadow-lg">
<!-- 任务时长延迟插件 -->
<!-- 超时 -->
<span class="font-bold text-green-500" v-if="realDuration - 0 > planDuration - 0">
+{{ $time.formatDuration(realDuration - planDuration) }}
</span>
<!-- 延时 -->
<span class="font-bold text-red-500" v-if="realDuration - 0 < planDuration - 0">
-{{ $time.formatDuration(planDuration - realDuration) }}
</span>
</view>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps({ task: { default: () => {}, type: Object } });
const realDuration = computed(() => props.task.realDuration);
const planDuration = computed(() => props.task.planDuration);
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

29
plugins/p-task-start-time-delay/p-task-start-time-delay.vue

@ -0,0 +1,29 @@
<template>
<view class="box shadow-lg">
<!-- <view>任务开始时间延迟插件</view> -->
<view v-if="realStart && planStart">
<!-- 任务开始时间延迟插件 -->
<!-- 超时 -->
<span>{{ $time.formatDuration(+realStart - +planStart) }}</span>
</view>
</view>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps({ task: { default: () => {}, type: Object } });
const realStart = computed(() => props.task.realStart);
const planStart = computed(() => props.task.planStart);
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

14
plugins/p-task-title/p-task-title.vue

@ -1,12 +1,24 @@
<template>
<!-- 任务名插件 -->
<theme class="my-2">
<view class="bg-white rounded-md h-10 leading-10 pl-2">{{ task.name }}</view>
</theme>
<view class="box shadow-lg">
<view>{{ task.name }}</view>
</view>
</template>
<script setup>
defineProps({ task: { type: Object, default: () => {} } });
</script>
<style scoped lang="scss">
.box {
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

97
plugins/p-upload-deliverable/p-upload-deliverable.vue

@ -0,0 +1,97 @@
<template>
<!-- 上传交付物 -->
<view class="box shadow-lg py-2">
<u-input :auto-height="data.autoHeight" :border="data.border" :height="data.height" :type="data.type" v-model="data.content" width="100" />
<!-- 选择检查人 -->
<!-- <ChooseChecker ref="checker" :checkerList="data.checkerList" @setCheckerList="setCheckerList"></ChooseChecker> -->
<view class="flex justify-between">
<u-button @click="submit" class="m-0" size="mini" type="primary">提交</u-button>
<u-icon @click="changeShowHistory" name="arrow-up" v-if="data.showHistory"></u-icon>
<u-icon @click="changeShowHistory" name="arrow-down" v-else></u-icon>
</view>
<p-delivery-history :task="task" v-if="data.showHistory" />
</view>
</template>
<script setup>
import { reactive, ref, computed } from 'vue';
import { useStore } from 'vuex';
// import ChooseChecker from '@/components/ChooseChecker/ChooseChecker.vue';
const props = defineProps({
task: { default: () => {}, type: Object },
});
const data = reactive({
content: '',
type: 'textarea',
border: true,
height: 30,
autoHeight: true,
checkerList: [],
showHistory: false, //
});
const checker = ref(null);
const store = useStore();
const members = computed(() => store.state.role.members);
const projectId = computed(() => store.getters['project/projectId']);
const checkers = computed(() => {
let arr = [];
if (members.value.length) {
members.value.forEach(member => {
const item = { value: member.memberId, label: member.name };
arr.push(item);
});
}
return arr;
});
//
function setCheckerList(checked, item) {
if (checked) {
data.checkerList.push(item.memberId);
} else {
const index = data.checkerList.findIndex(checker => checker === item.memberId);
data.checkerList.splice(index, 1);
}
}
//
function changeShowHistory() {
data.showHistory = !data.showHistory;
}
//
async function submit() {
try {
const { content, checkerList } = data;
const { task } = props;
if (!checkerList.length) {
uni.$ui.showToast('请选择检查人');
return;
}
const params = { content, checkerList, projectId: projectId.value, taskSubId: task.id };
await uni.$u.api.saveDeliver(params);
uni.$ui.showToast('交付物提交成功');
data.content = '';
data.checkerList = [];
checker.clearChecked();
} catch (error) {
console.error('p-upload-deliverable.vue submit error: ', error);
uni.$ui.showToast('交付物提交失败,请稍后重试');
}
}
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

80
plugins/p-wbs-import/p-wbs-import.vue

@ -0,0 +1,80 @@
<template>
<view class="box shadow-lg">
<view @click="handleUpload" v-if="task.name === '导入WBS新建项目'">{{ task.name }}</view>
<view @click="handleUpdate" v-if="task.name === '导入WBS更新项目'">{{ task.name }}</view>
<!-- 全局提示框 -->
<u-top-tips ref="uTips"></u-top-tips>
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
defineProps({ task: { type: Object, default: () => {} } });
const store = useStore();
const userId = computed(() => store.state.user.userId);
const projectId = computed(() => store.getters['project/projectId']);
const uTips = ref(null);
//
function onUploadSuccess() {
uTips.show({
title: '导入成功,即将打开新项目',
type: 'success',
duration: '3000',
});
}
//
function onUploadError(error) {
uTips.show({
title: error || '导入失败',
type: 'error',
duration: '6000',
});
}
//
// TODO:
async function handleUpdate() {
try {
await uni.$u.api.import({ projectId: projectId.value });
// WBS
//
onUploadSuccess();
} catch (error) {
onUploadError(error);
}
}
// wbs
async function handleUpload() {
try {
const res = await uni.$u.api.import();
// WBS
//
onUploadSuccess();
setTimeout(() => {
uni.$u.route('/pages/project/project', {
u: userId.value,
p: res.id,
pname: res.pname,
url: res.url,
});
}, 2000);
} catch (error) {
onUploadError(error);
}
}
</script>
<style scoped lang="scss">
.box{
border-radius: 8px;
background: #fff;
padding: 16px;
overflow: hidden;
}
</style>

4
store/task/actions.js

@ -5,7 +5,9 @@ const actions = {
* @param {string} roleId 角色id
*/
getPermanent({ commit }, param) {
commit('setShowGlobalSkeleton', true);
uni.$catchReq.getPermanent(param, (err, data) => {
commit('setShowGlobalSkeleton', false);
if (err) {
console.error('err: ', err);
} else {
@ -20,7 +22,9 @@ const actions = {
* @param {object} param 请求参数 roleId, timeNode, timeUnit
*/
getGlobal({ commit }, param) {
commit('setShowGlobalSkeleton', true);
uni.$catchReq.getGlobal(param, (err, data) => {
commit('setShowGlobalSkeleton', false);
if (err) {
console.error('err: ', err);
} else {

9
store/task/mutations.js

@ -225,6 +225,15 @@ const mutations = {
state.showSkeleton = show;
},
/**
* 设置日常任务骨架屏是否显示
* @param {Object} state
* @param {Boolean} show
*/
setShowGlobalSkeleton(state, show) {
state.showGlobalSkeleton = show;
},
/**
* 是否设置时间轴自动滚动的位置
* @param {Object} state

1
store/task/state.js

@ -18,6 +18,7 @@ const state = {
dailyTasks: [], // 日常任务
tasks: [], // 所有的定期任务
showSkeleton: false, // 定期任务骨架屏
showGlobalSkeleton: false, // 日常任务骨架屏
newProjectInfo: {},
showScrollTo: false, // 是否可以设置时间轴自动滚动的位置
};

20
store/user/actions.js

@ -1,5 +1,3 @@
import ui from '@/utils/ui.js';
const actions = {
/**
* 通过userId获取token
@ -15,7 +13,23 @@ const actions = {
uni.$storage.setStorageSync('user', JSON.stringify(res));
return res;
} catch (error) {
ui.showToast(error.msg || '获取个人信息失败');
uni.$ui.showToast(error.msg || '获取个人信息失败');
throw error;
}
},
/**
* 发送验证码
* @param {ant} commit
* @param {object} params 要提交的数据
* @param {string} params.phone 手机号
*/
async sendCode({ commit }, params) {
try{
const res = await uni.$u.api.getSmsCode(params);
uni.$ui.showToast('验证码发送成功');
} catch (error) {
uni.$ui.showToast(error.msg || '发送失败');
throw error;
}
},

2
utils/cacheAndRequest.js

@ -83,7 +83,6 @@ export default {
uni.$cache
.getStorageRegularTask(params)
.then(data => {
console.log('cache data: ', data);
!remote && fn(null, data);
})
.catch(err => !remote && fn(err));
@ -93,7 +92,6 @@ export default {
uni.$u.api
.getRegularTask(params)
.then(data => {
console.log('api data: ', uni.$u.deepClone(data));
remote = true;
fn(null, uni.$u.deepClone(data));

2
utils/upload.js

@ -55,8 +55,8 @@ export default {
*/
chooseAndUpload(url, formData = {}, extension = ['.xls', '.xlsx'], name = 'param') {
uni.hideLoading();
clearTimeout(timer);
let timer = null;
clearTimeout(timer);
return new Promise((resolve, reject) => {
const token = uni.$storage.getStorageSync('anyringToken');
if (!token) {

Loading…
Cancel
Save