提交 a7c26e7ae607d39f970faef90edd9290d98b5cbe

作者 genglw
2 个父辈 db96d690 60f302a9

Merge branch 'developer/yxly-teacher-genglw-20220713' into develop

正在显示 88 个修改的文件 包含 978 行增加215 行删除
  1 +.DS_Store
  2 +node_modules/
  3 +unpackage/
  4 +dist/
  5 +
  6 +# local env files
  7 +.env.local
  8 +.env.*.local
  9 +
  10 +# Log files
  11 +npm-debug.log*
  12 +yarn-debug.log*
  13 +yarn-error.log*
  14 +
  15 +# Editor directories and files
  16 +.project
  17 +.idea
  18 +.vscode
  19 +*.suo
  20 +*.ntvs*
  21 +*.njsproj
  22 +*.sln
  23 +*.sw*
... ...
... ... @@ -7,7 +7,8 @@
7 7 * @LastEditTime: 2022-02-18 14:06:28
8 8 -->
9 9 <template>
10   - <view>
  10 + <view>
  11 + <u-toast ref="uToast" />
11 12 </view>
12 13 </template>
13 14
... ... @@ -36,5 +37,5 @@
36 37 <style lang="scss">
37 38 /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
38 39 @import "@/uni_modules/uview-ui/index.scss";
39   - @import '@/static/common/css/icon.css';
  40 + @import '@/static/css/icon.css';
40 41 </style>
... ...
1 1 <template>
2 2 <view class="u-button">
3   - <u-button type="primary" :shape="shape" :open-type="openType" @getphonenumber="getPhoneNumber" hover-class="none" :disabled="disabled" :custom-style="getCustomStyle"
4   - @click="click">
5   - {{text}}
  3 + <u-button :text="text" color="#0CB17A" :plain="false" :hairline="false" :disabled="disabled" :throttleTime="1500"
  4 + type="info" shape="circle" :open-type="openType" @getphonenumber="getPhoneNumber"
  5 + :custom-style="getCustomStyle" @click="click">
6 6 </u-button>
7 7 </view>
8 8 </template>
... ... @@ -18,14 +18,10 @@
18 18 type: {
19 19 type: String,
20 20 default: 'confirm'
21   - },
22   - openType: {
23   - type: String,
24   - default: ''
25 21 },
26   - shape: {
  22 + openType: {
27 23 type: String,
28   - default: 'square'
  24 + default: ''
29 25 },
30 26 disabled: {
31 27 type: Boolean,
... ... @@ -37,53 +33,69 @@
37 33 return {}
38 34 }
39 35 },
  36 + color: {
  37 + type: String,
  38 + default: ''
  39 + },
  40 +
