| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <template>
- <view v-if="detaile">
- <!-- <view class="info ddflex">
- <image :src="detaile.headUrl" mode="aspectFill"></image>
- <view class="fflex">
- <view class="tit">{{detaile.realName}}</view>
- <view class="rec-tag ddflex" v-if="detaile.userExtend && detaile.userExtend.label">
- <text class="ddflex" v-for="(it,idx) in detaile.userExtend.label.split(',')" :key="idx">{{it}}</text>
- </view>
- <view class="tea-bri" v-if="detaile.userExtend && detaile.userExtend.projects">{{detaile.userExtend.projects}}</view>
- </view>
- </view>
- <view class="content">
- <view class="viewMore">
- <mp-html :content="detaile.userExtend.brief" :lazy-load="true" @imgtap="choose"></mp-html>
- </view>
- </view> -->
- <image :src="detaile.headUrl" mode="aspectFill" class="zj-bg"></image>
- <view class="content-box">
- <view class="zj-name ddflex">
- <text class="fflex">{{detaile.realName}}</text>
- <image @click="showPop" class="qr" src="../static/images/qrcode.png" v-if="detaile.wechatQrcode"></image>
- </view>
- <view class="zj-label">{{detaile.userExtend.label}}</view>
- <view class="title" v-if="detaile.userExtend.brief">专家简介</view>
- <view class="zj-brief" v-if="detaile.userExtend.brief">
- <mp-html :content="detaile.userExtend.brief" :lazy-load="true" @imgtap="choose"></mp-html>
- </view>
- <view class="title" v-if="detaile.userExtend.projects">擅长项目</view>
- <view class="zj-brief" v-if="detaile.userExtend.projects">
- <mp-html :content="detaile.userExtend.projects" :lazy-load="true" @imgtap="choose"></mp-html>
- </view>
- </view>
- <view class="ceng" v-if="isShowPop" @click="hidePop"></view>
- <view class="popup" :style="'bottom:' + sBottom +';'">
- <image src="../static/images/cancel.png" class="cancel" @click="hidePop()"></image>
- <image :src="detaile.wechatQrcode" class="code" show-menu-by-longpress="true"></image>
- <view class="tip">请{{detaile.wechatNumber ? '复制微信号或' : ''}}长按识别或保存二维码去微信添加</view>
- <view class="pop-btn dflex">
- <view @click="copy(detaile.wechatNumber)" v-if="detaile.wechatNumber">复制微信号</view>
- <view @click="saveImg()">保存二维码</view>
- </view>
- <!-- <image src="../../static/images/close.png" class="close" @click="hidePop"></image> -->
- </view>
- <!-- #ifdef H5 -->
- <wx-share ref="wxshare" />
- <!-- #endif -->
- </view>
- </template>
- <script>
- const app = getApp();
- const req = require('../../utils/request.js');
- const api = require('../../utils/api.js');
- const util = require('../../utils/util.js');
- import mpHtml from "../../components/mp-html/components/mp-html/mp-html";
- export default {
- components: {
- mpHtml,
- },
- data() {
- return {
- detaile: '',
- viewMore: false,
- config: {},
- isShowPop: false,
- sBottom: '-100%'
- };
- },
- onLoad: async function(options) {
- if(options.appId) req.setStorage('appId',options.appId);
- uni.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- });
- this.id = options.id;
- await this.getDetail();
- // await this.monitor();
- },
- onShow(){
- this.config = JSON.parse(req.getStorage('configRes'))
- // this.getBrowse();
- },
- onShareAppMessage: function() {
- return this.onShareMessage();
- },
- onShareTimeline() {
- return {
- title: this.detail.realName,
- image: this.detaile.headUrl,
- query: '/topic/teacherDet/teacherDet?id=' + this.detaile.id
- };
- },
-
- onReady() {
- // #ifdef H5
- var that = this;
- //初始化分享内容
- setTimeout(function() {
- var shareContent = that.onShareMessage();
- if (shareContent) {
- shareContent.path = window.location.origin + shareContent.path;
- }
- console.log('分享内容》》》》》', shareContent);
- that.$refs.wxshare.init(shareContent);
- }, 4 * 1000);
- // #endif
- },
- methods: {
- onShareMessage(){
- let path = '';
- let isSolution = '';
- // #ifndef H5
- isSolution = req.env[req.env.NODE_ENV].isSolution;
- // #endif
- // #ifdef H5
- isSolution = false;
- // #endif
- let userInfo = req.getStorage('userInfo');
- if(isSolution){
- path = '/share/home/index?appId='+req.getStorage('appId')+'&userId='+userInfo.id;
- }else{
- path = '/topic/teacherDet/teacherDet?id=' + this.detaile.id + '&appId=' + req.getStorage('appId');
- }
- return {
- title: this.detaile.realName,
- imageUrl:this.detaile.headUrl,
- path: path
- };
- },
-
- showPop(){
- this.isShowPop = true;
- this.sBottom = 0;
- },
- hidePop(){
- this.isShowPop = false;
- this.sBottom = '-100%';
- },
- copy(content){
- uni.setClipboardData({
- //准备复制的数据
- data: content,
- success: function (res) {
- req.msg('复制成功')
- }
- })
- },
- saveImg() {
- let that = this;
- let codeUrl = this.detaile.wechatQrcode;
- uni.saveImageToPhotosAlbum({
- filePath: codeUrl,
- success(res) {
- uni.showToast({
- title: '图片保存成功',
- icon: 'none',
- success() {
- },
- fail() {
- uni.showToast({
- title: '图片保存失败'
- });
- }
- })
- }
- })
- },
- choose: function () {
- let freshen = false;
- this.$emit('freshen', {
- detail: freshen
- });
- },
- getDateTimeStamp(dateStr){
- return util.getDateDiff(Date.parse(dateStr.replace(/-/gi,"/")));
- },
- splitLabel(label){
- if(!label){
- return false;
- }else{
- if (label.indexOf(",") > 0){
- return label.split(',');
- }else{
- return label.split(',');
- }
- }
- },
- getDetail() {
- let that = this;
- let apiUrl = '/api/v3/sysUser/info';
- return new Promise((resolve,reject)=>{
- req.getRequest(apiUrl,{ id: that.id },async res => {
- that.detaile = res;
- resolve();
- },true);
- })
- },
- getBrowse(){
- let params={
- bindId: this.id,
- type: 2
- }
- req.postRequest('/api/browse', params, data => {});
- },
- }
- };
- </script>
- <style>
- @import "./teacherDet.css";
- </style>
|