fix(新手旅程): 完善功能介绍完成后跳转显示新手任务,优化样式,调整 sql 版本

This commit is contained in:
lan-yonghui 2023-04-07 21:04:43 +08:00 committed by 刘瑞斌
parent cc8be22fa2
commit fca4b9f8a3
6 changed files with 56 additions and 46 deletions

View File

@ -57,6 +57,8 @@
</template>
<script>
import {hasPermissions} from "../../../utils/permission";
export default {
name: "MsIntroduction",
data() {
@ -115,9 +117,8 @@ export default {
},
gotoTurn(){
this.closeDialog()
if(localStorage.getItem("noviceStatus") && localStorage.getItem("noviceStatus") === "1"){
let redirectUrl = sessionStorage.getItem("redirectUrl")
if(redirectUrl.includes("track")){
if(localStorage.getItem("noviceStatus") && localStorage.getItem("noviceStatus") === "1" && hasPermissions("PROJECT_TRACK_CASE:READ+CREATE")){
if(this.$route.path.includes("track")){
this.$emit("skipOpen", "/track/case/all")
this.$router.push("/track/case/all")
}else{

View File

@ -33,22 +33,23 @@ export default {
totalTask: 0,
taskData:[],
language: localStorage.getItem('language'),
status: this.$route.query.status
};
},
mounted() {
created() {
this.initTaskData(1)
},
methods: {
initTaskData(status){
getSideTask().then(res=>{
if(res.data.length > 0 && res.data[0].dataOption){
initTaskData(status) {
getSideTask().then(res => {
if (res.data.length > 0 && res.data[0].dataOption) {
this.taskData = JSON.parse(res.data[0].dataOption)
this.noviceStatus = res.data[0].status === 1
}else{
} else {
this.taskData = TASK_DATA
}
if(status === 2 && res.data[0].status === 0){
updateStatus(1).then(res=>{
if (status === 2 && res.data[0].status === 0) {
updateStatus(1).then(res => {
this.noviceStatus = true
localStorage.setItem("noviceStatus", "1")
})
@ -56,30 +57,47 @@ export default {
let microApp = JSON.parse(sessionStorage.getItem("micro_apps"));
let num = 0
let total = 0
this.taskData.forEach(item =>{
if(!(microApp && microApp[item.name]) || (item.name === 'ui' && !hasLicense()) ||
!hasPermissions(...item.permission)){
this.taskData.forEach(item => {
item.rate = 0
let subRTask = 0
item.taskData.forEach(res => {
if(hasPermissions(...res.permission) ){
subRTask += 1
if(res.status === 1){
item.rate += 1
}
}
});
if (!(microApp && microApp[item.name]) || (item.name === 'ui' && !hasLicense()) ||
!hasPermissions(...item.permission)) {
item.status = -1
total++
} else {
item.percentage = Math.floor(item.rate / item.taskData.length * 100)
if(item.percentage === 100){
item.percentage = Math.floor(item.rate / subRTask * 100)
if (item.percentage === 100) {
item.status = 1
}else if(100 > item.percentage && item.percentage > 0){
} else if (100 > item.percentage && item.percentage > 0) {
item.status = 2
}
num += item.rate
}
})
if(total < this.taskData.length){
if (total < this.taskData.length) {
this.taskStatus = true
}
this.totalTask = num
if (this.status) {
this.$refs.siteTask.skipOpen(this.taskData,"/track/case/all");
}
})
},
toggle(status){
this.initTaskData(status)
this.openBox = true
this.openBox = !this.openBox
if(this.openBox || status === 2){
this.initTaskData(status)
}
this.$refs.siteTask.open();
},
closeBox(status){
@ -90,7 +108,7 @@ export default {
},
skipOpen(path){
this.initTaskData(1)
this.$refs.siteTask.skipOpen(path);
this.$refs.siteTask.skipOpen(null,path);
}
}
@ -155,6 +173,7 @@ export default {
.parentBox .contentsBox div:hover span {
display: block;
color: #fff;
white-space: nowrap;
cursor: pointer;
}
.parentBox .contentsBox div:not(:last-child) {

View File

@ -165,18 +165,11 @@ export default {
incompleteNum: 0,
totalNum: 0,
language: localStorage.getItem('language'),
status: this.$route.query.status
}
},
props: {
taskData: Array
},
mounted() {
if(this.status){
this.skipOpen("/track/case/all")
}
},
methods: {
taskNum() {
let totalNum = 0
@ -230,7 +223,6 @@ export default {
notShow() {
this.noviceVisible = true
this.gifVisible = false
},
goContinue () {
updateStatus(0).then(res=>{
@ -243,11 +235,14 @@ export default {
gotoPath(path){
this.$router.push(path)
},
skipOpen(path){
if(path){
this.taskData.forEach(val=>{
val.taskData.forEach(item=>{
if(item.path === path){
skipOpen(data, path){
if(data) {
this.taskData = data
}
if(path) {
this.taskData.forEach(val => {
val.taskData.forEach(item => {
if (item.path === path) {
this.taskIndex = 1
this.taskNum()
this.cardVisible = true

View File

@ -1,13 +0,0 @@
SET SESSION innodb_lock_wait_timeout = 7200;
ALTER TABLE novice_statistics
MODIFY COLUMN data_option varchar(9000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL
COMMENT 'data option (JSON format)' AFTER guide_num;
ALTER TABLE novice_statistics
ADD COLUMN `status` tinyint NOT NULL DEFAULT 1 COMMENT '是否显示0不显示1显示' AFTER data_option;
ALTER TABLE novice_statistics
ADD UNIQUE INDEX `uk_id_user_id`(`id`, `user_id`) USING BTREE;
ALTER TABLE novice_statistics
ADD UNIQUE INDEX `uk_user_id`(`user_id`) USING BTREE
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -0,0 +1,8 @@
SET SESSION innodb_lock_wait_timeout = 7200;
ALTER TABLE novice_statistics MODIFY COLUMN data_option varchar(9000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'data option (JSON format)' AFTER guide_num;
ALTER TABLE novice_statistics ADD COLUMN `status` tinyint NOT NULL DEFAULT 1 COMMENT '是否显示0不显示1显示' AFTER data_option;
ALTER TABLE novice_statistics ADD UNIQUE INDEX `uk_id_user_id`(`id`, `user_id`) USING BTREE;
ALTER TABLE novice_statistics ADD UNIQUE INDEX `uk_user_id`(`user_id`) USING BTREE;
SET SESSION innodb_lock_wait_timeout = DEFAULT;