鲍张超 hace 3 años
padre
commit
e93bd0e27e

+ 2
- 2
src/App.vue Ver fichero

@@ -6,14 +6,14 @@
6 6
 </template>
7 7
 
8 8
 <script>
9
-import Tabber from './components/Tabber.vue'
9
+import Tabber from './components/Tabber.vue';
10 10
 
11 11
 export default {
12 12
   name: 'App',
13 13
   components: {
14 14
     Tabber
15 15
   }
16
-}
16
+};
17 17
 </script>
18 18
 
19 19
 <style>

+ 20
- 2
src/components/Course.vue Ver fichero

@@ -1,9 +1,27 @@
1 1
 <template>
2
-  <h1>Course 课程管理</h1>
2
+  <div>
3
+    <van-cell-group v-for="(item, index) in courseList" :key="index">
4
+      <van-cell :title="item.name" icon="records" @click="handLogin()" is-link />
5
+    </van-cell-group>
6
+  </div>
3 7
 </template>
4 8
 
5 9
 <script>
6
-export default {}
10
+export default {
11
+  data() {
12
+    return {
13
+      courseList: [
14
+        { name: '课程阿斯达四方' },
15
+        { name: 'dgdgdgdfgfds' },
16
+        { name: '啊飒飒的给' },
17
+        { name: '昂贵的法国电视公司提供' },
18
+        { name: '认同感他如果' },
19
+        { name: '课程阿斯好友和用户运营达四方' },
20
+        { name: '肉体和肉体和人' }
21
+      ]
22
+    };
23
+  }
24
+};
7 25
 </script>
8 26
 
9 27
 <style lang="less" scoped>

+ 20
- 2
src/components/StrongPhoto.vue Ver fichero

@@ -1,9 +1,27 @@
1 1
 <template>
2
-  <h1>StrongPhoto 精彩瞬间</h1>
2
+  <!-- <h1>StrongPhoto 精彩瞬间</h1> -->
3
+  <div>
4
+    <span v-for="(image, index) in imageList" :key="index">
5
+      <van-image width="200px" :src="image.a" />
6
+    </span>
7
+  </div>
3 8
 </template>
4 9
 
5 10
 <script>
6
-export default {}
11
+export default {
12
+  data() {
13
+    return {
14
+      imageList: [
15
+        { a: 'https://img.yzcdn.cn/vant/cat.jpeg' },
16
+        { a: 'https://img.yzcdn.cn/vant/cat.jpeg' },
17
+        { a: 'https://img.yzcdn.cn/vant/cat.jpeg' },
18
+        { a: 'https://img.yzcdn.cn/vant/cat.jpeg' },
19
+        { a: 'https://img.yzcdn.cn/vant/cat.jpeg' },
20
+        { a: 'https://img.yzcdn.cn/vant/cat.jpeg' }
21
+      ]
22
+    };
23
+  }
24
+};
7 25
 </script>
8 26
 
9 27
 <style lang="less" scoped>

+ 16
- 13
src/components/UserCenter.vue Ver fichero

@@ -28,29 +28,32 @@ export default {
28 28
   data() {
29 29
     return {
30 30
       code: '' // 前端获取 code 传给后端调用相应接口
31
-    }
31
+    };
32 32
   },
