index.vue 17 KB

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