Browse Source

fix: 修改时间轴bug

develop
song 4 years ago
parent
commit
fe0860875d
  1. 3
      CHANGELOG.md
  2. 1
      package.json
  3. 2
      src/App.vue
  4. 2
      src/common/styles/tailwind.scss
  5. 3
      src/mixins/userAuth.js
  6. 4
      src/pages/index/index.vue
  7. 13
      src/pagesProject/project/components/Evaluated/EvaluatedNLCP.vue
  8. 47
      src/pagesProject/project/components/Evaluated/EvaluatedXLJH.vue
  9. 36
      src/pagesProject/project/components/Evaluated/components/EvaluatedDetail.vue
  10. 10
      src/pagesProject/project/components/TimeLine/TimeLine.vue
  11. 12
      src/pagesProject/project/components/TimeLine/component/TimeBoxIn.vue
  12. 139
      src/pagesUser/git-phone-power/git-phone-power.vue
  13. 9
      src/pagesUser/phone-bind/phone-bind.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-11-19)
# 0.1.0 (2021-11-22)
### 🌟 新功能
范围|描述|commitId
@ -229,6 +229,7 @@
- | 修改定期任务骨架屏高度 | [909a734](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/909a734)
- | 小红点api缓存修改 | [e992343](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/e992343)
- | 提交本地代码 | [e0cf2ed](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/e0cf2ed)
- | 提升性能的代码更改 | [3548af7](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/3548af7)
- | 插件查询及展示 | [4dba770](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4dba770)
- | 数据存储,避免重复调用接口 | [d22308a](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/d22308a)
- | 整理代码 | [7a55315](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7a55315)

1
package.json

@ -14,6 +14,7 @@
"build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build --mode production",
"build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build --mode production",
"build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build --mode production",
"build:mp-weixin-test": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build --mode development",
"cz": "npm run log && git add . && git cz",
"dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
"dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",

2
src/App.vue

