第一次上传
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
export class BaseConfig {
|
||||
// protected static servesUrl: string = "http://192.168.0.142:5002";//线下
|
||||
|
||||
protected static servesUrl: string = "https://vp.xypays.cn";
|
||||
protected static imgUrl: string = "http://vp.cloud.xypays.cn";
|
||||
protected static mediaUrl: string = "http://byc1.xypays.cn/";
|
||||
protected static uploadUrl: string = "/TencentCos/GetUpLoadInfo";
|
||||
protected static payuploadUrl: string = "http://pay.xypays.cn";
|
||||
}
|
||||
@@ -0,0 +1,388 @@
|
||||
/*
|
||||
* HTML5 Parser By Sam Blowes
|
||||
*
|
||||
* Designed for HTML5 documents
|
||||
*
|
||||
* Original code by John Resig (ejohn.org)
|
||||
* http://ejohn.org/blog/pure-javascript-html-parser/
|
||||
* Original code by Erik Arvidsson, Mozilla Public License
|
||||
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* License
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* This code is triple licensed using Apache Software License 2.0,
|
||||
* Mozilla Public License or GNU Public License
|
||||
*
|
||||
* ////////////////////////////////////////////////////////////////////////////
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* ////////////////////////////////////////////////////////////////////////////
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* The Original Code is Simple HTML Parser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Erik Arvidsson.
|
||||
* Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* ////////////////////////////////////////////////////////////////////////////
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* Usage
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* // Use like so:
|
||||
* HTMLParser(htmlString, {
|
||||
* start: function(tag, attrs, unary) {},
|
||||
* end: function(tag) {},
|
||||
* chars: function(text) {},
|
||||
* comment: function(text) {}
|
||||
* });
|
||||
*
|
||||
* // or to get an XML string:
|
||||
* HTMLtoXML(htmlString);
|
||||
*
|
||||
* // or to get an XML DOM Document
|
||||
* HTMLtoDOM(htmlString);
|
||||
*
|
||||
* // or to inject into an existing document/DOM node
|
||||
* HTMLtoDOM(htmlString, document);
|
||||
* HTMLtoDOM(htmlString, document.body);
|
||||
*
|
||||
*/
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
|
||||
var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
|
||||
var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5
|
||||
|
||||
var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5
|
||||
// fixed by xxx 将 ins 标签从块级名单中移除
|
||||
|
||||
var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
|
||||
|
||||
var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open
|
||||
// (and which close themselves)
|
||||
|
||||
var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled"
|
||||
|
||||
var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything)
|
||||
|
||||
var special = makeMap('script,style');
|
||||
function HTMLParser(html, handler) {
|
||||
var index;
|
||||
var chars;
|
||||
var match;
|
||||
var stack = [];
|
||||
var last = html;
|
||||
|
||||
stack.last = function () {
|
||||
return this[this.length - 1];
|
||||
};
|
||||
|
||||
while (html) {
|
||||
chars = true; // Make sure we're not in a script or style element
|
||||
|
||||
if (!stack.last() || !special[stack.last()]) {
|
||||
// Comment
|
||||
if (html.indexOf('<!--') == 0) {
|
||||
index = html.indexOf('-->');
|
||||
|
||||
if (index >= 0) {
|
||||
if (handler.comment) {
|
||||
handler.comment(html.substring(4, index));
|
||||
}
|
||||
|
||||
html = html.substring(index + 3);
|
||||
chars = false;
|
||||
} // end tag
|
||||
|
||||
} else if (html.indexOf('</') == 0) {
|
||||
match = html.match(endTag);
|
||||
|
||||
if (match) {
|
||||
html = html.substring(match[0].length);
|
||||
match[0].replace(endTag, parseEndTag);
|
||||
chars = false;
|
||||
} // start tag
|
||||
|
||||
} else if (html.indexOf('<') == 0) {
|
||||
match = html.match(startTag);
|
||||
|
||||
if (match) {
|
||||
html = html.substring(match[0].length);
|
||||
match[0].replace(startTag, parseStartTag);
|
||||
chars = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (chars) {
|
||||
index = html.indexOf('<');
|
||||
var text = index < 0 ? html : html.substring(0, index);
|
||||
html = index < 0 ? '' : html.substring(index);
|
||||
|
||||
if (handler.chars) {
|
||||
handler.chars(text);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) {
|
||||
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, '$1$2');
|
||||
|
||||
if (handler.chars) {
|
||||
handler.chars(text);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
parseEndTag('', stack.last());
|
||||
}
|
||||
|
||||
if (html == last) {
|
||||
throw 'Parse Error: ' + html;
|
||||
}
|
||||
|
||||
last = html;
|
||||
} // Clean up any remaining tags
|
||||
|
||||
|
||||
parseEndTag();
|
||||
|
||||
function parseStartTag(tag, tagName, rest, unary) {
|
||||
tagName = tagName.toLowerCase();
|
||||
if (block[tagName]) {
|
||||
while (stack.last() && inline[stack.last()]) {
|
||||
parseEndTag('', stack.last());
|
||||
}
|
||||
}
|
||||
|
||||
if (closeSelf[tagName] && stack.last() == tagName) {
|
||||
parseEndTag('', tagName);
|
||||
}
|
||||
|
||||
unary = empty[tagName] || !!unary;
|
||||
|
||||
if (!unary) {
|
||||
stack.push(tagName);
|
||||
}
|
||||
|
||||
if (handler.start) {
|
||||
var attrs = [];
|
||||
rest.replace(attr, function (match, name) {
|
||||
var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
|
||||
attrs.push({
|
||||
name: name,
|
||||
value: value,
|
||||
escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // "
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
if (handler.start) {
|
||||
handler.start(tagName, attrs, unary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseEndTag(tag, tagName) {
|
||||
// If no tag name is provided, clean shop
|
||||
if (!tagName) {
|
||||
var pos = 0;
|
||||
} // Find the closest opened tag of the same type
|
||||
else {
|
||||
for (var pos = stack.length - 1; pos >= 0; pos--) {
|
||||
if (stack[pos] == tagName) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pos >= 0) {
|
||||
// Close all the open elements, up the stack
|
||||
for (var i = stack.length - 1; i >= pos; i--) {
|
||||
if (handler.end) {
|
||||
handler.end(stack[i]);
|
||||
}
|
||||
} // Remove the open elements from the stack
|
||||
|
||||
|
||||
stack.length = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function makeMap(str) {
|
||||
var obj = {};
|
||||
var items = str.split(',');
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
obj[items[i]] = true;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function removeDOCTYPE(html) {
|
||||
return html.replace(/<\?xml.*\?>\n/, '').replace(/<!doctype.*>\n/, '').replace(/<!DOCTYPE.*>\n/, '');
|
||||
}
|
||||
|
||||
function parseAttrs(attrs) {
|
||||
return attrs.reduce(function (pre, attr) {
|
||||
var value = attr.value;
|
||||
var name = attr.name;
|
||||
if (pre[name]) {
|
||||
pre[name] = pre[name] + " " + value;
|
||||
} else {
|
||||
pre[name] = value;
|
||||
}
|
||||
|
||||
return pre;
|
||||
}, {});
|
||||
}
|
||||
function convertStyleStringToJSON(styleString) {
|
||||
var styles = styleString.split(";"); // 通过分号将样式字符串分割为多个样式声明
|
||||
var result = {};
|
||||
|
||||
styles.forEach(function(style) {
|
||||
var styleParts = style.split(":"); // 通过冒号将样式声明分割为属性和值
|
||||
var property = styleParts[0].trim();
|
||||
var value = styleParts[1] && styleParts[1].trim();
|
||||
|
||||
if (property && value) {
|
||||
result[property] = value; // 将属性和值添加到结果对象中
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
function parseHtml(html) {
|
||||
html = removeDOCTYPE(html);
|
||||
var stacks = [];
|
||||
var results = {
|
||||
node: 'root',
|
||||
children: []
|
||||
};
|
||||
HTMLParser(html, {
|
||||
start: function start(tag, attrs, unary) {
|
||||
var node = {
|
||||
name: tag
|
||||
};
|
||||
|
||||
if (attrs.length !== 0) {
|
||||
node.attrs = parseAttrs(attrs);
|
||||
node.styles = node.attrs.style ? convertStyleStringToJSON(node.attrs.style) : {}
|
||||
}
|
||||
|
||||
if(!node.type) {
|
||||
if(inline[node.name] && node.name !== 'img' ) {
|
||||
node.type = 'text';
|
||||
if(node.name == 'br') {
|
||||
node.text = '\n'
|
||||
} else if(node.name == 'strong'){
|
||||
node.styles.fontWeight = 'bold'
|
||||
}
|
||||
} else if(node.name == 'img'){
|
||||
node.type = 'image'
|
||||
node.src = node.attrs.src
|
||||
} else {
|
||||
node.type = 'view'
|
||||
if(['h1','h2','h3','h4','h5','h6'].includes(node.name)) {
|
||||
node.styles.fontWeight = 'bold'
|
||||
}
|
||||
}
|
||||
}
|
||||
if (unary) {
|
||||
var parent = stacks[0] || results;
|
||||
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
|
||||
parent.children.push(node);
|
||||
} else {
|
||||
stacks.unshift(node);
|
||||
}
|
||||
},
|
||||
end: function end(tag) {
|
||||
var node = stacks.shift();
|
||||
if (node.name !== tag) console.error('invalid state: mismatch end tag');
|
||||
if (stacks.length === 0) {
|
||||
results.children.push(node);
|
||||
} else {
|
||||
var parent = stacks[0];
|
||||
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
parent.children.push(node);
|
||||
}
|
||||
const isTextBox = node.children && node.children.length > 1 && node.children.every(child => {
|
||||
return ['text','image'].includes(child.type)
|
||||
})
|
||||
if(isTextBox) {
|
||||
node.type = 'textBox'
|
||||
}
|
||||
},
|
||||
chars: function chars(text) {
|
||||
var node = {
|
||||
type: 'text',
|
||||
text: text
|
||||
};
|
||||
|
||||
if (stacks.length === 0) {
|
||||
results.children.push(node);
|
||||
} else {
|
||||
var parent = stacks[0];
|
||||
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
|
||||
parent.children.push(node);
|
||||
}
|
||||
},
|
||||
comment: function comment(text) {
|
||||
var node = {
|
||||
node: 'comment',
|
||||
text: text
|
||||
};
|
||||
var parent = stacks[0];
|
||||
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
|
||||
parent.children.push(node);
|
||||
}
|
||||
});
|
||||
return results.children;
|
||||
}
|
||||
|
||||
export default parseHtml;
|
||||
@@ -0,0 +1,581 @@
|
||||
<template>
|
||||
<view class="settings-page">
|
||||
<!-- 沉浸式状态栏 -->
|
||||
<view class="status-bar"></view>
|
||||
|
||||
<!-- 顶部导航 -->
|
||||
<view class="nav-bar">
|
||||
<image class="back-icon" src="/static/icons/back.svg" @click="goBack" mode="aspectFit" />
|
||||
<text class="nav-title">设置</text>
|
||||
<view class="nav-placeholder"></view>
|
||||
</view>
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<view class="content">
|
||||
<!-- 个人信息卡片 -->
|
||||
<view class="profile-card">
|
||||
<view class="card-title">
|
||||
<text class="ri-user-line title-icon"></text>
|
||||
<text class="title-text">个人信息</text>
|
||||
</view>
|
||||
|
||||
<!-- 头像 -->
|
||||
<view class="setting-item" @click="uploadFImg(140,140,'Avatar','headimg')">
|
||||
<view class="item-left">
|
||||
<text class="item-label">头像</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<image class="avatar-preview" :src="Service.GetMateUrlByImg(userInfo.headImg)"
|
||||
mode="aspectFill" />
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 昵称 -->
|
||||
<view class="setting-item" @click="changeNickname">
|
||||
<view class="item-left">
|
||||
<text class="item-label">昵称</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-value">{{ userInfo.nick }}</text>
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 手机号 -->
|
||||
<view class="setting-item">
|
||||
<view class="item-left">
|
||||
<text class="item-label">手机号</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-value">{{ userInfo.phone }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 会员ID -->
|
||||
<view class="setting-item">
|
||||
<view class="item-left">
|
||||
<text class="item-label">会员ID</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-value">{{ userInfo.userNo }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 其他设置 -->
|
||||
<!-- <view class="other-settings-card">
|
||||
<view class="card-title">
|
||||
<text class="ri-settings-4-line title-icon"></text>
|
||||
<text class="title-text">其他设置</text>
|
||||
</view>
|
||||
|
||||
<view class="setting-item" @click="clearCache">
|
||||
<view class="item-left">
|
||||
<text class="item-label">清除缓存</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-value">23.5MB</text>
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="setting-item" @click="checkUpdate">
|
||||
<view class="item-left">
|
||||
<text class="item-label">检查更新</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-value">当前版本 v1.0.0</text>
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="setting-item" @click="viewPrivacy">
|
||||
<view class="item-left">
|
||||
<text class="item-label">隐私政策</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="setting-item" @click="viewAgreement">
|
||||
<view class="item-left">
|
||||
<text class="item-label">用户协议</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="ri-arrow-right-s-line item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view class="logout-section">
|
||||
<button class="logout-btn" @click="save()">
|
||||
<text class="btn-text">保存信息</text>
|
||||
</button>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 修改昵称弹窗 -->
|
||||
<view v-if="showNicknameModal" class="modal-overlay" @click="closeNicknameModal">
|
||||
<view class="modal-content" @click.stop>
|
||||
<view class="modal-header">
|
||||
<text class="modal-title">修改昵称</text>
|
||||
<text class="ri-close-line modal-close" @click="closeNicknameModal"></text>
|
||||
</view>
|
||||
<view class="modal-body">
|
||||
<input class="nickname-input" v-model="tempNickname" placeholder="请输入新昵称" maxlength="20" />
|
||||
</view>
|
||||
<view class="modal-footer">
|
||||
<button class="modal-btn cancel" @click.stop="closeNicknameModal">取消</button>
|
||||
<button class="modal-btn confirm" @click.stop="saveNickname">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
import { Service } from '@/Service/Service';
|
||||
import { ref } from "vue";
|
||||
import { vpUserService } from '@/Service/vp/vpUserService';
|
||||
import ImageCropperFunc from "@/components/ImageCropper";
|
||||
|
||||
const userInfo = ref<any>({
|
||||
nick: '',
|
||||
sex: '',
|
||||
phone: '',
|
||||
headImg: ''
|
||||
})
|
||||
|
||||
// 临时昵称
|
||||
const tempNickname = ref('')
|
||||
|
||||
|
||||
|
||||
onLoad(() => {
|
||||
getUserinfo()
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
const getUserinfo = () => {
|
||||
vpUserService.GetUserInfo().then(res => {
|
||||
userInfo.value = res.data.userInfo
|
||||
})
|
||||
}
|
||||
const uploadFImg = (width : any, height : any, Type : any, Name : any) => {
|
||||
uni.chooseImage({
|
||||
count: 1, // 最多选择3张图片
|
||||
sizeType: ['original', 'compressed'], // 支持原图和压缩图
|
||||
sourceType: ['album', 'camera'], // 可从相册选择或使用相机拍照
|
||||
success: function (res) {
|
||||
let path = res.tempFiles[0].path
|
||||
let arr = path.split('.')
|
||||
let name = arr[arr.length - 1]
|
||||
Service.uploadH5(path, 'Avatar', (data) => {
|
||||
userInfo.value.headImg = data
|
||||
vpUserService.UpdateUser(userInfo.value.headImg, userInfo.value.nick, userInfo.value.sex, '').then(res => {
|
||||
if (res.code == 0) {
|
||||
Service.Msg('修改成功!')
|
||||
getUserinfo()
|
||||
} else {
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
fail: function (err) {
|
||||
console.error('选择失败:', err.errMsg);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 修改昵称
|
||||
const changeNickname = () => {
|
||||
tempNickname.value = userInfo.value.nick
|
||||
showNicknameModal.value = true
|
||||
}
|
||||
|
||||
// 关闭昵称弹窗
|
||||
const closeNicknameModal = () => {
|
||||
showNicknameModal.value = false
|
||||
}
|
||||
|
||||
|
||||
// 保存昵称
|
||||
const saveNickname = () => {
|
||||
if (!tempNickname.value.trim()) {
|
||||
uni.showToast({
|
||||
title: '昵称不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
vpUserService.UpdateUser(userInfo.value.headImg, tempNickname.value, userInfo.value.sex, '').then(res => {
|
||||
if (res.code == 0) {
|
||||
Service.Msg('修改成功!')
|
||||
showNicknameModal.value = false
|
||||
userInfo.value.nick = tempNickname.value
|
||||
} else {
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 用户信息
|
||||
const user = ref({
|
||||
nickname: '美食达人',
|
||||
avatar: 'https://picsum.photos/200/200?random=100',
|
||||
phone: '138****8888',
|
||||
memberId: '8888888'
|
||||
})
|
||||
|
||||
// 显示昵称弹窗
|
||||
const showNicknameModal = ref(false)
|
||||
|
||||
|
||||
|
||||
// 返回
|
||||
const goBack = () => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
|
||||
// 修改头像
|
||||
const changeAvatar = () => {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
// 这里应该上传到服务器,现在暂时直接使用本地路径
|
||||
user.value.avatar = res.tempFilePaths[0]
|
||||
uni.showToast({
|
||||
title: '头像已更新',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 清除缓存
|
||||
const clearCache = () => {
|
||||
uni.showModal({
|
||||
title: '清除缓存',
|
||||
content: '确定要清除缓存吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '清除中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '缓存已清除',
|
||||
icon: 'success'
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 检查更新
|
||||
const checkUpdate = () => {
|
||||
uni.showLoading({
|
||||
title: '检查中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '已是最新版本',
|
||||
icon: 'success'
|
||||
})
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
// 查看隐私政策
|
||||
const viewPrivacy = () => {
|
||||
uni.showToast({
|
||||
title: '隐私政策页面',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
// 查看用户协议
|
||||
const viewAgreement = () => {
|
||||
uni.showToast({
|
||||
title: '用户协议页面',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
const logout = () => {
|
||||
uni.showModal({
|
||||
title: '退出登录',
|
||||
content: '确定要退出登录吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '退出中...'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '已退出登录',
|
||||
icon: 'success'
|
||||
})
|
||||
// 这里可以跳转到登录页面
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.settings-page {
|
||||
min-height: 100vh;
|
||||
background: #F5F5F5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 状态栏 */
|
||||
.status-bar {
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 导航栏 */
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 60rpx 24rpx 20rpx 24rpx;
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
}
|
||||
|
||||
.back-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
padding: 8rpx;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.nav-placeholder {
|
||||
width: 48rpx;
|
||||
}
|
||||
|
||||
/* 内容区域 */
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 32rpx 24rpx;
|
||||
}
|
||||
|
||||
/* 卡片通用样式 */
|
||||
.profile-card,
|
||||
.other-settings-card {
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
padding-bottom: 16rpx;
|
||||
border-bottom: 2rpx solid #F5F5F5;
|
||||
}
|
||||
|
||||
.title-icon {
|
||||
font-size: 32rpx;
|
||||
color: #FF6B00;
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
/* 设置项 */
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 24rpx 0;
|
||||
border-bottom: 1rpx solid #F5F5F5;
|
||||
}
|
||||
|
||||
.setting-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.item-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item-label {
|
||||
font-size: 28rpx;
|
||||
color: #222222;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.item-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.item-value {
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.item-arrow {
|
||||
font-size: 28rpx;
|
||||
color: #CCCCCC;
|
||||
}
|
||||
|
||||
.avatar-preview {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
|
||||
/* 退出登录按钮 */
|
||||
.logout-section {
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #FFFFFF;
|
||||
border: 2rpx solid #F44336;
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #F44336;
|
||||
}
|
||||
|
||||
/* 弹窗样式 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
width: 560rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
font-size: 40rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.nickname-input {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
padding: 0 20rpx;
|
||||
background: #F5F5F5;
|
||||
border-radius: 12rpx;
|
||||
font-size: 28rpx;
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.modal-btn {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.modal-btn.cancel {
|
||||
background: #F5F5F5;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.modal-btn.confirm {
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
color: #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,276 @@
|
||||
{
|
||||
"easycom": {
|
||||
// 注意一定要放在custom里,否则无效,https://ask.dcloud.net.cn/question/131175
|
||||
"custom": {
|
||||
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
|
||||
}
|
||||
},
|
||||
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
|
||||
{
|
||||
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页",
|
||||
"navigationBarBackgroundColor": "#36394D",
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/community",
|
||||
"style": {
|
||||
"navigationBarTitleText": "社区",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/user",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/index/shop",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "积分商城"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "v派商家",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"subPackages": [{
|
||||
"root": "pages/community",
|
||||
"pages": [{
|
||||
"path": "noticeList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "社区公告"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "merchantCom",
|
||||
"style": {
|
||||
"navigationBarTitleText": "社区商家"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "merchantDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "美食小店"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/goods",
|
||||
"pages": [
|
||||
{
|
||||
"path": "integralGoods",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分商品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "merchant",
|
||||
"style": {
|
||||
"navigationBarTitleText": "热门商家"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "goodsDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "商品详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "goodsContro",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "商品管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "addGoods",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "添加商品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "Pay",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "付款"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/article",
|
||||
"pages": [{
|
||||
"path": "articleCom",
|
||||
"style": {
|
||||
"navigationBarTitleText": "社区公告"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "newsList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新闻公告"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "news",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新闻详情"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}, {
|
||||
"root": "pages/userFunc",
|
||||
"pages": [{
|
||||
"path" : "setData",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "编辑资料"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "integration",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "积分明细"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "trade",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "交易记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "editStore",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "编辑店铺"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "statistics",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "数据统计"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "set",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "设置"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "bind",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "绑定手机号"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "password",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "修改支付密码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "storeInter",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "积分明细"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "withdrow",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "提现"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "vip",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "会员码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "promoteCode",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "推广码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "addressList",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "收货地址"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "addAddress",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "添加地址"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
"tabBar": {
|
||||
"color": "#8a8a8a",
|
||||
"selectedColor": "#EC754B",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [{
|
||||
"text": "首页",
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "/static/tabBar/home.png",
|
||||
"selectedIconPath": "/static/tabBar/homed.png"
|
||||
},
|
||||
// {
|
||||
// "text": "社区",
|
||||
// "pagePath": "pages/index/community",
|
||||
// "iconPath": "/static/tabBar/community.png",
|
||||
// "selectedIconPath": "/static/tabBar/communityed.png"
|
||||
// }
|
||||
// ,
|
||||
{
|
||||
"text": "积分商城",
|
||||
"pagePath": "pages/index/shop",
|
||||
"iconPath": "/static/tabBar/shop.png",
|
||||
"selectedIconPath": "/static/tabBar/shoped.png"
|
||||
},
|
||||
{
|
||||
"text": "个人中心",
|
||||
"pagePath": "pages/index/user",
|
||||
"iconPath": "/static/tabBar/user.png",
|
||||
"selectedIconPath": "/static/tabBar/usered.png"
|
||||
}]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import { Service } from '@/Service/Service';
|
||||
/*****用户*****/
|
||||
class vpUserService {
|
||||
private static GetUserInfoPath : string = '/User/GetUserInfo';
|
||||
/*****获取用户信息*****/
|
||||
static GetUserInfo() {
|
||||
var result = Service.Request(this.GetUserInfoPath, 'GET', {});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static GetUserAccInfoPath : string = '/User/GetUserAccInfo';
|
||||
/*****获取用户账户信息*****/
|
||||
static GetUserAccInfo(page : number) {
|
||||
var result = Service.Request(this.GetUserAccInfoPath, 'GET', { page });
|
||||
return result;
|
||||
}
|
||||
|
||||
private static UpdateUserPath : string = '/User/UpdateUser';
|
||||
/*****修改用户信息*****/
|
||||
static UpdateUser(headImg:string,nick:string,sex:string,phone:string) {
|
||||
var result = Service.Request(this.UpdateUserPath, 'POST', { headImg,nick,sex,phone });
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static PayMerchPath : string = '/Order/PayMerch';
|
||||
/*****支付*****/
|
||||
static PayMerch(merchId:string,amount:number,payway:string,openId:string) {
|
||||
var result = Service.Request(this.PayMerchPath, 'POST', { merchId,amount,payway,openId });
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static GetShareEwmPath : string = '/User/GetShareEwm';
|
||||
/*****获取用户二维码*****/
|
||||
static GetShareEwm() {
|
||||
var result = Service.Request(this.GetShareEwmPath, 'GET', { });
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static GetAddressInfoPath : string = '/User/GetAddressInfo';
|
||||
/*****根据经纬度获取地址*****/
|
||||
static GetAddressInfo(lon:number,lat:number) {
|
||||
var result = Service.Request(this.GetAddressInfoPath, 'GET', {lon ,lat});
|
||||
return result;
|
||||
}
|
||||
|
||||
private static CollectMerchPath : string = '/User/CollectMerch';
|
||||
/*****用户收藏*****/
|
||||
static CollectMerch(merchId:string) {
|
||||
var result = Service.Request(this.CollectMerchPath, 'POST', {merchId});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
export { Service, vpUserService };
|
||||
Reference in New Issue
Block a user