帧视界壹通告,付费看视频的微信小程序
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.

83 lines
1.5 KiB

11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 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. },
  18. getters: {},
  19. mutations: {
  20. // 初始化配置
  21. initConfig(state){
  22. // api('getConfig', res => {
  23. // if(res.code == 200){
  24. // state.configList = res.result
  25. // }
  26. // })
  27. let config = ['getPrivacyPolicy', 'getUserAgreement']
  28. config.forEach(k => {
  29. api(k, res => {
  30. if (res.code == 200) {
  31. state.configList[k] = res.result
  32. }
  33. })
  34. })
  35. },
  36. login(state){
  37. uni.showLoading({
  38. title: '登录中...'
  39. })
  40. uni.login({
  41. success(res) {
  42. if(res.errMsg != "login:ok"){
  43. return
  44. }
  45. api('loginLogin', {
  46. code : res.code
  47. }, res => {
  48. uni.hideLoading()
  49. if(res.code != 200){
  50. return
  51. }
  52. state.userInfo = res.result.userInfo
  53. uni.setStorageSync('token', res.result.token)
  54. if(!state.userInfo.nickName || !state.userInfo.headImage){
  55. uni.navigateTo({
  56. url: '/pages/auth/wxUserInfo'
  57. })
  58. }else{
  59. uni.navigateBack(-1)
  60. }
  61. })
  62. }
  63. })
  64. },
  65. getUserInfo(state){
  66. api('infoGetInfo', res => {
  67. if(res.code == 200){
  68. state.userInfo = res.result
  69. }
  70. })
  71. },
  72. },
  73. actions: {},
  74. })
  75. export default store