index.vue 17 KB

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