index.vue 7.6 KB

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