Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product_new

pull/2/head
perry 2023-05-16 18:18:04 +08:00
commit 901f666fcb
21 changed files with 658 additions and 627 deletions

20
builds/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM registry.cn-hangzhou.aliyuncs.com/lrh-public/openjdk:8u222-jre-up
LABEL Author="axzsd" \
Email="atva725@qq.com" \
Description="创盈支付服务端"
ENV SPRING_PROFILES_ACTIVE="dev"
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"
WORKDIR /work/projects/yudao-server
COPY yudao-server/target/yudao-server.jar /opt/app.jar
EXPOSE 48080
ENTRYPOINT exec java $JAVA_OPTIONS -jar -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE} /opt/app.jar

45
builds/Jenkinsfile vendored Normal file
View File

@ -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: [cloneOption(depth: 1, noTags: true, reference: '', shallow: true)], userRemoteConfigs: [[credentialsId: 'Hx-Deploy-Git', url: 'http://117.33.142.185:3000/zenghuapei/cyywl_server.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"'
}
}
}
}
}

View File

@ -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/cyywl:/work/projects/yudao-server
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
ports:
- "48080:48080"
deploy:
resources:
limits:
memory: 800MB
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:48080/cyyywl-api/actuator/health"]
timeout: 30s
interval: 45s
retries: 3

View File

@ -1,5 +1,7 @@
server:
port: 48080
servlet:
context-path: /cyyywl-api
--- #################### 数据库相关配置 ####################

View File

