index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <view class="content container">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <view class="h110"></view>
  5. <!-- #endif -->
  6. <view class="bg"></view>
  7. <view class="cont-box">
  8. <view class="user-cont" @click="navTo('/pages/user/userInfo')">
  9. <view class="user-box" v-if="user!=null">
  10. <view class="left">
  11. <u-avatar :src="user.avatar" size="50"></u-avatar>
  12. <!-- <image class="img" :src="user.avatar" mode="aspectFill"></image> -->
  13. <view class="user" >
  14. <view class="username">{{user.nickName}}</view>
  15. <view class="account">{{user.email}}</view>
  16. </view>
  17. </view>
  18. <view class="right" >
  19. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/right_arrow.png"></image>
  20. </view>
  21. </view>
  22. <view class="company" v-if="user!=null">
  23. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/icon_comp.png"></image>
  24. <view class="name">{{user.createBy||'暂无数据'}}</view>
  25. </view>
  26. </view>
  27. <view class="menu-box" style="margin-top: -20rpx;">
  28. <view class="title-box">
  29. <image class="icon" src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/manergevip/chang.png"></image>
  30. <view class="title">常用功能</view>
  31. </view>
  32. <view class="line"></view>
  33. <view class="menus">
  34. <view class="menu-item" @click="navTo('/pages/courseManage/manage/manageIndex')">
  35. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/menu_info.png"></image>
  36. <view class="m-name">销售管理</view>
  37. </view>
  38. <view class="menu-item" @click="navTo('/pages/user/users/users')">
  39. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/manergevip/qudao.png"></image>
  40. <view class="m-name">审核销售</view>
  41. </view>
  42. <view class="menu-item" @click="handleShare">
  43. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/manergevip/share-manage.png"></image>
  44. <view class="m-name">邀请销售</view>
  45. </view>
  46. <view class="menu-item" @click="navTo('/pages/courseManage/manage/lableSetup')">
  47. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/changeLable.png"></image>
  48. <view class="m-name">标签设置</view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="menu-box">
  53. <view class="title-box">
  54. <image class="icon" src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/manergevip/qita.png"></image>
  55. <view class="title">其它工具</view>
  56. </view>
  57. <view class="line"></view>
  58. <view class="menus">
  59. <view class="menu-item" @click="navTo('/pages/user/about')">
  60. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/manergevip/about.png"></image>
  61. <view class="m-name">关于我们</view>
  62. </view>
  63. <view class="menu-item" @click="navTo('/pages/user/editUser')">
  64. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/manergevip/setup.png"></image>
  65. <view class="m-name">设置</view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="btn-box" >
  70. <view class="sub-btn" @click="showLogout()">退出登录</view>
  71. </view>
  72. </view>
  73. <!-- 分享弹窗 -->
  74. <u-popup :show="showShare" :closeOnClickOverlay="true" :round='20' @close="closeShare" @open="openShare">
  75. <view class="sharePop x-ac">
  76. <!--#ifdef MP-WEIXIN-->
  77. <view class="sharePop-item y-f" @click="shareimg">
  78. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/card_icon.png" mode="aspectFill"
  79. style="width: 80rpx; height: 80rpx;margin-top: 20rpx;"></image>
  80. <view style="font-weight: bold;margin-bottom: 4px;">生成卡片</view>
  81. <view style="font-size: 12px;color: #888;">指导分享轻松转发</view>
  82. <button open-type="share" class="share">分享课程</button>
  83. </view>
  84. <!--#endif-->
  85. <!-- <view class="sharePop-item y-f" @click="buildimg">
  86. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/poster_icon.png" mode="aspectFill"></image>
  87. <view style="font-weight: bold;margin-bottom: 4px;">生成海报</view>
  88. <view style="font-size: 12px;color: #888;">保存海报美观宣传</view>
  89. </view> -->
  90. <!--#ifdef H5-->
  91. <view class="sharePop-item y-f" @click="shareSale">
  92. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/link_icon.png" mode="aspectFill"></image>
  93. <view style="font-weight: bold;margin-bottom: 4px;">复制链接</view>
  94. <view style="font-size: 12px;color: #888;">生成链接一键复制</view>
  95. </view>
  96. <!--#endif-->
  97. </view>
  98. </u-popup>
  99. <!-- 长按保存海报 -->
  100. <u-popup :show="setImg" @close="closeimg" :round="12">
  101. <view class="w100 h500">
  102. <image :src="codeLink.url" class="codeimg w660" mode="widthFix"></image>
  103. </view>
  104. <view class="justify-around mtb40">
  105. <view class="column justify-center align-center" @click="downimg">
  106. <image src='https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/image/downicon.png' class="w80 h80"></image>
  107. <view class="mt10">长按图片保存</view>
  108. </view>
  109. </view>
  110. </u-popup>
  111. <!-- 设置链接有效时长弹窗 -->
  112. <!-- <u-modal :show="setTimeShow" content='content' class="model" @confirm="confirmTime">
  113. <view class="setTimebox">
  114. <view class="timetip">不传默认以系统参数为准</view>
  115. <view class="x-f">
  116. <text style="margin-right: 20px;">链接有效时长(分钟)</text>
  117. <u-input fontSize="14px" placeholder="链接有效时长" border="none" v-model="time" maxlength="5"></u-input>
  118. </view>
  119. </view>
  120. </u-modal> -->
  121. <!-- 卡片分享引导 -->
  122. <u-overlay :show="showzhidao" @click="showzhidao = false" style="z-index: 9999;">
  123. <view class="point-box">
  124. <view class="imgshe" >
  125. <image src='https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/image/point.png' class="w300 h300"></image>
  126. </view>
  127. <view class="column colorf fs32 xu-box fs40
  128. align-center justify-center">
  129. <view class="justify-center">点击右上角
  130. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/image/wxmore.png"
  131. class="w50 h50 mlr10"></image>
  132. </view>
  133. <view class="mt20">选择 “转发给朋友”</view>
  134. <view style="color: #cbcbcb;" class="fs28 mt40">点击任意位置关闭弹窗</view>
  135. </view>
  136. </view>
  137. </u-overlay>
  138. <u-modal :show="show" title="提示" :showCancelButton="true" @cancel="hideLogout()" @confirm="logout()" content='确认退出吗?'></u-modal>
  139. </view>
  140. </template>
  141. <script>
  142. import { getCompanyUser } from '@/api/user.js'
  143. import {
  144. sharecourselink,
  145. buildCode,
  146. getSDK,
  147. becomeVipuser,
  148. becomeVipuserImg
  149. } from '@/api/courseManage'
  150. import wx from 'weixin-js-sdk'
  151. export default {
  152. data() {
  153. return {
  154. show:false,
  155. user:null,
  156. showShare:false,
  157. copyLinks:'',
  158. setTimeShow:false,
  159. time:'',
  160. setImg:false,
  161. codeLink:'',
  162. showzhidao:false,
  163. imgs:this.$store.state.imgpath+'/app/image/logo.png'
  164. }
  165. },
  166. onShow() {
  167. this.getCompanyUsers()
  168. },
  169. onShareAppMessage() {
  170. return {
  171. title: this.$store.state.logoname+'小程序的'+this.user.nickName+'邀请您成为销售', // 分享卡片标题
  172. path: '/pages/courseManage/course/becomeSale?id='+this.user.companyId, // 目标页面路径
  173. // 携带参数:将当前页面的数据拼接到路径中
  174. imageUrl: this.user.avatar || this.imgs, // 分享卡片封面图(可选)
  175. success: (res) => {
  176. console.log("分享成功", res);
  177. },
  178. fail: (err) => {
  179. console.log("分享失败", err);
  180. },
  181. }
  182. },
  183. mounted() {
  184. },
  185. methods: {
  186. shareSale(){
  187. const fullUrl = location.href;
  188. const Path = fullUrl.split('/#')[0] || '';
  189. setTimeout(() => {
  190. uni.setClipboardData({
  191. data: Path+'/#/pages/courseManage/course/becomeSale?id='+this.user.companyId,
  192. success: () => {
  193. uni.showToast({
  194. title: '邀请链接已复制',
  195. icon: 'none',
  196. duration: 2000
  197. });
  198. // this.setTimeShow = !this.setTimeShow
  199. this.showShare = false
  200. // console.log(res)
  201. },
  202. fail: () => {
  203. uni.showToast({
  204. title: '复制失败',
  205. icon: 'none'
  206. });
  207. }
  208. });
  209. }, 100)
  210. },
  211. // 获取jssdk
  212. getjssdklist() {
  213. const param = {
  214. url: window.location.href.split('#')[0] // 注意去除 hash
  215. }
  216. getSDK(param).then(res => {
  217. wx.config({
  218. debug: false,
  219. appId: res.data.appId, // 必填,公众号的唯一标识
  220. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  221. nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
  222. signature: res.data.signature, // 必填,签名
  223. jsApiList: ["updateAppMessageShareData", "onMenuShareAppMessage", ] // 必填,需要使用的JS接口列表
  224. });
  225. })
  226. },
  227. shareimg(){
  228. //分享好友
  229. let self = this
  230. // 配置--配置全局
  231. wx.ready(function() { //需在用户可能点击分享按钮前就先调用
  232. wx.updateAppMessageShareData({
  233. title: self.user.userName+"邀请您成为群管", // 分享标题
  234. desc: self.user.deptName, // 分享描述
  235. link:self.copyLinks,
  236. imgUrl: self.codeLink.url ||self.imgs, // 分享图标
  237. success: function(res) {
  238. self.showzhidao=true
  239. self.setImg=false
  240. self.showShare=false
  241. // 设置成功
  242. uni.showToast({
  243. title: '卡片已生成',
  244. icon: 'none',
  245. duration: 1000
  246. });
  247. },
  248. fail: function(err) {
  249. // console.log(err);
  250. uni.showToast({
  251. title: '卡片生成失败,请重试',
  252. icon: 'none',
  253. duration: 2000
  254. })
  255. }
  256. })
  257. });
  258. },
  259. handleShare() {
  260. this.showShare = true
  261. // this.getjssdklist()
  262. // this.getlink('preload'); // 提前加载链接
  263. },
  264. //设置链接时长
  265. confirmTime() {
  266. this.setTimeShow = false
  267. this.showShare = false
  268. this.getlink('preload')
  269. this.copyLink()
  270. },
  271. closeimg(){
  272. this.setImg=false
  273. this.showShare=false
  274. },
  275. buildimg() {
  276. //生成海报
  277. this.setImg=!this.setImg
  278. this.getshareimg()
  279. },
  280. getshareimg(){
  281. //生成海报
  282. uni.showLoading({
  283. title: '正在生成中...'
  284. })
  285. const param={
  286. code:'',
  287. companyId:this.user.companyId,
  288. companyUserId:this.user.userId
  289. }
  290. becomeVipuserImg(param).then(res=>{
  291. if(res.code==200){
  292. this.codeLink=res.data
  293. this.getlink()
  294. // console.log(res)
  295. }else{
  296. uni.showToast({
  297. title: res.msg,
  298. icon: 'none',
  299. duration: 2000
  300. });
  301. }
  302. })
  303. },
  304. getlink(type){
  305. //生成链接
  306. const param={
  307. companyId:this.user.companyId,
  308. companyUserId:this.user.userId,
  309. tagids:'',
  310. limitTime:this.time
  311. }
  312. becomeVipuser(param).then(res=>{
  313. if(res.code==200){
  314. this.copyLinks=res.data
  315. if (this.copyLinks.startsWith('http://')) {
  316. this.copyLinks = this.copyLinks.replace('http://', 'https://');
  317. }
  318. // console.log(this.copyLinks,'分享链接')
  319. }else{
  320. }
  321. })
  322. },
  323. copyLink(){
  324. console.log(this.showShare)
  325. setTimeout(() => {
  326. uni.setClipboardData({
  327. data: this.copyLinks,
  328. success: () => {
  329. uni.showToast({
  330. title: '链接已复制',
  331. icon: 'none',
  332. duration: 2000
  333. });
  334. // this.setTimeShow = !this.setTimeShow
  335. this.showShare = false
  336. },
  337. fail: () => {
  338. uni.showToast({
  339. title: '复制失败',
  340. icon: 'none'
  341. });
  342. }
  343. });
  344. }, 100)
  345. },
  346. closeShare() {
  347. this.showShare = false
  348. },
  349. openShare() {
  350. // this.showShare = false
  351. },
  352. showLogout(){
  353. this.show=true;
  354. },
  355. hideLogout(){
  356. this.show=false;
  357. },
  358. logout(){
  359. uni.removeStorageSync('AppToken')
  360. // 条件编译判断平台,设置不同登录页路径
  361. let loginPage = '';
  362. // #ifdef H5
  363. loginPage = '/pages/auth/login';
  364. // #endif
  365. // #ifdef MP-WEIXIN
  366. loginPage = '/pages/auth/login';
  367. // #endif
  368. uni.navigateTo({
  369. url: loginPage,
  370. })
  371. },
  372. navTo(url){
  373. uni.navigateTo({
  374. url
  375. })
  376. },
  377. getCompanyUsers(){
  378. var data = {
  379. };
  380. getCompanyUser(data).then(res => {
  381. if(res.code==200){
  382. console.log(res)
  383. this.user=res.user;
  384. if(this.user.avatar){
  385. this.user.avatar=uni.getStorageSync('requestPath')+res.user.avatar
  386. }else{
  387. this.user.avatar=='';
  388. }
  389. }else{
  390. }
  391. });
  392. },
  393. }
  394. }
  395. </script>
  396. <style lang="scss">
  397. page{
  398. height: 100%;
  399. background: #f6f6f6;
  400. }
  401. </style>
  402. <style scoped lang="scss">
  403. .share{
  404. display: inline-block;
  405. position: absolute;
  406. top: 0;
  407. left: 0;
  408. width: 100%;
  409. height: 100%;
  410. opacity: 0;
  411. }
  412. .container {
  413. font-family: PingFang SC, PingFang SC;
  414. font-weight: 400;
  415. font-size: 14px;
  416. color: #222222;
  417. height: 100%;
  418. overflow: hidden;
  419. }
  420. .imgshe{
  421. display: flex;
  422. flex-direction: row-reverse
  423. }
  424. .point-box{
  425. height: 100%;
  426. width: 100%;
  427. .xu-box{
  428. border: #f5f5f5 4rpx dashed;
  429. padding: 20rpx 20rpx;
  430. }
  431. }
  432. .setTimebox {
  433. font-family: PingFang SC, PingFang SC;
  434. font-weight: 400;
  435. font-size: 14px;
  436. width: fit-content;
  437. height: fit-content;
  438. }
  439. .codeimg {
  440. position: absolute;
  441. z-index: 9999;
  442. left: 40rpx;
  443. top: 40rpx;
  444. }
  445. .timetip {
  446. font-family: PingFang SC, PingFang SC;
  447. font-weight: 400;
  448. font-size: 14px;
  449. color: #2979ff;
  450. text-align: center;
  451. margin-bottom: 5px;
  452. }
  453. .content{
  454. position: relative;
  455. height: 100%;
  456. width: 100%;
  457. .bg{
  458. width: 100%;
  459. height: 360upx;
  460. position: absolute;
  461. top: 0;
  462. left: 0;
  463. z-index: 1;
  464. background: linear-gradient(to bottom, #dae9ff, #e1e1fd);
  465. // background: linear-gradient(to bottom, #8bbfff, #1773ff);
  466. border-radius: 0rpx 0rpx 60rpx 60rpx;
  467. }
  468. .cont-box{
  469. position: relative;
  470. z-index: 2;
  471. padding: 30rpx 30rpx 200rpx;
  472. .user-cont{
  473. // box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  474. padding: 30rpx;
  475. // background-color: #fff;
  476. border-radius: 15rpx;
  477. .user-box{
  478. width: 100%;
  479. display: flex;
  480. align-items: center;
  481. justify-content: flex-start;
  482. .left{
  483. flex:1;
  484. display: flex;
  485. align-items: center;
  486. justify-content: flex-start;
  487. image{
  488. border-radius: 50%;
  489. width:120rpx;
  490. height:120rpx;
  491. }
  492. .user{
  493. margin-left: 20rpx;
  494. width: calc(100% - 140rpx);
  495. display: flex;
  496. flex-direction: column;
  497. align-items: flex-start;
  498. justify-content: flex-start;
  499. .username{
  500. font-size: 38rpx;
  501. font-family: PingFang SC;
  502. color: #111;
  503. font-weight: bold;
  504. }
  505. .account{
  506. padding: 5rpx 0rpx;
  507. border-radius: 30rpx;
  508. margin-top: 20rpx;
  509. font-size: 24rpx;
  510. font-family: PingFang SC;
  511. color: #515151;
  512. }
  513. }
  514. }
  515. .right{
  516. image{
  517. width: 15rpx;
  518. height:30rpx;
  519. }
  520. }
  521. }
  522. .company{
  523. margin-top: 30rpx;
  524. display: flex;
  525. align-items: center;
  526. justify-content: flex-start;
  527. image{
  528. width:40rpx;
  529. height:40rpx;
  530. }
  531. .name{
  532. margin-left: 15rpx;
  533. font-size: 28rpx;
  534. color: #111;
  535. }
  536. }
  537. }
  538. .menu-box{
  539. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  540. width: 100%;
  541. margin-top: 30rpx;
  542. padding: 30rpx;
  543. background-color: #fff;
  544. border-radius: 15rpx;
  545. .title-box{
  546. display: flex;
  547. align-items: center;
  548. justify-content: flex-start;
  549. .icon{
  550. width: 40rpx;
  551. height:40rpx;
  552. }
  553. .title{
  554. margin-left: 10rpx;
  555. font-size: 28rpx;
  556. font-family: PingFang SC;
  557. color: #111;
  558. }
  559. }
  560. .line{
  561. margin-top: 15rpx;
  562. height: 0.5rpx;
  563. width: 100%;
  564. background-color: #efefef;
  565. }
  566. .menus{
  567. margin-top: 30rpx;
  568. display: flex;
  569. align-items: center;
  570. justify-content: flex-start;
  571. flex-wrap: wrap;
  572. }
  573. .menu-item{
  574. display: flex;
  575. flex-direction: column;
  576. align-items: center;
  577. justify-content: center;
  578. width: 25%;
  579. margin-bottom: 20rpx;
  580. image{
  581. width:60rpx;
  582. height:60rpx;
  583. }
  584. .m-name{
  585. margin-top: 10rpx;
  586. font-size: 24rpx;
  587. font-family: PingFang SC;
  588. color: #111;
  589. }
  590. }
  591. }
  592. .menu-box1{
  593. width: 100%;
  594. margin-top: 30rpx;
  595. padding: 0rpx 30rpx;
  596. background-color: #fff;
  597. border-radius: 15rpx;
  598. .menu-item{
  599. width: 100%;
  600. display: flex;
  601. align-items: center;
  602. justify-content: flex-start;
  603. line-height: 100rpx;
  604. .left{
  605. flex:1;
  606. display: flex;
  607. align-items: center;
  608. justify-content: flex-start;
  609. image{
  610. width: 30rpx;
  611. height:30rpx;
  612. }
  613. .label{
  614. margin-left: 10rpx;
  615. }
  616. }
  617. .right{
  618. image{
  619. width: 10rpx;
  620. height:15rpx;
  621. }
  622. }
  623. }
  624. }
  625. }
  626. }
  627. .btn-box{
  628. margin: 30rpx 0rpx 30rpx;
  629. display: flex;
  630. align-items: center;
  631. justify-content: center;
  632. .sub-btn{
  633. // box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  634. border: 1rpx solid #f8f8f8;
  635. background: #FFFFFF;
  636. width: 100%;
  637. height: 88upx;
  638. line-height: 88upx;
  639. text-align: center;
  640. font-size: 30upx;
  641. font-family: PingFang SC;
  642. color: #2979ff;
  643. }
  644. }
  645. .sharePop {
  646. background-color: #fff;
  647. padding: 20px 0;
  648. border-radius: 20px 20px 0 0;
  649. &-item {
  650. padding: 0 10px;
  651. box-sizing: border-box;
  652. font-family: PingFang SC, PingFang SC;
  653. font-weight: 400;
  654. font-size: 14px;
  655. display: inline-flex !important;
  656. image {
  657. height: 48px;
  658. width: 48px;
  659. margin-bottom: 10px;
  660. }
  661. }
  662. }
  663. </style>