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

69 lines
1.2 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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. },
  28. login(state){
  29. uni.login({
  30. success(res) {
  31. if(res.errMsg != "login:ok"){
  32. return
  33. }
  34. api('loginLogin', {
  35. code : res.code
  36. }, res => {
  37. if(res.code != 200){
  38. return
  39. }
  40. state.userInfo = res.result.userInfo
  41. uni.setStorageSync('token', res.result.token)
  42. if(!state.userInfo.nickName || !state.userInfo.headImage){
  43. uni.navigateTo({
  44. url: '/pages/auth/wxUserInfo'
  45. })
  46. }else{
  47. uni.navigateBack(-1)
  48. }
  49. })
  50. }
  51. })
  52. },
  53. getUserInfo(state){
  54. api('infoGetInfo', res => {
  55. if(res.code == 200){
  56. state.userInfo = res.result
  57. }
  58. })
  59. },
  60. },
  61. actions: {},
  62. })
  63. export default store