index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="pages_manage flex-1 hb column hidden">
  3. <dataIndex v-if="tabact==0"></dataIndex>
  4. <courseIndex v-if="tabact==1" @child-data-update='onChildDataUpdate' :parent-method="handleParentMethod"></courseIndex>
  5. <memberIndex v-if="tabact==2" @childEvent='chlidpages' style="height: 100%;"></memberIndex>
  6. <UrgeIndex v-if="tabact==3" style="height: 100%;"></UrgeIndex>
  7. <manageIndex v-if="tabact==4" @childsales='chlidSalsepages'></manageIndex>
  8. <view class="footbox" >
  9. <view @click="tabclick(item)" v-for="(item,index) in listtab" class="column align-center flex-1" :key="index">
  10. <image :src="tabact==item.value?item.tabsel:item.tab" class="w50 h50"></image>
  11. <view class="fs24" :class="tabact==item.value?'actcolor':'colortab'">{{item.name}}</view>
  12. </view>
  13. </view>
  14. <view style="flex:0">
  15. <u-popup :show="showShare" :closeOnClickOverlay="true" :round='20' @close="closeShare" >
  16. <view class="sharePop x-ac">
  17. <!--#ifdef MP-WEIXIN-->
  18. <view class="sharePop-item y-f card-share">
  19. <image :src="imgPath+'/app/images/card_icon.png'"
  20. mode="aspectFill" style="width: 80rpx; height: 80rpx;margin-top: 20rpx;"></image>
  21. <view style="font-weight: bold;margin-bottom: 4px;">生成卡片</view>
  22. <view style="font-size: 12px;color: #888;">指导分享轻松转发</view>
  23. <button open-type="share" class="share">分享课程</button>
  24. <view @click="copy" v-if="imgname!='乐氏本源'"
  25. class="base-color-6 u-border ptb10 plr30 radius50 mt20">复制页面地址</view>
  26. </view>
  27. <!--#endif-->
  28. </view>
  29. </u-popup>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import dataIndex from './components/dataIndex.vue'
  35. import courseIndex from './components/courseIndex.vue'
  36. import memberIndex from './components/memberIndex.vue'
  37. import UrgeIndex from './components/UrgeIndex.vue'
  38. import manageIndex from './components/manageIndex.vue'
  39. import {copyuniLink} from "@/api/manageCompany.js"
  40. import { mapGetters } from 'vuex';
  41. export default{
  42. components:{
  43. dataIndex,
  44. courseIndex,
  45. memberIndex,
  46. UrgeIndex,
  47. manageIndex
  48. },
  49. data(){
  50. return{
  51. showShare:false,
  52. tabact:0,
  53. childdata:[],
  54. vipPages:'',
  55. salsepages:'',
  56. // appid:this.$store.state.appid
  57. listtab:[
  58. {
  59. name:'数据',
  60. value:0,
  61. tab:require("@/static/manageTabIcon/data.png"),
  62. tabsel:require('@/static/manageTabIcon/data_on.png')
  63. },
  64. {
  65. name:'课程库',
  66. value:1,
  67. tab:require('@/static/manageTabIcon/liveclasses.png'),
  68. tabsel:require('@/static/manageTabIcon/liveclasses_on.png')
  69. },
  70. {
  71. name:'会员',
  72. value:2,
  73. tab:require('@/static/manageTabIcon/vip.png'),
  74. tabsel:require('@/static/manageTabIcon/vip_on.png')
  75. },
  76. {
  77. name:'催课',
  78. value:3,
  79. tab:require('@/static/manageTabIcon/training.png'),
  80. tabsel:require('@/static/manageTabIcon/training_on.png')
  81. },
  82. {
  83. name:'管理',
  84. value:4,
  85. tab:require('@/static/manageTabIcon/manage.png'),
  86. tabsel:require('@/static/manageTabIcon/manage_on.png')
  87. }
  88. ],
  89. companyUserInfo:JSON.parse(uni.getStorageSync('companyUserInfo'))
  90. }
  91. },
  92. computed: {
  93. appid() {
  94. return this.$store.state.appid
  95. },
  96. imgPath() {
  97. return this.$store.state.imgpath
  98. },
  99. ...mapGetters(['logoimg']),
  100. },
  101. watch: {
  102. logoimg: {
  103. immediate: true, // 页面一进入就检查一次
  104. handler(val) {
  105. return val
  106. }
  107. },
  108. },
  109. onShareAppMessage() {
  110. if(this.tabact==1){
  111. return {
  112. title: this.childdata.title, // 分享卡片标题
  113. path: this.childdata.path + "?course=" + JSON.stringify(this.childdata.params), // 目标页面路径
  114. // 携带参数:将当前页面的数据拼接到路径中
  115. imageUrl: this.childdata.img, // 分享卡片封面图(可选)
  116. success: (res) => {
  117. console.log("分享成功", res);
  118. },
  119. fail: (err) => {
  120. console.log("分享失败", err);
  121. },
  122. }
  123. }
  124. if(this.tabact==2){
  125. return {
  126. title:this.$store.state.logoname+'小程序的'+this.companyUserInfo.nickName + '邀请您成为会员!',
  127. path: this.vipPages,
  128. imageUrl: this.logoimg,
  129. }
  130. }
  131. if(this.tabact==4){
  132. return {
  133. title:this.$store.state.logoname+'小程序的'+this.companyUserInfo.nickName + '邀请您成为销售!',
  134. path: this.salsepages,
  135. imageUrl: this.logoimg,
  136. }
  137. }
  138. },
  139. onLoad(option) {
  140. this.tabact=option.act?option.act:0
  141. },
  142. methods:{
  143. copy(){
  144. console.log("hhh")
  145. uni.showLoading({
  146. title: "处理中..."
  147. });
  148. const data={
  149. appid:this.appid,
  150. linkStr:this.childdata.path + "?course=" + JSON.stringify(this.childdata.params)
  151. }
  152. copyuniLink(data).then(res=>{
  153. if(res.code==200){
  154. uni.hideLoading();
  155. setTimeout(() => {
  156. uni.setClipboardData({
  157. data:res.data,
  158. // data: this.childdata.path + "?course=" + JSON.stringify(this.childdata.params),
  159. success: () => {
  160. uni.showToast({
  161. title: '链接已复制',
  162. icon: 'none',
  163. duration: 2000
  164. });
  165. },
  166. fail: () => {
  167. uni.showToast({
  168. title: '复制失败',
  169. icon: 'none'
  170. });
  171. }
  172. });
  173. }, 200)
  174. }else{
  175. uni.hideLoading();
  176. uni.showToast({
  177. title: res.msg,
  178. icon: 'none'
  179. });
  180. }
  181. })
  182. },
  183. chlidpages(e){
  184. this.vipPages=e
  185. },
  186. chlidSalsepages(e){
  187. console.log('父组件',e)
  188. this.salsepages=e
  189. },
  190. closeShare() {
  191. this.showShare = false
  192. // console.log('open');
  193. },
  194. handleParentMethod() {
  195. },
  196. onChildDataUpdate(data) {
  197. this.childdata = data
  198. this.showShare = this.childdata.onshow
  199. console.log(this.childdata);
  200. console.log('父组件', this.childdata.path + "?course=" +JSON.stringify(this.childdata.params) )
  201. },
  202. tabclick(item){
  203. this.tabact=item.value
  204. uni.setNavigationBarTitle({
  205. title: item.name
  206. });
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. .colortab{
  213. color: #7e7e7e;
  214. }
  215. .actcolor{
  216. color: #1773ff;
  217. }
  218. .footbox{
  219. position: fixed;
  220. bottom: 0;
  221. width: 100%;
  222. background-color: #fff;
  223. display: flex;
  224. justify-content: space-around;
  225. padding-bottom: 40rpx ;
  226. padding-top: 20rpx;
  227. }
  228. .card-share{
  229. position: relative;
  230. }
  231. .share{
  232. display: inline-block;
  233. position: absolute;
  234. top: 0;
  235. left: 0;
  236. width: 100%;
  237. height: 80%;
  238. opacity: 0;
  239. }
  240. .sharePop {
  241. background-color: #fff;
  242. padding: 30rpx 0;
  243. border-radius: 20px 20px 0 0;
  244. /* #ifdef MP-WEIXIN */
  245. /* #endif */
  246. /* #ifdef H5 */
  247. padding-bottom: 60px;
  248. /* #endif */
  249. &-item {
  250. padding: 0 10px;
  251. box-sizing: border-box;
  252. font-family: PingFang SC, PingFang SC;
  253. font-weight: 400;
  254. font-size: 14px;
  255. display: inline-flex !important;
  256. image {
  257. height: 48px;
  258. width: 48px;
  259. margin-bottom: 10px;
  260. }
  261. }
  262. }
  263. </style>