帧视界壹通告,付费看视频的微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.3 KiB

11 months ago
11 months ago
10 months ago
8 months ago
11 months ago
10 months ago
11 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
9 months ago
11 months ago
9 months ago
11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
8 months ago
11 months ago
11 months ago
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. Vue.use(Vuex); //vue的插件机制
  4. import api from '@/api/api.js'
  5. //Vuex.Store 构造器选项
  6. const store = new Vuex.Store({
  7. state: {
  8. configList: [], //配置列表
  9. count : 10,
  10. userInfo : {},
  11. certifiedIndividual : {
  12. imageReverseSide: '',
  13. imageStraight: '',
  14. card: '',
  15. name: '',
  16. },
  17. competitionBanner : '',//比赛页面背景图片
  18. idCardOpenStatus : false,//实名认证状态
  19. paySeeTime : '',//付费查看联系方式,可查看的时间
  20. },
  21. getters: {
  22. // 通过报错的方式阻止缓存,这里的报错千万不要修复
  23. isVedio(state){
  24. return state.configList.open.content == 'Y'
  25. },
  26. },
  27. mutations: {
  28. // 初始化配置
  29. initConfig(state){
  30. api('getConfig', res => {
  31. if(res.code == 200){
  32. // state.configList = res.result
  33. res.result.forEach(n => {
  34. // 比赛页面背景图片
  35. if(n.keyValue == 'banner'){
  36. state.competitionBanner = n.content
  37. }
  38. // 付费查看联系方式,可查看的时间
  39. if(n.keyValue == 'time'){
  40. state.paySeeTime = n.content
  41. }
  42. state.configList[n.keyValue] = n
  43. })
  44. }
  45. })
  46. let config = ['getPrivacyPolicy', 'getUserAgreement', 'getPublishPostNotice']
  47. config.forEach(k => {
  48. api(k, res => {
  49. if (res.code == 200) {
  50. state.configList[k] = res.result
  51. }
  52. })
  53. })
  54. },
  55. getIsVedio(state){
  56. api('getIsVedio', res => {
  57. state.configList.isVedio = res.result
  58. })
  59. },
  60. login(state){
  61. uni.showLoading({
  62. title: '登录中...'
  63. })
  64. uni.login({
  65. success(res) {
  66. if(res.errMsg != "login:ok"){
  67. return
  68. }
  69. api('loginLogin', {
  70. code : res.code
  71. }, res => {
  72. uni.hideLoading()
  73. if(res.code != 200){
  74. return
  75. }
  76. state.userInfo = res.result.userInfo
  77. uni.setStorageSync('token', res.result.token)
  78. if(!state.userInfo.nickName || !state.userInfo.headImage){
  79. if(state.configList.open && state.configList.open.content != 'Y'){
  80. state.userInfo.headImage = 'https://tennis-oss.xzaiyp.top/2024-10-09/385774b4-d94a-4d45-993a-ae4ddd0b2751.jpg'
  81. state.userInfo.nickName = '帧视界' + Math.floor(Math.random() * 1000000)
  82. api('infoUpdateInfo', {
  83. headImage: state.userInfo.headImage,
  84. nickName: state.userInfo.nickName,
  85. })
  86. return uni.navigateBack(-1)
  87. }
  88. uni.navigateTo({
  89. url: '/pages/auth/wxUserInfo'
  90. })
  91. }else{
  92. uni.navigateBack(-1)
  93. }
  94. })
  95. }
  96. })
  97. },
  98. getUserInfo(state){
  99. api('infoGetInfo', res => {
  100. if(res.code == 200){
  101. res.result.idCardOpen = parseInt(res.result.idCardOpen)
  102. state.userInfo = res.result
  103. if(res.result.idCardOpen){
  104. this.commit('getCartInfo')
  105. }
  106. }
  107. })
  108. },
  109. getCartInfo(state){
  110. // this.userInfo.idCardOpen 1企业认证 2个人认证
  111. api(['infoGetCompanyCertification',
  112. 'infoGetCertification'][state.userInfo.idCardOpen - 1],
  113. res => {
  114. if(res.code == 200){
  115. state.certifiedIndividual = res.result || {}
  116. // 实名认证审核状态
  117. state.idCardOpenStatus = state.certifiedIndividual && state.certifiedIndividual.state == 1
  118. }
  119. })
  120. },
  121. },
  122. actions: {},
  123. })
  124. export default store