40 41 },
41 42 data() {
42 43 return {}
43 44 },
44   - computed: {
45   - getCustomStyle() {
46 45
47   - const {
48   - type = ''
49   - } = this;
50   -
51   - let style = {};
52   -
53   - switch (type) {
  46 + watch: {
  47 + buttonType: function(newVal, oldVal) {
  48 + switch (this.type) {
54 49 case 'confirm':
55   - return Object.assign({}, {
56   - backgroundColor: '#FF001A',
57   - borderRadius: '8rpx',
58   - }, this.customStyle);
59   - break;
60   -
61   - case 'cancel':
62   - return Object.assign({}, {
63   - backgroundColor: "rgba(0,0,0,0.15)",
64   - borderRadius: '8rpx',
65   - }, this.customStyle);
66   - break;
67   -
68   - case 'custom':
69   - return Object.assign({}, this.customStyle);
  50 + this.color = "#0CB17A";
70 51 break;
71 52 }
72 53 }
73 54 },
  55 +
  56 + computed: {
  57 + // getCustomStyle() {
  58 +
  59 + // const {
  60 + // type = ''
  61 + // } = this;
  62 +
  63 + // let style = {};
  64 +
  65 + // switch (type) {
  66 + // case 'confirm':
  67 + // return Object.assign({}, {
  68 + // backgroundColor: '#FF001A',
  69 + // borderRadius: '8rpx',
  70 + // }, this.customStyle);
  71 + // break;
  72 +
  73 + // case 'cancel':
  74 + // return Object.assign({}, {
  75 + // backgroundColor: "rgba(0,0,0,0.15)",
  76 + // borderRadius: '8rpx',
  77 + // }, this.customStyle);
  78 + // break;
  79 +
  80 + // case 'custom':
  81 + // return Object.assign({}, this.customStyle);
  82 + // break;
  83 + // }
  84 + // }
  85 + },
74 86 methods: {
75 87 // 按钮点击
76 88 click(e) {
77 89 this.$emit('click', e);
78   - },
79   -
80   - getPhoneNumber(e) {
81   - this.$emit("getPhoneNumber", e)
  90 + },
  91 +
  92 + getPhoneNumber(e) {
  93 + this.$emit("getPhoneNumber", e)
82 94 }
83 95 }
84 96 }
85 97 </script>
86 98
87   -<style lang="scss">
88   -
  99 +<style lang="scss">
  100 +
89 101 </style>
... ...
1 1 const http = uni.$u.http
2 2
3   -// post请求,获取菜单
4   -export const postMenu = (params) => http.post('/ebapi/public_api/index', params)
  3 +// 获取token
  4 +export const postTokenApi = (params, config = {}) => http.post('/auth/v1/login', params, config)
5 5
6   -// get请求,获取菜单,注意:get请求的配置等,都在第二个参数中,详见前面解释
7   -export const getMenu = (data) => http.get('/ebapi/public_api/index', data)
  6 +// 获取用户信息
  7 +export const getUserInfoApi = (data) => http.get('/user/v1/detail', {
  8 + params: data
  9 +})
  10 +
  11 +// 获取短信验证码
  12 +export const getSmsCodeApi = (data) => http.get('/basic/v1/sms_code/get', {
  13 + params: data
  14 +})
... ...
... ... @@ -5,26 +5,50 @@ module.exports = (vm) => {
5 5 /* config 为默认全局配置*/
6 6
7 7 // 测试环境
8   - // config.baseUrl = "http://39.104.52.206:8000";
  8 + config.baseURL = "http://39.104.52.206:8000";
9 9 // 预生产环境
10   - // config.baseUrl = "https://api-isxpre.workai.com.cn";
  10 + // config.baseURL = "https://api-isxpre.workai.com.cn";
11 11 // 线上环境
12   - config.baseUrl = "https://api-isx.workai.com.cn";
  12 + // config.baseURL = "https://api-isx.workai.com.cn";
13 13
14   - config.OSSUrl = "https://oss.workai.com.cn";
15   -
16   - // 如果将此值设置为true,拦截回调中将会返回服务端返回的所有数据response,而不是response.data
17   - // 设置为true后,就需要在this.$u.http.interceptor.response进行多一次的判断,请打印查看具体值
18   -
19   - config.loadingText = '努力加载中~';
20   - config.loadingTime = 800;
21   - config.originalData = true;
22   - // 设置自定义头部content-type
23 14 config.header = {
24 15 // 'content-type': 'xxx'
25 16 'Authorization': 'Basic d29ya2FpOjEyMzQ1Ng=='
26 17 };
27 18
  19 + // 设置自定义头部content-type
  20 + config.dataType = 'json';
  21 + // #ifndef MP-ALIPAY
  22 + config.responseType = 'text';
  23 + // #endif
  24 + // 注:如果局部custom与全局custom有同名属性,则后面的属性会覆盖前面的属性,相当于Object.assign(全局,局部)
  25 + config.custom = {}; // 全局自定义参数默认值
  26 + // #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN
  27 + config.timeout = 60000;
  28 + // #endif
  29 + // #ifdef APP-PLUS
  30 + config.sslVerify = true;
  31 + // #endif
  32 + // #ifdef H5
  33 + // 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+)
  34 + config.withCredentials = false;
  35 + // #endif
  36 + // #ifdef APP-PLUS
  37 + config.firstIpv4 = false; // DNS解析时优先使用ipv4 仅 App-Android 支持 (HBuilderX 2.8.0+)
  38 + // #endif
  39 + // 局部优先级高于全局,返回当前请求的task,options。请勿在此处修改options。非必填
  40 + // getTask: (task, options) => {
  41 + // 相当于设置了请求超时时间500ms
  42 + // setTimeout(() => {
  43 + // task.abort()
  44 + // }, 500)
  45 + // },
  46 +
  47 + // 全局自定义验证器。参数为statusCode 且必存在,不用判断空情况。
  48 + config.validateStatus = (statusCode) => { // statusCode 必存在。此处示例为全局默认配置
  49 + return statusCode >= 200 && statusCode < 300
  50 + };
  51 +
28 52 return config;
29 53 })
30 54
... ...
... ... @@ -102,7 +102,7 @@
102 102 },
103 103 "quickapp" : {},
104 104 "mp-weixin" : {
105   - "appid" : "wx5177bff86a427016",
  105 + "appid" : "wx84b71301436652ce",
106 106 "setting" : {
107 107 "urlCheck" : false,
108 108 "es6" : true,
... ...
1 1 {
2 2 "easycom": {
3   - "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue",
  3 + "^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue",
4 4 "^c-(.*)": "@/components/c-$1/c-$1.vue"
5 5 },
6 6 "condition": { //模式配置,仅开发期间生效
7 7 "current": 0, //当前激活的模式(list 的索引项)
8 8 "list": [{
9 9 "name": "defult", //模式名称
10   - "path": "pages/main/position/positionDetail/positionDetail",
11   - "query": "jobId=1544925053173403649&brokerId=1000007"
  10 + "path": "pages/main/my/mobileLogin/mobileLogin",
  11 + "query": ""
12 12 }]
13 13 },
14 14 "pages": [{
... ... @@ -20,14 +20,40 @@
20 20 }
21 21 },
22 22 {
  23 + "path": "pages/tabBar/internship/internship",
  24 + "style": {
  25 + "navigationStyle": "custom",
  26 + "navigationBarTitleText": ""
  27 + }
  28 + },
  29 + {
23 30 "path": "pages/tabBar/my/my",
24 31 "style": {
25   - "navigationStyle": "custom"
26   - // "navigationBarTitleText": "校企职通车人人推"
  32 + "navigationStyle": "custom",
  33 + "navigationBarTitleText": ""
27 34 }
28 35 }
29 36 ],
30   - "subPackages": [],
  37 + "subPackages": [{
  38 + "root": "pages/main/my",
  39 + "pages": [{
  40 + "path": "login/login",
  41 + "style": {
  42 + "navigationBarTitleText": "登录",
  43 + "enablePullDownRefresh": false
  44 + }
  45 +
  46 + },
  47 + {
  48 + "path": "mobileLogin/mobileLogin",
  49 + "style": {
  50 + "navigationBarTitleText": "手机登录",
  51 + "enablePullDownRefresh": false
  52 + }
  53 +
  54 + }
  55 + ]
  56 + }],
31 57
32 58 "preloadRule": {
33 59
... ... @@ -49,15 +75,23 @@
49 75 "height": "100rpx",
50 76 "fontSize": "40rpx",
51 77 "list": [{
52   - "pagePath": "pages/tabBar/home/home",
53   - "iconPath": "/static/img/tabbar/home.png",
54   - "selectedIconPath": "/static/img/tabbar/homeHL.png",
55   - "text": "首页"
56   - }, {
57   - "pagePath": "pages/tabBar/my/my",
58   - "iconPath": "/static/img/tabbar/my.png",
59   - "selectedIconPath": "/static/img/tabbar/myHL.png",
60   - "text": "我的"
61   - }]
  78 + "pagePath": "pages/tabBar/home/home",
  79 + "iconPath": "/static/img/icon/home.png",
  80 + "selectedIconPath": "/static/img/icon/homeHL.png",
  81 + "text": "首页"
  82 + },
  83 + {
  84 + "pagePath": "pages/tabBar/internship/internship",
  85 + "iconPath": "/static/img/icon/position.png",
  86 + "selectedIconPath": "/static/img/icon/positionHL.png",
  87 + "text": "实习"
  88 + },
  89 + {
  90 + "pagePath": "pages/tabBar/my/my",
  91 + "iconPath": "/static/img/icon/my.png",
  92 + "selectedIconPath": "/static/img/icon/myHL.png",
  93 + "text": "我的"
  94 + }
  95 + ]
62 96 }
63 97 }
... ...
  1 +<template>
  2 + <page-meta>
  3 + <navigation-bar :title="nbTitle" :front-color="nbFrontColor" :background-color="nbBackgroundColor" />
  4 + </page-meta>
  5 + <view>
  6 + <web-view :webview-styles="webviewStyles" :src="url"></web-view>
  7 + </view>
  8 +</template>
  9 +
  10 +<script>
  11 + export default {
  12 + data() {
  13 + return {
  14 + nbTitle: '',
  15 + nbFrontColor: '#000000',
  16 + nbBackgroundColor: '#ffffff',
  17 + url: "",
  18 + webviewStyles: {
  19 + progress: {
  20 + color: '#FF3333'
  21 + }
  22 + }
  23 + }
  24 + },
  25 +
  26 + onLoad(option) {
  27 + console.log(option);
  28 + this.url = option.url;
  29 + this.nbTitle = option.navtitle;
  30 + },
  31 +
  32 + methods: {
  33 +
  34 + }
  35 + }
  36 +</script>
  37 +
  38 +<style lang="scss" scoped>
  39 +
  40 +</style>
