Browse Source

fix: 完善分享功能

develop
song 4 years ago
parent
commit
dab9e65720
  1. 1
      CHANGELOG.md
  2. 1
      src/apis/role.js
  3. 4
      src/pagesProject/project/components/Evaluated/EvaluatedNLCP.vue
  4. 14
      src/pagesProject/project/components/Title/Title.vue
  5. 65
      src/pagesProject/project/project.vue
  6. 17
      src/pagesYanyuan/transfer-page/transfer-page.vue
  7. 8
      src/store/project/getters.js
  8. 2
      src/utils/tall.js

1
CHANGELOG.md

@ -199,6 +199,7 @@
- | 添加canvas | [9bc13c7](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/9bc13c7)
- | 添加分享功能 | [b882484](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/b882484)
- | 添加绑定WiFi | [c523022](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c523022)
- | 添加长者信息提示 | [c30cdc2](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c30cdc2)
- | 监听时间基本点 | [033fca0](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/033fca0)
- | 答题时记录做到第几题 | [547eb6e](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/547eb6e)
- | 绘制canvas | [3c9d471](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/3c9d471)

1
src/apis/role.js

@ -1,4 +1,5 @@
const install = (Vue, vm) => {
console.log('uni.$t.domain: ', uni.$t.domain);
vm.$u.api = { ...vm.$u.api } || {};
//根据项目id查找角色
vm.$u.api.findShowRole = param => vm.$u.post(`${uni.$t.domain}/role/show`, param);

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

@ -78,7 +78,9 @@ export default {
.exec();
this.cHeight = uni.upx2px(400);
this.getData();
setTimeout(() => {
this.getData();
}, 1000);
});
},

14
src/pagesProject/project/components/Title/Title.vue

