From e486eed737f971a7ceec251da4f0011dee0f5de2 Mon Sep 17 00:00:00 2001 From: axzsd Date: Tue, 16 May 2023 17:34:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- builds/Dockerfile | 63 ++++++++++++++++++++++++++++++++++ builds/Jenkinsfile | 45 ++++++++++++++++++++++++ builds/docker-compose-test.yml | 28 +++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 builds/Dockerfile create mode 100644 builds/Jenkinsfile create mode 100644 builds/docker-compose-test.yml diff --git a/builds/Dockerfile b/builds/Dockerfile new file mode 100644 index 000000000..bb75b1aac --- /dev/null +++ b/builds/Dockerfile @@ -0,0 +1,63 @@ +FROM adoptopenjdk/openjdk11:latest + +LABEL Author="axzsd" \ + Email="atva725@qq.com" \ + Description="cmx活动" + +ENV SPRING_PROFILES_ACTIVE="dev" +ENV JAVA_OPTIONS "-Xms256m -Xmx530m \ +-Dfile.encoding=UTF-8 \ +-Djava.awt.headless=true \ +-Dsun.net.client.defaultConnectTimeout=10000 \ +-Dsun.net.client.defaultReadTimeout=30000" + +#RUN apt-get update && apt-get install bash --only-upgrade \ +# && apt-get install libaprutil1 --only-upgrade \ +# && apt-get install coreutils --only-upgrade \ +# && apt-get install libgcc1 --only-upgrade \ +# && apt-get install gcc-6-base --only-upgrade \ +# && apt-get install libstdc++6 --only-upgrade \ +# && apt-get install multiarch-support --only-upgrade \ +# && apt-get install libc6 --only-upgrade \ +# && apt-get install libc-bin --only-upgrade \ +# && apt-get install libpng16-16 --only-upgrade \ +# && apt-get install unzip --only-upgrade \ +# && apt-get install mount --only-upgrade \ +# && apt-get install libsmartcols1 --only-upgrade \ +# && apt-get install libblkid1 --only-upgrade \ +# && apt-get install libfdisk1 --only-upgrade \ +# && apt-get install libmount1 --only-upgrade \ +# && apt-get install bsdutils --only-upgrade \ +# && apt-get install libuuid1 --only-upgrade \ +# && apt-get install util-linux --only-upgrade \ +# && apt-get install gnupg-agent --only-upgrade \ +# && apt-get install gpgv --only-upgrade \ +# && apt-get install dirmngr --only-upgrade \ +# && apt-get install gnupg --only-upgrade \ +# && apt-get install libtasn1-6 --only-upgrade \ +# && apt-get install ncurses-bin --only-upgrade \ +# && apt-get install libncursesw5 --only-upgrade \ +# && apt-get install ncurses-base --only-upgrade \ +# && apt-get install libtinfo5 --only-upgrade \ +# && apt-get install bash --only-upgrade \ +# && apt-get install wget --only-upgrade \ +# && apt-get install libsepol1 --only-upgrade \ +# && apt-get install perl-base --only-upgrade \ +# && apt-get install libpcre3 --only-upgrade \ +# && apt-get install git --only-upgrade \ +# && apt-get install git-man --only-upgrade \ +# && apt-get install libncurses5 --only-upgrade \ +# && apt-get install openssh-client --only-upgrade \ +# && apt-get install libperl5.24 --only-upgrade \ +# && apt-get install perl --only-upgrade \ +# && apt-get install perl-modules-5.24 --only-upgrade \ +# && apt-get install python --only-upgrade \ +# && apt-get install python-minimal --only-upgrade \ +# && apt-get install libpython-stdlib --only-upgrade \ +# && apt clean + +WORKDIR /opt +COPY hound-server/target/hound-server.jar /opt/app.jar + +EXPOSE 3001 +ENTRYPOINT exec java $JAVA_OPTIONS -jar -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE} /opt/app.jar diff --git a/builds/Jenkinsfile b/builds/Jenkinsfile new file mode 100644 index 000000000..a718d2c34 --- /dev/null +++ b/builds/Jenkinsfile @@ -0,0 +1,45 @@ +pipeline { + agent any + + environment { + INTRANET_REGISTRY='192.168.1.124:10083' + PUBLIC_REGISTRY='192.168.1.124:10083' + IMAGE_NAMESPACE='cmx' + IMAGE_NAME='yudao-server-api' + GIT_BRANCH='feature/mall_product' + Dockerfile='builds/Dockerfile' + DockerComposefile='docker-compose-test.yml' + } + + + stages { + stage('Pull Code') { + steps { + checkout([$class: 'GitSCM', branches: [[name: "$GIT_BRANCH"]], extensions: [], userRemoteConfigs: [[credentialsId: 'Hx-Deploy-Git', url: 'http://117.33.142.185:3000/epiboly/hound-server-parent.git']]]) + } + } + + stage('compile & buildImage->push') { + steps { + withMaven(maven: 'M3') { + sh 'mvn clean package -Dmaven.test.skip=true' + } + withCredentials([usernamePassword(credentialsId: 'HxDockerRepo', passwordVariable: 'DOCKER_PASSWORD', usernameVariable: 'DOCKER_USERNAME')]) { + sh 'docker build -f $Dockerfile -t $INTRANET_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID .' + sh 'echo "push start..."' + sh 'docker push $INTRANET_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID' + } + } + } + + stage('SSH Deploy') { + steps { + withCredentials([sshUserPrivateKey(credentialsId: 'halo-test-ssh', keyFileVariable: 'primaryKeyVar', usernameVariable: 'userVar')]) { + sh 'ssh -i ${primaryKeyVar} root@36.41.184.13 "curl -s https://cmx.bskies.cc:8000/shell/deploy/init_work_dir.sh | bash -s /opt/app/${IMAGE_NAME}"' + sh 'scp -i ${primaryKeyVar} builds/${DockerComposefile} root@36.41.184.13:/opt/app/${IMAGE_NAME}' + sh 'ssh -i ${primaryKeyVar} root@36.41.184.13 "curl -s https://cmx.bskies.cc:8000/shell/deploy/docker_deploy.sh | bash -s /opt/app/${IMAGE_NAME} $PUBLIC_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID /opt/app/${IMAGE_NAME}/$DockerComposefile"' + } + } + } + } +} \ No newline at end of file diff --git a/builds/docker-compose-test.yml b/builds/docker-compose-test.yml new file mode 100644 index 000000000..14c10dcfe --- /dev/null +++ b/builds/docker-compose-test.yml @@ -0,0 +1,28 @@ +version: "3.9" +services: + yudao-server: + image: ${IMAGE_VERSION} + restart: always + privileged: true + container_name: yudao-server + environment: + TZ: Asia/Shanghai + SPRING_PROFILES_ACTIVE: test + volumes: + - /opt/logs/cmx:/opt/logs + ulimits: + nproc: 65535 + nofile: + soft: 20000 + hard: 40000 + ports: + - "3001:3001" + deploy: + resources: + limits: + memory: 600MB + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3001/hound-api/actuator/health"] + timeout: 30s + interval: 45s + retries: 3 \ No newline at end of file From 7b2bd4c26bf1e5a3f74587538bbac7acb36b87c2 Mon Sep 17 00:00:00 2001 From: axzsd Date: Tue, 16 May 2023 17:47:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- builds/Dockerfile | 57 +++---------------- builds/Jenkinsfile | 2 +- builds/docker-compose-test.yml | 10 ++-- .../src/main/resources/application-dev.yaml | 2 + 4 files changed, 15 insertions(+), 56 deletions(-) diff --git a/builds/Dockerfile b/builds/Dockerfile index bb75b1aac..995db64f9 100644 --- a/builds/Dockerfile +++ b/builds/Dockerfile @@ -1,63 +1,20 @@ -FROM adoptopenjdk/openjdk11:latest +FROM registry.cn-hangzhou.aliyuncs.com/lrh-public/openjdk:8u222-jre-up LABEL Author="axzsd" \ Email="atva725@qq.com" \ - Description="cmx活动" + Description="创盈支付服务端" ENV SPRING_PROFILES_ACTIVE="dev" -ENV JAVA_OPTIONS "-Xms256m -Xmx530m \ +ENV JAVA_OPTIONS "-Xms800m -Xmx800m \ +-XX:+HeapDumpOnOutOfMemoryError \ -Dfile.encoding=UTF-8 \ -Djava.awt.headless=true \ -Dsun.net.client.defaultConnectTimeout=10000 \ -Dsun.net.client.defaultReadTimeout=30000" -#RUN apt-get update && apt-get install bash --only-upgrade \ -# && apt-get install libaprutil1 --only-upgrade \ -# && apt-get install coreutils --only-upgrade \ -# && apt-get install libgcc1 --only-upgrade \ -# && apt-get install gcc-6-base --only-upgrade \ -# && apt-get install libstdc++6 --only-upgrade \ -# && apt-get install multiarch-support --only-upgrade \ -# && apt-get install libc6 --only-upgrade \ -# && apt-get install libc-bin --only-upgrade \ -# && apt-get install libpng16-16 --only-upgrade \ -# && apt-get install unzip --only-upgrade \ -# && apt-get install mount --only-upgrade \ -# && apt-get install libsmartcols1 --only-upgrade \ -# && apt-get install libblkid1 --only-upgrade \ -# && apt-get install libfdisk1 --only-upgrade \ -# && apt-get install libmount1 --only-upgrade \ -# && apt-get install bsdutils --only-upgrade \ -# && apt-get install libuuid1 --only-upgrade \ -# && apt-get install util-linux --only-upgrade \ -# && apt-get install gnupg-agent --only-upgrade \ -# && apt-get install gpgv --only-upgrade \ -# && apt-get install dirmngr --only-upgrade \ -# && apt-get install gnupg --only-upgrade \ -# && apt-get install libtasn1-6 --only-upgrade \ -# && apt-get install ncurses-bin --only-upgrade \ -# && apt-get install libncursesw5 --only-upgrade \ -# && apt-get install ncurses-base --only-upgrade \ -# && apt-get install libtinfo5 --only-upgrade \ -# && apt-get install bash --only-upgrade \ -# && apt-get install wget --only-upgrade \ -# && apt-get install libsepol1 --only-upgrade \ -# && apt-get install perl-base --only-upgrade \ -# && apt-get install libpcre3 --only-upgrade \ -# && apt-get install git --only-upgrade \ -# && apt-get install git-man --only-upgrade \ -# && apt-get install libncurses5 --only-upgrade \ -# && apt-get install openssh-client --only-upgrade \ -# && apt-get install libperl5.24 --only-upgrade \ -# && apt-get install perl --only-upgrade \ -# && apt-get install perl-modules-5.24 --only-upgrade \ -# && apt-get install python --only-upgrade \ -# && apt-get install python-minimal --only-upgrade \ -# && apt-get install libpython-stdlib --only-upgrade \ -# && apt clean -WORKDIR /opt -COPY hound-server/target/hound-server.jar /opt/app.jar +WORKDIR /work/projects/yudao-server +COPY yudao-server/target/yudao-server.jar /opt/app.jar -EXPOSE 3001 +EXPOSE 48080 ENTRYPOINT exec java $JAVA_OPTIONS -jar -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE} /opt/app.jar diff --git a/builds/Jenkinsfile b/builds/Jenkinsfile index a718d2c34..9f4a8b3f9 100644 --- a/builds/Jenkinsfile +++ b/builds/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { stages { stage('Pull Code') { steps { - checkout([$class: 'GitSCM', branches: [[name: "$GIT_BRANCH"]], extensions: [], userRemoteConfigs: [[credentialsId: 'Hx-Deploy-Git', url: 'http://117.33.142.185:3000/epiboly/hound-server-parent.git']]]) + checkout([$class: 'GitSCM', branches: [[name: "$GIT_BRANCH"]], extensions: [cloneOption(depth: 1, noTags: true, reference: '', shallow: true)], userRemoteConfigs: [[credentialsId: 'Hx-Deploy-Git', url: 'http://117.33.142.185:3000/zenghuapei/cyywl_server.git']]]) } } diff --git a/builds/docker-compose-test.yml b/builds/docker-compose-test.yml index 14c10dcfe..267950ae4 100644 --- a/builds/docker-compose-test.yml +++ b/builds/docker-compose-test.yml @@ -8,21 +8,21 @@ services: environment: TZ: Asia/Shanghai SPRING_PROFILES_ACTIVE: test - volumes: - - /opt/logs/cmx:/opt/logs +# volumes: +# - /opt/logs/cyywl:/work/projects/yudao-server ulimits: nproc: 65535 nofile: soft: 20000 hard: 40000 ports: - - "3001:3001" + - "48080:48080" deploy: resources: limits: - memory: 600MB + memory: 800MB healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3001/hound-api/actuator/health"] + test: ["CMD", "curl", "-f", "http://localhost:48080/cyyywl-api/actuator/health"] timeout: 30s interval: 45s retries: 3 \ No newline at end of file diff --git a/yudao-server/src/main/resources/application-dev.yaml b/yudao-server/src/main/resources/application-dev.yaml index e4cafd6a9..cc95bc1ea 100644 --- a/yudao-server/src/main/resources/application-dev.yaml +++ b/yudao-server/src/main/resources/application-dev.yaml @@ -1,5 +1,7 @@ server: port: 48080 + servlet: + context-path: /cyyywl-api --- #################### 数据库相关配置 #################### From 24b4be91d096d8eca52e7e57d92ea5ad18422127 Mon Sep 17 00:00:00 2001 From: TianYu <332368756@qq.com> Date: Tue, 16 May 2023 18:00:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E5=8A=9F=E8=83=BD=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/system/tenant/index.vue | 294 +++++++----- yudao-ui-app/App.vue | 439 +++++++++--------- yudao-ui-app/api/api.js | 41 +- yudao-ui-app/api/user.js | 13 +- yudao-ui-app/config/app.js | 2 +- yudao-ui-app/config/cache.js | 1 + yudao-ui-app/pages.json | 18 +- yudao-ui-app/pages/user/index.vue | 62 ++- yudao-ui-app/pages/users/login/index.vue | 198 +------- yudao-ui-app/pages/users/register/index.vue | 2 +- .../pages/users/retrievePassword/index.vue | 26 +- .../pages/users/user_address/index.vue | 24 +- .../pages/users/user_address_list/index.vue | 8 +- yudao-ui-app/pages/users/user_info/index.vue | 14 +- yudao-ui-app/store/modules/app.js | 9 +- yudao-ui-app/utils/request.js | 2 +- yudao-ui-app/utils/util.js | 37 +- 17 files changed, 563 insertions(+), 627 deletions(-) diff --git a/yudao-ui-admin/src/views/system/tenant/index.vue b/yudao-ui-admin/src/views/system/tenant/index.vue index 99c5f2116..ff70cead4 100755 --- a/yudao-ui-admin/src/views/system/tenant/index.vue +++ b/yudao-ui-admin/src/views/system/tenant/index.vue @@ -1,26 +1,30 @@ diff --git a/yudao-ui-app/api/api.js b/yudao-ui-app/api/api.js index 8d1845b94..df2519887 100644 --- a/yudao-ui-app/api/api.js +++ b/yudao-ui-app/api/api.js @@ -1,12 +1,12 @@ import request from "@/utils/request.js"; /** * 公共接口 ,优惠券接口 , 行业此讯 , 手机号码注册 - * + * */ /** * 获取主页数据 无需授权 - * + * */ export function getIndexData() { @@ -15,17 +15,22 @@ export function getIndexData() /** * 获取登录授权login - * + * */ export function getLogo() { return request.get('wechat/getLogo', {}, { noAuth : true}); } +export function refreshToken(token) +{ + return request.post('member/auth/refresh-token?refreshToken=' + token, {}, { noAuth : true}); +} + /** * 保存form_id - * @param string formId + * @param string formId */ export function setFormId(formId) { return request.post("wechat/set_form_id", { formId: formId}); @@ -34,7 +39,7 @@ export function setFormId(formId) { /** * 领取优惠卷 * @param int couponId - * + * */ export function setCouponReceive(couponId){ return request.post('coupon/receive', { couponId: couponId}); @@ -57,7 +62,7 @@ export function getUserCoupons(data){ /** * 文章分类列表 - * + * */ export function getArticleCategoryList(){ return request.get('article/category/list',{},{noAuth:true}) @@ -66,7 +71,7 @@ export function getArticleCategoryList(){ /** * 文章列表 * @param int cid - * + * */ export function getArticleList(cid,data){ return request.get('article/list/' + cid, data,{noAuth:true}) @@ -74,7 +79,7 @@ export function getArticleList(cid,data){ /** * 文章 热门列表 - * + * */ export function getArticleHotList(){ return request.get('article/hot/list',{},{noAuth:true}); @@ -82,7 +87,7 @@ export function getArticleHotList(){ /** * 文章 轮播列表 - * + * */ export function getArticleBannerList(){ return request.get('article/banner/list',{},{noAuth:true}) @@ -90,8 +95,8 @@ export function getArticleBannerList(){ /** * 文章详情 - * @param int id - * + * @param int id + * */ export function getArticleDetails(id){ return request.get('article/info',id,{noAuth:true}); @@ -124,7 +129,7 @@ export function registerVerify(phone){ /** * 手机号注册 * @param object data - * + * */ export function phoneRegister(data){ return request.post('register',data,{noAuth:true}); @@ -133,7 +138,7 @@ export function phoneRegister(data){ /** * 手机号修改密码 * @param object data - * + * */ export function phoneRegisterReset(data){ return request.post('register/reset',data,{noAuth:true}) @@ -142,7 +147,7 @@ export function phoneRegisterReset(data){ /** * 手机号+密码登录 * @param object data - * + * */ export function phoneLogin(data){ return request.post('login',data,{noAuth:true}) @@ -169,7 +174,7 @@ export function switchH5Login() { /** * 换绑手机号 - * + * */ export function bindingPhone(data){ return request.post('update/binding',data); @@ -177,7 +182,7 @@ export function bindingPhone(data){ /** * 换绑手机号校验 - * + * */ export function bindingVerify(data){ return request.post('update/binding/verify',data); @@ -185,7 +190,7 @@ export function bindingVerify(data){ /** * 退出登錄 - * + * */ export function logout(){ return request.get('logout'); @@ -211,7 +216,7 @@ export function pink() * 获取城市信息 */ export function getCity() { - return request.get('city/list', { }, { noAuth: true }); + return request.get('area/tree', { }, { noAuth: true }); } /** diff --git a/yudao-ui-app/api/user.js b/yudao-ui-app/api/user.js index 952e7788f..9efbdda67 100644 --- a/yudao-ui-app/api/user.js +++ b/yudao-ui-app/api/user.js @@ -5,9 +5,10 @@ import Cache from "@/utils/cache.js" * */ export function getUserInfo(){ - return request.get('user'); + return request.get('member/user/get'); } + /** * 设置用户分享 * @@ -43,8 +44,8 @@ export function getCodeApi() { * h5用户发送验证码 * @param data object 用户手机号 */ -export function registerVerify(phone){ - return request.post('member/auth/send-sms-code', { mobile: phone, scene: 4 },{noAuth:true},1) +export function registerVerify(phone, scene){ + return request.post('member/auth/send-sms-code', { mobile: phone, scene },{noAuth:true},1) } /** @@ -60,7 +61,7 @@ export function register(data) { * @param data object 用户手机号 验证码 密码 */ export function registerReset(data) { - return request.post("register/reset", data, { noAuth: true }); + return request.post("member/auth/reset-password", data, { noAuth: true }); } /** @@ -290,14 +291,14 @@ export function getAddressDetail(id){ * @param object */ export function userEdit(data){ - return request.post('user/edit',data); + return request.post('member/user/update-user',data); } /* * 退出登录 * */ export function getLogout() { - return request.get("logout"); + return request.post("member/auth/logout"); } /** * 小程序充值 diff --git a/yudao-ui-app/config/app.js b/yudao-ui-app/config/app.js index bfe2ed9c4..cd2ed590d 100644 --- a/yudao-ui-app/config/app.js +++ b/yudao-ui-app/config/app.js @@ -21,7 +21,7 @@ module.exports = { 'content-type': 'application/x-www-form-urlencoded' }, // 回话密钥名称 请勿修改此配置 - TOKENNAME: 'Authori-zation', + TOKENNAME: 'Authorization', // 缓存时间 0 永久 EXPIRE:0, //分页最多显示条数 diff --git a/yudao-ui-app/config/cache.js b/yudao-ui-app/config/cache.js index 35fa41834..a241ac5e6 100644 --- a/yudao-ui-app/config/cache.js +++ b/yudao-ui-app/config/cache.js @@ -1,6 +1,7 @@ module.exports = { //token LOGIN_STATUS: 'LOGIN_STATUS_TOKEN', + REFRESH_TOKEN: 'REFRESH_TOKEN', // uid UID:'UID', //用户信息 diff --git a/yudao-ui-app/pages.json b/yudao-ui-app/pages.json index f7ff0d994..269b88f47 100644 --- a/yudao-ui-app/pages.json +++ b/yudao-ui-app/pages.json @@ -241,6 +241,12 @@ "navigationBarTitleText": "地址管理" } }, + { + "path": "user_spread_user/index", + "style": { + "navigationBarTitleText": "分销中心" + } + }, { "path": "user_address/index", "style": { @@ -269,7 +275,7 @@ "style": { "navigationBarTitleText": "修改密码", "navigationBarBackgroundColor": "#e93323" - // #ifdef MP + // #ifdef MP , "navigationBarTextStyle": "#fff" // #endif @@ -314,7 +320,7 @@ "style": { "navigationBarTitleText": "推广人排行", "navigationBarBackgroundColor": "#e93323" - // #ifdef MP + // #ifdef MP , "navigationBarTextStyle": "#fff" // #endif @@ -522,6 +528,12 @@ "selectedIconPath": "static/images/2-002.png", "text": "分类" }, + { + "pagePath": "pages/order_addcart/order_addcart", + "iconPath": "static/images/3-001.png", + "selectedIconPath": "static/images/3-002.png", + "text": "会员申请" + }, { "pagePath": "pages/order_addcart/order_addcart", "iconPath": "static/images/3-001.png", @@ -544,4 +556,4 @@ "query": "" //启动参数,在页面的onLoad函数里面得到 }] } -} \ No newline at end of file +} diff --git a/yudao-ui-app/pages/user/index.vue b/yudao-ui-app/pages/user/index.vue index 59793d2ef..9b0c1cd22 100644 --- a/yudao-ui-app/pages/user/index.vue +++ b/yudao-ui-app/pages/user/index.vue @@ -21,33 +21,33 @@ - - {{userInfo.phone}} + + {{userInfo.mobile}} - 绑定手机号 + 绑定手机号 - + {{userInfo.integral && uid ? userInfo.integral: 0}} 积分 - + @@ -91,11 +91,15 @@ 我的服务 - {{item.name}} - + --> + + + {{item.name}} + @@ -187,7 +191,18 @@ isAuto: false, //没有授权的不会自动授权 isShowAuth: false, //是否隐藏授权 orderStatusNum: {}, - MyMenus: [], + MyMenus: [ + { + pic: '/static/images/address.png', + url: '/pages/users/user_address_list/index', + name: '收货地址' + }, + { + pic: '/static/images/record4.png', + url: '/pages/users/user_spread_user/index', + name: '分销中心' + }, + ], wechatUrl: [], servicePic: '/static/images/customer.png', sysHeight: sysHeight, @@ -207,7 +222,7 @@ // #ifdef H5 that.$set(that, 'pageHeight', app.globalData.windowHeight); // #endif - that.$set(that, 'MyMenus', app.globalData.MyMenus); + // that.$set(that, 'MyMenus', app.globalData.MyMenus); if (!this.$Cache.has('cityList')) this.getCityList(); if (that.isLogin == false) { // #ifdef H5 @@ -225,7 +240,6 @@ }); // #endif if (that.isLogin) { - this.getMyMenus(); // this.setVisit(); this.getOrderData(); this.$store.dispatch('USERINFO'); @@ -278,7 +292,7 @@ }, // 授权回调 onLoadFun() { - this.getMyMenus(); + // this.getMyMenus(); // this.setVisit(); this.getOrderData(); }, @@ -299,26 +313,6 @@ url: '/pages/users/app_login/index' }) }, - /** - * - * 获取个人中心图标 - */ - getMyMenus: function() { - let that = this; - if (this.MyMenus.length) return; - getMenuList().then(res => { - that.$set(that, 'MyMenus', res.data.routine_my_menus); - that.wechatUrl = res.data.routine_my_menus.filter((item) => { - return item.url.indexOf('service') !== -1 - }) - res.data.routine_my_menus.map((item) => { - if (item.url.indexOf('service') !== -1) that.servicePic = item.pic - }) - if(res.data.routine_my_banner){ - that.imgUrls = res.data.routine_my_banner - } - }); - }, // 编辑页面 goEdit() { if (this.isLogin == false) { @@ -526,7 +520,7 @@ padding: 30rpx 16rpx; position: relative; z-index: 11; - + .order-hd { justify-content: space-between; font-size: 30rpx; diff --git a/yudao-ui-app/pages/users/login/index.vue b/yudao-ui-app/pages/users/login/index.vue index fefa2b9e2..e6894e397 100644 --- a/yudao-ui-app/pages/users/login/index.vue +++ b/yudao-ui-app/pages/users/login/index.vue @@ -5,7 +5,7 @@ -
+
@@ -22,7 +22,7 @@
-
+
@@ -38,18 +38,12 @@
-
-
- - -
-
-
登录
登录
注册账号
+
找回密码
快速登录
账号登录
@@ -95,182 +89,17 @@ mobile: "", password: "", captcha: "", - formItem: 1, type: "login", logoUrl: "", - keyCode: "", - codeUrl: "", - codeVal: "", - isShowCode: false, - platform: '', - appLoginStatus: false, // 微信登录强制绑定手机号码状态 - appUserInfo: null, // 微信登录保存的用户信息 - appleLoginStatus: false, // 苹果登录强制绑定手机号码状态 - appleUserInfo: null, - appleShow: false // 苹果登录版本必须要求ios13以上的 }; }, - watch:{ - formItem:function(nval,oVal){ - if(nval == 1){ - this.type = 'login' - }else{ - this.type = 'register' - } - } - }, mounted: function() { - this.getCode(); this.getLogoImage(); }, onLoad() { - let self = this - uni.getSystemInfo({ - success: function(res) { - if (res.platform.toLowerCase() == 'ios' && res.system.split(' ')[1] >= 13) { - self.appleShow = true - } - } - }); + }, methods: { - // 苹果登录 - appleLogin() { - let self = this - this.mobile = '' - this.captcha = '' - uni.showLoading({ - title: '登录中' - }) - uni.login({ - provider: 'apple', - timeout: 10000, - success(loginRes) { - uni.getUserInfo({ - provider: 'apple', - success: function(infoRes) { - self.appleUserInfo = infoRes.userInfo - self.appleLoginApi() - }, - fail() { - uni.hideLoading() - uni.showToast({ - title: '获取用户信息失败', - icon: 'none', - duration: 2000 - }) - }, - complete() { - uni.hideLoading() - } - }); - }, - fail(error) { - uni.hideLoading() - console.log(error) - } - }) - }, - // 苹果登录Api - appleLoginApi() { - let self = this - appleLogin({ - openId: self.appleUserInfo.openId, - email: self.appleUserInfo.email == undefined ? '' :self.appleUserInfo.email, - identityToken: self.appleUserInfo.identityToken || '' - }).then((res) => { - this.$store.commit("LOGIN", { - 'token': res.data.token - }); - this.getUserInfo(res.data); - }).catch(error => { - uni.hideLoading(); - uni.showModal({ - title: '提示', - content: `错误信息${error}`, - success: function(res) { - if (res.confirm) { - console.log('用户点击确定'); - } else if (res.cancel) { - console.log('用户点击取消'); - } - } - }); - }) - }, - // App微信登录 - wxLogin() { - let self = this - this.mobile = '' - this.captcha = '' - uni.showLoading({ - title: '登录中' - }) - uni.login({ - provider: 'weixin', - success: function(loginRes) { - // 获取用户信息 - uni.getUserInfo({ - provider: 'weixin', - success: function(infoRes) { - uni.hideLoading(); - self.appUserInfo = infoRes.userInfo - self.appUserInfo.type = self.platform === 'ios' ? 'iosWx' : 'androidWx' - self.wxLoginGo(self.appUserInfo) - }, - fail() { - uni.hideLoading(); - uni.showToast({ - title: '获取用户信息失败', - icon: 'none', - duration: 2000 - }) - }, - complete() { - uni.hideLoading() - } - }); - }, - fail() { - uni.hideLoading() - uni.showToast({ - title: '登录失败', - icon: 'none', - duration: 2000 - }) - } - }); - }, - wxLoginGo(userInfo) { - appAuth(userInfo).then(res => { - if (res.data.type === 'register') { - uni.navigateTo({ - url: '/pages/users/app_login/index?authKey='+res.data.key - }) - } - if (res.data.type === 'login') { - this.$store.commit("LOGIN", { - 'token': res.data.token - }); - this.getUserInfo(res.data); - } - }).catch(res => { - that.$util.Tips({ - title: res - }); - }); - }, - again() { - this.codeUrl = - VUE_APP_API_URL + - "/sms_captcha?" + - "key=" + - this.keyCode + - Date.parse(new Date()); - }, - getCode() { - let that = this - }, async getLogoImage() { let that = this; getLogo().then(res => { @@ -300,7 +129,8 @@ let data = res.data; let newTime = Math.round(new Date() / 1000); this.$store.commit("LOGIN", { - 'token': res.data.token + 'token': res.data.accessToken, + 'refreshToken': res.data.refreshToken }); that.getUserInfo(data); }) @@ -353,6 +183,11 @@ uni.navigateTo({ url: '/pages/users/register/index' }) + }, + jumpRetrievePassword(){ + uni.navigateTo({ + url: '/pages/users/retrievePassword/index' + }) }, async code() { let that = this; @@ -362,8 +197,7 @@ if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.mobile)) return that.$util.Tips({ title: '请输入正确的手机号码' }); - if (that.formItem == 2) that.type = "register"; - await registerVerify(that.mobile) + await registerVerify(that.mobile, 1) .then(res => { that.$util.Tips({title:res.message}); that.sendCode(); @@ -397,7 +231,8 @@ data }) => { this.$store.commit("LOGIN", { - 'token': data.token + 'token': data.accessToken, + 'refreshToken': data.refreshToken }); that.getUserInfo(data); }) @@ -408,10 +243,11 @@ }); }, getUserInfo(data){ - this.$store.commit("SETUID", data.uid); + this.$store.commit("SETUID", data.userId); getUserInfo().then(res => { this.$store.commit("UPDATE_USERINFO", res.data); - let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index"; + // let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index"; + let backUrl = "/pages/index/index"; if (backUrl.indexOf('/pages/users/login/index') !== -1) { backUrl = '/pages/index/index'; } diff --git a/yudao-ui-app/pages/users/register/index.vue b/yudao-ui-app/pages/users/register/index.vue index 393ed9547..b13f0ffa2 100644 --- a/yudao-ui-app/pages/users/register/index.vue +++ b/yudao-ui-app/pages/users/register/index.vue @@ -81,7 +81,7 @@ if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(this.registerForm.mobile)) return this.$util.Tips({ title: '请输入正确的手机号码' }); - await registerVerify(this.registerForm.mobile) + await registerVerify(this.registerForm.mobile, 4) .then(res => { this.$util.Tips({ title: res.message diff --git a/yudao-ui-app/pages/users/retrievePassword/index.vue b/yudao-ui-app/pages/users/retrievePassword/index.vue index e9937e6a2..f120ee9da 100644 --- a/yudao-ui-app/pages/users/retrievePassword/index.vue +++ b/yudao-ui-app/pages/users/retrievePassword/index.vue @@ -72,7 +72,7 @@ }, mixins: [sendVerifyCode], mounted: function() { - this.getCode(); + }, methods: { back() { @@ -82,15 +82,6 @@ this.codeUrl = VUE_APP_API_URL + "/captcha?" + this.keyCode + Date.parse(new Date()); }, - getCode() { - getCodeApi() - .then(res => { - this.keyCode = res.data.key; - }) - .catch(res => { - this.$dialog.error(res.msg); - }); - }, async registerReset() { var that = this; if (!that.account) return that.$util.Tips({ @@ -103,10 +94,9 @@ title: '请填写验证码' }); registerReset({ - account: that.account, - captcha: that.captcha, + mobile: that.account, password: that.password, - code: that.codeVal + code: that.captcha }) .then(res => { that.$util.Tips({ @@ -129,15 +119,9 @@ if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({ title: '请输入正确的手机号码' }); - if (that.formItem == 2) that.type = "register"; - await registerVerify({ - phone: that.account, - type: that.type, - key: that.keyCode, - code: that.codeVal - }) + await registerVerify(that.account, 3) .then(res => { - that.$dialog.success(res.message); + // that.$dialog.success(res.message); that.sendCode(); }) .catch(res => { diff --git a/yudao-ui-app/pages/users/user_address/index.vue b/yudao-ui-app/pages/users/user_address/index.vue index ec7dd967e..a10f37a18 100644 --- a/yudao-ui-app/pages/users/user_address/index.vue +++ b/yudao-ui-app/pages/users/user_address/index.vue @@ -150,7 +150,7 @@ getCity().then(res => { this.district = res.data; let oneDay = 24 * 3600 * 1000; - // this.$Cache.set('cityList', JSON.stringify(res.data)); //设置不过期时间的方法 + // this.$Cache.set('cityList', JSON.stringify(res.data)); //设置不过期时间的方法 this.$Cache.setItem({name:'cityList',value:res.data,expires:oneDay * 7}); //设置七天过期时间 that.initialize(); }) @@ -158,8 +158,8 @@ initialize: function() { let that = this,province = [],city = [],area = []; if (that.district.length) { - let cityChildren = that.district[0].child || []; - let areaChildren = cityChildren.length ? (cityChildren[0].child || []) : []; + let cityChildren = that.district[0].children || []; + let areaChildren = cityChildren.length ? (cityChildren[0].children || []) : []; that.district.forEach(function(item) { province.push(item.name); }); @@ -175,9 +175,9 @@ bindRegionChange: function(e) { let multiIndex = this.multiIndex, province = this.district[multiIndex[0]] || { - child: [] + children: [] }, - city = province.child[multiIndex[1]] || { + city = province.children[multiIndex[1]] || { cityId: 0 }, multiArray = this.multiArray, @@ -193,25 +193,25 @@ column = e.detail.column, value = e.detail.value, currentCity = this.district[value] || { - child: [] + children: [] }, multiArray = that.multiArray, multiIndex = that.multiIndex; multiIndex[column] = value; switch (column) { case 0: - let areaList = currentCity.child[0] || { - child: [] + let areaList = currentCity.children[0] || { + children: [] }; - multiArray[1] = currentCity.child.map((item) => { + multiArray[1] = currentCity.children.map((item) => { return item.name; }); - multiArray[2] = areaList.child.map((item) => { + multiArray[2] = areaList.children.map((item) => { return item.name; }); break; case 1: - let cityList = that.district[multiIndex[0]].child[multiIndex[1]].child || []; + let cityList = that.district[multiIndex[0]].children[multiIndex[1]].children || []; multiArray[2] = cityList.map((item) => { return item.name; }); @@ -416,7 +416,7 @@ }, /** * 提交用户添加地址 - * + * */ formSubmit: function(e) { let that = this, diff --git a/yudao-ui-app/pages/users/user_address_list/index.vue b/yudao-ui-app/pages/users/user_address_list/index.vue index 2b78887ae..61fa9a3dd 100644 --- a/yudao-ui-app/pages/users/user_address_list/index.vue +++ b/yudao-ui-app/pages/users/user_address_list/index.vue @@ -238,7 +238,7 @@ }, /** * 获取地址列表 - * + * */ getAddressList: function(isPage) { let that = this; @@ -252,8 +252,8 @@ that.loading = true; that.loadTitle = ''; getAddressList({ - page: that.page, - limit: that.limit + pageNo: that.page, + pageSize: that.limit }).then(res => { let list = res.data.list; let loadend = list.length < that.limit; @@ -350,7 +350,7 @@ goOrder: function(id) { if(this.preOrderNo){ uni.redirectTo({ - url: '/pages/users/order_confirm/index?is_address=1&preOrderNo=' + this.preOrderNo + '&addressId=' + id + url: '/pages/users/order_confirm/index?is_address=1&preOrderNo=' + this.preOrderNo + '&addressId=' + id }) } } diff --git a/yudao-ui-app/pages/users/user_info/index.vue b/yudao-ui-app/pages/users/user_info/index.vue index 6e48153b2..3e0a36703 100644 --- a/yudao-ui-app/pages/users/user_info/index.vue +++ b/yudao-ui-app/pages/users/user_info/index.vue @@ -74,7 +74,8 @@