index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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;" v-if="imgname=='医建宝'">生成卡片</view>
  22. <view style="font-size: 12px;color: #888;" v-if="imgname=='医建宝'">指导分享轻松转发</view>
  23. <button open-type="share" class="share" v-if="imgname=='医建宝'">分享课程</button>
  24. <view @click="copy" class="base-color-6 u-border ptb10 plr30 radius50 mt20">复制页面地址</view>
  25. </view>
  26. <!--#endif-->
  27. </view>
  28. </u-popup>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import dataIndex from './components/dataIndex.vue'
  34. import courseIndex from './components/courseIndex.vue'
  35. import memberIndex from './components/memberIndex.vue'
  36. import UrgeIndex from './components/UrgeIndex.vue'
  37. import manageIndex from './components/manageIndex.vue'
  38. import {copyuniLink,getlinkCode} from "@/api/manageCompany.js"
  39. export default{
  40. components:{
  41. dataIndex,
  42. courseIndex,
  43. memberIndex,
  44. UrgeIndex,
  45. manageIndex
  46. },
  47. data(){
  48. return{
  49. showShare:false,
  50. tabact:1,
  51. childdata:[],
  52. vipPages:'',
  53. salsepages:'',
  54. projectCode:'',
  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. imgname() {
  99. return this.$store.state.logoname
  100. }
  101. },
  102. onShareAppMessage() {
  103. if(this.tabact==1){
  104. return {
  105. title: this.childdata.title, // 分享卡片标题
  106. path: this.childdata.path + "?course=" + JSON.stringify(this.childdata.params), // 目标页面路径
  107. // 携带参数:将当前页面的数据拼接到路径中
  108. imageUrl: this.childdata.img, // 分享卡片封面图(可选)
  109. success: (res) => {
  110. console.log("分享成功", res);
  111. },
  112. fail: (err) => {
  113. console.log("分享失败", err);
  114. },
  115. }
  116. }
  117. if(this.tabact==2){
  118. return {
  119. title:this.$store.state.logoname+'小程序的'+this.companyUserInfo.nickName + '邀请您成为会员!',
  120. path: this.vipPages,
  121. imageUrl: this.imgPath+'/app/image/logoshare.png',
  122. }
  123. }
  124. if(this.tabact==4){
  125. return {
  126. title:this.$store.state.logoname+'小程序的'+this.companyUserInfo.nickName + '邀请您成为销售!',
  127. path: this.salsepages,
  128. imageUrl: this.imgPath+'/app/image/logoshare.png',
  129. }
  130. }
  131. },
  132. onLoad(option) {
  133. this.tabact=option.act?option.act:1
  134. },
  135. methods:{
  136. copy(){
  137. console.log("hhh")
  138. uni.showLoading({
  139. title: "处理中..."
  140. });
  141. this.getlinkCodes()
  142. },
  143. setlnk(){
  144. const path ='/pages_course/videovip'//医健宝
  145. // const path ='/pages_course/courseCover'
  146. const data={
  147. // appid:'wx503cf8ab31f83dd4',
  148. appid:this.appid,//医健宝
  149. linkStr:path + "?course=" + JSON.stringify(this.childdata.params)
  150. }
  151. copyuniLink(data).then(res=>{
  152. if(res.code==200){
  153. uni.hideLoading();
  154. setTimeout(() => {
  155. uni.setClipboardData({
  156. data:res.data,
  157. // data:path + "?course=" + JSON.stringify(this.childdata.params),
  158. success: () => {
  159. uni.showToast({
  160. title: '链接已复制',
  161. icon: 'none',
  162. duration: 2000
  163. });
  164. },
  165. fail: () => {
  166. uni.showToast({
  167. title: '复制失败',
  168. icon: 'none'
  169. });
  170. }
  171. });
  172. }, 200)
  173. }else{
  174. uni.hideLoading();
  175. uni.showToast({
  176. title: res.msg,
  177. icon: 'none'
  178. });
  179. }
  180. })
  181. },
  182. getlinkCodes(){
  183. getlinkCode().then(res=>{
  184. if(res.code){
  185. this.childdata.params.projectCode=res.code
  186. this.projectCode=res.data
  187. this.setlnk()
  188. console.log(this.childdata.params)
  189. }
  190. })
  191. },
  192. chlidpages(e){
  193. this.vipPages=e
  194. },
  195. chlidSalsepages(e){
  196. console.log('父组件',e)
  197. this.salsepages=e
  198. },
  199. closeShare() {
  200. this.showShare = false
  201. // console.log('open');
  202. },
  203. handleParentMethod() {
  204. },
  205. onChildDataUpdate(data) {
  206. this.childdata = data
  207. this.showShare = this.childdata.onshow
  208. console.log(this.childdata);
  209. console.log('父组件', this.childdata.path + "?course=" +JSON.stringify(this.childdata.params) )
  210. },
  211. tabclick(item){
  212. this.tabact=item.value
  213. uni.setNavigationBarTitle({
  214. title: item.name
  215. });
  216. }
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .colortab{
  222. color: #7e7e7e;
  223. }
  224. .actcolor{
  225. color: #1773ff;
  226. }
  227. .footbox{
  228. position: fixed;
  229. bottom: 0;
  230. width: 100%;
  231. background-color: #fff;
  232. display: flex;
  233. justify-content: space-around;
  234. padding-bottom: 40rpx ;
  235. padding-top: 20rpx;
  236. z-index: 999;
  237. }
  238. .card-share{
  239. position: relative;
  240. }
  241. .share{
  242. display: inline-block;
  243. position: absolute;
  244. top: 0;
  245. left: 0;
  246. width: 100%;
  247. height: 80%;
  248. opacity: 0;
  249. }
  250. .sharePop {
  251. background-color: #fff;
  252. padding: 30rpx 0;
  253. border-radius: 20px 20px 0 0;
  254. /* #ifdef MP-WEIXIN */
  255. /* #endif */
  256. padding-bottom: 50px;
  257. &-item {
  258. padding: 0 10px;
  259. box-sizing: border-box;
  260. font-family: PingFang SC, PingFang SC;
  261. font-weight: 400;
  262. font-size: 14px;
  263. display: inline-flex !important;
  264. image {
  265. height: 48px;
  266. width: 48px;
  267. margin-bottom: 10px;
  268. }
  269. }
  270. }
  271. </style>