... ...
  1 +<template>
  2 + <view class="login">
  3 + <u-image width="100%" height="100%" :src="vuex_baseImgUrl+'/logo_bg.png'" />
  4 +
  5 + <view class="box">
  6 +
  7 + <view class="logo">
  8 + <u-image width="260rpx" height="140rpx" :src="vuex_baseImgUrl+'/logo.png'" />
  9 + </view>
  10 +
  11 + <view class="btn button_warp">
  12 + <c-button type="confirm" shape="circle"
  13 + :customStyle="{borderRadius:'48rpx',fontSize:'34rpx',color:'#fff',fontWeight:'400'}" text="微信一键登录"
  14 + :disabled="isDisable" openType="getPhoneNumber" @getPhoneNumber="getPhoneNumber"
  15 + @click="getUserProfile"></c-button>
  16 + </view>
  17 +
  18 + <view class="changeLogin" @click="handelMobileLogin">
  19 + 手机号码登录/注册
  20 + </view>
  21 +
  22 + <view class="agreement">
  23 + <view class="check">
  24 + <u-checkbox-group @change="checkboxChange" v-model="checked">
  25 + <u-checkbox size="30" activeColor="#0CB17A" shape="circle">
  26 + </u-checkbox>
  27 + </u-checkbox-group>
  28 + </view>
  29 + <view class="text">
  30 + <text>您已阅读理解并同意</text>
  31 + <text class="span" @click="linkService">《优学乐业服务协议》、</text>
  32 + <text class="span" @click="linkPolicy">《优学乐业隐私政策》</text>
  33 + </view>
  34 + </view>
  35 +
  36 + </view>
  37 + </view>
  38 +</template>
  39 +
  40 +<script>
  41 + import {
  42 + mapState,
  43 + mapActions
  44 + } from 'vuex'
  45 +
  46 + export default {
  47 + data() {
  48 + return {
  49 + isDisable: true,
  50 + checked: [],
  51 + service: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/agreement/%E3%80%8A%E4%BC%98%E5%AD%A6%E4%B9%90%E4%B8%9A%E7%94%A8%E6%88%B7%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E3%80%8B.htm",
  52 + policy: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/agreement/%E3%80%8A%E4%BC%98%E5%AD%A6%E4%B9%90%E4%B8%9A%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE%E3%80%8B.htm",
  53 + form: {
  54 + mobile: '',
  55 + password: '',
  56 + },
  57 + }
  58 + },
  59 +
  60 + onLoad() {
  61 + const {
  62 + dispatch
  63 + } = this.$store;
  64 +
  65 + },
  66 +
  67 + onShow() {
  68 +
  69 + },
  70 +
  71 + watch: {
  72 + checked: function(newVal, oldVal) {
  73 + this.isDisable = newVal.length != 0 ? false : true;
  74 +
  75 + }
  76 + },
  77 +
  78 + computed: {
  79 + ...mapState('user', {
  80 + // 箭头函数可使代码更简练
  81 + isReg: 'isReg',
  82 +
  83 + }),
  84 + },
  85 +
  86 + methods: {
  87 +
  88 + linkService() {
  89 + console.log(this)
  90 + this.$u.route({
  91 + url: `/pages/common/webview/webview?navtitle=服务协议&url=${this.service}`,
  92 + })
  93 + },
  94 +
  95 + linkPolicy() {
  96 + this.$u.route({
  97 + url: `/pages/common/webview/webview?navtitle=隐私政策&url=${this.policy}`,
  98 + })
  99 + },
  100 +
  101 + checkboxChange(n) {
  102 + console.log(n)
  103 +
  104 + },
  105 +
  106 + getUserProfile() {
  107 + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
  108 + // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
  109 + wx.getUserProfile({
  110 + desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  111 + success: (res) => {
  112 + console.log('getUserProfile...', res)
  113 + // this.$store.commit('setWenxinUserInfo', res);
  114 + this.$u.vuex('vuex_weixinUserInfo', res.userInfo);
  115 + }
  116 + })
  117 + },
  118 +
  119 + getPhoneNumber(e) {
  120 + console.log(e)
  121 +
  122 + wx.login({
  123 + success: (res) => {
  124 + console.log(res);
  125 +
  126 + // this.getUserProfile();
  127 +
  128 + this.$store.dispatch(`user/login`, {
  129 + way: 'wechat_code',
  130 + type: 'student',
  131 + jsCode: res.code,
  132 + code: e.detail.code,
  133 + })
  134 + }
  135 + })
  136 + },
  137 +
  138 + phoneLogin() {
  139 + this.$store.dispatch(`user/login`, {
  140 + way: 'name',
  141 + type: 'student',
  142 + username: this.form.mobile,
  143 + password: this.form.password,
  144 + })
  145 + },
  146 +
  147 + handelMobileLogin() {
  148 + this.$u.route({
  149 + url: "/pages/main/my/mobileLogin/mobileLogin",
  150 + params: {}
  151 + });
  152 + }
  153 + }
  154 +
  155 + }
  156 +</script>
  157 +
  158 +<style lang="scss" scoped>
  159 + .login {
  160 + width: 100%;
  161 + height: 100%;
  162 + position: relative;
  163 +
  164 + .box {
  165 + width: 100%;
  166 + height: 100%;
  167 + position: absolute;
  168 + top: 0;
  169 + left: 0;
  170 +
  171 + .logo {
  172 + padding: 156rpx 0 0 0;
  173 + width: 260rpx;
  174 + margin: 0 auto;
  175 + }
  176 +
  177 + .changeLogin {
  178 + width: 100%;
  179 + text-align: center;
  180 + margin: 48rpx 0 0 0;
  181 + font-size: 15px;
  182 + font-weight: 400;
  183 + color: rgba(0, 0, 0, 0.65);
  184 + }
  185 +
  186 + .agreement {
  187 + position: fixed;
  188 + left: 0;
  189 + bottom: 34rpx;
  190 + display: flex;
  191 + flex-direction: row;
  192 + justify-content: flex-start;
  193 + font-size: 24rpx;
  194 + margin: 30rpx 0 32rpx 0;
  195 + padding: 0 50rpx;
  196 +
  197 + .check {
  198 + width: 40rpx;
  199 + padding: 3rpx 0 0 0;
  200 + // display: inline-block;
  201 + }
  202 +
  203 + .text {
  204 + // display: inline-block;
  205 + color: rgba(0, 0, 0, 0.45);
  206 +
  207 + .span {
  208 + color: #0CB17A;
  209 + }
  210 + }
  211 + }
  212 +
  213 + .form {
  214 + margin: 30rpx 60rpx 0px;
  215 + }
  216 +
  217 + .btn {
  218 + margin-top: 200rpx;
  219 + padding: 0 48rpx;
  220 + }
  221 +
  222 + .wxLogin {
  223 + display: flex;
  224 + align-items: center;
  225 + flex-direction: column;
  226 + margin-top: 180rpx;
  227 +
  228 + button {
  229 + background-color: transparent;
  230 + }
  231 +
  232 + button::after {
  233 + border: initial
  234 + }
  235 +
  236 + image {
  237 + width: 96rpx;
  238 + height: 96rpx;
  239 + }
  240 +
  241 + text {
  242 + margin-top: 0rpx;
  243 + }
  244 + }
  245 + }
  246 + }
  247 +</style>
