index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. export default{
  41. components:{
  42. dataIndex,
  43. courseIndex,
  44. memberIndex,
  45. UrgeIndex,
  46. manageIndex
  47. },
  48. data(){
  49. return{
  50. showShare:false,
  51. tabact:0,
  52. childdata:[],
  53. vipPages:'',
  54. salsepages:'',
  55. // appid:this.$store.state.appid
  56. listtab:[
  57. {
  58. name:'数据',
  59. value:0,
  60. tab:require("@/static/manageTabIcon/data.png"),
  61. tabsel:require('@/static/manageTabIcon/data_on.png')
  62. },
  63. {
  64. name:'课程库',
  65. value:1,
  66. tab:require('@/static/manageTabIcon/liveclasses.png'),
  67. tabsel:require('@/static/manageTabIcon/liveclasses_on.png')
  68. },
  69. {
  70. name:'会员',
  71. value:2,
  72. tab:require('@/static/manageTabIcon/vip.png'),
  73. tabsel:require('@/static/manageTabIcon/vip_on.png')
  74. },
  75. {
  76. name:'催课',
  77. value:3,
  78. tab:require('@/static/manageTabIcon/training.png'),
  79. tabsel:require('@/static/manageTabIcon/training_on.png')
  80. },
  81. {
  82. name:'管理',
  83. value:4,
  84. tab:require('@/static/manageTabIcon/manage.png'),
  85. tabsel:require('@/static/manageTabIcon/manage_on.png')
  86. }
  87. ],
  88. companyUserInfo:JSON.parse(uni.getStorageSync('companyUserInfo'))
  89. }
  90. },
  91. computed: {
  92. appid() {
  93. return this.$store.state.appid
  94. },
  95. imgPath() {
  96. return this.$store.state.imgpath
  97. }
  98. },
  99. onShareAppMessage() {
  100. if(this.tabact==1){
  101. return {
  102. title: this.childdata.title, // 分享卡片标题
  103. path: this.childdata.path + "?course=" + JSON.stringify(this.childdata.params), // 目标页面路径
  104. // 携带参数:将当前页面的数据拼接到路径中
  105. imageUrl: this.childdata.img, // 分享卡片封面图(可选)
  106. success: (res) => {
  107. console.log("分享成功", res);
  108. },
  109. fail: (err) => {
  110. console.log("分享失败", err);
  111. },
  112. }
  113. }
  114. if(this.tabact==2){
  115. return {
  116. title:this.$store.state.logoname+'小程序的'+this.companyUserInfo.nickName + '邀请您成为会员!',
  117. path: this.vipPages,
  118. imageUrl: this.imgPath+'/app/image/logoshare.png',
  119. }
  120. }
  121. if(this.tabact==4){
  122. return {
  123. title:this.$store.state.logoname+'小程序的'+this.companyUserInfo.nickName + '邀请您成为销售!',
  124. path: this.salsepages,
  125. imageUrl: this.imgPath+'/app/image/logoshare.png',
  126. }
  127. }
  128. },
  129. onLoad(option) {
  130. this.tabact=option.act?option.act:0
  131. },
  132. methods:{
  133. copy(){
  134. console.log("hhh")
  135. uni.showLoading({
  136. title: "处理中..."
  137. });
  138. const data={
  139. appid:this.appid,
  140. linkStr:this.childdata.path + "?course=" + JSON.stringify(this.childdata.params)
  141. }
  142. copyuniLink(data).then(res=>{
  143. if(res.code==200){
  144. uni.hideLoading();
  145. setTimeout(() => {
  146. uni.setClipboardData({
  147. data:res.data,
  148. // data: this.childdata.path + "?course=" + JSON.stringify(this.childdata.params),
  149. success: () => {
  150. uni.showToast({
  151. title: '链接已复制',
  152. icon: 'none',
  153. duration: 2000
  154. });
  155. },
  156. fail: () => {
  157. uni.showToast({
  158. title: '复制失败',
  159. icon: 'none'
  160. });
  161. }
  162. });
  163. }, 200)
  164. }else{
  165. uni.hideLoading();
  166. uni.showToast({
  167. title: res.msg,
  168. icon: 'none'
  169. });
  170. }
  171. })
  172. },
  173. chlidpages(e){
  174. this.vipPages=e
  175. },
  176. chlidSalsepages(e){
  177. console.log('父组件',e)
  178. this.salsepages=e
  179. },
  180. closeShare() {
  181. this.showShare = false
  182. // console.log('open');
  183. },
  184. handleParentMethod() {
  185. },
  186. onChildDataUpdate(data) {
  187. this.childdata = data
  188. this.showShare = this.childdata.onshow
  189. console.log(this.childdata);
  190. console.log('父组件', this.childdata.path + "?course=" +JSON.stringify(this.childdata.params) )
  191. },
  192. tabclick(item){
  193. this.tabact=item.value
  194. uni.setNavigationBarTitle({
  195. title: item.name
  196. });
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. .colortab{
  203. color: #7e7e7e;
  204. }
  205. .actcolor{
  206. color: #1773ff;
  207. }
  208. .footbox{
  209. position: fixed;
  210. bottom: 0;
  211. width: 100%;
  212. background-color: #fff;
  213. display: flex;
  214. justify-content: space-around;
  215. padding-bottom: 40rpx ;
  216. padding-top: 20rpx;
  217. }
  218. .card-share{
  219. position: relative;
  220. }
  221. .share{
  222. display: inline-block;
  223. position: absolute;
  224. top: 0;
  225. left: 0;
  226. width: 100%;
  227. height: 80%;
  228. opacity: 0;
  229. }
  230. .sharePop {
  231. background-color: #fff;
  232. padding: 30rpx 0;
  233. border-radius: 20px 20px 0 0;
  234. /* #ifdef MP-WEIXIN */
  235. /* #endif */
  236. /* #ifdef H5 */
  237. padding-bottom: 60px;
  238. /* #endif */
  239. &-item {
  240. padding: 0 10px;
  241. box-sizing: border-box;
  242. font-family: PingFang SC, PingFang SC;
  243. font-weight: 400;
  244. font-size: 14px;
  245. display: inline-flex !important;
  246. image {
  247. height: 48px;
  248. width: 48px;
  249. margin-bottom: 10px;
  250. }
  251. }
  252. }
  253. </style>