index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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:90rpx; height: 90rpx;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,getlinkCode,getLoginMiniAppId} 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:1,
  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. MiniAppIds:''
  90. }
  91. },
  92. computed: {
  93. appid() {
  94. return this.$store.state.appid
  95. },
  96. imgPath() {
  97. return this.$store.state.imgpath
  98. }
  99. },
  100. onShareAppMessage() {
  101. if(this.tabact==1){
  102. return {
  103. title: this.childdata.title, // 分享卡片标题
  104. path: this.childdata.path + "?course=" + JSON.stringify(this.childdata.params), // 目标页面路径
  105. // 携带参数:将当前页面的数据拼接到路径中
  106. imageUrl: this.childdata.img, // 分享卡片封面图(可选)
  107. success: (res) => {
  108. console.log("分享成功", res);
  109. },
  110. fail: (err) => {
  111. console.log("分享失败", err);
  112. },
  113. }
  114. }
  115. if(this.tabact==2){
  116. return {
  117. title:this.$store.state.logoname+'小程序的'+this.companyUserInfo.nickName + '邀请您成为会员!',
  118. path: this.vipPages,
  119. imageUrl: this.imgPath+'/app/image/logoshare.png',
  120. }
  121. }
  122. if(this.tabact==4){
  123. return {
  124. title:this.$store.state.logoname+'小程序的'+this.companyUserInfo.nickName + '邀请您成为销售!',
  125. path: this.salsepages,
  126. imageUrl: this.imgPath+'/app/image/logoshare.png',
  127. }
  128. }
  129. },
  130. onLoad(option) {
  131. this.tabact=option.act?option.act:1
  132. },
  133. onShow() {
  134. this.getLoginMiniAppIds()
  135. },
  136. methods:{
  137. getLoginMiniAppIds(){
  138. getLoginMiniAppId({appId:this.appid}).then(res=>{
  139. if(res.code==200){
  140. this.MiniAppIds=res.data
  141. }else{
  142. uni.showToast({
  143. title: res.msg,
  144. icon: 'none'
  145. });
  146. }
  147. })
  148. },
  149. copy(){
  150. console.log("hhh")
  151. uni.showLoading({
  152. title: "处理中..."
  153. });
  154. this.getlinkCodes()
  155. },
  156. setlnk(){
  157. let path =''
  158. if(this.MiniAppIds=='wx503cf8ab31f83dd4'){
  159. path ='/pages_course/courseCover'
  160. }else{
  161. path ='/pages_course/videovip'
  162. }
  163. const data={
  164. // appid:'wx503cf8ab31f83dd4',
  165. appid:this.MiniAppIds,
  166. linkStr:path + "?course=" + JSON.stringify(this.childdata.params)
  167. }
  168. copyuniLink(data).then(res=>{
  169. if(res.code==200){
  170. uni.hideLoading();
  171. setTimeout(() => {
  172. uni.setClipboardData({
  173. data:res.data,
  174. // data:path + "?course=" + JSON.stringify(this.childdata.params),
  175. success: () => {
  176. uni.showToast({
  177. title: '链接已复制',
  178. icon: 'none',
  179. duration: 2000
  180. });
  181. },
  182. fail: () => {
  183. uni.showToast({
  184. title: '复制失败',
  185. icon: 'none'
  186. });
  187. }
  188. });
  189. }, 200)
  190. }else{
  191. uni.hideLoading();
  192. uni.showToast({
  193. title: res.msg,
  194. icon: 'none'
  195. });
  196. }
  197. })
  198. },
  199. getlinkCodes(){
  200. getlinkCode().then(res=>{
  201. if(res.code){
  202. this.childdata.params.projectCode=res.code
  203. this.projectCode=res.data
  204. this.setlnk()
  205. console.log(this.childdata.params)
  206. }
  207. })
  208. },
  209. chlidpages(e){
  210. this.vipPages=e
  211. },
  212. chlidSalsepages(e){
  213. console.log('父组件',e)
  214. this.salsepages=e
  215. },
  216. closeShare() {
  217. this.showShare = false
  218. // console.log('open');
  219. },
  220. handleParentMethod() {
  221. },
  222. onChildDataUpdate(data) {
  223. this.childdata = data
  224. this.showShare = this.childdata.onshow
  225. console.log(this.childdata);
  226. console.log('父组件', this.childdata.path + "?course=" +JSON.stringify(this.childdata.params) )
  227. },
  228. tabclick(item){
  229. this.tabact=item.value
  230. uni.setNavigationBarTitle({
  231. title: item.name
  232. });
  233. }
  234. }
  235. }
  236. </script>
  237. <style lang="scss" scoped>
  238. .colortab{
  239. color: #7e7e7e;
  240. }
  241. .actcolor{
  242. color: #1773ff;
  243. }
  244. .footbox{
  245. position: fixed;
  246. bottom: 0;
  247. width: 100%;
  248. background-color: #fff;
  249. display: flex;
  250. justify-content: space-around;
  251. padding-bottom: 40rpx ;
  252. padding-top: 20rpx;
  253. }
  254. .card-share{
  255. position: relative;
  256. }
  257. .share{
  258. display: inline-block;
  259. position: absolute;
  260. top: 0;
  261. left: 0;
  262. width: 100%;
  263. height: 80%;
  264. opacity: 0;
  265. }
  266. .sharePop {
  267. background-color: #fff;
  268. padding: 30rpx 0;
  269. border-radius: 20px 20px 0 0;
  270. /* #ifdef MP-WEIXIN */
  271. /* #endif */
  272. /* #ifdef H5 */
  273. padding-bottom: 60px;
  274. /* #endif */
  275. &-item {
  276. padding: 0 10px;
  277. box-sizing: border-box;
  278. font-family: PingFang SC, PingFang SC;
  279. font-weight: 400;
  280. font-size: 14px;
  281. display: inline-flex !important;
  282. image {
  283. height: 48px;
  284. width: 48px;
  285. margin-bottom: 10px;
  286. }
  287. }
  288. }
  289. </style>