index.vue 6.9 KB

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