becomeVIP.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. <template>
  2. <view class="content hb column justify-center align-center bgf">
  3. <image :src="imgPath+'/app/image/becomevip.png'" mode="widthFix"></image>
  4. <view class="justify-start align-center fs24 base-color-9" v-if="userInfo.userId">
  5. <view>{{nameuser}}#</view>
  6. <view>{{userInfo.userId}}</view>
  7. </view>
  8. <view class="bolds">成为会员,享受更多权益</view>
  9. <!--#ifdef H5-->
  10. <view class="sure" @click="registerCourse">{{isVip==1?'您已成为会员':viptext}}</view>
  11. <!--#endif-->
  12. <!--#ifdef MP-WEIXIN-->
  13. <view class="base-bg-orange colorf ptb20 plr40 radius60"
  14. v-if="(userInfos==null||userInfos=='')&&imgname=='乐氏本源'" @click="nato()">授权用户信息</view>
  15. <view class="btns" v-else>
  16. <!-- <button
  17. class="author-btn"
  18. open-type="getUserInfo"
  19. :disabled="userdisabled"
  20. @getuserinfo="userInfologin" v-if="authType==0">{{isVip==1?'您已成为会员':'申请成为会员'}}</button>
  21. <button
  22. v-else
  23. class="author-btn"
  24. open-type="getPhoneNumber"
  25. @getphonenumber="phoneLogin" >{{isVip==1?'您已成为会员':'申请成为会员'}}</button> -->
  26. <button class="author-btn" @click="handleAgree()">{{viptext}}</button>
  27. </view>
  28. <!--#endif-->
  29. <!--#ifdef MP-WEIXIN-->
  30. <u-popup :show="userlogo" mode="bottom" round='12'>
  31. <view class="userlogo column">
  32. <view class="mtb30 justify-start align-center ml20">
  33. <u-avatar :src="imgPath+'/app/image/logo.png'" size="50"></u-avatar>
  34. <view class="bold mlr20">{{imgname}}</view>
  35. <view>申请</view>
  36. </view>
  37. <view class="bold fs36 ml20">授权你的昵称头像信息</view>
  38. <view class="mtb20 justify-between align-center plr20">
  39. <view class="justify-start align-center">
  40. <view class="boxweixin" :class="userinfos.nickname==''?'boxnosel':'boxsel'">
  41. <view v-if="userinfos.nickname">√</view>
  42. </view>
  43. <view class="ml20">
  44. <view class="base-color-3 bold">第一步</view>
  45. <view class="fs24 base-color-9">请点击授权微信昵称</view>
  46. </view>
  47. </view>
  48. <view class="button-container">
  49. <input
  50. type="nickname"
  51. class="hidden-input"
  52. @blur="onNickNameInput"
  53. @input="onNickNameInput"
  54. />
  55. <button class="custom-button" :class="nameuser==''?'subname':'subavt'">{{nameuser?"已授权":'允许授权'}}</button>
  56. </view>
  57. </view>
  58. <view class="mtb20 justify-between align-center plr20 mt40">
  59. <view class="justify-start align-center">
  60. <view class="boxweixin" :class="userinfos.nickname==''?'boxnosel':'boxsel'">
  61. <view v-if="userinfos.avatar">√</view>
  62. </view>
  63. <view class="ml20">
  64. <view class="base-color-3 bold">第二步</view>
  65. <view class="fs24 base-color-9">请点击授权微信头像</view>
  66. </view>
  67. </view>
  68. <view class="button-container">
  69. <button open-type="chooseAvatar" @chooseavatar="onChooseAvatar" class="hidden-input"
  70. v-if="nameuser">
  71. 允许授权
  72. </button>
  73. <button class="custom-button sub" @click="shouquan" v-if="nameuser==''">允许授权</button>
  74. <button class="custom-button " :class="avataruser==''?'subname':'subavt'"
  75. v-else>{{avataruser?"已授权":'允许授权'}}</button>
  76. </view>
  77. </view>
  78. <view class="submitname" @click="confimrname" :class="nameuser&&avataruser?'subact':'sub'">确定</view>
  79. </view>
  80. </u-popup>
  81. <!--#endif-->
  82. <view class="footer-tips">重庆云联融智提供技术支持</view>
  83. </view>
  84. </template>
  85. <script>
  86. import { loginByMp,registerCourses,loginByMiniApp,handleFsUserWx} from '@/api/courseLook'
  87. import {
  88. getConfigByKey
  89. } from "@/api/user.js"
  90. export default {
  91. data() {
  92. return {
  93. isVip: 0,
  94. isWechat: false,
  95. isLogin: false,
  96. companyid:'',
  97. companyUserId:'',
  98. userInfo:{},
  99. tagIds:[],
  100. isbecomevip:0,
  101. viptext:'申请成为会员',
  102. userlogo:false,
  103. userinfos:{
  104. nickname:'',
  105. avatar:""
  106. },
  107. headImg:'',
  108. authType:0,//0微信登录 1手机号登录
  109. userdisabled:false,
  110. projectId:'',
  111. H5course:{}
  112. }
  113. },
  114. computed: {
  115. imgPath() {
  116. return this.$store.state.imgpath
  117. },
  118. imgname() {
  119. return this.$store.state.logoname
  120. },
  121. appid() {
  122. return this.$store.state.appid
  123. },
  124. nameuser() {
  125. return this.userinfos.nickname
  126. },
  127. avataruser() {
  128. return this.userinfos.avatar
  129. },
  130. },
  131. onLoad(option) {
  132. uni.$on('usercode',(data)=>{
  133. console.log('huoqu ',data)
  134. this.goLogin(data)
  135. })
  136. uni.$on('vipMsg',(data)=>{
  137. console.log('vipMsg ',data)
  138. this.viptext=data
  139. })
  140. console.log(option)
  141. let path = 'https://userapp.moonxiang.com/prod-api'//存在文化
  142. uni.setStorageSync('requestPath',path)
  143. if(uni.getStorageSync('userInfo')&&uni.getStorageSync('userInfo')!='{}') {
  144. this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
  145. } else {
  146. this.userInfo = {}
  147. }
  148. // this.userInfo=JSON.parse(uni.getStorageSync('userInfo')) || {};
  149. //#ifdef MP-WEIXIN
  150. let obj=uni.getStorageSync('TOKEN_WEXIN');
  151. //#endif
  152. // #ifdef H5
  153. let obj=uni.getStorageSync('TOKEN_KEY');
  154. // #endif
  155. // let obj=uni.getStorageSync('AppToken');
  156. this.isLogin = !!obj;
  157. this.companyid = option.companyId || ''
  158. this.companyUserId=option.companyUserId || 0
  159. this.projectId=option.projectId
  160. this.H5course.companyId=option.companyId
  161. this.H5course.companyUserId=option.companyUserId
  162. this.H5course.projectId=option.projectId
  163. uni.setStorageSync('H5course',this.H5course)
  164. console.log(this.H5course)
  165. //#ifdef MP-WEIXIN
  166. // if(this.$store.state.logoname!=='乐氏本源'&&!uni.getStorageSync('userInfos')){
  167. // this.userlogo=true
  168. // }
  169. if(!uni.getStorageSync('userInfos')&&this.$store.state.logoname=='乐氏本源'){
  170. uni.navigateTo({
  171. url:'/pages_course/webview'
  172. })
  173. return
  174. }
  175. //#endif
  176. if(option.tagids=="null"){
  177. this.tagIds=[]
  178. }else{
  179. this.tagIds=option.tagids
  180. const arr =this.tagIds.split(",")
  181. .map(item => parseInt(item.trim(), 10))
  182. .filter(num => !isNaN(num)); // 过滤无效转换
  183. this.tagIds =arr
  184. // console.log(this.tagIds);
  185. }
  186. // this.isWechat = String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger"
  187. this.code = option.code
  188. // #ifdef H5
  189. if(this.code&&!this.isLogin) {
  190. this.loginByMp()
  191. }
  192. // #endif
  193. },
  194. onShow() {
  195. this.getWebviewUrl()
  196. if(uni.getStorageSync('userInfo')&&uni.getStorageSync('userInfo')!='{}') {
  197. this.userInfo =JSON.parse(uni.getStorageSync('userInfo'))
  198. } else {
  199. this.userInfo = {}
  200. }
  201. //#ifdef MP-WEIXIN
  202. console.log(111,uni.getStorageSync('userInfo'),this.userInfo)
  203. this.userinfos=uni.getStorageSync('userInfo')
  204. console.log(uni.getStorageSync('userinfos'))
  205. let obj=uni.getStorageSync('TOKEN_WEXIN');
  206. //#endif
  207. // #ifdef H5
  208. let obj=uni.getStorageSync('TOKEN_KEY');
  209. // #endif
  210. this.isLogin = !!obj;
  211. if(this.isLogin&&this.isVip!=1) {
  212. this.registerCourse()
  213. }
  214. },
  215. methods: {
  216. getWebviewUrl() {
  217. var data = {
  218. key: 'course.config'
  219. }
  220. getConfigByKey(data).then(res => {
  221. if (res.code == 200) {
  222. console.log("getConfigByKey====", JSON.parse(res.data))
  223. let data = JSON.parse(res.data,)
  224. uni.setStorageSync('setWebviewUrl',data.userCourseAuthDomain)
  225. }else{
  226. uni.showToast({
  227. icon:'none',
  228. title: res.msg,
  229. });
  230. }
  231. })
  232. },
  233. goLogin(){
  234. uni.showLoading({
  235. title: '加载中'
  236. })
  237. uni.login({
  238. provider: "weixin",
  239. success: async loginRes => {
  240. let code = loginRes.code // 获取开发code
  241. loginByMiniApp({
  242. // encryptedData: loginRes.mp.detail.encryptedData,
  243. // iv: loginRes.mp.detail.iv,
  244. code: code,
  245. companyId : this.companyid || '',
  246. companyUserId:this.companyUserId || 0,
  247. nickname:this.userinfos.nickname ||'',
  248. avatar:this.userinfos.avatar||'',
  249. authType:this.authType,
  250. appId:this.appid,
  251. projectId:this.projectId
  252. })
  253. .then( res => {
  254. if(res.code==200){
  255. console.log(res)
  256. uni.hideLoading();
  257. uni.showToast({
  258. icon:'none',
  259. title: "登录成功",
  260. });
  261. uni.setStorageSync('TOKEN_WEXIN', res.token);
  262. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  263. this.userInfo=res.user;
  264. this.isLogin = true
  265. setTimeout(()=>{
  266. this.registerCourse()
  267. },200)
  268. }else if(res.code==406){
  269. uni.hideLoading();
  270. uni.showToast({
  271. icon:'none',
  272. title: '该用户已成为其他销售会员',
  273. });
  274. }else{
  275. uni.hideLoading();
  276. uni.showToast({
  277. icon:'none',
  278. title: res.msg,
  279. });
  280. }
  281. })
  282. },
  283. })
  284. },
  285. goLogins(data) {
  286. console.log('huoqu111',data)
  287. if(data){
  288. console.log('huoqu1222',data)
  289. uni.showLoading({
  290. title: '加载中'
  291. })
  292. uni.login({
  293. provider: "weixin",
  294. success: async loginRes => {
  295. console.log(loginRes)
  296. let code = loginRes.code // 获取开发code
  297. handleFsUserWx({
  298. code: code,
  299. appId:this.appid,
  300. userId:data.userId
  301. })
  302. .then( res => {
  303. if(res.code==200){
  304. console.log(res)
  305. uni.hideLoading();
  306. uni.showToast({
  307. icon:'none',
  308. title: "登录成功",
  309. });
  310. this.userinfos=uni.getStorageSync('userinfos')
  311. uni.getStorageSync('TOKEN_WEXIN');
  312. this.userInfo=uni.getStorageSync('userInfo');
  313. this.isLogin = true
  314. setTimeout(()=>{
  315. this.registerCourse()
  316. },200)
  317. }else if(res.code==406){
  318. uni.hideLoading();
  319. uni.showToast({
  320. icon:'none',
  321. title: '该用户已成为其他销售会员',
  322. });
  323. }else{
  324. uni.hideLoading();
  325. uni.showToast({
  326. icon:'none',
  327. title: res.msg,
  328. });
  329. }
  330. })
  331. },
  332. })
  333. }else{
  334. uni.navigateTo({
  335. url:'/pages_course/webview?H5course='+uni.getStorageSync('H5course')
  336. })
  337. }
  338. },
  339. shouquan(){
  340. if(this.userinfos.nickname==''){
  341. uni.showToast({
  342. icon:'none',
  343. title: "请先授权微信昵称",
  344. });
  345. }
  346. },
  347. confimrname(){
  348. if(this.userinfos.nickname==''){
  349. uni.showToast({
  350. icon:'none',
  351. title: "请授权微信昵称",
  352. });
  353. return
  354. }
  355. if(this.userinfos.avatar==''){
  356. uni.showToast({
  357. icon:'none',
  358. title: "请授权微信头像",
  359. });
  360. return
  361. }
  362. uni.setStorageSync('userInfos',this.userinfos)
  363. this.editUserA()
  364. this.userlogo=false
  365. },
  366. onChooseAvatar(e){
  367. this.userinfos.avatar=e.detail.avatarUrl
  368. console.log(e.detail.avatarUrl)
  369. uni.uploadFile({
  370. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', //仅为示例,非真实的接口地址
  371. filePath: e.detail.avatarUrl,
  372. name: 'file',
  373. formData: {
  374. 'user': 'test' // 上传附带参数
  375. },
  376. success: (uploadFileRes) => {
  377. console.log(uploadFileRes)
  378. // 根据接口具体返回格式 赋值具体对应url
  379. var data=JSON.parse(uploadFileRes.data)
  380. this.headImg=uni.getStorageSync('requestPath')+data.fileName
  381. this.userinfos.avatar=data.url
  382. }
  383. });
  384. },
  385. onNickNameInput(e){
  386. console.log(e)
  387. this.userinfos.nickname=e.detail.value
  388. },
  389. nato(){
  390. uni.navigateTo({
  391. url:'/pages_course/webview'
  392. })
  393. },
  394. handleAgree(){
  395. console.log(144443)
  396. if(this.isVip==1){
  397. uni.showToast({
  398. title: '您已成为会员!',
  399. icon: 'none',
  400. duration: 2000,
  401. })
  402. }else{
  403. this.goLogin()
  404. uni.showToast({
  405. title: this.viptext,
  406. icon: 'none',
  407. duration: 2000,
  408. })
  409. }
  410. },
  411. userInfologin(e) {
  412. console.log(123333)
  413. this.userdisabled=true
  414. var that=this;
  415. uni.showLoading({
  416. title: "加载中..."
  417. });
  418. if (e.mp.detail.errMsg == 'getUserInfo:ok') {
  419. this.utils.getProvider()
  420. .then(provider => {
  421. if (!provider) {
  422. this.userdisabled=false
  423. reject()
  424. }
  425. // uni登录
  426. uni.login({
  427. provider: provider,
  428. success: async loginRes => {
  429. let code = loginRes.code // 获取开发code
  430. this.userinfos=uni.getStorageSync('userInfos')?uni.getStorageSync('userInfos'):this.userinfos
  431. loginByMiniApp({
  432. encryptedData: e.mp.detail.encryptedData,
  433. iv: e.mp.detail.iv,
  434. code: code,
  435. nickname:this.userinfos.nickname?this.userinfos.nickname:'',
  436. avatar:this.userinfos.avatar?this.userinfos.avatar:'',
  437. companyId : this.companyid || '',
  438. companyUserId:this.companyUserId || 0,
  439. authType:this.authType,
  440. appId:this.appid,
  441. projectId:this.projectId
  442. })
  443. .then( res => {
  444. if(res.code==200){
  445. // console.log(res)
  446. uni.hideLoading();
  447. uni.showToast({
  448. icon:'none',
  449. title: "登录成功",
  450. });
  451. uni.setStorageSync('TOKEN_WEXIN', res.token);
  452. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  453. this.userInfo=res.user;
  454. uni.hideLoading()
  455. this.userdisabled=false
  456. // this.isLogin = true
  457. setTimeout(()=>{
  458. this.checkUserInfoA()
  459. // this.registerCourse()
  460. },200)
  461. }else if(res.code==406){
  462. uni.hideLoading();
  463. uni.showToast({
  464. icon:'none',
  465. title: '该用户已成为其他销售会员',
  466. });
  467. }
  468. else{
  469. uni.hideLoading();
  470. uni.showToast({
  471. icon:'none',
  472. title: res.msg,
  473. });
  474. }
  475. })
  476. .catch(res=>{
  477. this.userdisabled=false
  478. })
  479. },
  480. fail() {
  481. this.userdisabled=false
  482. }
  483. })
  484. })
  485. .catch(err => {
  486. this.userdisabled=false
  487. uni.showToast({
  488. icon:'none',
  489. title: err,
  490. });
  491. })
  492. } else {
  493. this.userdisabled=false
  494. uni.showToast({
  495. title: '已拒绝授权',
  496. icon: 'none',
  497. duration: 2000,
  498. })
  499. }
  500. },
  501. // 微信用户手机号登录
  502. phoneLogin(e) {
  503. var that=this;
  504. uni.showLoading({
  505. title: "加载中..."
  506. });
  507. if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
  508. this.utils.getProvider()
  509. .then(provider => {
  510. if (!provider) {
  511. reject()
  512. }
  513. // uni登录
  514. uni.login({
  515. provider: provider,
  516. success: async loginRes => {
  517. let code = loginRes.code // 获取开发code
  518. this.userinfos=uni.getStorageSync('userInfos')?uni.getStorageSync('userInfos'):this.userinfos
  519. loginByMiniApp({
  520. encryptedData: e.mp.detail.encryptedData,
  521. iv: e.mp.detail.iv,
  522. code: code,
  523. nickname:this.userinfos.nickname?this.userinfos.nickname:'',
  524. avatar:this.userinfos.avatar?this.userinfos.avatar:'',
  525. companyId : this.companyid || '',
  526. companyUserId:this.companyUserId || 0,
  527. authType:this.authType,
  528. appId:this.appid,
  529. projectId:this.projectId
  530. })
  531. .then( res => {
  532. if(res.code==200){
  533. // console.log(res)
  534. uni.hideLoading();
  535. uni.showToast({
  536. icon:'none',
  537. title: "登录成功",
  538. });
  539. uni.setStorageSync('TOKEN_WEXIN', res.token);
  540. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  541. this.userInfo=res.user;
  542. uni.hideLoading()
  543. // this.isLogin = true
  544. // setTimeout(()=>{
  545. // this.registerCourse()
  546. // },200)
  547. setTimeout(()=>{
  548. this.checkUserInfoA()
  549. // this.registerCourse()
  550. },200)
  551. }else if(res.code==406){
  552. uni.hideLoading();
  553. uni.showToast({
  554. icon:'none',
  555. title: '该用户已成为其他销售会员',
  556. });
  557. }
  558. else{
  559. uni.hideLoading();
  560. uni.showToast({
  561. icon:'none',
  562. title: res.msg,
  563. });
  564. }
  565. })
  566. }
  567. })
  568. })
  569. .catch(err => {
  570. uni.showToast({
  571. icon:'none',
  572. title: err,
  573. });
  574. })
  575. } else {
  576. uni.showToast({
  577. title: '已拒绝授权',
  578. icon: 'none',
  579. duration: 2000,
  580. })
  581. }
  582. },
  583. getWechatCode() {
  584. if (this.isWechat) {
  585. let appid = "wx0d021524695f1943"; //微信APPid(百年康城)
  586. let code = this.getUrlCode().code; //是否存在code
  587. let local = window.location.href;
  588. if (code == null || code === "") {
  589. let urlPaths = local.split("/registerCourse");
  590. uni.setStorageSync('beforLoginPage', urlPaths[1]);
  591. //不存在就打开上面的地址进行授权
  592. window.location.href =
  593. "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
  594. appid +
  595. "&redirect_uri=" +
  596. encodeURIComponent(local) +
  597. "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
  598. } else {
  599. this.code = code;
  600. this.loginByMp()
  601. }
  602. }else{
  603. uni.showToast({
  604. title: '请在微信浏览器中打开',
  605. icon:'error'
  606. })
  607. }
  608. },
  609. getUrlCode() {
  610. // 截取url中的code方法
  611. var url = location.search;
  612. var theRequest = new Object();
  613. if (url.indexOf("?") != -1) {
  614. var str = url.substr(1);
  615. var strs = str.split("&");
  616. for (var i = 0; i < strs.length; i++) {
  617. theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1];
  618. }
  619. }
  620. return theRequest;
  621. },
  622. loginByMp() {
  623. if (this.code == null) {
  624. return;
  625. }
  626. uni.showLoading({
  627. title: "处理中..."
  628. });
  629. loginByMp({code:this.code}).then(res => {
  630. uni.hideLoading();
  631. if (res.code == 200) {
  632. uni.setStorageSync('TOKEN_KEY', res.token);
  633. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  634. this.userInfo= res.user
  635. let beforLoginUrl = uni.getStorageSync('beforLoginPage');
  636. this.isLogin = true
  637. this.registerCourse()
  638. } else {
  639. uni.showToast({
  640. title: res.msg,
  641. icon: 'none'
  642. });
  643. }
  644. },
  645. err => {}
  646. );
  647. },
  648. // 成为会员
  649. registerCourse() {
  650. console.log(123333,this.userInfo.userId)
  651. this.isVip = 0
  652. // 确保从本地存储重新获取最新数据
  653. // if(uni.getStorageSync('userInfo')){
  654. // this.userInfo=JSON.parse(uni.getStorageSync('userInfo'));
  655. // }
  656. // if (!this.userInfo.userId) {
  657. // // 空值检查
  658. // uni.showToast({ title: '用户未登录或信息不完整', icon: 'none' });
  659. // return;
  660. // }
  661. if(this.tagIds==null){
  662. this.tagIds=""
  663. }
  664. // console.log(this.tagIds)
  665. const data={
  666. userId:this.userInfo.userId,
  667. companyUserId:this.companyUserId,
  668. companyId:this.companyid,
  669. tagIds:this.tagIds,
  670. projectId:this.projectId
  671. }
  672. if(this.isLogin) {
  673. registerCourses(data).then(res=>{
  674. if(res.code == 200) {
  675. this.isVip = 1
  676. this.isbecomevip=1
  677. this.viptext='您已成为会员'
  678. uni.showToast({
  679. title: '注册成功',
  680. icon:'none'
  681. })
  682. } else {
  683. this.isbecomevip=1
  684. // console.log(this.isbecomevip)
  685. this.viptext=res.msg
  686. uni.showToast({
  687. icon:'none',
  688. title: res.msg
  689. })
  690. }
  691. })
  692. } else {
  693. // #ifdef H5
  694. this.getWechatCode()
  695. // #endif
  696. }
  697. }
  698. }
  699. }
  700. </script>
  701. <style lang="scss" scoped>
  702. .subname{
  703. background-color: #00aa00;
  704. color: #fff;
  705. }
  706. .subavt{
  707. background-color: #fff;
  708. border: 2rpx #0a0 solid;
  709. color: #00aa00;
  710. }
  711. .boxweixin{
  712. width: 44rpx;
  713. height: 44rpx;
  714. border-radius: 50%;
  715. text-align: center;
  716. line-height: 34rpx;
  717. color: #0a0;
  718. }
  719. .boxnosel{
  720. border: #757575 4rpx solid;
  721. }
  722. .boxsel{
  723. border: #0a0 4rpx solid;
  724. }
  725. .button-container {
  726. position: relative;
  727. width: 240rpx;
  728. }
  729. .hidden-input {
  730. position: absolute;
  731. top: 0;
  732. left: 0;
  733. width: 100%;
  734. height: 100%;
  735. opacity: 0;
  736. z-index: 2;
  737. }
  738. .custom-button {
  739. position: relative;
  740. z-index: 1;
  741. /* 其他样式 */
  742. width:100%;
  743. margin: 0 auto;
  744. height: 80rpx;
  745. line-height: 60rpx;
  746. font-size: 28rpx;
  747. padding: 10rpx 20rpx;
  748. }
  749. .submitname{
  750. width: 90%;
  751. margin: 0 auto;
  752. text-align: center;
  753. padding: 30rpx;
  754. margin-top: 40rpx;
  755. }
  756. .sub{
  757. background-color: #f0f0f0;
  758. color: #0a0;
  759. }
  760. .subact{
  761. background-color: #0a0;
  762. color: #fff;
  763. }
  764. .userlogo{
  765. height: 760rpx;
  766. }
  767. .getlogo{
  768. width:240rpx;
  769. background-color: #fff;
  770. // padding: 10rpx 20rpx;
  771. }
  772. ::v-deep .u-popup {
  773. flex: 0 !important;
  774. }
  775. // .submitname{
  776. // width: 60%;
  777. // background-color: #05a8ee;
  778. // color: #fff;
  779. // margin: 0 auto;
  780. // border-radius: 80rpx;
  781. // text-align: center;
  782. // padding: 20rpx;
  783. // margin-top: 40rpx;
  784. // }
  785. .userlogo{
  786. height: 760rpx;
  787. }
  788. .getlogo{
  789. width:calc(60% - 40rpx);
  790. margin: 0 auto;
  791. background-color: #fff;
  792. padding: 10rpx 20rpx;
  793. image{
  794. width: 80rpx !important;
  795. height: 80rpx !important;
  796. }
  797. }
  798. .footer-tips {
  799. // margin-top: 14rpx;
  800. position: fixed;
  801. width: 100%;
  802. bottom: 44rpx;
  803. text-align: center;
  804. font-family: PingFang SC,PingFang SC;
  805. font-weight: 500;
  806. font-size: 12px;
  807. color: #bbb;
  808. transform: scale(0.8);
  809. }
  810. .content {
  811. image {
  812. width: 300rpx;
  813. height: 300rpx;
  814. }
  815. }
  816. .bolds {
  817. color: #999;
  818. font-size: 16px;
  819. height: auto;
  820. line-height: inherit;
  821. margin-bottom: 0;
  822. width: 304px;
  823. word-break: break-all;
  824. text-align: center;
  825. margin: 50rpx 0 100rpx 0;
  826. }
  827. .sure {
  828. width: 500rpx;
  829. background-color: #1777ff;
  830. line-height: 88rpx;
  831. text-align: center;
  832. border-radius: 8rpx;
  833. color: #fff;
  834. }
  835. .btns{
  836. position: relative;
  837. width: 630rpx;
  838. height: 80rpx;
  839. .author-btn{
  840. z-index:100;
  841. position: absolute;
  842. width: 630rpx;
  843. height: 80rpx;
  844. line-height: 80rpx;
  845. text-align: center;
  846. background: #1777ff;
  847. border-radius: 40rpx;
  848. font-size: 30rpx;
  849. font-family: PingFang SC;
  850. font-weight: 500;
  851. color: rgba(255, 255, 255, 1);
  852. }
  853. }
  854. </style>