33 33
   created() {
34 34
     // 从 window.location.href 中截取 code 并且赋值
35
-    if (window.location.href.indexOf('CSDN_state') !== -1) {
36
-      // 此方法仅供参考!!!
37
-      this.code = window.location.href.split('?')[1].split('=')[1].split('&')[0]
38
-      this.$store.commit('SET_USER_INFO', { code: this.code })
35
+    if (window.location.href.indexOf('Code_state') !== -1) {
36
+      this.code = window.location.href
37
+        .split('?')[1]
38
+        .split('=')[1]
39
+        .split('&')[0];
40
+      this.$store.commit('SET_USER_INFO', { code: this.code });
39 41
     }
40 42
 
41 43
     if (this.$store.state.user.code) {
42 44
       // 存在 code 直接调用接口
43
-      this.handGetUserInfo(this.code)
45
+      this.handGetUserInfo(this.code);
44 46
     }
45 47
   },
46 48
   methods: {
47 49
     handLogin() {
48
-      this.$store.commit('SET_USER_INFO', { code: this.code })
50
+      this.$router.push('/SetUser');
51
+      // this.$store.commit('SET_USER_INFO', { code: this.code })
49 52
 
50 53
       // 重定向地址重定到当前页面,在路径获取 code
51 54
       if (process.env.NODE_ENV === 'development') {
52
-        console.log(222)
53
-        return
55
+        console.log(222);
56
+        return;
54 57
       }
55 58
       /**
56 59
        * 获取 code
@@ -63,7 +66,7 @@ export default {
63 66
       //   }
64 67
       // }
65 68
 
66
-      const hrefUrl = window.location.href
69
+      const hrefUrl = window.location.href;
67 70
 
68 71
       // const originCode = localStorage.getItem('wxcode')
69 72
       // const queryCode = getCode()
@@ -78,14 +81,14 @@ export default {
78 81
 						&response_type=code
79 82
 						&scope=snsapi_userinfo
80 83
 						&state=Code_state#wechat_redirect
81
-					`
84
+					`;
82 85
       }
83 86
     },
84 87
     handGetUserInfo(code) {
85 88
       console.log(
86 89
         '🚀 ~ file: UserCenter.vue ~ line 44 ~ handGetUserInfo ~ code',
87 90
         code
88
-      )
91
+      );
89 92
       // 调用后端接口,参数为 code 剩下工作量交给后端即可
90 93
       // wxLogin({
91 94
       //   data: {
@@ -101,7 +104,7 @@ export default {
101 104
       // })
102 105
     }
103 106
   }
104
-}
107
+};
105 108
 </script>
106 109
 
107 110
 <style lang="less" scoped>

+ 55
- 0
src/components/userPages/SetUser.vue Ver fichero

@@ -0,0 +1,55 @@
1
+<template>
2
+  <div class="setInfo">
3
+    <van-nav-bar title="修改个人信息" left-text="返回" left-arrow @click-left="onClickLeft" />
4
+    <van-form @submit="onSubmit">
5
+      <van-field
6
+        v-model="username"
7
+        name="username"
8
+        label="姓名"
9
+        placeholder="姓名"
10
+        :rules="[{ required: true, message: '请填写姓名' }]"
11
+      />
12
+      <van-field
13
+        v-model="phone"
14
+        type="number"
15
+        name="phone"
16
+        label="手机号"
17
+        placeholder="手机号"
18
+        :rules="[{ required: true, message: '请填写手机号码' }]"
19
+      />
20
+      <div style="margin: 20px; margin-top:3em;">
21
+        <van-button round block type="info" native-type="submit">提交</van-button>
22
+      </div>
23
+    </van-form>
24
+  </div>
25
+</template>
26
+
27
+<script>
28
+export default {
29
+  data() {
30
+    return {
31
+      username: '',
32
+      phone: ''
33
+    };
34
+  },
35
+  methods: {
36
+    onClickLeft() {
37
+      this.$router.go(-1);
38
+    },
39
+    onSubmit(values) {
40
+      console.log('submit', values);
41
+      this.$toast.success('提示文案');
42
+    }
43
+  }
44
+};
45
+</script>
46
+
47
+<style lang="less" scoped>
48
+.setInfo {
49
+  width: 100%;
50
+  height: 33%;
51
+  border-bottom-left-radius: 20px;
52
+  border-bottom-right-radius: 20px;
53
+  background-color: #fff;
54
+}
55
+</style>

+ 23
- 6
src/main.js Ver fichero

@@ -1,13 +1,30 @@
1 1
 import Vue from 'vue'
2 2
 import App from './App.vue'
3
-import { Tabbar, TabbarItem, Button } from 'vant';
4 3
 import router from './router/index'//路由
5 4
 import store from './store';//状态管理
6
-import { Icon } from 'vant';
7
-import { Notify } from 'vant';
8
-
9
-import { Cell, CellGroup } from 'vant';
10
-
5
+import {
6
+  Cell, CellGroup,
7
+  Icon,
8
+  Notify,
9
+  Form,
10
+  Tabbar,
11
+  TabbarItem,
12
+  Button,
13
+  Field,
14
+  Toast,
15
+  Card,
16
+  NavBar,
17
+  Image, SwipeItem, Tag, Swipe
18
+} from 'vant';
19
+Vue.use(Swipe);
20
+Vue.use(Tag);
21
+Vue.use(NavBar);
22
+Vue.use(SwipeItem);
23
+Vue.use(Image);
24
+Vue.use(Toast);
25
+Vue.use(Card);
26
+Vue.use(Form);
27
+Vue.use(Field);
11 28
 Vue.use(Cell);
12 29
 Vue.use(CellGroup);
13 30
 Vue.use(Notify);

+ 13
- 1
src/router/index.js Ver fichero

@@ -5,7 +5,7 @@ import Router from 'vue-router'
5 5
 import Course from '../components/Course.vue'//课程
6 6
 import StrongPhoto from '../components/StrongPhoto.vue'
7 7
 import UserCenter from '../components/UserCenter.vue'
8
-
8
+import SetUser from '../components/userPages/SetUser.vue'
9 9
 // // import Login from '../Login.vue'
10 10
 
11 11
 
@@ -48,11 +48,23 @@ export default new Router({
48 48
       meta: {
49 49
         requireAuth: false //是否登陆
50 50
       }
51
+    },
52
+
53
+    // 修改个人信息
54
+    {
55
+      path: '/SetUser',
56
+      name: 'SetUser',
57
+      component: SetUser,
58
+      meta: {
59
+        requireAuth: true //是否登陆
60
+      }
51 61
     }
52 62
 
53 63
 
54 64
 
55 65
 
66
+
67
+
56 68
   ]
57 69
 })
58 70
 

+ 1
- 0
src/util/api.js Ver fichero

@@ -0,0 +1 @@
1
+import request from "./request";

+ 1
- 1
src/util/request.js Ver fichero

@@ -13,7 +13,7 @@ import store from '../store'
13 13
 
14 14
 export default function (url, params, methodType = 'GET') {
15 15
   return new Promise((resolve, reject) => {
16
-    const { personId, phone, appid, totalScore } = store.state.user
16
+    // const { personId, phone, appid, totalScore } = store.state.user
17 17
     // const timestamp = new Date().valueOf()
18 18
     // const sign = md5(appid + personId + phone + timestamp)
19 19
 

+ 4
- 11
yarn.lock Ver fichero

@@ -1456,11 +1456,6 @@
1456 1456
   optionalDependencies:
1457 1457
     prettier "^1.18.2 || ^2.0.0"
1458 1458
 
1459
-"@vue/devtools-api@^6.0.0-beta.11":
1460
-  version "6.0.12"
1461
-  resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.0.12.tgz#7b57cce215ae9f37a86984633b3aa3d595aa5b46"
1462
-  integrity sha512-iO/4FIezHKXhiDBdKySCvJVh8/mZPxHpiQrTy+PXVqJZgpTPTdHy4q8GXulaY+UKEagdkBb0onxNQZ0LNiqVhw==
1463
-
1464 1459
 "@vue/preload-webpack-plugin@^1.1.0":
1465 1460
   version "1.1.2"
1466 1461
   resolved "https://registry.npmmirror.com/@vue/preload-webpack-plugin/-/preload-webpack-plugin-1.1.2.tgz#ceb924b4ecb3b9c43871c7a429a02f8423e621ab"
@@ -8367,12 +8362,10 @@ vue@^2.6.11:
8367 8362
   resolved "https://registry.npmmirror.com/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235"
8368 8363
   integrity sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==
8369 8364
 
8370
-vuex@^4.0.2:
8371
-  version "4.0.2"
8372
-  resolved "https://registry.yarnpkg.com/vuex/-/vuex-4.0.2.tgz#f896dbd5bf2a0e963f00c67e9b610de749ccacc9"
8373
-  integrity sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==
8374
-  dependencies:
8375
-    "@vue/devtools-api" "^6.0.0-beta.11"
8365
+vuex@^3.6.2:
8366
+  version "3.6.2"
8367
+  resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.6.2.tgz#236bc086a870c3ae79946f107f16de59d5895e71"
8368
+  integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==
8376 8369
 
8377 8370
 watchpack-chokidar2@^2.0.1:
8378 8371
   version "2.0.1"