@ -66,7 +66,7 @@ export default {
*/
async noPhone(phone) {
if (!phone) {
this.$u.route('/pagesUser/phone-bind/phone-bind');
this.$u.route('/pagesUser/git-phone-power/git-phone-power');
}
},

2
src/common/styles/tailwind.scss

@ -1251,7 +1251,7 @@
}
.m-0 {
margin: 0px;
margin: 0px!important;
}
.m-1 {

3
src/mixins/userAuth.js

@ -34,10 +34,11 @@ export default {
province,
sex: gender,
});
console.log('data: ', data);
const { user } = this;
user.wxInfo = data;
this.setUser(user);
// 获取手机号
this.showBindPnone = true;
},
fail: error => {
console.log('error: ', error);

4
src/pages/index/index.vue

@ -1,5 +1,5 @@
<template>
<view class="flex flex-col h-full bg-gray-50" @click="openAuth">
<view class="flex flex-col h-full bg-gray-50">
<view class="relative" @touchmove="onMove">
<!-- 日历 -->
<Calendar @selected-change="onDateChange" :show-back="true" ref="calendar" @handleFindPoint="handleFindPoint" />
@ -19,12 +19,10 @@
<script>
import { mapState, mapMutations } from 'vuex';
import UserAuthMixin from '@/mixins/userAuth';
let prevY = 0;
export default {
mixins: [UserAuthMixin],
data() {
return {
calendar: null,

13
src/pagesProject/project/components/Evaluated/EvaluatedNLCP.vue

@ -33,12 +33,16 @@
</template>
<script>
import { mapMutations } from 'vuex';
import { mapState, mapMutations } from 'vuex';
import UCharts from './components/UCharts.vue';
export default {
components: { UCharts },
props: { task: { type: Object, default: null }, taskIndex: { type: Number, default: 0 }, itemIndex: { type: Number, default: 0 } },
props: {
task: { type: Object, default: null },
taskId: { type: String, default: '' },
itemIndex: { type: Number, default: 0 },
},
data() {
return {
cWidth: '',
@ -47,6 +51,8 @@ export default {
};
},
computed: mapState('task', ['tasks']),
mounted() {
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
@ -93,7 +99,8 @@ export default {
//
changeShowState() {
const { taskIndex, itemIndex } = this;
const { itemIndex, taskId } = this;
const taskIndex = this.tasks.findIndex(item => item.id === taskId);
const options = {
taskIndex,
itemIndex,

47
src/pagesProject/project/components/Evaluated/EvaluatedXLJH.vue

@ -36,19 +36,37 @@
<u-icon name="arrow-down" color="#909399" v-else @click="changeShowState"></u-icon>
</view>
<!-- 详情 -->
<EvaluatedDetail :task="task.data.train" v-if="task.data.showDetail" />
<view v-if="task.data.showDetail">
<EvaluatedDetail :task="task.data.train" v-if="task.data.train.trainType === 0" />
<view v-else class="p-2">
<img class="w-full pic" :style="{ height: height }" src="https://www.tall.wiki/staticrec/yanyuan/rest.png" />
</view>
</view>
</view>
</template>
<script>
import { mapMutations } from 'vuex';
import { mapState, mapMutations } from 'vuex';
import EvaluatedDetail from './components/EvaluatedDetail';
export default {
components: { EvaluatedDetail },
props: { task: { type: Object, default: null }, taskIndex: { type: Number, default: 0 }, itemIndex: { type: Number, default: 0 } },
props: {
task: { type: Object, default: null },
taskId: { type: String, default: '' },
itemIndex: { type: Number, default: 0 },
},
data() {
return { count: 3 };
return { count: 3, height: null };
},
computed: mapState('task', ['tasks']),
mounted() {
this.$nextTick(() => {
this.setPicHeight();
});
},
methods: {
@ -56,12 +74,31 @@ export default {
//
changeShowState() {
const { taskIndex, itemIndex } = this;
const { itemIndex, taskId } = this;
const taskIndex = this.tasks.findIndex(item => item.id === taskId);
const options = {
taskIndex,
itemIndex,
};
this.setShowDetail(options);
if (this.task.data.train.trainType === 1) {
this.setPicHeight();
}
},
setPicHeight() {
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query
.selectAll('.pic')
.boundingClientRect(data => {
if (data && data.length) {
this.height = (data[0].width * 10) / 14 + 'px';
}
})
.exec();
});
},
},
};

36
src/pagesProject/project/components/Evaluated/components/EvaluatedDetail.vue

@ -1,5 +1,14 @@
<template>
<view class="my-2">
<!-- 工具箱 -->
<view v-if="train.tools.length">
<u-radio-group v-model="radioDefaultValue" @change="radioGroupChange">
<!-- v-for="(tool, index) in train.tools" -->
<u-radio @change="radioChange" v-for="(tool, index) in train.tools" :key="index" :name="item.toolId">
{{ item.toolCode }}
</u-radio>
</u-radio-group>
</view>
<view v-if="train.contentDetails.length" class="text-xs">
<!-- 训练目标 训练元素 训练原理 训练步骤 -->
<view v-for="(purpose, purposeIndex) in train.contentDetails" :key="purposeIndex">
@ -49,6 +58,33 @@ import ProcessRestore from './ProcessRestore';
export default {
components: { ResultLevel, ProcessRestore },
props: { train: { type: Object, default: null } },
data() {
return {};
},
computed: {
radioDefaultValue() {
if (this.train && this.train.tools && this.train.tools.length) {
const index = this.train.tools.findIndex(tool => tool.useStatus === 1);
console.log('index: ', index);
if (index) {
return this.train.tools[index].toolId;
}
}
return '';
},
},
methods: {
// radio
radioChange(e) {
console.log(e);
},
// radioradio-group
radioGroupChange(e) {
console.log(e);
},
},
};
</script>

10
src/pagesProject/project/components/TimeLine/TimeLine.vue

@ -4,9 +4,9 @@
<scroll-view
style="height: 100%"
:lower-threshold="100"
:lower-threshold="50"
:scroll-y="true"
:upper-threshold="100"
:upper-threshold="50"
:scroll-into-view="scrollToTaskId"
@scroll="scroll"
@scrolltolower="handleScrollBottom"
@ -16,9 +16,9 @@
<!-- 时间轴 -->
<!-- <u-divider bg-color="#f3f4f6" class="pt-5" fontSize="14px" v-if="topEnd">已到顶部</u-divider> -->
<view class="column">
<view :key="task.id" v-for="(task, taskIndex) in tasks" :id="`a${task.id}`">
<TimeBoxIn :task="task" :taskIndex="taskIndex" v-if="task.array && task.array.length" />
<TimeBoxOut :task="task" :taskIndex="taskIndex" v-else />
<view :key="task.id" v-for="task in tasks" :id="`a${task.id}`">
<TimeBoxIn :task="task" :taskId="task.id" v-if="task.array && task.array.length" />
<TimeBoxOut :task="task" :taskId="task.id" v-else />
</view>
</view>
<!-- <u-divider bg-color="#f3f4f6" class="pb-5" fontSize="14px" v-if="bottomEnd">我也是有底线的</u-divider> -->

12
src/pagesProject/project/components/TimeLine/component/TimeBoxIn.vue

@ -41,8 +41,8 @@
<view class="p-0 u-col-between">
<NotEvaluated :task="item" v-if="item.data.mentalTest.finishStatus === 0" />
<view v-else>
<EvaluatedNLCP :task="item" :taskIndex="taskIndex" :itemIndex="itemIndex" v-if="item.data.type === 0" />
<EvaluatedXLJH :task="item" :taskIndex="taskIndex" :itemIndex="itemIndex" v-if="item.data.type === 1" />
<EvaluatedNLCP :task="item" :taskId="taskId" :itemIndex="itemIndex" v-if="item.data.type === 0" />
<EvaluatedXLJH :task="item" :taskId="taskId" :itemIndex="itemIndex" v-if="item.data.type === 1" />
</view>
</view>
</view>
@ -73,9 +73,9 @@ export default {
type: Object,
default: null,
},
taskIndex: {
type: Number,
default: 0,
taskId: {
type: String,
default: '',
},
},
@ -91,7 +91,7 @@ export default {
methods: {
...mapActions('task', ['getGlobal']),
...mapMutations('task', ['setTipsContent']),
...mapMutations('task', ['setTipsContent', 'setShowDetail']),
//
setHeight(panel) {

139
src/pagesUser/git-phone-power/git-phone-power.vue

@ -1,58 +1,139 @@
<template>
<view>
<u-button
:custom-style="customStyle"
shape="square"
size="default"
type="primary"
open-type="getPhoneNumber"
@getphonenumber="getphonenumber"
>
授权手机号
</u-button>
<view class="flex flex-col items-center">
<img class="my-28 w-24 h-24" src="https://www.tall.wiki/staticrec/yanyuan/logo.png" />
<view class="flex flex-col w-full px-4">
<u-button shape="square" type="primary" class="w-full mb-3" @click="openAuth" v-if="!showBindPnone"> 微信授权登录 </u-button>
<u-button shape="square" type="primary" class="w-full mb-3" open-type="getPhoneNumber" @getphonenumber="getphonenumber" v-else>
绑定手机号
</u-button>
<u-button class="w-full" shape="square" @click="back"> 取消 </u-button>
</view>
<!-- 合并账号 -->
<u-top-tips ref="uTips"></u-top-tips>
<u-modal
v-model="bindingPhone"
content="该手机号已经注册过账号,是否将账号合并?"
class="p-4 ml-7 mr-7"
:show-cancel-button="true"
@confirm="yesMerge()"
@cancel="noMerge()"
></u-modal>
<u-modal v-model="mergePop" class="p-4 ml-7 mr-7" :show-cancel-button="true" @confirm="isMerge(0)" @cancel="isMerge(1)">
<view class="slot-content">
<view class="p-4">
<p>1您可以选择合并账号完成手机号的绑定系统会为您自动合并两个账号的数据信息</p>
<br />
<p>2如果选择不合并已注册手机号的已有数据可能会被清空</p>
<br />
<p class="text-red-500">注意合并账号可能会带来不确定的数据丢失</p>
</view>
</view>
</u-modal>
</view>
</template>
<script>
import UserAuthMixin from '@/mixins/userAuth';
import { mapMutations } from 'vuex';
export default {
mixins: [UserAuthMixin],
data() {
return {
customStyle: {
margin: '188rpx 88rpx',
width: '574rpx',
},
show: false,
//
bindingPhone: false,
//
mergePop: false,
showBindPnone: false,
};
},
mounted() {
if (this.user && this.user.wxInfo && this.user.wxInfo.nickname) {
this.showBindPnone = true;
}
},
methods: {
...mapMutations('user', ['setToken', 'setUser']),
// ,
// ,
// ,,id,,
// id,,
async getphonenumber(e) {
if (this.user && this.user.phone) return;
console.log('e: ', e, e.detail.errMsg);
// if (e.detail.errMsg === 'getPhoneNumber:fail user deny') {
// this.$u.route('/pagesUser/phone-bind/phone-bind');
// } else {
//
if (e.detail.errMsg === 'getPhoneNumber:ok') {
const params = {
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
miniType: 'basicCar',
};
const data = await this.$u.api.bindPhone(params);
if (data && data.id) {
// const newUser = { ...this.user, phone: data.phone };
// this.setUser(newUser);
// setTimeout(() => uni.navigateBack({ delta: 2 }), 50);
this.$u.route('pages/questionnaire-webview/questionnaire-webview', { u: this.userId });
} else {
this.phone = data.phone;
this.show = true;
try {
const params = {
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
miniType: 'basicCar',
};
const data = await this.$u.api.bindPhone(params);
if (data && data.id) {
this.setUser(data);
this.setToken(data.token);
// const newUser = { ...this.user, phone: data.phone };
// this.setUser(newUser);
// setTimeout(() => uni.navigateBack({ delta: 2 }), 50);
// this.$u.route('pages/questionnaire-webview/questionnaire-webview', { u: this.userId });
} else {
this.phone = data.phone;
}
} catch (error) {
console.log('error: ', error);
if (error.code === 75) {
this.bindingPhone = true;
}
}
} else {
this.$u.route('/pagesUser/phone-bind/phone-bind');
}
},
//
noMerge() {
this.bindingPhone = false;
},
//
yesMerge() {
this.mergePop = true;
},
//
async isMerge(merge) {
try {
const data = await this.$u.api.phoneMerge(this.model.phone, merge);
this.setUser(data);
this.setToken(data.token);
this.$refs.uTips.show({
title: '手机号合并成功, 即将跳转上一页',
type: 'success',
duration: '3000',
});
setTimeout(() => uni.redirectTo({ url: '/pages/index/index' }), 2000);
} catch (error) {
this.$refs.uTips.show({
title: error.msg || '手机号合并失败',
type: 'error',
duration: '3000',
});
}
this.mergePop = false;
},
//
back() {
uni.redirectTo({ url: '/pages/index/index' });
},
},
};
</script>

9
src/pagesUser/phone-bind/phone-bind.vue

@ -1,5 +1,5 @@
<template>
<view class="wrap" @click="openAuth">
<view class="wrap">
<u-form :model="model" :rules="rules" ref="uForm" :errorType="errorType">
<!-- 手机号 -->
<u-form-item :rightIconStyle="{ color: '#888', fontSize: '32rpx' }" label="手机号码" prop="phone" label-width="160">
@ -47,11 +47,9 @@
</template>
<script>
import UserAuthMixin from '@/mixins/userAuth';
import { mapMutations } from 'vuex';
export default {
mixins: [UserAuthMixin],
data() {
return {
model: {
@ -113,7 +111,8 @@ export default {
try {
const { phone, code } = this.model;
const data = await this.$u.api.phoneBind(phone, code);
console.log('data: ', data);
this.setUser(data);
this.setToken(data.token);
this.$refs.uTips.show({
title: '手机号绑定成功, 即将跳转上一页',
type: 'success',
@ -132,7 +131,7 @@ export default {
if (error.code === 75) {
this.bindingPhone = true;
}
console.log(error.code);
console.error(error);
}
} else {
console.log('验证失败');

Loading…
Cancel
Save