@ -4,7 +4,7 @@
<!-- :is-back="false" -->
<u-navbar :custom-back="onBack" class="overflow-hidden">
<view class="flex justify-start flex-1 px-3 min-0 text-base">
<view class="truncate">{{ project.name }}</view>
<view class="truncate">{{ projectName }}</view>
</view>
</u-navbar>
<!-- #endif -->
@ -12,8 +12,8 @@
<!-- #ifdef H5 -->
<view class="overflow-hidden py-3">
<view class="flex justify-start flex-1 px-3 min-0 text-base">
<u-icon name="arrow-left" @click="onBack" class="mr-3" size="40" />
<view class="truncate">{{ project.name }}</view>
<u-icon name="arrow-left" @click="openIndex" class="mr-3" size="40" />
<view class="truncate">{{ projectName }}</view>
</view>
</view>
<!-- #endif -->
@ -21,7 +21,7 @@
</template>
<script>
import { mapGetters, mapState } from 'vuex';
import { mapGetters } from 'vuex';
export default {
name: 'ProjectTitle',
@ -47,8 +47,8 @@ export default {
},
computed: {
...mapState('project', ['project']),
...mapGetters('user', ['userId']),
...mapGetters('project', ['projectName']),
},
methods: {
@ -70,7 +70,8 @@ export default {
//
onBack() {
// eslint-disable-next-line no-undef
uni.navigateBack();
// uni.navigateBack();
uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
},
// LWBS
@ -83,7 +84,6 @@ export default {
},
//
openIndex() {
console.log(111);
uni.webView.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
},

65
src/pagesProject/project/project.vue

@ -79,12 +79,9 @@ export default {
},
onLoad(options) {
console.log('AAA: ', options);
this.templateCode = options.code;
if (options.share && options.share === '1') {
console.log('0001');
// TODO:
console.log('options.code: ', options.code);
this.queryGuide(options.code);
this.shareInit(options);
} else {
@ -97,19 +94,11 @@ export default {
}
}, 300);
} else {
console.log('0002');
this.shareWeixinInit(options);
// TODO:
// this.queryGuide(options.code);
// this.init(options);
this.queryGuide(options.code);
this.init(options);
}
}
//
// wx.showShareMenu({
// withShareTicket: true,
// menus: ['shareAppMessage', 'shareTimeline'],
// });
},
watch: {
@ -391,7 +380,6 @@ export default {
* @param {object | null} options
*/
async init(options) {
console.log('init options: ', options);
if (!this.token) {
// tokenuserIdtoken
// token userId
@ -403,7 +391,11 @@ export default {
}
//
options && options.pname && this.setProjectName(options.pname);
if (this.project && this.project.id) {
this.setProjectName(this.project.name);
} else {
options && options.pname && this.setProjectName(options.pname);
}
if (!options || !options.p) {
this.$t.ui.showToast('缺少项目信息参数'); // id
@ -442,23 +434,9 @@ export default {
//
async shareWeixinInit(options) {
console.log('小程序进来的初始化options: ', options);
await this.getProjectById({ projectId: options.p, num: 0, templateCode: options.code }); // id
await this.queryGuide(options.code);
await this.queryFamilyIsMember(options.p);
const obj = {
p: options.p,
u: this.userId,
pname: options.pname,
code: options.code,
};
this.init(obj);
// let timer = null;
// timer = setInterval(() => {
// if (!this.showGuide) {
// clearInterval(timer);
// }
// }, 300);
await this.queryFamilyIsMember(options.p, options);
},
/**
@ -481,13 +459,10 @@ export default {
*/
async getProjectById(params) {
try {
console.log('项目params: ', params);
console.log('项目 api', uni.$u.api.findProjectById);
const data = await uni.$u.api.findProjectById(params);
console.log('项目信息: ', data);
const data = await this.$u.api.findProjectById(params);
this.setProject(data);
} catch (error) {
console.error('通过项目id获取项目信息 error: ', error || '获取项目信息失败');
console.error('通过项目id获取项目信息error: ', error || '获取项目信息失败');
}
},
@ -565,7 +540,7 @@ export default {
await this.$u.api.updateGuide(params);
this.showGuide = false;
} catch (error) {
console.log('error: ', error);
console.error('error: ', error);
}
},
@ -573,26 +548,28 @@ export default {
* 查询用户是否是项目成员
* @param {string} projectId
*/
async queryFamilyIsMember(projectId) {
async queryFamilyIsMember(projectId, options) {
try {
const params = { projectId };
const data = await this.$u.api.familyIsMember(params);
console.log('data: ', data);
//
if (data.familyStatus === 2 && data.keyUserId) {
console.log('不是成员 询问是否成为家属');
if ((data.familyStatus === -1 || data.familyStatus === 2) && data.keyUserId) {
const arr = [{ keyUserId: data.keyUserId, sex: data.sex, userName: data.userName }];
this.setElderlyInfo(arr);
this.showElder = true;
}
if (data.familyStatus === 1) {
console.log('是 直接打开');
const obj = {
p: options.p,
u: this.userId,
pname: options.pname,
code: options.code,
};
this.init(obj);
}
if (data.familyStatus === 0) {
console.log('申请已提交,返回首页');
this.transferContent = '家属申请已提交,请等待审核';
//
this.$t.page.openPage('/pagesYanyuan/transfer-page/transfer-page?type=jiashu');
this.$t.page.openPage('/pagesYanyuan/transfer-page/transfer-page?type=isjiashu');
}
} catch (error) {
console.error('error: ', error);

17
src/pagesYanyuan/transfer-page/transfer-page.vue

@ -21,23 +21,30 @@ export default {
this.content = '工具箱已绑定';
}
if (options.type === 'jiashu') {
this.openApplyModal();
this.openApplyModal(1);
}
if (options.type === 'isjiashu') {
this.openApplyModal(0);
}
},
mounted() {
this.$nextTick(() => {
setTimeout(() => {
uni.redirectTo({ url: '/pages/index/index' });
uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
}, 5000);
});
},
methods: {
//
async openApplyModal() {
await this.applyFamily();
this.content = this.transferContent;
async openApplyModal(type) {
if (type === 1) {
await this.applyFamily();
this.content = this.transferContent;
} else {
this.content = '家属申请已提交,请等待审核';
}
this.timer = setInterval(() => {
this.time--;
if (this.time === 0) {

8
src/store/project/getters.js

@ -6,6 +6,14 @@ const getters = {
projectId({ project }) {
return project.id;
},
/**
* 当前项目的名字
* @param {object} project
*/
projectName({ project }) {
return project.name;
},
};
export default getters;

2
src/utils/tall.js

@ -23,7 +23,7 @@ const $t = {
timeConfig, // 时间相关配置
ui, // ui界面提示相关
chooseAndUpload: upload.chooseAndUpload, // 选择并上传单个文件相关的封装
domain: `${gateway}/defaultwbs`,
domain: `${gateway}/yanyuan/v2.0`,
cache, // 本地存储相关
$q: cacheAndRequest,
user, // 用户相关配置

Loading…
Cancel
Save