@ -7,10 +7,12 @@
<el-input v-model="queryParams.name" placeholder="请输入租户名" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input v-model="queryParams.contactName" placeholder="请输入联系人" clearable @keyup.enter.native="handleQuery"/>
<el-input v-model="queryParams.contactName" placeholder="请输入联系人" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="联系手机" prop="contactMobile">
<el-input v-model="queryParams.contactMobile" placeholder="请输入联系手机" clearable @keyup.enter.native="handleQuery"/>
<el-input v-model="queryParams.contactMobile" placeholder="请输入联系手机" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="租户状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择租户状态" clearable>
@ -19,8 +21,10 @@
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
@ -32,54 +36,47 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:tenant:create']">新增</el-button>
v-hasPermi="['system:tenant:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['system:tenant:export']">导出</el-button>
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['system:tenant:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="租户编号" align="center" prop="id" />
<el-table-column label="租户名" align="center" prop="name" />
<el-table-column label="租户套餐" align="center" prop="packageId">
<el-table-column label="编号" align="center" prop="id"/>
<el-table-column label="店铺LOGO" align="center" prop="logo">
<template v-slot="scope">
<el-tag v-if="scope.row.packageId === 0" type="danger"></el-tag>
<el-tag v-else> {{getPackageName(scope.row.packageId)}} </el-tag>
<img :src="scope.row.logo" width="50" height="50" />
</template>
</el-table-column>
<el-table-column label="联系人" align="center" prop="contactName" />
<el-table-column label="联系手机" align="center" prop="contactMobile" />
<el-table-column label="账号额度" align="center" prop="accountCount">
<template v-slot="scope">
<el-tag> {{scope.row.accountCount}} </el-tag>
</template>
</el-table-column>
<el-table-column label="过期时间" align="center" prop="expireTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.expireTime) }}</span>
</template>
</el-table-column>
<el-table-column label="绑定域名" align="center" prop="domain" width="180" />
<el-table-column label="租户状态" align="center" prop="status">
<el-table-column label="店铺名称" align="center" prop="name"/>
<el-table-column label="销售对接人" align="center" prop="saleContactName"/>
<el-table-column label="销售对接号码" align="center" prop="saleContactMobile"/>
<el-table-column label="店铺负责人" align="center" prop="contactName"/>
<el-table-column label="店铺负责人号码" align="center" prop="contactMobile"/>
<el-table-column label="店铺状态" align="center" prop="status">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:tenant:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:tenant:delete']">删除</el-button>
<el-button size="mini" type="text" @click="handleLook(scope.row)"
v-hasPermi="['system:tenant:update']">查看
</el-button>
<el-button size="mini" type="text" @click="handleUpdate(scope.row)"
v-hasPermi="['system:tenant:update']">编辑
</el-button>
<el-button size="mini" type="text" @click="handleDelete(scope.row)"
v-hasPermi="['system:tenant:delete']">禁用
</el-button>
</template>
</el-table-column>
</el-table>
@ -88,44 +85,77 @@
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="租户名" prop="name">
<el-input v-model="form.name" placeholder="请输入租户名" />
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="140px" :disabled="isLook">
<el-row>
<el-col :span="12">
<el-form-item label="店铺名称" prop="name">
<el-input v-model="form.name" placeholder="请输入"/>
</el-form-item>
<el-form-item label="租户套餐" prop="packageId">
<el-select v-model="form.packageId" placeholder="请选择租户套餐" clearable size="small">
<el-option v-for="item in packageList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-col>
<el-col :span="12">
<el-form-item label="微信客户地址" prop="wxKfUrl">
<el-input v-model="form.wxKfUrl" placeholder="请输入"/>
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input v-model="form.contactName" placeholder="请输入联系人" />
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="销售对接人" prop="saleContactName">
<el-input v-model="form.saleContactName" placeholder="请输入"/>
</el-form-item>
<el-form-item label="联系手机" prop="contactMobile">
<el-input v-model="form.contactMobile" placeholder="请输入联系手机" />
</el-col>
<el-col :span="12">
<el-form-item label="销售对接号码" prop="saleContactMobile">
<el-input v-model="form.saleContactMobile" placeholder="请输入"/>
</el-form-item>
<el-form-item v-if="form.id === undefined" label="用户名称" prop="username">
<el-input v-model="form.username" placeholder="请输入用户名称" />
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="店铺负责人" prop="contactName">
<el-input v-model="form.contactName" placeholder="请输入"/>
</el-form-item>
<el-form-item v-if="form.id === undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" show-password />
</el-col>
<el-col :span="12">
<el-form-item label="店铺负责人号码" prop="contactMobile">
<el-input v-model="form.contactMobile" placeholder="请输入"/>
</el-form-item>
<el-form-item label="账号额度" prop="accountCount">
<el-input-number v-model="form.accountCount" placeholder="请输入账号额度" controls-position="right" :min="0" />
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="店铺LOGO图片" prop="logo">
<el-input v-model="form.logo" placeholder="请输入"/>
</el-form-item>
<el-form-item label="过期时间" prop="expireTime">
<el-date-picker clearable size="small" v-model="form.expireTime" type="date"
value-format="timestamp" placeholder="请选择过期时间" />
</el-form-item>
<el-form-item label="绑定域名" prop="domain">
<el-input v-model="form.domain" placeholder="请输入绑定域名" />
</el-form-item>
<el-form-item label="租户状态" prop="status">
</el-col>
<el-col :span="12">
<el-form-item label="店铺状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
:key="dict.value" :label="parseInt(dict.value)">{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="店铺简介" prop="introduction">
<el-input v-model="form.introduction" placeholder="请输入"/>
</el-form-item>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="服务时间" prop="serviceTime">
<el-input v-model="form.serviceTime" placeholder="请输入"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="服务电话" prop="serviceMobile">
<el-input v-model="form.serviceMobile" placeholder="请输入"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -136,14 +166,20 @@
</template>
<script>
import { createTenant, updateTenant, deleteTenant, getTenant, getTenantPage, exportTenantExcel } from "@/api/system/tenant";
import {
createTenant,
updateTenant,
deleteTenant,
getTenant,
getTenantPage,
exportTenantExcel
} from '@/api/system/tenant';
import {CommonStatusEnum} from '@/utils/constants'
import {getTenantPackageList} from "@/api/system/tenantPackage";
import {getTenantPackageList} from '@/api/system/tenantPackage';
export default {
name: "SystemTenant",
components: {
},
name: 'SystemTenant',
components: {},
data() {
return {
//
@ -159,7 +195,7 @@ export default {
//
packageList: [],
//
title: "",
title: '',
//
open: false,
//
@ -174,17 +210,44 @@ export default {
},
//
form: {},
isLook: false,
//
rules: {
name: [{ required: true, message: "租户名不能为空", trigger: "blur" }],
packageId: [{ required: true, message: "租户套餐不能为空", trigger: "blur" }],
contactName: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
status: [{ required: true, message: "租户状态不能为空", trigger: "blur" }],
accountCount: [{ required: true, message: "账号额度不能为空", trigger: "blur" }],
expireTime: [{ required: true, message: "过期时间不能为空", trigger: "blur" }],
domain: [{ required: true, message: "绑定域名不能为空", trigger: "blur" }],
username: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }],
name: [{
required: true,
message: '名称不能为空',
trigger: 'blur'
}],
wxKfUrl: [{
required: true,
message: '微信客服地址不能为空',
trigger: 'blur'
}],
contactName: [{
required: true,
message: '店铺负责人不能为空',
trigger: 'blur'
}],
contactMobile: [{
required: true,
message: '店铺负责人号码不能为空',
trigger: 'blur'
}],
introduction: [{
required: true,
message: '店铺简介不能为空',
trigger: 'blur'
}],
serviceTime: [{
required: true,
message: '服务不能为空',
trigger: 'blur'
}],
serviceMobile: [{
required: true,
message: '服务不能为空',
trigger: 'blur'
}]
}
};
},
@ -224,7 +287,7 @@ export default {
domain: undefined,
status: CommonStatusEnum.ENABLE,
};
this.resetForm("form");
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
@ -233,35 +296,44 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.resetForm('queryForm');
this.handleQuery();
},
handleLook(row){
this.form = row
this.open = true
this.isLook = true
this.title = '查看店铺'
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加租户";
this.isLook = false;
this.title = '添加店铺';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.isLook = false;
const id = row.id;
getTenant(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改租户";
this.title = '修改店铺';
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs['form'].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateTenant(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
@ -269,7 +341,7 @@ export default {
}
//
createTenant(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
@ -278,12 +350,13 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除租户编号为"' + id + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除店铺编号为"' + id + '"的数据项?').then(function () {
return deleteTenant(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal.msgSuccess('删除成功');
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
@ -298,7 +371,8 @@ export default {
}).then(response => {
this.$download.excel(response, '租户.xls');
this.exportLoading = false;
}).catch(() => {});
}).catch(() => {
});
},
/** 套餐名格式化 */
getPackageName(packageId) {

View File

@ -2,6 +2,9 @@
import {
checkLogin
} from "./libs/login";
import {
refreshToken
} from "@/api/api";
import {
HTTP_REQUEST_URL
} from './config/app';
@ -156,9 +159,31 @@
// #endif
},
async mounted() {
if(this.$store.getters.isLogin && !this.$Cache.get('USER_INFO'))await this.$store.dispatch('USERINFO');
if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) {
await this.$store.dispatch('USERINFO');
}
setInterval(() => {
if (this.$store.getters.isLogin) {
this.setRefreshToken()
}
}, 60000)
},
methods: {
setRefreshToken() {
refreshToken(this.$Cache.get("REFRESH_TOKEN"))
.then(res => {
let data = res.data;
this.$store.commit("LOGIN", {
'token': data.accessToken,
'refreshToken': data.refreshToken
});
})
.catch(res => {
this.$util.Tips({
title: res
});
});
}
},
onShow: function() {
// #ifdef H5

View File

@ -22,6 +22,11 @@ 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
@ -211,7 +216,7 @@ export function pink()
* 获取城市信息
*/
export function getCity() {
return request.get('city/list', { }, { noAuth: true });
return request.get('area/tree', { }, { noAuth: true });
}
/**

View File

@ -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");
}
/**
* 小程序充值

View File

@ -21,7 +21,7 @@ module.exports = {
'content-type': 'application/x-www-form-urlencoded'
},
// 回话密钥名称 请勿修改此配置
TOKENNAME: 'Authori-zation',
TOKENNAME: 'Authorization',
// 缓存时间 0 永久
EXPIRE:0,
//分页最多显示条数

View File

@ -1,6 +1,7 @@
module.exports = {
//token
LOGIN_STATUS: 'LOGIN_STATUS_TOKEN',
REFRESH_TOKEN: 'REFRESH_TOKEN',
// uid
UID:'UID',
//用户信息

View File

@ -241,6 +241,12 @@
"navigationBarTitleText": "地址管理"
}
},
{
"path": "user_spread_user/index",
"style": {
"navigationBarTitleText": "分销中心"
}
},
{
"path": "user_address/index",
"style": {
@ -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",

View File

@ -21,33 +21,33 @@
</view>
</view>
</view>
<view class="num" v-if="userInfo.phone && uid" @click="goEdit()">
<view class="num-txt">{{userInfo.phone}}</view>
<view class="num" v-if="userInfo.mobile && uid" @click="goEdit()">
<view class="num-txt">{{userInfo.mobile}}</view>
<view class="icon">
<image src="/static/images/edit.png" mode=""></image>
</view>
</view>
<view class="phone" v-if="!userInfo.phone && isLogin" @tap="bindPhone"></view>
<view class="phone" v-if="!userInfo.mobile && isLogin" @tap="bindPhone"></view>
</view>
</view>
<view class="num-wrapper">
<view class="num-item" @click="goMenuPage('/pages/users/user_money/index')">
<!-- <view class="num-item" @click="goMenuPage('/pages/users/user_money/index')">
<text
class="num">{{userInfo.nowMoney && uid ?Number(userInfo.nowMoney).toFixed(2):0}}</text>
<view class="txt">余额</view>
</view>
</view> -->
<view class="num-item" @click="goMenuPage('/pages/users/user_integral/index')">
<text class="num">{{userInfo.integral && uid ? userInfo.integral: 0}}</text>
<view class="txt">积分</view>
</view>
<view class="num-item" @click="goMenuPage('/pages/users/user_coupon/index')">
<!-- <view class="num-item" @click="goMenuPage('/pages/users/user_coupon/index')">
<text class="num">{{userInfo.couponCount && uid ? userInfo.couponCount : 0}}</text>
<view class="txt">优惠券</view>
</view>
<view class="num-item" @click="goMenuPage('/pages/users/user_goods_collection/index')">
<text class="num">{{userInfo.collectCount && uid ? userInfo.collectCount : 0}}</text>
<view class="txt">收藏</view>
</view>
</view> -->
</view>
<!-- <view class="sign" @click="goSignIn"></view> -->
</view>
@ -91,10 +91,14 @@
<view class="menu-title">我的服务</view>
<view class="list-box">
<block v-for="(item,index) in MyMenus" :key="index">
<navigator class="item" :url="item.url" hover-class="none"
<!-- <navigator class="item" :url="item.url" hover-class="none"
v-if="!(item.url =='/pages/service/index' || (item.url =='/pages/users/user_spread_user/index' && !userInfo.isPromoter))">
<image :src="item.pic"></image>
<text>{{item.name}}</text>
</navigator> -->
<navigator class="item" :url="item.url" hover-class="none">
<image :src="item.pic"></image>
<text>{{item.name}}</text>
</navigator>
</block>
<!-- #ifndef MP -->
@ -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) {

View File

@ -5,7 +5,7 @@
<image :src="logoUrl"/>
<!-- <image src="/static/images/logo2.png" v-if="!logoUrl" /> -->
</div>
<div class="whiteBg" v-if="formItem === 1">
<div class="whiteBg">
<div class="list" v-if="current !== 1">
<form @submit.prevent="submit">
<div class="item">
@ -22,7 +22,7 @@
</div>
</form>
</div>
<div class="list" v-if="current !== 0 || appLoginStatus || appleLoginStatus">
<div class="list" v-if="current !== 0">
<div class="item">
<div class="acea-row row-middle">
<image src="/static/images/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
@ -38,18 +38,12 @@
</button>
</div>
</div>
<div class="item" v-if="isShowCode">
<div class="acea-row row-middle">
<image src="/static/images/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
<div class="code" @click="again"><img :src="codeUrl" /></div>
</div>
</div>
</div>
<div class="logon" @click="loginMobile" v-if="current !== 0"></div>
<div class="logon" @click="submit" v-if="current === 0"></div>
<div class="tips">
<div @click="jumpRegister"></div>
<div @click="jumpRetrievePassword"></div>
<div v-if="current==0" @click="current = 1"></div>
<div v-if="current==1" @click="current = 0"></div>
</div>
@ -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';
}

View File

@ -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

View File

@ -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 => {

View File

@ -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;
});

View File

@ -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;

View File

@ -74,7 +74,8 @@
<script>
import {
userEdit,
getLogout
getLogout,
uploadAvatar
} from '@/api/user.js';
import {
switchH5Login
@ -162,12 +163,9 @@
uploadpic: function() {
let that = this;
that.$util.uploadImageOne({
url: 'user/upload/image',
name: 'multipart',
model: "maintain",
pid: 0
name: 'file',
}, function(res) {
that.newAvatar = res.data.url;
that.newAvatar = res.data;
});
},

View File

@ -3,6 +3,7 @@ import {
} from "../../api/user.js";
import {
LOGIN_STATUS,
REFRESH_TOKEN,
UID,
PLATFORM
} from '../../config/cache';
@ -13,6 +14,7 @@ import {
const state = {
token: Cache.get(LOGIN_STATUS) || '',
refreshToken: Cache.get(REFRESH_TOKEN) || '',
backgroundColor: "#fff",
userInfo: Cache.get(USER_INFO)?JSON.parse(Cache.get(USER_INFO)):null,
uid: Cache.get(UID) || null,
@ -25,7 +27,9 @@ const state = {
const mutations = {
LOGIN(state, opt) {
state.token = opt.token;
state.refreshToken = opt.refreshToken;
Cache.set(LOGIN_STATUS, opt.token);
Cache.set(REFRESH_TOKEN, opt.refreshToken);
},
SETUID(state,val){
state.uid = val;
@ -38,6 +42,7 @@ const mutations = {
state.token = undefined;
state.uid = undefined
Cache.clear(LOGIN_STATUS);
Cache.clear(REFRESH_TOKEN);
Cache.clear(UID);
Cache.clear(USER_INFO);
},

View File

@ -32,7 +32,7 @@ function baseRequest(url, method, data, {
});
}
}
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
return new Promise((reslove, reject) => {
uni.request({
url: Url + '/app-api/' + url,

View File

@ -440,7 +440,7 @@ export default {
sourceType = opt.sourceType || ['album', 'camera'],
is_load = opt.is_load || true,
uploadUrl = opt.url || '',
inputName = opt.name || 'pics',
inputName = opt.name || 'file',
pid = opt.pid,
model = opt.model;
@ -453,7 +453,7 @@ export default {
uni.showLoading({
title: '图片上传中',
});
let urlPath = HTTP_ADMIN_URL + '/api/admin/upload/image' + "?model=" + model + "&pid=" + pid
let urlPath = HTTP_ADMIN_URL + '/app-api/infra/file/upload'
let localPath = res.tempFilePaths[0];
uni.uploadFile({
url: urlPath,
@ -464,9 +464,11 @@ export default {
// #ifdef MP
"Content-Type": "multipart/form-data",
// #endif
[TOKENNAME]: store.state.app.token
[TOKENNAME]: store.state.app.token,
'tenant-id': 1
},
success: function(res) {
console.log('res', res)
uni.hideLoading();
if (res.statusCode == 403) {
that.Tips({
@ -474,8 +476,7 @@ export default {
});
} else {
let data = res.data ? JSON.parse(res.data) : {};
if (data.code == 200) {
data.data.localPath = localPath;
if (data.code == 0) {
successCallback && successCallback(data)
} else {
errorCallback && errorCallback(data);