... ...
  1 +<template>
  2 + <view class="login">
  3 + <view class="box">
  4 + <view v-if="changeLogin == '账号密码登录'" class="form">
  5 + <u-form :model="form" ref="uForm">
  6 + <u-form-item prop="mobile"
  7 + :leftIconStyle="{width:'40rpx',height:'40rpx', position:'relative', right:'8rpx'}"
  8 + left-icon="/static/img/my/login_mobile.png" borderBottom>
  9 + <u-input v-model="form.mobile" border="none" maxlength='11' placeholder="请输入手机号"
  10 + :customStyle="{fontSize:'17px'}" />
  11 + </u-form-item>
  12 + <u-form-item prop="verifyCode"
  13 + :leftIconStyle="{width:'40rpx',height:'40rpx', position:'relative', right:'8rpx'}"
  14 + left-icon="/static/img/my/login_code1.png" borderBottom>
  15 + <u-input v-model="form.password" border="none" placeholder="请输入验证码"
  16 + :customStyle="{fontSize:'17px'}" />
  17 + <u-button type="default" size="mini" slot="right" :hair-line="false"
  18 + :custom-style="{color:'#0CB17A', border:'none',fontSize:'30rpx'}" @click="getCode">
  19 + {{codeText}}
  20 + </u-button>
  21 + <u-code ref="uCode" @change="codeChange"></u-code>
  22 + </u-form-item>
  23 + </u-form>
  24 + </view>
  25 + <view v-else class="form">
  26 + <u-form :model="form" ref="uForm">
  27 + <u-form-item prop="mobile"
  28 + :left-icon-style="{width:'40rpx',height:'40rpx', position:'relative', right:'8rpx'}"
  29 + left-icon="/static/img/my/login_mobile.png" borderBottom>
  30 + <u-input v-model="form.mobile" border="none" placeholder="请输入账号"
  31 + :customStyle="{fontSize:'17px'}" />
  32 + </u-form-item>
  33 + <u-form-item prop="verifyCode"
  34 + :left-icon-style="{width:'40rpx',height:'40rpx', position:'relative', right:'8rpx'}"
  35 + left-icon="/static/img/my/login_code2.png" borderBottom>
  36 + <u-input v-model="form.password" border="none" type='password' placeholder="请输入密码"
  37 + :customStyle="{fontSize:'17px'}" />
  38 + </u-form-item>
  39 + </u-form>
  40 + </view>
  41 +
  42 + <view class="btn button_warp">
  43 + <c-button type="confirm" shape="circle"
  44 + :customStyle="{borderRadius:'48rpx',fontSize:'34rpx',color:'#fff',fontWeight:'400'}" text="登录"
  45 + :disabled="isDisable" @click="phoneLogin"></c-button>
  46 + </view>
  47 +
  48 + <view class="changeLogin" @click="onchangeLogin">
  49 + {{changeLogin}}
  50 + </view>
  51 +
  52 + <view class="agreement">
  53 + <view class="check">
  54 + <u-checkbox-group @change="checkboxChange" v-model="checked">
  55 + <u-checkbox size="28" activeColor="#0CB17A" shape="circle">
  56 + </u-checkbox>
  57 + </u-checkbox-group>
  58 + </view>
  59 + <view class="text">
  60 + <text>您已阅读理解并同意</text>
  61 + <text class="span" @click="linkService">《优学乐业服务协议》、</text>
  62 + <text class="span" @click="linkPolicy">《优学乐业隐私政策》</text>
  63 + </view>
  64 + </view>
  65 + </view>
  66 + <view>
  67 + <u-toast ref="uToast" />
  68 + </view>
  69 + </view>
  70 +</template>
  71 +
  72 +<script>
  73 + import {
  74 + mapState,
  75 + mapActions
  76 + } from 'vuex'
  77 + import {
  78 + getSmsCodeApi,
  79 + } from '@/config/api.js';
  80 + import md5 from '@/common/md5';
  81 +
  82 + export default {
  83 + data() {
  84 + return {
  85 + errorType: ['toast'],
  86 + isDisable: true,
  87 + checked: [],
  88 + service: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/agreement/%E3%80%8A%E4%BC%98%E5%AD%A6%E4%B9%90%E4%B8%9A%E7%94%A8%E6%88%B7%E6%9C%8D%E5%8A%A1%E5%8D%8F%E8%AE%AE%E3%80%8B.htm",
  89 + policy: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/agreement/%E3%80%8A%E4%BC%98%E5%AD%A6%E4%B9%90%E4%B8%9A%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE%E3%80%8B.htm",
  90 + form: {
  91 + mobile: '',
  92 + password: '',
  93 + },
  94 + changeLogin: '账号密码登录',
  95 + codeText: '发送验证码',
  96 + }
  97 + },
  98 +
  99 + onLoad() {
  100 + const {
  101 + dispatch
  102 + } = this.$store;
  103 +
  104 + },
  105 +
  106 + onShow() {
  107 +
  108 + },
  109 +
  110 + watch: {
  111 + checked: function(newVal, oldVal) {
  112 + this.isDisable = newVal.length != 0 ? false : true;
  113 +
  114 + }
  115 + },
  116 +
  117 +
  118 + computed: {
  119 + ...mapState('user', {
  120 + // 箭头函数可使代码更简练
  121 + isReg: 'isReg',
  122 +
  123 + }),
  124 + },
  125 +
  126 + methods: {
  127 +
  128 + onchangeLogin() {
  129 + if (this.changeLogin == '验证码登录') {
  130 + this.changeLogin = '账号密码登录';
  131 + } else {
  132 + this.changeLogin = '验证码登录';
  133 + }
  134 + },
  135 +
  136 + linkService() {
  137 + console.log(this)
  138 + this.$u.route({
  139 + url: `/pages/common/webview/webview?navtitle=服务协议&url=${this.service}`,
  140 + })
  141 + },
  142 +
  143 + linkPolicy() {
  144 + this.$u.route({
  145 + url: `/pages/common/webview/webview?navtitle=隐私政策&url=${this.policy}`,
  146 + })
  147 + },
  148 +
  149 + checkboxChange(n) {
  150 + // console.log(n)
  151 + },
  152 +
  153 + getUserProfile() {
  154 + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
  155 + // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
  156 + wx.getUserProfile({
  157 + desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  158 + success: (res) => {
  159 + console.log('getUserProfile...', res)
  160 + // this.$store.commit('setWenxinUserInfo', res);
  161 + this.$u.vuex('vuex_weixinUserInfo', res.userInfo);
  162 + }
  163 + })
  164 + },
  165 +
  166 + codeChange(text) {
  167 + this.codeText = text;
  168 + },
  169 +
  170 + getCode() {
  171 + const {
  172 + mobile = ''
  173 + } = this.form;
  174 +
  175 + if (!(mobile && /^1[0-9]{10}$/.test(mobile))) {
  176 + this.$refs.uToast.show({
  177 + message: '请填写正确手机号',
  178 + type: 'error',
  179 + duration: 1500,
  180 + })
  181 +
  182 + } else {
  183 + if (this.$refs.uCode.canGetCode) {
  184 + // 模拟向后端请求验证码
  185 + uni.showLoading({
  186 + title: '正在获取验证码'
  187 + })
  188 + setTimeout(() => {
  189 + uni.hideLoading();
  190 + // 通知验证码组件内部开始倒计时
  191 + this.$refs.uCode.start();
  192 +
  193 + console.log(mobile)
  194 +
  195 + getSmsCodeApi({
  196 + phone: mobile
  197 + })
  198 +
  199 + }, 1000);
  200 + } else {
  201 + this.$u.toast('倒计时结束后再发送');
  202 + }
  203 + }
  204 + },
  205 +
  206 + phoneLogin() {
  207 + // this.getUserProfile();
  208 + if (this.changeLogin == '账号密码登录') {
  209 + this.$store.dispatch(`user/login`, {
  210 + way: 'code',
  211 + type: 'student',
  212 + phone: this.form.mobile,
  213 + code: this.form.password,
  214 + })
  215 + } else {
  216 + console.log(md5.hex_md5(this.form.password));
  217 + this.$store.dispatch(`user/login`, {
  218 + way: 'name',
  219 + type: 'student',
  220 + username: this.form.mobile,
  221 + password: md5.hex_md5(this.form.password),
  222 + })
  223 + }
  224 + },
  225 + }
  226 +
  227 + }
  228 +</script>
  229 +
  230 +<style lang="scss" scoped>
  231 + .login {
  232 + width: 100%;
  233 + height: 100%;
  234 + position: relative;
  235 +
  236 + .box {
  237 + width: 100%;
  238 + height: 100%;
  239 + position: absolute;
  240 + top: 0;
  241 + left: 0;
  242 +
  243 + .logo {
  244 + padding: 156rpx 0 0 0;
  245 + width: 120rpx;
  246 + margin: 0 auto;
  247 + }
  248 +
  249 + .name {
  250 + margin: 32rpx 0 0 0;
  251 + text-align: center;
  252 + font-size: 48rpx;
  253 + line-height: 66rpx;
  254 + color: #000000;
  255 + font-weight: 600;
  256 + }
  257 +
  258 + .changeLogin {
  259 + width: 100%;
  260 + text-align: center;
  261 + margin: 48rpx 0 0 0;
  262 + font-size: 15px;
  263 + font-weight: 400;
  264 + color: #0CB17A;
  265 + }
  266 +
  267 + .agreement {
  268 + position: fixed;
  269 + left: 0;
  270 + bottom: 34rpx;
  271 + display: flex;
  272 + flex-direction: row;
  273 + justify-content: flex-start;
  274 + font-size: 24rpx;
  275 + margin: 30rpx 0 32rpx 0;
  276 + padding: 0 50rpx;
  277 +
  278 + .check {
  279 + width: 40rpx;
  280 + padding: 5rpx 0 0 0;
  281 + // display: inline-block;
  282 + }
  283 +
  284 + .text {
  285 + // display: inline-block;
  286 + color: rgba(0, 0, 0, 0.45);
  287 +
  288 + .span {
  289 + color: #0CB17A;
  290 + }
  291 + }
  292 + }
  293 +
  294 + .form {
  295 + margin: 128rpx 60rpx 0px;
  296 + }
  297 +
  298 + .btn {
  299 + margin-top: 128rpx;
  300 + padding: 0 48rpx;
  301 + }
  302 +
  303 + .wxLogin {
  304 + display: flex;
  305 + align-items: center;
  306 + flex-direction: column;
  307 + margin-top: 180rpx;
  308 +
  309 + button {
  310 + background-color: transparent;
  311 + }
  312 +
  313 + button::after {
  314 + border: initial
  315 + }
  316 +
  317 + image {
  318 + width: 96rpx;
  319 + height: 96rpx;
  320 + }
  321 +
  322 + text {
  323 + margin-top: 0rpx;
  324 + }
  325 + }
  326 + }
  327 + }
  328 +</style>
