index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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="/static/images/right_arrow.png"></image>
  20. </view>
  21. </view>
  22. <view class="company" v-if="user!=null">
  23. <image src="/static/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="/static/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="/static/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="/static/manergevip/qudao.png"></image>
  40. <view class="m-name">审核销售</view>
  41. </view>
  42. <view class="menu-item" @click="handleShare">
  43. <image src="/static/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="/static/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="/static/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="/static/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="/static/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="@/static/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="@/static/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="@/static/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='@/static/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='@/static/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="@/static/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. this.utils.logout();
  345. // 条件编译判断平台,设置不同登录页路径
  346. let loginPage = '';
  347. // #ifdef H5
  348. loginPage = '/pages/auth/login';
  349. // #endif
  350. // #ifdef MP-WEIXIN
  351. loginPage = '/pages/auth/wxlogin';
  352. // #endif
  353. uni.reLaunch({
  354. url: loginPage,
  355. animationType: 'pop-in',
  356. animationDuration: 100
  357. })
  358. },
  359. navTo(url){
  360. uni.navigateTo({
  361. url
  362. })
  363. },
  364. getCompanyUsers(){
  365. var data = {
  366. };
  367. getCompanyUser(data).then(res => {
  368. if(res.code==200){
  369. console.log(res)
  370. this.user=res.user;
  371. if(this.user.avatar){
  372. this.user.avatar=uni.getStorageSync('requestPath')+res.user.avatar
  373. }else{
  374. this.user.avatar=='';
  375. }
  376. }else{
  377. }
  378. });
  379. },
  380. }
  381. }
  382. </script>
  383. <style lang="scss">
  384. page{
  385. height: 100%;
  386. background: #f6f6f6;
  387. }
  388. </style>
  389. <style scoped lang="scss">
  390. .container {
  391. font-family: PingFang SC, PingFang SC;
  392. font-weight: 400;
  393. font-size: 14px;
  394. color: #222222;
  395. height: 100%;
  396. overflow: hidden;
  397. }
  398. .imgshe{
  399. display: flex;
  400. flex-direction: row-reverse
  401. }
  402. .point-box{
  403. height: 100%;
  404. width: 100%;
  405. .xu-box{
  406. border: #f5f5f5 4rpx dashed;
  407. padding: 20rpx 20rpx;
  408. }
  409. }
  410. .setTimebox {
  411. font-family: PingFang SC, PingFang SC;
  412. font-weight: 400;
  413. font-size: 14px;
  414. width: fit-content;
  415. height: fit-content;
  416. }
  417. .codeimg {
  418. position: absolute;
  419. z-index: 9999;
  420. left: 40rpx;
  421. top: 40rpx;
  422. }
  423. .timetip {
  424. font-family: PingFang SC, PingFang SC;
  425. font-weight: 400;
  426. font-size: 14px;
  427. color: #2979ff;
  428. text-align: center;
  429. margin-bottom: 5px;
  430. }
  431. .content{
  432. position: relative;
  433. height: 100%;
  434. width: 100%;
  435. .bg{
  436. width: 100%;
  437. height: 360upx;
  438. position: absolute;
  439. top: 0;
  440. left: 0;
  441. z-index: 1;
  442. background: linear-gradient(to bottom, #dae9ff, #e1e1fd);
  443. // background: linear-gradient(to bottom, #8bbfff, #1773ff);
  444. border-radius: 0rpx 0rpx 60rpx 60rpx;
  445. }
  446. .cont-box{
  447. position: relative;
  448. z-index: 2;
  449. padding: 30rpx 30rpx 200rpx;
  450. .user-cont{
  451. // box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  452. padding: 30rpx;
  453. // background-color: #fff;
  454. border-radius: 15rpx;
  455. .user-box{
  456. width: 100%;
  457. display: flex;
  458. align-items: center;
  459. justify-content: flex-start;
  460. .left{
  461. flex:1;
  462. display: flex;
  463. align-items: center;
  464. justify-content: flex-start;
  465. image{
  466. border-radius: 50%;
  467. width:120rpx;
  468. height:120rpx;
  469. }
  470. .user{
  471. margin-left: 20rpx;
  472. width: calc(100% - 140rpx);
  473. display: flex;
  474. flex-direction: column;
  475. align-items: flex-start;
  476. justify-content: flex-start;
  477. .username{
  478. font-size: 38rpx;
  479. font-family: PingFang SC;
  480. color: #111;
  481. font-weight: bold;
  482. }
  483. .account{
  484. padding: 5rpx 0rpx;
  485. border-radius: 30rpx;
  486. margin-top: 20rpx;
  487. font-size: 24rpx;
  488. font-family: PingFang SC;
  489. color: #515151;
  490. }
  491. }
  492. }
  493. .right{
  494. image{
  495. width: 15rpx;
  496. height:30rpx;
  497. }
  498. }
  499. }
  500. .company{
  501. margin-top: 30rpx;
  502. display: flex;
  503. align-items: center;
  504. justify-content: flex-start;
  505. image{
  506. width:40rpx;
  507. height:40rpx;
  508. }
  509. .name{
  510. margin-left: 15rpx;
  511. font-size: 28rpx;
  512. color: #111;
  513. }
  514. }
  515. }
  516. .menu-box{
  517. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  518. width: 100%;
  519. margin-top: 30rpx;
  520. padding: 30rpx;
  521. background-color: #fff;
  522. border-radius: 15rpx;
  523. .title-box{
  524. display: flex;
  525. align-items: center;
  526. justify-content: flex-start;
  527. .icon{
  528. width: 40rpx;
  529. height:40rpx;
  530. }
  531. .title{
  532. margin-left: 10rpx;
  533. font-size: 28rpx;
  534. font-family: PingFang SC;
  535. color: #111;
  536. }
  537. }
  538. .line{
  539. margin-top: 15rpx;
  540. height: 0.5rpx;
  541. width: 100%;
  542. background-color: #efefef;
  543. }
  544. .menus{
  545. margin-top: 30rpx;
  546. display: flex;
  547. align-items: center;
  548. justify-content: flex-start;
  549. flex-wrap: wrap;
  550. }
  551. .menu-item{
  552. display: flex;
  553. flex-direction: column;
  554. align-items: center;
  555. justify-content: center;
  556. width: 25%;
  557. margin-bottom: 20rpx;
  558. image{
  559. width:60rpx;
  560. height:60rpx;
  561. }
  562. .m-name{
  563. margin-top: 10rpx;
  564. font-size: 24rpx;
  565. font-family: PingFang SC;
  566. color: #111;
  567. }
  568. }
  569. }
  570. .menu-box1{
  571. width: 100%;
  572. margin-top: 30rpx;
  573. padding: 0rpx 30rpx;
  574. background-color: #fff;
  575. border-radius: 15rpx;
  576. .menu-item{
  577. width: 100%;
  578. display: flex;
  579. align-items: center;
  580. justify-content: flex-start;
  581. line-height: 100rpx;
  582. .left{
  583. flex:1;
  584. display: flex;
  585. align-items: center;
  586. justify-content: flex-start;
  587. image{
  588. width: 30rpx;
  589. height:30rpx;
  590. }
  591. .label{
  592. margin-left: 10rpx;
  593. }
  594. }
  595. .right{
  596. image{
  597. width: 10rpx;
  598. height:15rpx;
  599. }
  600. }
  601. }
  602. }
  603. }
  604. }
  605. .btn-box{
  606. margin: 30rpx 0rpx 30rpx;
  607. display: flex;
  608. align-items: center;
  609. justify-content: center;
  610. .sub-btn{
  611. // box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  612. border: 1rpx solid #f8f8f8;
  613. background: #FFFFFF;
  614. width: 100%;
  615. height: 88upx;
  616. line-height: 88upx;
  617. text-align: center;
  618. font-size: 30upx;
  619. font-family: PingFang SC;
  620. color: #2979ff;
  621. }
  622. }
  623. .sharePop {
  624. background-color: #fff;
  625. padding: 20px 0;
  626. border-radius: 20px 20px 0 0;
  627. &-item {
  628. padding: 0 10px;
  629. box-sizing: border-box;
  630. font-family: PingFang SC, PingFang SC;
  631. font-weight: 400;
  632. font-size: 14px;
  633. display: inline-flex !important;
  634. image {
  635. height: 48px;
  636. width: 48px;
  637. margin-bottom: 10px;
  638. }
  639. }
  640. }
  641. </style>