center.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="pages">
  3. <!-- <view class="" :style="{height: navHeight+'px' }"></view> -->
  4. <!-- <view class="page-bg">
  5. <img class="img" :src="staticUrl+'/img/center-index-bg.png'" alt="">
  6. </view> -->
  7. <view class="box">
  8. <view class="home_top">
  9. <view class="base-info block-wrap u-flex u-row-between" @click="$u.route('/center/memberinfo',{type:'redirectTo'})" v-if="vuex_member_info.name">
  10. <view class="left u-flex">
  11. <!-- <u-avatar :src="avatar||staticUrl+'/img/avatar.png'" size="140rpx"></u-avatar> -->
  12. <view class="info">
  13. <view class="name ellipsis-1">{{vuex_member_info.contact||vuex_member_info.name}}</view>
  14. <view class="mobile u-flex">
  15. <text class="mobile">{{vuex_member_info.name}}</text>
  16. <!-- <text class="mobile">{{vuex_member_info.mobile|hidePhoneNumber}}</text> -->
  17. </view>
  18. </view>
  19. </view>
  20. <!-- <u-icon @click="$u.route('/center/memberinfo',{type:'redirectTo'})" name="setting-fill" color="#333333" size="38rpx"></u-icon> -->
  21. </view>
  22. <view class="base-info block-wrap u-flex u-row-between" @click="goLogin" v-else>
  23. <view class="left u-flex">
  24. <u-avatar :src="staticUrl+'/img/avatar.png'" size="140rpx"></u-avatar>
  25. <view class="info">
  26. <view class="name ellipsis-1">登录/注册</view>
  27. <text class="mobile">登录查看更多</text>
  28. </view>
  29. </view>
  30. <!-- <u-icon name="setting-fill" color="#333333" size="38rpx"></u-icon> -->
  31. </view>
  32. </view>
  33. </view>
  34. <view class="tools block-wrap">
  35. <!-- <view class="title">常用工具</view> -->
  36. <view class="tools-wrap">
  37. <view class=""
  38. v-for="(item,index) in tools"
  39. @click="toolsClick(item)"
  40. :key="index">
  41. <view class="tool-item u-flex u-row-between" v-if="!item.chat">
  42. <view class="left u-flex">
  43. <u-icon :name="item.ico" color="#333333" size="55rpx"></u-icon>
  44. <text class="name">{{item.name}}</text>
  45. </view>
  46. <u-icon name="arrow-right" color="#ddd" size="40rpx"></u-icon>
  47. </view>
  48. <view class="tool-item" v-if="item.chat==1">
  49. <button class="button-item u-flex u-row-between" type="default" open-type="contact">
  50. <view class="left u-flex">
  51. <u-icon :name="item.ico" color="#333333" size="55rpx"></u-icon>
  52. <text class="name">{{item.name}}</text>
  53. </view>
  54. <u-icon name="arrow-right" color="#ddd" size="40rpx"></u-icon>
  55. </button>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <tabbar :tabbarIndexProps="2" />
  61. </view>
  62. </template>
  63. <script>
  64. import { systemInfo } from "@/mixin.js";
  65. import tabbar from "../components/tabbar.vue"
  66. export default {
  67. components:{
  68. tabbar
  69. },
  70. mixins:[systemInfo],
  71. data() {
  72. return {
  73. staticUrl:this.$commonConfig.staticUrl,
  74. avatar:this.$commonConfig.staticUrl+'/img/avatar.png',
  75. memberInfo:{},
  76. customerMobile:'',
  77. tools:[
  78. // {name:'观看记录',url:'/center/viewrecord',ico:this.$commonConfig.staticUrl+'/img/center-record.png',checkauth:true},
  79. // {name:'领券中心',url:'/center/mycoupon',ico:this.$commonConfig.staticUrl+'/img/center-coupon.png',checkauth:true},
  80. // {name:'开具发票',url:'center/invoice',ico:this.$commonConfig.staticUrl+'/img/center-ticket.png',checkauth:true},
  81. {name:'报名记录',url:'center/order',ico:this.$commonConfig.staticUrl+'/img/center-order.png',checkauth:true},
  82. // {name:'客服热线',url:'',ico:this.$commonConfig.staticUrl+'/img/center-call.png',checkauth:true,phone:''},
  83. // {name:'在线客服',chat:'1',ico:this.$commonConfig.staticUrl+'/img/center-call.png'},
  84. ]
  85. }
  86. },
  87. onShow() {
  88. // if(this.vuex_member_info.name){
  89. this.getMemberInfo();
  90. // }
  91. },
  92. onLoad() {
  93. this.getSystemInfo();
  94. },
  95. methods: {
  96. getMemberInfo(){
  97. this.$u.api.getInfo({userid:this.vuex_member_info.id}).then(res=>{
  98. this.memberInfo = res.data;
  99. this.avatar = res.data.contractImg;
  100. this.tools.forEach(item => {
  101. if (item.name === '客服热线') {
  102. item.phone = res.data.customerMobile;
  103. }
  104. });
  105. this.$u.vuex('vuex_member_info', res.data);
  106. const isExist = this.tools.some(item => item.name === '实名认证');
  107. if(!res.data.memberInfo.isAuth&&!isExist){
  108. this.tools.push({name:'实名认证',url:'center/factorauth',ico:this.$commonConfig.staticUrl+'/img/center-ticket.png',checkauth:true})
  109. }
  110. // console.log('memberInfo',this.memberInfo);
  111. }).catch(err=>{
  112. console.log('memberInfo',err.data);
  113. })
  114. },
  115. toolsClick(item){
  116. let that = this;
  117. console.log('item',item);
  118. if(item.name!=='在线客服'&&item.name!=='客服热线'&&item.name!=='实名认证'&&item.name!=='我的订单'){
  119. uni.showToast({
  120. title:'开发中',
  121. icon:"none"
  122. })
  123. return
  124. }
  125. if ('phone' in item) {
  126. if(!item.phone){
  127. uni.showToast({
  128. title:'电话号码为空',
  129. icon:"none"
  130. })
  131. return
  132. }
  133. uni.makePhoneCall({
  134. phoneNumber: item.phone,
  135. success() {
  136. console.log('success');
  137. },
  138. fail() {
  139. console.log('fail');
  140. }
  141. });
  142. return
  143. }
  144. if ('chat' in item) {
  145. return
  146. }
  147. console.log('item.checkauth',item.checkauth);
  148. if(item.checkauth){
  149. this.checkauth(item.url)
  150. }else{
  151. uni.$u.route(item.url);
  152. }
  153. },
  154. goLogin(){
  155. uni.setStorage({
  156. key: 'backUrl',
  157. data:'center/center' ,
  158. success: function () {
  159. uni.$u.route('/pages/login/login')
  160. }
  161. });
  162. },
  163. checkauth(pageUrl){
  164. if(this.vuex_member_info.name){
  165. uni.$u.route(pageUrl)
  166. }else{
  167. uni.showModal({
  168. title: '提示',
  169. content: '你需要登录后,才可使用此功能!',
  170. success: res => {
  171. if (res.confirm) {
  172. uni.setStorage({
  173. key: 'backUrl',
  174. data:pageUrl ,
  175. success: function () {
  176. uni.$u.route('/pages/login/login')
  177. }
  178. });
  179. }
  180. }
  181. })
  182. }
  183. }
  184. }
  185. }
  186. </script>
  187. <style>
  188. page{
  189. background-color: #fff;
  190. padding-top: 0;
  191. }
  192. </style>
  193. <style lang="scss" scoped>
  194. $boxHeight:418rpx;
  195. .box { width: 100%;height:$boxHeight; margin: auto; overflow: hidden; }
  196. .home_top {
  197. position: relative;
  198. width: 100%;
  199. z-index: 2;
  200. height: $boxHeight;
  201. .base-info{
  202. position: absolute;
  203. left: 32rpx;
  204. right: 32rpx;
  205. bottom: 90rpx;
  206. color: #fff;
  207. }
  208. }
  209. .home_top:after { width: 180%; height: $boxHeight; position: absolute; left: -40%; top: 0; z-index: -1; content: ''; border-radius: 0 0 50% 50%; background: linear-gradient(180deg, #EE0C0C 0%, #F39D9F 100%); }
  210. .block-wrap{
  211. margin: 24rpx 32rpx;
  212. }
  213. .title{
  214. font-size: 32rpx;
  215. font-weight: 600;
  216. color: #333333;
  217. line-height: 45rpx;
  218. margin-bottom: 30rpx;
  219. }
  220. .base-info{
  221. margin-bottom: 10rpx;
  222. .info{
  223. margin-left: 30rpx;
  224. .name{
  225. font-size: 36rpx;
  226. font-weight: bold;
  227. color: #FFFFFF;
  228. line-height: 54rpx;
  229. margin-bottom: 10rpx;
  230. }
  231. .mobile{
  232. width: fit-content;
  233. font-size: 28rpx;
  234. font-weight: 400;
  235. color: #FFFFFF;
  236. line-height: 42rpx;
  237. }
  238. }
  239. }
  240. .tools{
  241. .tools-wrap{
  242. }
  243. .tool-item{
  244. padding: 12rpx 18rpx;
  245. background-color: #FBFBFB;
  246. margin-bottom: 20rpx;
  247. border-radius: 20rpx;
  248. overflow: hidden;
  249. .name{
  250. font-size: 32rpx;
  251. font-weight: 400;
  252. color: #363636;
  253. margin-left: 12rpx;
  254. }
  255. }
  256. .button-item{
  257. background-color: transparent;
  258. line-height: 1;
  259. font-size: 24rpx;
  260. font-weight: 400;
  261. color: #666666;
  262. border: 0;
  263. padding: 0;
  264. top: -2px;
  265. &::after{border: initial;}
  266. }
  267. }
  268. </style>