... ...
... ... @@ -5,10 +5,6 @@
5 5 </template>
6 6
7 7 <script>
8   - import {
9   - postMenu,
10   - getMenu
11   - } from '@/config/api.js';
12 8
13 9 export default {
14 10 data() {
... ... @@ -18,16 +14,7 @@
18 14 },
19 15
20 16 onLoad() {
21   - // 发出post,假设需要带上token
22   - postMenu({
23   - custom: {
24   - auth: true
25   - }
26   - }).then(() => {
27   -
28   - }).catch(() => {
29   -
30   - })
  17 +
31 18 },
32 19
33 20 onShow() {
... ...
  1 +<template>
  2 + <view class="internship">
  3 +
  4 + </view>
  5 +</template>
  6 +
  7 +<script>
  8 +
  9 + export default {
  10 + data() {
  11 + return {
  12 +
  13 + };
  14 + },
  15 +
  16 + onLoad() {},
  17 +
  18 + async onShow() {
  19 +
  20 + },
  21 +
  22 + methods: {
  23 +
  24 + },
  25 + };
  26 +</script>
  27 +
  28 +<style lang="scss" scoped>
  29 +
  30 +
  31 +</style>
... ...
... ... @@ -35,7 +35,7 @@ const store = new Vuex.Store({
35 35 position,
36 36 },
37 37 state: {
38   - vuex_appId: 'wx5177bff86a427016',
  38 + vuex_appId: 'wx84b71301436652ce',
39 39 vuex_corpId: 'ww4300c59cb9537f9e',//企业ID
40 40 // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
41 41 // 加上vuex_前缀,是防止变量名冲突,也让人一目了然
... ... @@ -46,7 +46,7 @@ const store = new Vuex.Store({
46 46 // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
47 47 vuex_version: '1.0.1',
48 48 vuex_demo: '绛紫',
49   - vuex_baseImgUrl: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/job-sharing",
  49 + vuex_baseImgUrl: "https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/yxly-teacher",
50 50 vuex_ossUrl: "https://yxly.oss-cn-beijing.aliyuncs.com",
51 51 vuex_ossUrlPubilc: "https://yxlypublic.oss-cn-beijing.aliyuncs.com",
52 52 vuex_customer_chatUrl:"https://work.weixin.qq.com/kfid/kfc04063cd2d1081221",//企业微信客服
... ...
1   -const state = () => ({
2   - openid: '',
3   - isReg: '',
4   - id: '',
5   - name: '',
6   - number: '',
7   - password: '',
8   - phone: '',
9   - status: '',
10   - type: '',
11   - username: '',
12   - userBasicInfo: {},
13   -
14   -})
15   -
16   -// getters
17   -const getters = {
18   - // doneOpenid: (state, getters, rootState) => {
19   - // return state.openid
20   - // },
21   -}
22   -
23   -// actions
24   -const actions = {
25   -
26   - async login({
27   - commit,
28   - dispatch,
29   - state
30   - }, params) {
31   - const login_result = await uni.$u.api.getLoginApi({
32   - ...params
33   - });
34   -
35   - if (login_result) {
  1 +import {
  2 + postTokenApi,
  3 + getUserInfoApi,
  4 + } from '@/config/api.js';
  5 +
  6 + const state = () => ({
  7 + openid: '',
  8 + isReg: '',
  9 + id: '',
  10 + name: '',
  11 + number: '',
  12 + password: '',
  13 + phone: '',
  14 + status: '',
  15 + type: '',
  16 + username: '',
  17 + userBasicInfo: {},
  18 +
  19 + })
  20 +
  21 + const getters = {
  22 + // doneOpenid: (state, getters, rootState) => {
  23 + // return state.openid
  24 + // },
  25 + }
  26 +
  27 + // actions
  28 + const actions = {
  29 +
  30 + async login({
  31 + commit,
  32 + dispatch,
  33 + state
  34 + }, params) {
  35 + const login_result = await postTokenApi({
  36 + ...params
  37 + }, {
  38 + custom: {
  39 + auth: false
  40 + }
  41 + });
36 42
37   - let vuex_token = `Bearer ${login_result.access_token}`
38   - await uni.$u.vuex('vuex_token', vuex_token);
39   - await uni.$u.vuex('vuex_phone', login_result.phone);
40   -
41   - switch (login_result.status) {
42   -
43   - case 'not_reg': //未注册
44   - // uni.$u.route({
45   - // url: '/pages/student/my/login/login',
46   - // type: 'reLaunch',
47   - // });
48   - break;
49   -
50   - case 'annulled': //已注销
51   - // uni.$u.route({
52   - // url: '/pages/student/my/written-off/written-off',
53   - // type: 'navigateTo',
54   - // });
55   - break;
56   -
57   - case 'annulling': //注销中
58   - uni.$u.route({
59   - url: '/pages/common/login/login',
60   - // type: 'navigateTo',
61   - });
62   - break;
63   -
64   - case 'active': //已注册
65   - const userInfo = await dispatch(`getUserInfo`);
66   -
67   - if (userInfo) {
68   - uni.navigateBack({
69   - delta: 1
70   - });
71   - }
72   -
73   - break;
74   - }
75   -
76   - return login_result;
77   - }
78   -
79   -
80   - },
81   -
82   - async loginOut({
83   - commit,
84   - dispatch,
85   - state
86   - }, params) {
87   - console.log('loginOut')
88   - await uni.$u.vuex('vuex_user', '');
89   - await uni.$u.vuex('vuex_token', '');
90   - await uni.setStorageSync('lifeData', {});
91   -
92   - uni.$u.route('/pages/common/login/login');
93   - },
94   -
95   - async getUserInfo({
96   - commit,
97   - dispatch,
98   - state
99   - }, params) {
100   -
101   - const userInfo = await uni.$u.api.getUserApi();
102   - await uni.$u.vuex('vuex_user', userInfo);
103   -
104   - return userInfo;
105   - },
106   -}
107   -
108   -// mutations
109   -const mutations = {
110   -
111   - setUserInfo(state, userInfo) {
112   - state.id = userInfo.id;
113   - state.name = userInfo.name;
114   - state.phone = userInfo.phone;
115   - state.username = userInfo.username;
116   - state.userBasicInfo = userInfo.userBasicInfo;
117   - },
118   -}
119   -
120   -export default {
121   - namespaced: true,
122   - state,
123   - getters,
124   - actions,
125   - mutations
126   -}
  43 + console.log(login_result)
  44 +
  45 + if (login_result) {
  46 +
  47 + let vuex_token = `Bearer ${login_result.access_token}`
  48 + await uni.$u.vuex('vuex_token', vuex_token);
  49 + await uni.$u.vuex('vuex_phone', login_result.phone);
  50 +
  51 + switch (login_result.status) {
  52 +
  53 + case 'not_reg': //未注册
  54 + uni.$u.route({
  55 + url: '/pages/student/my/login/login',
  56 + type: 'reLaunch',
  57 + });
  58 + break;
  59 +
  60 + case 'annulled': //已注销
  61 + uni.$u.route({
  62 + url: '/pages/student/my/written-off/written-off',
  63 + type: 'navigateTo',
  64 + });
  65 + break;
  66 +
  67 + case 'annulling': //注销中
  68 + uni.$u.route({
  69 + url: '/pages/student/my/freezing/freezing',
  70 + type: 'navigateTo',
  71 + });
  72 + break;
  73 +
  74 + case 'active': //已注册
  75 + const userInfo = await dispatch(`getUserInfo`);
  76 +
  77 + // if (userInfo) {
  78 + // const {
  79 + // student = {}
  80 + // } = userInfo;
  81 + // if (student && JSON.stringify(student) != '{}' && student.status == 'verified') {
  82 + // uni.$u.route({
  83 + // url: 'pages/student/tabBar/internship/internship',
  84 + // type: 'switchTab',
  85 + // params: {
  86 +
  87 + // }
  88 + // })
  89 +
  90 + // } else {
  91 + // uni.$u.route({
  92 + // url: `/pages/student/my/student-status-certification/student-status-certification`,
  93 + // type: 'reLaunch',
  94 + // params: {
  95 +
  96 + // }
  97 + // })
  98 + // }
  99 + // }
  100 +
  101 + break;
  102 + }
  103 +
  104 + return login_result;
  105 + }
  106 +
  107 +
  108 + },
  109 +
  110 + async loginOut({
  111 + commit,
  112 + dispatch,
  113 + state
  114 + }, params) {
  115 +
  116 + await uni.$u.vuex('vuex_user', {});
  117 + await uni.$u.vuex('vuex_token', {});
  118 + await uni.setStorageSync('lifeData', {});
  119 +
  120 + uni.$u.route('/pages/student/my/login/login');
  121 + },
  122 +
  123 + async getUserInfo({
  124 + commit,
  125 + dispatch,
  126 + state
  127 + }, params) {
  128 +
  129 + const userInfo = await getUserInfoApi();
  130 +
  131 + uni.$u.vuex('vuex_user', userInfo);
  132 +
  133 + return userInfo;
  134 + },
  135 + }
  136 +
  137 + // mutations
  138 + const mutations = {
  139 +
  140 + setUserInfo(state, userInfo) {
  141 + state.id = userInfo.id;
  142 + state.name = userInfo.name;
  143 + state.phone = userInfo.phone;
  144 + state.username = userInfo.username;
  145 + state.userBasicInfo = userInfo.userBasicInfo;
  146 + },
  147 + }
  148 +
  149 + export default {
  150 + namespaced: true,
  151 + state,
  152 + getters,
  153 + actions,
  154 + mutations
  155 + }
... ...
注册登录 后发表评论