index.vue 17 KB

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