init
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<!-- 错误界面 -->
|
||||
<template>
|
||||
<view class="error-page">
|
||||
<s-empty
|
||||
v-if="errCode === 'NetworkError'"
|
||||
icon="/static/internet-empty.png"
|
||||
text="网络连接失败"
|
||||
showAction
|
||||
actionText="重新连接"
|
||||
@clickAction="onReconnect"
|
||||
buttonColor="#ff3000"
|
||||
/>
|
||||
<s-empty
|
||||
v-else-if="errCode === 'TemplateError'"
|
||||
icon="/static/internet-empty.png"
|
||||
text="未找到模板,请前往后台启用对应模板"
|
||||
showAction
|
||||
actionText="重新加载"
|
||||
@clickAction="onReconnect"
|
||||
buttonColor="#ff3000"
|
||||
/>
|
||||
<s-empty
|
||||
v-else-if="errCode !== ''"
|
||||
icon="/static/internet-empty.png"
|
||||
:text="errMsg"
|
||||
showAction
|
||||
actionText="重新加载"
|
||||
@clickAction="onReconnect"
|
||||
buttonColor="#ff3000"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { ref } from 'vue';
|
||||
import { ShoproInit } from '@/sheep';
|
||||
|
||||
const errCode = ref('');
|
||||
const errMsg = ref('');
|
||||
|
||||
onLoad((options) => {
|
||||
errCode.value = options.errCode;
|
||||
errMsg.value = options.errMsg;
|
||||
});
|
||||
|
||||
// 重新连接
|
||||
async function onReconnect() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
});
|
||||
await ShoproInit();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.error-page {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,118 @@
|
||||
<!-- FAQ 常见问题 -->
|
||||
<template>
|
||||
<s-layout :bgStyle="{ color: '#FFF' }" class="set-wrap" title="常见问题">
|
||||
<uni-collapse>
|
||||
<uni-collapse-item v-for="(item, index) in state.list" :key="item">
|
||||
<template v-slot:title>
|
||||
<view class="ss-flex ss-col-center header">
|
||||
<view class="ss-m-l-20 ss-m-r-20 icon">
|
||||
<view class="rectangle">
|
||||
<view class="num ss-flex ss-row-center ss-col-center">
|
||||
{{ index + 1 < 10 ? '0' + (index + 1) : index + 1 }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="triangle"> </view>
|
||||
</view>
|
||||
<view class="title ss-m-t-36 ss-m-b-36">
|
||||
{{ item.title }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="content ss-p-l-78 ss-p-r-40 ss-p-b-50 ss-p-t-20">
|
||||
<text class="text">{{ item.content }}</text>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
<s-empty
|
||||
v-if="state.list.length === 0 && !state.loading"
|
||||
text="暂无常见问题"
|
||||
icon="/static/collect-empty.png"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const state = reactive({
|
||||
list: [],
|
||||
loading: true,
|
||||
});
|
||||
|
||||
async function getFaqList() {
|
||||
const { error, data } = await sheep.$api.data.faq();
|
||||
if (error === 0) {
|
||||
state.list = data;
|
||||
state.loading = false;
|
||||
}
|
||||
}
|
||||
onLoad(() => {
|
||||
// TODO 芋艿:【文章】目前简单做,使用营销文章,作为 faq
|
||||
if (true) {
|
||||
sheep.$router.go('/pages/public/richtext', {
|
||||
title: '常见问题',
|
||||
});
|
||||
return;
|
||||
}
|
||||
getFaqList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header {
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: 30rpx;
|
||||
max-width: 688rpx;
|
||||
}
|
||||
|
||||
.icon {
|
||||
position: relative;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
|
||||
.rectangle {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 40rpx;
|
||||
height: 36rpx;
|
||||
background: var(--ui-BG-Main);
|
||||
border-radius: 4px;
|
||||
|
||||
.num {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG);
|
||||
line-height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.triangle {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 4rpx solid transparent;
|
||||
border-right: 4rpx solid transparent;
|
||||
border-top: 8rpx solid var(--ui-BG-Main);
|
||||
position: absolute;
|
||||
left: 16rpx;
|
||||
bottom: -4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
border-bottom: 1rpx solid #dfdfdf;
|
||||
|
||||
.text {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<s-pages title="华贸专区">
|
||||
<view class="container">
|
||||
<web-view :src="url" />
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
url: 'http://szsc.huamaohezun.com/dwz/4gOffKKb',
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,456 @@
|
||||
<template>
|
||||
<!-- 空登陆页 -->
|
||||
<s-layout navbar="inner" title="登录" color="#19203b">
|
||||
<view class="login">
|
||||
<view class="login_top_img w100" :style="{ top: -height + 'px' }">
|
||||
<image :src="$url + 'index/login_bg1.png'" mode="widthFix" class="w100" />
|
||||
</view>
|
||||
<view class="login_con w100 flex-column ju-between">
|
||||
<view class="login_top">
|
||||
<view class="font-Heavy size52 c0">Hello!</view>
|
||||
<view class="font-Heavy size52 c0">欢迎使用优购商城</view>
|
||||
</view>
|
||||
<view class="flex1 bottomCon">
|
||||
<view class="login_bottom">
|
||||
<view class="size40 f500 title">{{ dataObj.con[type].title }}</view>
|
||||
<view class="form">
|
||||
<uni-forms ref="form" label-position="top">
|
||||
<view v-for="(v, i) in dataObj.con[type].arr" :key="i">
|
||||
<uni-forms-item
|
||||
:required="false"
|
||||
:label="dataObj.formArr[v].title"
|
||||
:name="dataObj.formArr[v].value"
|
||||
>
|
||||
<view class="flex-center border_bottom">
|
||||
<uni-easyinput
|
||||
v-model="formData[dataObj.formArr[v].value]"
|
||||
:placeholder="dataObj.formArr[v].placeholder"
|
||||
:type="dataObj.formArr[v].type"
|
||||
:inputBorder="false"
|
||||
:maxlength="dataObj.formArr[v].max"
|
||||
/>
|
||||
<view v-if="v == 2" class="c_primary size28" @click="getCode">{{
|
||||
num > 0 && num < 60 ? num + 's后重新获取' : '获取验证码'
|
||||
}}</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view class="flex-row ju-between size28 btns">
|
||||
<view class="flex-row">
|
||||
<view class="">{{ dataObj.con[type].text }}</view>
|
||||
<view
|
||||
class="c_primary"
|
||||
@click="typeChange(dataObj.btns[dataObj.con[type].btn1].value)"
|
||||
>{{ dataObj.btns[dataObj.con[type].btn1].text }}</view
|
||||
>
|
||||
</view>
|
||||
<view
|
||||
class="c_primary"
|
||||
@click="typeChange(dataObj.btns[dataObj.con[type].btn2].value)"
|
||||
v-if="dataObj.con[type].btn2"
|
||||
>{{ dataObj.btns[dataObj.con[type].btn2]?.text }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="submit-btn" @click="$debounce(sub, 1000)">
|
||||
{{ dataObj.con[type].sub }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="radio-box">
|
||||
<radio-group @change="radioChange">
|
||||
<label class="flex-center">
|
||||
<radio color="#FA7E31" class="radio" value="1" :checked="false" />
|
||||
<view class="flex-center size24">
|
||||
我已阅读并同意
|
||||
<text class="c_primary" @click="go(2)">《用户服务协议》</text>
|
||||
和
|
||||
<text class="c_primary" @click="go(1)">《隐私政策》</text>
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { gethotupdatelist } from '@/sheep/api/index/index';
|
||||
import AuthUtil from '@/sheep/api/member/auth';
|
||||
let type = ref(2);
|
||||
let formData = reactive({});
|
||||
let num = ref(0);
|
||||
let dataObj = reactive({
|
||||
con: {
|
||||
1: {
|
||||
title: '验证码登录',
|
||||
arr: [1, 2],
|
||||
text: '还没账号?',
|
||||
btn1: 1,
|
||||
btn2: 2,
|
||||
sub: '立即登录',
|
||||
toast: '登录成功',
|
||||
},
|
||||
2: {
|
||||
title: '密码登录',
|
||||
arr: [1, 3],
|
||||
text: '还没账号?',
|
||||
btn1: 1,
|
||||
btn2: 3,
|
||||
sub: '立即登录',
|
||||
toast: '登录成功',
|
||||
},
|
||||
3: {
|
||||
title: '用户注册',
|
||||
arr: [1, 4, 5],
|
||||
// arr: [1, 2, 4, 5],
|
||||
text: '已有账号,',
|
||||
btn1: 4,
|
||||
btn2: 3,
|
||||
sub: '立即注册',
|
||||
toast: '注册成功',
|
||||
},
|
||||
4: {
|
||||
title: '忘记密码',
|
||||
arr: [1, 2, 4, 5],
|
||||
text: '已有账号,',
|
||||
btn1: 4,
|
||||
btn2: 2,
|
||||
sub: '修改密码',
|
||||
toast: '修改成功',
|
||||
},
|
||||
},
|
||||
formArr: {
|
||||
1: {
|
||||
title: '手机号',
|
||||
type: 'number',
|
||||
value: 'mobile',
|
||||
max: 11,
|
||||
placeholder: '请输入手机号',
|
||||
},
|
||||
2: {
|
||||
title: '验证码',
|
||||
type: 'number',
|
||||
value: 'code',
|
||||
max: 4,
|
||||
placeholder: '请输入验证码',
|
||||
},
|
||||
3: {
|
||||
title: '密码',
|
||||
type: 'password',
|
||||
value: 'password',
|
||||
placeholder: '请输入密码',
|
||||
},
|
||||
4: {
|
||||
title: '设置密码',
|
||||
type: 'password',
|
||||
value: 'password',
|
||||
placeholder: '请输入您的密码',
|
||||
},
|
||||
5: {
|
||||
title: '确认密码',
|
||||
type: 'password',
|
||||
value: 'confirmPassword',
|
||||
placeholder: '请再次输入您的密码',
|
||||
},
|
||||
},
|
||||
btns: {
|
||||
1: {
|
||||
text: '去注册',
|
||||
value: 3,
|
||||
},
|
||||
2: {
|
||||
text: '密码登录',
|
||||
value: 2,
|
||||
},
|
||||
// 3: {
|
||||
// text: '验证码登录',
|
||||
// value: 1,
|
||||
// },
|
||||
4: {
|
||||
text: '去登录',
|
||||
value: 2,
|
||||
},
|
||||
},
|
||||
});
|
||||
const rules = reactive({
|
||||
mobile: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
pattern: /^1[3456789]\d{8}$/,
|
||||
message: '手机号格式不正确',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入验证码',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
password: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入密码',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const typeChange = (val) => {
|
||||
console.log(val);
|
||||
type.value = val;
|
||||
clearInterval(timer.value);
|
||||
num.value = 0;
|
||||
};
|
||||
const radioValue = ref();
|
||||
const radioChange = (e) => {
|
||||
radioValue.value = e.detail.value;
|
||||
};
|
||||
const sub = async () => {
|
||||
if (!radioValue.value) {
|
||||
uni.showToast({
|
||||
title: '请阅读服务协议和隐私协议',
|
||||
duration: 1000,
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
let arr = dataObj.con[type.value].arr;
|
||||
let obj = {};
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (!formData[dataObj.formArr[arr[i]].value]) {
|
||||
uni.showToast({
|
||||
title: dataObj.formArr[arr[i]].placeholder,
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
obj[dataObj.formArr[arr[i]].value] = formData[dataObj.formArr[arr[i]].value];
|
||||
}
|
||||
let url = '';
|
||||
switch (type.value) {
|
||||
case 1: //密码登录
|
||||
url = AuthUtil.smsLogin;
|
||||
break;
|
||||
case 2: //验证码登录
|
||||
url = AuthUtil.login;
|
||||
break;
|
||||
case 3: //注册
|
||||
if (obj.password != obj.confirmPassword) {
|
||||
uni.showToast({
|
||||
title: '两次密码不一致',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
url = AuthUtil.register;
|
||||
break;
|
||||
case 4: //忘记密码
|
||||
break;
|
||||
}
|
||||
url(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
if (type.value == 3) {
|
||||
typeChange(2);
|
||||
return;
|
||||
}
|
||||
sheep.$store('user').getInfo();
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/index/index' });
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
};
|
||||
let timer = ref();
|
||||
const getCode = () => {
|
||||
if (num.value > 0 && num.value < 60) {
|
||||
return;
|
||||
}
|
||||
if (!radioValue.value) {
|
||||
uni.showToast({
|
||||
title: '请阅读服务协议和隐私协议',
|
||||
duration: 1000,
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 发送验证码
|
||||
if (!formData.mobile) {
|
||||
uni.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
sendCode();
|
||||
}
|
||||
};
|
||||
const sendCode = async () => {
|
||||
let numType = 1;
|
||||
switch (type.value) {
|
||||
case 1: //验证码登录1
|
||||
numType = 1;
|
||||
break;
|
||||
case 2: //密码登录1
|
||||
numType = 1;
|
||||
break;
|
||||
case 3: //注册6
|
||||
numType = 6;
|
||||
break;
|
||||
case 4: //忘记密码4
|
||||
numType = 4;
|
||||
break;
|
||||
}
|
||||
AuthUtil.sendSmsCode(formData.mobile, numType).then((res) => {
|
||||
if (res.code === 0) {
|
||||
num.value = 60;
|
||||
timer.value = setInterval(() => {
|
||||
num.value--;
|
||||
if (num.value <= 0) {
|
||||
clearInterval(timer.value);
|
||||
num.value = 60;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
};
|
||||
const go = (type) => {
|
||||
uni.navigateTo({ url: '/pages/home/agreement?type=' + type });
|
||||
};
|
||||
onLoad(async () => {});
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
let height = ref(0);
|
||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
|
||||
const wgtUp = async () => {
|
||||
// console.log(plus.runtime);
|
||||
|
||||
let res = await gethotupdatelist();
|
||||
if (res.code !== 0) return;
|
||||
let filePath = res.data.filePath;
|
||||
let localVersion = uni.getSystemInfoSync().appWgtVersion;
|
||||
if (res.data.versionNumber != localVersion) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '发现新的版本,是否更新?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: (res) => {
|
||||
downloadFile(filePath);
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
const downloadFile = (url) => {
|
||||
uni.downloadFile({
|
||||
url: url,
|
||||
success: (downloadResult) => {
|
||||
uni.showToast({
|
||||
title: '更新中....',
|
||||
icon: 'none',
|
||||
});
|
||||
if (downloadResult) {
|
||||
if (downloadResult.statusCode === 200) {
|
||||
plus.runtime.install(
|
||||
downloadResult.tempFilePath,
|
||||
{
|
||||
force: true,
|
||||
},
|
||||
function () {
|
||||
uni.showModal({
|
||||
title: '成功提示',
|
||||
content: '热更新成功,请重启应用',
|
||||
confirmColor: '#FA7E31',
|
||||
showCancel: false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
plus.runtime.restart(); //自动重启软件
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
function (e) {
|
||||
uni.showModal({
|
||||
title: '失败提示',
|
||||
content: e,
|
||||
showCancel: false,
|
||||
confirmColor: '#FA7E31',
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.login {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
.login_top_img {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
.login_con {
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
padding-top: 50rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
// position: absolute;
|
||||
// top: 166rpx;
|
||||
// left: 0;
|
||||
// z-index: 2;
|
||||
// background-color: #F2F4F7;
|
||||
}
|
||||
}
|
||||
.login_top {
|
||||
padding-left: 50rpx;
|
||||
margin-bottom: 48rpx;
|
||||
}
|
||||
.bottomCon {
|
||||
background-color: #ffffff;
|
||||
border-radius: 80rpx 80rpx 0 0;
|
||||
}
|
||||
.login_bottom {
|
||||
// background: linear-gradient(144deg, #19203b 0%, #070c18 100%);
|
||||
padding: 60rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.border_bottom {
|
||||
border-bottom: 1px solid #999999;
|
||||
}
|
||||
.submit-btn {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
.radio-box {
|
||||
padding-top: 100rpx;
|
||||
padding-bottom: 60rpx;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.radio {
|
||||
transform: scale(0.6);
|
||||
}
|
||||
.btns {
|
||||
margin-top: 70rpx;
|
||||
}
|
||||
.title {
|
||||
margin-bottom: 70rpx;
|
||||
}
|
||||
:deep(.uni-radio-input) {
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<s-pages title="账号注销">
|
||||
<view class="pages p-x-20">
|
||||
<view class="card bg24">
|
||||
<view class="card_title flex-center ju-between">
|
||||
<view class="weight700">注销提示</view>
|
||||
</view>
|
||||
<view>注销账号后,将数据清空,并无法登录该账号,且无法找回数据,是否继续注销账号?</view>
|
||||
</view>
|
||||
<view class="submit-btn bg24" @click="logout"><span>注销账号</span></view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import AuthUtil from '@/sheep/api/member/auth';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
// 注销账号
|
||||
const logout = () => {
|
||||
uni.showModal({
|
||||
title: '注销账号',
|
||||
content: '注销账号后,将数据清空,并无法登录该账号,请谨慎操作',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
const { code } = await AuthUtil.deactivate();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
sheep.$store('user').logout();
|
||||
sheep.$router.go('/pages/index/user');
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.card {
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 32rpx 28rpx;
|
||||
box-align: border-box;
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.card_title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
margin-bottom: 34rpx;
|
||||
}
|
||||
|
||||
.card_more {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
.submit-btn {
|
||||
width: calc(100% - 40rpx);
|
||||
position: fixed;
|
||||
left: 20rpx;
|
||||
bottom: 40rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,51 @@
|
||||
<!-- 自定义页面:支持装修 -->
|
||||
<template>
|
||||
<s-layout
|
||||
:title="state.name"
|
||||
navbar="custom"
|
||||
:bgStyle="state.page"
|
||||
:navbarStyle="state.navigationBar"
|
||||
onShareAppMessage
|
||||
showLeftButton
|
||||
>
|
||||
<s-block v-for="(item, index) in state.components" :key="index" :styles="item.property.style">
|
||||
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
|
||||
</s-block>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import DiyApi from '@/sheep/api/promotion/diy';
|
||||
|
||||
const state = reactive({
|
||||
name: '',
|
||||
components: [],
|
||||
navigationBar: {},
|
||||
page: {},
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
let id = options.id;
|
||||
|
||||
// #ifdef MP
|
||||
// 小程序预览自定义页面
|
||||
if (options.scene) {
|
||||
const sceneParams = decodeURIComponent(options.scene).split('=');
|
||||
id = sceneParams[1];
|
||||
}
|
||||
// #endif
|
||||
|
||||
const { code, data } = await DiyApi.getDiyPage(id);
|
||||
if (code === 0) {
|
||||
state.name = data.name;
|
||||
state.components = data.property?.components;
|
||||
state.navigationBar = data.property?.navigationBar;
|
||||
state.page = data.property?.page;
|
||||
}
|
||||
});
|
||||
|
||||
onPageScroll(() => {});
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -0,0 +1,298 @@
|
||||
<template>
|
||||
<s-layout title="实名认证" navbar="transparent">
|
||||
<view class="realname-page">
|
||||
<!-- <image src="/static/transparent_bg.png" class="transparent_bg" /> -->
|
||||
|
||||
<view class="realname-bg m-x-24 m-y-24 p-b-68">
|
||||
<view class="card m-b-20 flex-center ju-flex-start size30" v-if="showStatusCard">
|
||||
<view class="icon h_30 w_30 m-r-10">
|
||||
<image :src="$url + statusObj[dataObj.approvalStatus]?.icon" class="w100 h100" />
|
||||
</view>
|
||||
{{ statusObj[dataObj.approvalStatus]?.name }}
|
||||
</view>
|
||||
<view class="card">
|
||||
<view class="head-title"> 上传身份证 </view>
|
||||
<view class="img-box m-t-16" @click="upImg(1)">
|
||||
<view v-if="!dataObj.cardPortraitUrl">
|
||||
<view class="updata-img">
|
||||
<image src="/static/id_card_zheng.png" />
|
||||
</view>
|
||||
上传身份证人像面
|
||||
</view>
|
||||
<image :src="dataObj.cardPortraitUrl" v-else />
|
||||
</view>
|
||||
|
||||
<view class="img-box m-t-24" @click="upImg(2)">
|
||||
<view v-if="!dataObj.cardEmblemUrl">
|
||||
<view class="updata-img">
|
||||
<image src="/static/id_card_fan.png" />
|
||||
</view>
|
||||
上传身份证国徽面
|
||||
</view>
|
||||
<image :src="dataObj.cardEmblemUrl" v-else />
|
||||
</view>
|
||||
</view>
|
||||
<view class="card size28 flex-between m-t-38">
|
||||
<text>姓名</text>
|
||||
<view class="ipt-bar">
|
||||
<uni-easyinput
|
||||
maxlength="6"
|
||||
:clearable="false"
|
||||
:inputBorder="false"
|
||||
v-model="dataObj.userName"
|
||||
placeholder="请输入姓名"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card size28 flex-between m-t-28">
|
||||
<text>身份证</text>
|
||||
<view class="ipt-bar">
|
||||
<uni-easyinput
|
||||
maxlength="18"
|
||||
:clearable="false"
|
||||
:inputBorder="false"
|
||||
v-model="dataObj.cardNumber"
|
||||
placeholder="请输入身份证号码"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" v-if="showForm" @click="submit()"> 提交审核 </view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref, computed } from 'vue';
|
||||
import { baseUrl } from '@/sheep/config';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
let realStatus = ref();
|
||||
const dataObj = ref({
|
||||
id: '',
|
||||
userId: '',
|
||||
userName: '',
|
||||
cardNumber: '',
|
||||
cardPortraitUrl: '',
|
||||
cardEmblemUrl: '',
|
||||
approvalStatus: '', //0-审批中,1-审批通过,2-失败
|
||||
});
|
||||
let statusObj = {
|
||||
1: {
|
||||
name: '实名认证成功',
|
||||
icon: 'home/audit_status_1.svg',
|
||||
},
|
||||
2: {
|
||||
name: '实名认证失败,请重新提交信息',
|
||||
icon: 'home/audit_status_2.svg',
|
||||
},
|
||||
0: {
|
||||
name: '实名认证审核中',
|
||||
icon: 'home/audit_status_0.svg',
|
||||
},
|
||||
};
|
||||
|
||||
// 统一的显示/隐藏控制
|
||||
const showStatusCard = computed(() => dataObj.value.approvalStatus !== '');
|
||||
const showForm = computed(
|
||||
() => dataObj.value.approvalStatus === '' || dataObj.value.approvalStatus === 2,
|
||||
);
|
||||
onLoad((e) => {
|
||||
let user = JSON.parse(uni.getStorageSync('user-store')).userInfo;
|
||||
|
||||
dataObj.value.userId = user.id;
|
||||
// dataObj.value.approvalStatus = Number(e.status)
|
||||
realStatus.value = e.status;
|
||||
//1.获取实名认证信息
|
||||
getUserData();
|
||||
});
|
||||
let getUserData = (id) => {
|
||||
api.getRealName({}).then((res) => {
|
||||
//2.判断状态
|
||||
//如果res.data为空,没有提交实名状态
|
||||
if (res.data) {
|
||||
dataObj.value = res.data;
|
||||
}
|
||||
console.log(dataObj.value);
|
||||
});
|
||||
};
|
||||
const submit = () => {
|
||||
let pattern = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[0-9Xx]$/;
|
||||
if (!dataObj.value.cardPortraitUrl) {
|
||||
uni.showToast({
|
||||
title: '请上传身份证人像面',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else if (!dataObj.value.cardEmblemUrl) {
|
||||
uni.showToast({
|
||||
title: '请上传身份证国徽面',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else if (!dataObj.value.userName) {
|
||||
uni.showToast({
|
||||
title: '请输入姓名',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else if (!dataObj.value.cardNumber) {
|
||||
uni.showToast({
|
||||
title: '请输入身份证号',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else if (!pattern.test(dataObj.value.cardNumber)) {
|
||||
uni.showToast({
|
||||
title: '请输入有效身份证号',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
console.log(dataObj.value);
|
||||
if (!dataObj.value?.approvalStatus || dataObj.value?.approvalStatus == 0) {
|
||||
api.createRealName(dataObj.value).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getUserData();
|
||||
}
|
||||
});
|
||||
} else if (dataObj.value?.approvalStatus == 2) {
|
||||
api.updateRealName(dataObj.value).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getUserData();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const upImg = (type) => {
|
||||
if (!showForm.value) {
|
||||
return;
|
||||
}
|
||||
uni.chooseImage({
|
||||
count: 1, //默认9
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
success: function (res) {
|
||||
console.log(res);
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
const tempFiles = res.tempFiles;
|
||||
let resSize = tempFiles[0].size;
|
||||
if (resSize > 1048576) {
|
||||
uni.showToast({
|
||||
title: '上传图片大小不能超过1MB',
|
||||
icon: 'error',
|
||||
});
|
||||
return;
|
||||
}
|
||||
const token = uni.getStorageSync('token') ? uni.getStorageSync('token') : undefined;
|
||||
let tenant_id = uni.getStorageSync('tenant-id');
|
||||
uni.uploadFile({
|
||||
url: baseUrl + '/app-api/infra/file/upload', //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'file',
|
||||
formData: {
|
||||
directory: 'card',
|
||||
'tenant-id': tenant_id,
|
||||
token: token,
|
||||
},
|
||||
header: {},
|
||||
success: (uploadFileRes) => {
|
||||
let url = JSON.parse(uploadFileRes.data).data;
|
||||
console.log(url);
|
||||
console.log(type);
|
||||
if (type === 1) {
|
||||
dataObj.value.cardPortraitUrl = url;
|
||||
} else if (type === 2) {
|
||||
dataObj.value.cardEmblemUrl = url;
|
||||
}
|
||||
// upData({
|
||||
// avatar: url
|
||||
// });
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.transparent_bg {
|
||||
width: 100%;
|
||||
height: 708rpx;
|
||||
|
||||
// position: fixed;
|
||||
// top: 0;
|
||||
// left: 0;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.realname-bg {
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
|
||||
.ipt-bar {
|
||||
// min-width: 300rpx;
|
||||
|
||||
::v-deep .uni-input-input {
|
||||
// color: #fff;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
::v-deep .uni-easyinput__placeholder-class {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.head-title {
|
||||
font-size: 28rpx;
|
||||
// color: #FFFFFF;
|
||||
line-height: 52rpx;
|
||||
}
|
||||
|
||||
.img-box {
|
||||
width: 590rpx;
|
||||
height: 324rpx;
|
||||
background: #f2f5f7;
|
||||
border-radius: 12rpx;
|
||||
margin: 0 26rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
line-height: 34rpx;
|
||||
overflow: hidden;
|
||||
// padding: 28rpx 0;
|
||||
|
||||
.updata-img {
|
||||
width: 256rpx;
|
||||
height: 182rpx;
|
||||
margin: 28rpx auto 46rpx;
|
||||
border-radius: 12rpx;
|
||||
// border: 1rpx solid #999;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background: linear-gradient(to right, #fa8735 0%, #fe3b48 100%);
|
||||
color: #fff;
|
||||
margin: 140rpx 112rpx 0;
|
||||
font-size: 32rpx;
|
||||
border-radius: 50rpx;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,54 @@
|
||||
<!-- 文章展示 -->
|
||||
<template>
|
||||
<s-layout :bgStyle="{ color: '#FFF' }" :title="state.title" class="set-wrap">
|
||||
<view class="ss-p-30 richtext"><mp-html :content="state.content"></mp-html></view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import ArticleApi from '@/sheep/api/promotion/article';
|
||||
|
||||
const state = reactive({
|
||||
title: '',
|
||||
content: '',
|
||||
});
|
||||
|
||||
async function getRichTextContent(id, title) {
|
||||
const { code, data } = await ArticleApi.getArticle(id, title);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.content = data.content;
|
||||
// 标题不一致时,修改标题
|
||||
if (state.title !== data.title) {
|
||||
state.title = data.title;
|
||||
uni.setNavigationBarTitle({
|
||||
title: state.title,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.title) {
|
||||
state.title = options.title;
|
||||
uni.setNavigationBarTitle({
|
||||
title: state.title,
|
||||
});
|
||||
}
|
||||
getRichTextContent(options.id, options.title);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.set-title {
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
|
||||
:deep() {
|
||||
image {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,283 @@
|
||||
<!-- 搜索界面 -->
|
||||
<template>
|
||||
<s-pages class="set-wrap" title="搜索" color="#ffffff">
|
||||
<view class="">
|
||||
<card_search class="search" style="margin-bottom: 32rpx" @search="onSearch"></card_search>
|
||||
<view class="search_top">
|
||||
<view>
|
||||
<view class="flex-center ju-between search_title" v-if="state.historyList.length">
|
||||
<view class="size32 c0">历史搜索</view>
|
||||
<uni-icons @tap="onDelete" type="trash" color="" size="24" />
|
||||
</view>
|
||||
<view class="ss-flex ss-col-center ss-row-left ss-flex-wrap">
|
||||
<button
|
||||
class="history-btn ss-reset-button"
|
||||
@tap="onSearch(item)"
|
||||
v-for="(item, index) in state.historyList"
|
||||
:key="index"
|
||||
>
|
||||
{{ item }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-t-10 m-b-50">
|
||||
<view class="flex-center ju-between search_title" v-if="state.historyList.length">
|
||||
<view class="size32 c0">热门搜索</view>
|
||||
</view>
|
||||
<view class="ss-flex ss-col-center ss-row-left ss-flex-wrap">
|
||||
<button
|
||||
class="history-btn ss-reset-button"
|
||||
@tap="onSearch(item.searchKeyword)"
|
||||
v-for="(item, index) in state.hotSearchList"
|
||||
:key="index"
|
||||
>
|
||||
{{ item.searchKeyword }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="search_bottom w100">
|
||||
<scroll-view class="scroll-view" scroll-x="true" scroll-left="0">
|
||||
<view class="scroll flex-row nowrap">
|
||||
<view
|
||||
:style="{
|
||||
width: width,
|
||||
}"
|
||||
v-for="(v, i) in shoops"
|
||||
:key="i"
|
||||
class="scroll_item shrink"
|
||||
:class="{
|
||||
scroll_item1: i == 0,
|
||||
scroll_item2: i == 1,
|
||||
}"
|
||||
>
|
||||
<view class="flex-center ju-between mb20">
|
||||
<view class="flex-center">
|
||||
<view class="icon1">
|
||||
<image :src="$url + v.icon" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="bot_name size28">{{ v.name }}</view>
|
||||
</view>
|
||||
<view class="flex-center" @click="onSearch()">
|
||||
<view class="size24 c34">更多</view>
|
||||
<uni-icons type="right" color="#333333" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="goodsList w100">
|
||||
<view class="w100" v-for="(item, index) in v.list" :key="index">
|
||||
<card_goods :data="item" :type="3"></card_goods>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/index/index';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import card_goods from '@/components/goodsItem/card_goods.vue';
|
||||
let width = ref('516rpx');
|
||||
const state = reactive({
|
||||
historyList: [],
|
||||
hotSearchList: [],
|
||||
});
|
||||
|
||||
// 搜索
|
||||
function onSearch(keyword) {
|
||||
if (!keyword) {
|
||||
sheep.$router.go('/pages/goods/list');
|
||||
return;
|
||||
}
|
||||
saveSearchHistory(keyword);
|
||||
// 前往商品列表(带搜索条件)
|
||||
sheep.$router.go('/pages/goods/list', { keyword });
|
||||
}
|
||||
|
||||
// 保存搜索历史
|
||||
function saveSearchHistory(keyword) {
|
||||
// 如果关键词在搜索历史中,则把此关键词先移除
|
||||
if (state.historyList.includes(keyword)) {
|
||||
state.historyList.splice(state.historyList.indexOf(keyword), 1);
|
||||
}
|
||||
// 置顶关键词
|
||||
state.historyList.unshift(keyword);
|
||||
|
||||
// 最多保留 10 条记录
|
||||
if (state.historyList.length >= 10) {
|
||||
state.historyList.length = 10;
|
||||
}
|
||||
uni.setStorageSync('searchHistory', state.historyList);
|
||||
}
|
||||
|
||||
function onDelete() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认清除搜索历史吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
state.historyList = [];
|
||||
uni.removeStorageSync('searchHistory');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const gethotsearchlist = () => {
|
||||
api.gethotsearchlist().then((res) => {
|
||||
if (res.code == 0) {
|
||||
state.hotSearchList = res.data || [];
|
||||
}
|
||||
});
|
||||
};
|
||||
let shoops = reactive([
|
||||
{
|
||||
name: '推荐商品',
|
||||
icon: 'index/search3.png',
|
||||
list: [],
|
||||
},
|
||||
{
|
||||
name: '销量',
|
||||
icon: 'index/search2.png',
|
||||
list: [],
|
||||
},
|
||||
]);
|
||||
const getShoops = async (obj) => {
|
||||
let res = await SpuApi.getSpuPage({
|
||||
pageNo: 1,
|
||||
pageSize: 5,
|
||||
...obj,
|
||||
});
|
||||
if (res.code == 0) {
|
||||
return res.data.list;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
onLoad(async () => {
|
||||
state.historyList = uni.getStorageSync('searchHistory') || [];
|
||||
// 热门搜索
|
||||
gethotsearchlist();
|
||||
shoops[1].list = await getShoops({
|
||||
sortField: 'salesCount',
|
||||
sortAsc: true,
|
||||
});
|
||||
shoops[0].list = await getShoops({
|
||||
recommend: true,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.serach-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.uni-searchbar {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.serach-history {
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.clean-history {
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.history-btn {
|
||||
padding: 0 24rpx;
|
||||
// height: 48rpx;
|
||||
line-height: 48rpx;
|
||||
background: #f2f3f5;
|
||||
border-radius: 30rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
max-width: 690rpx;
|
||||
margin: 0 12rpx 24rpx 0;
|
||||
}
|
||||
.search {
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.search_top {
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
.search_title {
|
||||
margin-bottom: 16rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
.search_bottom {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.scroll-view {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow-x: auto; // 添加横向滚动
|
||||
-webkit-overflow-scrolling: touch; // 优化移动端滚动体验
|
||||
}
|
||||
.scroll-view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.scroll {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: max-content;
|
||||
padding: 0 32rpx;
|
||||
.scroll_item {
|
||||
padding: 32rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.bot_name {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
.scroll_item1 {
|
||||
background: linear-gradient(180deg, #ffe4e6 0%, #ffebe7 100%);
|
||||
margin-right: 32rpx;
|
||||
.bot_name {
|
||||
color: #fa7e31;
|
||||
}
|
||||
}
|
||||
.scroll_item2 {
|
||||
background: linear-gradient(180deg, #fff1cc 0%, rgba(255, 248, 222, 0.34) 100%);
|
||||
.bot_name {
|
||||
color: #ffbd15;
|
||||
}
|
||||
}
|
||||
}
|
||||
.icon1 {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.goodsList {
|
||||
padding: 40rpx 20rpx;
|
||||
padding-bottom: 2rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
:deep(.uni-icons) {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,328 @@
|
||||
<template>
|
||||
<s-pages title="设置">
|
||||
<view class="setPage">
|
||||
<view class="card1">
|
||||
<card_list :arr="listArr">
|
||||
<template v-slot:footer-1>
|
||||
<view @click="upImg" class="headImg">
|
||||
<image v-if="userInfo?.avatar" :src="userInfo?.avatar" mode="scaleToFill" />
|
||||
<image v-else :src="`${$url}home/head.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
</template>
|
||||
<template v-slot:footer-2>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请输入昵称"
|
||||
v-model="userInfo.nickname"
|
||||
style="text-align: right"
|
||||
@blur="upData"
|
||||
/>
|
||||
</template>
|
||||
</card_list>
|
||||
</view>
|
||||
<view class="bg24 submit-btn" @click="btn">登录其他账号</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { ref, computed, reactive, onMounted } from 'vue';
|
||||
import AuthUtil from '@/sheep/api/member/auth';
|
||||
import card_list from '@/components/card_list/card_list.vue';
|
||||
import { baseUrl } from '@/sheep/config';
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
const appInfo = computed(() => sheep.$store('app').info);
|
||||
const isLogin = computed(() => sheep.$store('user').isLogin);
|
||||
const userInfo = ref({});
|
||||
const storageSize = uni.getStorageInfoSync().currentSize + 'Kb';
|
||||
const state = reactive({
|
||||
showModal: false,
|
||||
});
|
||||
const listArr = ref([
|
||||
{
|
||||
id: '1',
|
||||
title: '头像',
|
||||
disabled: false,
|
||||
url: '',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
title: '昵称',
|
||||
rightText: '',
|
||||
},
|
||||
{
|
||||
id: '9',
|
||||
title: '用户ID',
|
||||
rightText: '',
|
||||
},
|
||||
{
|
||||
id: '10',
|
||||
title: '手机号',
|
||||
rightText: '',
|
||||
},
|
||||
// {
|
||||
// id: '3',
|
||||
// title: '手机号码',
|
||||
// rightText: '',
|
||||
// clickable: true,
|
||||
// link: 'navigateTo',
|
||||
// to: '/pages/home/phone',
|
||||
// },
|
||||
{
|
||||
id: '4',
|
||||
title: '修改密码',
|
||||
clickable: true,
|
||||
link: 'navigateTo',
|
||||
to: '/pages/home/pass',
|
||||
},
|
||||
{
|
||||
id: '5',
|
||||
title: '隐私政策',
|
||||
clickable: true,
|
||||
link: 'navigateTo',
|
||||
to: '/pages/home/agreement?type=1',
|
||||
},
|
||||
{
|
||||
id: '6',
|
||||
title: '用户协议',
|
||||
clickable: true,
|
||||
link: 'navigateTo',
|
||||
to: '/pages/home/agreement?type=2',
|
||||
},
|
||||
// {
|
||||
// id: '8',
|
||||
// title: '计算',
|
||||
// clickable: true,
|
||||
// link: 'navigateTo',
|
||||
// to: '/pages/home/calculate',
|
||||
// },
|
||||
{
|
||||
id: '7',
|
||||
title: '关于app',
|
||||
clickable: true,
|
||||
link: 'navigateTo',
|
||||
to: '/pages/public/versions/versions',
|
||||
// link: 'navigateTo',
|
||||
rightText: uni.getSystemInfoSync().appWgtVersion,
|
||||
},
|
||||
{
|
||||
id: '11',
|
||||
title: '账号注销',
|
||||
clickable: true,
|
||||
link: 'navigateTo',
|
||||
to: '/pages/public/logoff',
|
||||
},
|
||||
// {
|
||||
// id: '12',
|
||||
// title: '测试',
|
||||
// clickable: true,
|
||||
// link: 'navigateTo',
|
||||
// to: '/pages/public/test',
|
||||
// },
|
||||
]);
|
||||
|
||||
function onCheckUpdate() {
|
||||
sheep.$platform.checkUpdate();
|
||||
// 小程序初始化时已检查更新
|
||||
// H5实时更新无需检查
|
||||
// App 1.跳转应用市场更新 2.手动热更新 3.整包更新
|
||||
}
|
||||
|
||||
// 注销账号
|
||||
function onLogoff() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认注销账号?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
const { code } = await AuthUtil.deactivate();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
sheep.$store('user').logout();
|
||||
sheep.$router.go('/pages/index/user');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 退出账号
|
||||
function onLogout() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认退出账号?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
const { code } = await AuthUtil.logout();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
sheep.$store('user').logout();
|
||||
sheep.$router.go('/pages/index/user');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const upImg = () => {
|
||||
uni.chooseImage({
|
||||
count: 1, //默认9
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
success: function (res) {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
const tempFiles = res.tempFiles;
|
||||
let resSize = tempFiles[0].size;
|
||||
if (resSize > 1048576) {
|
||||
uni.showToast({
|
||||
title: '上传图片大小不能超过1MB',
|
||||
icon: 'error',
|
||||
});
|
||||
return;
|
||||
}
|
||||
const token = uni.getStorageSync('token') ? uni.getStorageSync('token') : undefined;
|
||||
let tenant_id = uni.getStorageSync('tenant-id');
|
||||
uni.uploadFile({
|
||||
url: baseUrl + '/app-api/infra/file/upload', //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'file',
|
||||
formData: {
|
||||
directory: 'head',
|
||||
'tenant-id': tenant_id,
|
||||
token: token,
|
||||
},
|
||||
header: {},
|
||||
success: (uploadFileRes) => {
|
||||
let url = JSON.parse(uploadFileRes.data).data;
|
||||
upData({
|
||||
avatar: url,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
const getData = async (obj) => {
|
||||
let res = await UserApi.getUserInfo();
|
||||
if (res.code != 0) return;
|
||||
userInfo.value = res.data;
|
||||
listArr.value.forEach((item) => {
|
||||
if (item.id == 2) {
|
||||
item.rightText = userInfo.value.nickname;
|
||||
}
|
||||
if (item.id == 3) {
|
||||
item.rightText = userInfo.value.mobile;
|
||||
}
|
||||
if (item.id == 9) {
|
||||
item.rightText = userInfo.value.id + '';
|
||||
}
|
||||
if (item.id == 10) {
|
||||
item.rightText = userInfo.value.mobile;
|
||||
}
|
||||
});
|
||||
console.log(listArr.value);
|
||||
};
|
||||
const upData = async (obj) => {
|
||||
let res = await UserApi.updateUser({
|
||||
...userInfo.value,
|
||||
...obj,
|
||||
});
|
||||
if (res.code != 0) return;
|
||||
getData();
|
||||
};
|
||||
const btn = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认退出账号?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
const { code } = await AuthUtil.logout();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
sheep.$store('user').logout();
|
||||
// sheep.$router.go('/pages/public/login');
|
||||
uni.reLaunch({
|
||||
url: '/pages/public/login',
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
onMounted(() => {
|
||||
// listArr.value.forEach(item=>{
|
||||
// if(item.id == 7){
|
||||
|
||||
// let localVersion = '';
|
||||
// // #ifdef APP-PLUS
|
||||
// localVersion = plus.runtime.versionCode;
|
||||
// // #endif
|
||||
// // #ifndef APP-PLUS
|
||||
// localVersion = uni.getStorageSync('localVersion') || '1.0.0';
|
||||
// // #endif
|
||||
// item.rightText = localVersion;
|
||||
// }
|
||||
// })
|
||||
getData();
|
||||
});
|
||||
const logout = () => {
|
||||
uni.showModal({
|
||||
title: '注销账号',
|
||||
content: '注销账号后,将数据清空,并无法登录该账号,请谨慎操作',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
const { code } = await AuthUtil.logout();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
sheep.$store('user').logout();
|
||||
sheep.$router.go('/pages/index/user');
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.setPage {
|
||||
padding: 30rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.card1 {
|
||||
background-color: var(--color24);
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.headImg {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
color: var(--color34);
|
||||
background: var(--color1);
|
||||
margin-top: 100rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<view class="p-t-300">
|
||||
<button @click="submit()">提交</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
|
||||
const state = ref(false);
|
||||
const formData = ref({
|
||||
name: '内哥',
|
||||
age: 10,
|
||||
phone: null,
|
||||
});
|
||||
function submit() {
|
||||
state.value = !state.value;
|
||||
console.log('状态为:' + state.value);
|
||||
if (state.value) {
|
||||
formData.value.phone = '13800000000';
|
||||
console.log('表单数据:', formData.value);
|
||||
} else {
|
||||
delete formData.value.phone;
|
||||
console.log('表单数据:', formData.value);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<view class="pages"> </view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
let { proxy } = getCurrentInstance();
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<s-pages title="版本号">
|
||||
<view class="pages relative h100 p-t-50">
|
||||
<view class="w_150 h_150 m-b-50" style="margin: 0 auto">
|
||||
<image class="w100 h100" src="/static/logo.png" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="center"> 最新版本号: {{ newversion }} </view>
|
||||
<view class="center m-t-50"> 当前版本号: {{ version }} </view>
|
||||
<view class="flex-center m-t-100 absolute b50 w100 p-x-32">
|
||||
<view class="ai-button2 m-r-20" @click="downloadFile()">更新最新版本</view>
|
||||
<view class="ai-button2" @click="copy()">复制APP下载链接</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import { gethotupdatelist, getAndroidAppUrl } from '@/sheep/api/index/index';
|
||||
import sheep from '@/sheep';
|
||||
let { proxy } = getCurrentInstance();
|
||||
let newversion = ref('');
|
||||
let version = ref('');
|
||||
let filePath = ref();
|
||||
let androidUrl = ref(); //安卓apk地址
|
||||
|
||||
const wgtUp = async () => {
|
||||
// console.log(plus.runtime);
|
||||
let res = await gethotupdatelist();
|
||||
if (res.code !== 0) return;
|
||||
filePath.value = res.data.filePath;
|
||||
let localVersion = uni.getSystemInfoSync().appWgtVersion;
|
||||
version.value = localVersion;
|
||||
newversion.value = res.data.versionNumber;
|
||||
if (res.data.versionNumber != localVersion) {
|
||||
if (res.data.type == 'min') {
|
||||
if (res.data.isForceUpdate) {
|
||||
// 强制更新
|
||||
downloadFile();
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '发现新的版本,是否更新?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
downloadFile();
|
||||
} else if (res.cancel) {
|
||||
if (res.data.isForceUpdate) {
|
||||
plus.runtime.quit(); //退出应用
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '发现新的版本,请到立即更新到最新版本',
|
||||
confirmText: '立即更新',
|
||||
cancelText: res.data.isForceUpdate ? '关闭' : '取消',
|
||||
confirmColor: '#FA7E31',
|
||||
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
updateApp(filePath.value);
|
||||
} else if (res.cancel) {
|
||||
if (res.data.isForceUpdate) {
|
||||
plus.runtime.quit(); //退出应用
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const updateApp = (url) => {
|
||||
uni.showLoading({
|
||||
title: '下载中',
|
||||
});
|
||||
uni.downloadFile({
|
||||
url: url, //下载地址
|
||||
success: (res) => {
|
||||
console.log(res, '下载成功');
|
||||
if (res.statusCode === 200) {
|
||||
console.log('下载成功');
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '下载成功',
|
||||
icon: 'success',
|
||||
});
|
||||
uni.saveFile({
|
||||
tempFilePath: res.tempFilePath,
|
||||
success: function (res) {
|
||||
uni.openDocument({
|
||||
filePath: res.savedFilePath,
|
||||
success: function (res) {
|
||||
console.log(res, '打开安装包');
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err, '打开安装包-失败');
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '下载失败,请检查网络',
|
||||
icon: 'none',
|
||||
});
|
||||
console.log(e);
|
||||
},
|
||||
});
|
||||
};
|
||||
const copy = () => {
|
||||
uni.setClipboardData({
|
||||
data: androidUrl.value,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '链接已复制,请在浏览器打开',
|
||||
icon: 'none',
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
const downloadFile = () => {
|
||||
if (newversion.value == version.value) {
|
||||
uni.showToast({ title: '已经是最新版本', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
let url = filePath.value;
|
||||
uni.downloadFile({
|
||||
url: url,
|
||||
success: (downloadResult) => {
|
||||
uni.showToast({
|
||||
title: '更新中....',
|
||||
icon: 'none',
|
||||
});
|
||||
if (downloadResult) {
|
||||
if (downloadResult.statusCode === 200) {
|
||||
plus.runtime.install(
|
||||
downloadResult.tempFilePath,
|
||||
{
|
||||
force: true,
|
||||
},
|
||||
function () {
|
||||
uni.showModal({
|
||||
title: '成功提示',
|
||||
content: '热更新成功,请重启应用',
|
||||
confirmColor: '#FA7E31',
|
||||
showCancel: false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
plus.runtime.restart(); //自动重启软件
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
function (e) {
|
||||
uni.showModal({
|
||||
title: '失败提示',
|
||||
content: e,
|
||||
showCancel: false,
|
||||
confirmColor: '#FA7E31',
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
//获取安卓apk
|
||||
function getAndroid() {
|
||||
getAndroidAppUrl().then((res) => {
|
||||
console.log(res.data);
|
||||
androidUrl.value = res.data || 'http://8.136.55.200:1080/app.apk';
|
||||
});
|
||||
}
|
||||
onMounted(() => {
|
||||
getAndroid();
|
||||
wgtUp();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,26 @@
|
||||
<!-- 网页加载 -->
|
||||
<template>
|
||||
<s-layout :title="title" />
|
||||
<iframe :src="url" frameborder="0" class="iframe" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const url = ref();
|
||||
const title = ref();
|
||||
|
||||
onLoad((e) => {
|
||||
url.value = e.url;
|
||||
title.value = e.title;
|
||||
console.log(e);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user