Browse Source

fix: 解决冲突

deliver
song 4 years ago
parent
commit
c60cd9f31b
  1. 45
      .drone.yml
  2. 1
      CHANGELOG.md
  3. 1
      apis/tall.js
  4. 42
      hooks/user/userMixin.js
  5. 40
      manifest.json
  6. 14
      pages/user/login.vue
  7. 266
      pages/user/mixin.js
  8. 2
      plugins/p-deliver-check/p-deliver-check.vue
  9. 20
      store/user/actions.js

45
.drone.yml

@ -17,35 +17,36 @@ volumes:
path: /var/lib/data path: /var/lib/data
steps: steps:
- name: restore-cache # - name: restore-cache
image: drillster/drone-volume-cache # image: drillster/drone-volume-cache
volumes: # volumes:
- name: cache # - name: cache
path: /cache # path: /cache
settings: # settings:
restore: true # restore: true
mount: # mount:
- ./node_modules # - ./node_modules
- name: build - name: build
image: node:latest image: node:latest
pull: if-not-exists # default always pull: if-not-exists # default always
volumes: # volumes:
- name: cache # - name: cache
path: /root/.m2 # path: /root/.m2
commands: commands:
- npm config set registry http://registry.npm.taobao.org
- npm i - npm i
- npm run build:dev - npm run test
- name: rebuild-cache # - name: rebuild-cache
image: drillster/drone-volume-cache # image: drillster/drone-volume-cache
volumes: # volumes:
- name: cache # - name: cache
path: /cache # path: /cache
settings: # settings:
rebuild: true # rebuild: true
mount: # mount:
- ./node_modules # - ./node_modules
- name: deploy-scp - name: deploy-scp
image: appleboy/drone-scp image: appleboy/drone-scp

1
CHANGELOG.md

@ -10,6 +10,7 @@
- | vue3 | [12ed2ad](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12ed2ad) - | vue3 | [12ed2ad](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12ed2ad)
- | 使用uview完成api请求 | [1b3efd8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b3efd8) - | 使用uview完成api请求 | [1b3efd8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b3efd8)
- | 手机号登录 | [565585b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/565585b) - | 手机号登录 | [565585b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/565585b)
- | 插件面板分开显示 | [fb5e86b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/fb5e86b)
- | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91) - | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91)
- | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6) - | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6)
- | 时间轴展示 | [8b1b380](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8b1b380) - | 时间轴展示 | [8b1b380](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8b1b380)

1
apis/tall.js

@ -2,6 +2,7 @@ import Config from '@/common/js/config.js'
const apiUrl = Config.apiUrl; const apiUrl = Config.apiUrl;
const tall = `${apiUrl}/tall3/v3.0`; const tall = `${apiUrl}/tall3/v3.0`;
const tall1 = `http://101.201.226.163/gateway/ptos`;
export function setupTall(app) { export function setupTall(app) {
uni.$u.api = { ...uni.$u.api } || {}; uni.$u.api = { ...uni.$u.api } || {};

42
hooks/user/userMixin.js

@ -82,14 +82,19 @@ export default function userMixin() {
], ],
}; };
const smsCode = ref(null); // 短信验证码 const smsCode = ref(null); // 短信验证码
const showInterval = ref(false); // const showInterval = ref(false);
const interval = ref(120); // const interval = ref(120);
const codeTimer = ref(null); const codeTimer = ref(null);
const showPaste = ref(false); // const showPaste = ref(false);
const dataObj = reactive({
showInterval: false,
interval: 120,
showPaste: false
})
//有图片验证码的值 //有图片验证码的值
function hasvalue(form) { function hasvalue(form) {
if(form.smsCode || form.showPaste) return if(form.smsCode || dataObj.showPaste) return
if (!verifyPhone(form.phone)) { if (!verifyPhone(form.phone)) {
uni.$ui.showToast('请输入正确的手机号'); uni.$ui.showToast('请输入正确的手机号');
return; return;
@ -98,24 +103,24 @@ export default function userMixin() {
uni.$ui.showToast('请输入图形验证码'); uni.$ui.showToast('请输入图形验证码');
return; return;
} }
getCode(); getCode(form);
} }
// 获取验证码 // 获取验证码
async function getCode() { async function getCode(form) {
try { try {
if (!verificationCodeId.value || !form.verificationCodeValue) { if (!form.verificationCodeId || !form.verificationCodeValue) {
showToast('缺少图形验证码参数'); uni.$ui.showToast('缺少图形验证码参数');
return; return;
} }
const params = { const params = {
phone: form.phone, phone: form.phone,
verificationCodeId: verificationCodeId.value, verificationCodeId: form.verificationCodeId,
verificationCodeValue: form.verificationCodeValue, verificationCodeValue: form.verificationCodeValue,
}; };
const date = await store.dispatch('user/sendCode', params); const date = await store.dispatch('user/sendCode', params);
getCodeInterval(); getCodeInterval();
showPaste.value = true; dataObj.showPaste = true;
} catch (err) { } catch (err) {
throw err; throw err;
} }
@ -123,16 +128,16 @@ export default function userMixin() {
// 获取验证码倒计时 // 获取验证码倒计时
function getCodeInterval() { function getCodeInterval() {
showInterval.value = true; dataObj.showInterval = true;
codeTimer.value = setInterval(() => { codeTimer.value = setInterval(() => {
if (interval.value === 0) { if (dataObj.interval === 0) {
clearInterval(codeTimer.value); clearInterval(codeTimer.value);
codeTimer.value = null; codeTimer.value = null;
showInterval.value = false; dataObj.showInterval = false;
interval.value = 120; dataObj.interval = 120;
return; return;
} }
interval.value = interval.value - 1; dataObj.interval = dataObj.interval - 1;
}, 1000); }, 1000);
} }
@ -213,9 +218,10 @@ export default function userMixin() {
return { return {
rules, rules,
showPaste, // showPaste,
showInterval, // showInterval,
interval, // interval,
dataObj,
hasvalue, hasvalue,
checkRules, checkRules,
setCode, setCode,

40
manifest.json

@ -1,6 +1,6 @@
{ {
"name" : "tall-4-project", "name" : "时物链条",
"appid" : "__UNI__1EC8558", "appid" : "__UNI__3CBCFFF",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
@ -43,7 +43,41 @@
/* ios */ /* ios */
"ios" : {}, "ios" : {},
/* SDK */ /* SDK */
"sdkConfigs" : {} "sdkConfigs" : {
"ad" : {}
},
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
}
} }
}, },
/* */ /* */

14
pages/user/login.vue

@ -11,9 +11,9 @@
</u-form-item> </u-form-item>
<u-form-item label="验证码" prop="smsCode" label-width="150"> <u-form-item label="验证码" prop="smsCode" label-width="150">
<u-input @focus="mixinInit.hasvalue(form)" placeholder="请输入验证码" v-model="form.smsCode" type="text"> </u-input> <u-input @focus="mixinInit.hasvalue(form)" placeholder="请输入验证码" v-model="form.smsCode" type="text"></u-input>
<u-button slot="right" type="primary" size="mini" v-show="mixinInit.showPaste" @click="mixinInit.setCode" class="u-m-r-20">粘贴</u-button> <u-button slot="right" type="primary" size="mini" v-show="mixinInit.dataObj.showPaste" @click="mixinInit.setCode" class="u-m-r-20">粘贴</u-button>
<u-button slot="right" size="mini" v-if="mixinInit.showInterval">{{ mixinInit.interval }}</u-button> <u-button slot="right" size="mini" v-if="mixinInit.dataObj.showInterval">{{ mixinInit.dataObj.interval }}</u-button>
</u-form-item> </u-form-item>
<view class="flex flex-nowrap"> <view class="flex flex-nowrap">
@ -52,13 +52,11 @@
const form = reactive({ const form = reactive({
phone: '', phone: '',
verificationCodeValue: '', verificationCodeId: '', // id
verificationCodeValue: '', //
smsCode: '' smsCode: ''
}); });
const imageBase64 = ref(null); // const imageBase64 = ref(null); //
const verificationCodeId = ref(null); // id
const data = {};
const treeId = ref(null);
getImageCode(); getImageCode();
@ -80,7 +78,7 @@
try { try {
const data = await uni.$u.api.getImageCode(); const data = await uni.$u.api.getImageCode();
imageBase64.value = data.imageBase64 || ''; imageBase64.value = data.imageBase64 || '';
verificationCodeId.value = data.verificationCodeId || ''; form.verificationCodeId = data.verificationCodeId || '';
uni.$ui.hideLoading(); uni.$ui.hideLoading();
} catch (error) { } catch (error) {
uni.$ui.hideLoading(); uni.$ui.hideLoading();

266
pages/user/mixin.js

@ -1,266 +0,0 @@
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import clipboard from "@/common/js/dc-clipboard/clipboard.js"
export default function mixinInit {
const store = useStore();
const user = computed(() => store.state.user.user);
const rules = ref({
phone: [
{
required: true,
message: '请输入手机号',
trigger: ['change','blur'],
},
{
validator: (rule, value, callback) => {
// 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
return this.$u.test.mobile(value);
},
message: '手机号码不正确',
// 触发器可以同时用blur和change,二者之间用英文逗号隔开
trigger: ['change','blur'],
}
],
verificationCodeValue: [
{
required: true,
message: '请输入图形验证码',
trigger: ['change','blur'],
},
{
type: 'number',
message: '图形验证码只能为数字',
trigger: ['change','blur'],
}
],
smsCode: [
{
required: true,
message: '请输入验证码',
trigger: ['change','blur'],
},
{
type: 'number',
message: '验证码只能为数字',
trigger: ['change','blur'],
}
],
account: [
{
required: true,
message: '请输入用户名',
trigger: ['change','blur'],
},
{
min: 2,
max: 20,
message: '用户名长度在2到20个字符',
trigger: ['change','blur'],
},
{
pattern: /^[a-zA-Z0-9._-]{2,20}$/,
message: '请输入2-20位字母、数字、汉字或字符"_ - ."',
trigger: ['change','blur'],
}
],
password: [
{
required: true,
message: '请输入密码',
trigger: ['change','blur'],
},
{
min: 6,
max: 20,
message: '密码长度在6到20个字符',
trigger: ['change','blur'],
},
{
// 正则不能含有两边的引号
pattern: /^[a-zA-Z0-9._-]{6,20}$/,
message: '请输入6-20位字母、数字、汉字或字符"_ - ."',
trigger: ['change','blur'],
}
],
});
const errorType = ref(['message']);
const labelPosition = ref('left');
const border = ref(false);
const smsCode = ref(''); // 短信验证码
const showInterval = ref(false);
const interval = ref(120);
const codeTimer = ref(null);
const showPaste = ref(false);
return {
errorType,
// getImageCode,
// hasvalue,
// getCode,
// getCodeInterval,
// checkRules,
// setCode,
// getClipboardContents,
// verifyPhone,
// verifyLoginname,
// handleWxLogin
}
}
// const mixin = {
// computed: mapState('user', ['user']),
// onReady() {
// this.$refs.uForm.setRules(this.rules);
// },
// methods: {
// ...mapActions('user', ['sendCode']),
// 获取图形验证码
// async getImageCode() {
// this.$util.showLoading();
// try {
// const data = await uni.$u.api.getImageCode();
// const { imageBase64, verificationCodeId } = data;
// this.imageBase64 = imageBase64 || '';
// this.verificationCodeId = verificationCodeId || '';
// uni.hideLoading();
// } catch (error) {
// uni.hideLoading();
// uni.$ui.showToast(error);
// }
// },
// //有图片验证码的值
// hasvalue() {
// if(this.model.smsCode || this.model.showPaste) return
// if (!this.verifyPhone(this.model.phone)) {
// uni.$ui.showToast('请输入正确的手机号');
// return;
// }
// if (!this.model.verificationCodeValue) {
// uni.$ui.showToast('请输入图形验证码');
// return;
// }
// this.getCode();
// },
// // 获取验证码
// async getCode() {
// try {
// const { phone, verificationCodeValue } = this.model;
// const { verificationCodeId } = this;
// if (!verificationCodeId || !verificationCodeValue) {
// uni.$ui.showToast('缺少图形验证码参数');
// return;
// }
// const params = {
// phone,
// verificationCodeId,
// verificationCodeValue,
// };
// const date = await store.dispatch('user/sendCode', params);
// getCodeInterval();
// showPaste.value = true;
// } catch (err) {
// throw err;
// }
// },
// // 获取验证码倒计时
// getCodeInterval() {
// this.showInterval = true;
// this.codeTimer = setInterval(() => {
// if (this.interval === 0) {
// clearInterval(this.codeTimer);
// this.codeTimer = null;
// this.showInterval = false;
// this.interval = 120;
// return;
// }
// this.interval = this.interval - 1;
// }, 1000);
// },
// // 验证信息
// checkRules() {
// // const { smsCode, phone, user } = this;
// if (!this.verifyPhone(phone.value)) {
// uni.$ui.showToast('请输入正确的手机号');
// return false;
// }
// if (!smsCode.value) {
// uni.$ui.showToast('验证码无效');
// return false;
// }
// if (phone.value === user.value.phone) {
// uni.$ui.showToast('新手机号不能与旧手机号相同');
// return;
// }
// return true;
// },
// // 粘贴
// setCode() {
// // 获取粘贴板内容
// // 小程序平台
// //#ifdef MP-WEIXIN
// var _this = this
// uni.getClipboardData({
// success (res) {
// _this.smsCode = res.data;
// }
// });
// //#endif
// // 非小程序平台
// //#ifndef MP-WEIXIN
// this.getClipboardContents()
// //#endif
// },
// // 非小程序平台粘贴
// async getClipboardContents() {
// try {
// const text = await navigator.clipboard.readText();
// this.smsCode = text;
// } catch (err) {
// console.error('Failed to read clipboard contents: ', err);
// }
// },
// /**
// * 验证手机号格式
// * @param {string} phone 手机号
// */
// verifyPhone(phone) {
// const phoneExg = /^1\d{10}$/;
// return phoneExg.test(phone);
// },
// /**
// * 验证账号/密码 格式
// * @param {string} account 账号
// */
// verifyLoginname(account) {
// const accountExg = /^[a-zA-Z0-9._-]{2,20}$/;
// return accountExg.test(account);
// },
// // 微信登录
// handleWxLogin() {
// const origin = 'https://test.tall.wiki/pt-mui'; // 测试
// const appid = 'wxd1842e073e0e6d91';
// const state = 'wx_web';
// const href = 'https://open.weixin.qq.com/connect/qrconnect';
// // eslint-disable-next-line
// window.location.href =
// `${href}?appid=${appid}&redirect_uri=${origin}&response_type=code&scope=snsapi_login&state=${state}#wechat_redirect`;
// },
// // }
// };

2
plugins/p-deliver-check/p-deliver-check.vue

@ -19,7 +19,7 @@
</template> </template>
<script setup> <script setup>
import { reactive, watchEffect, defineEmits } from 'vue'; import { reactive, watchEffect } from 'vue';
const data = reactive({ const data = reactive({
remark: '', remark: '',

20
store/user/actions.js

@ -1,5 +1,3 @@
import ui from '@/utils/ui.js';
const actions = { const actions = {
/** /**
* 通过userId获取token * 通过userId获取token
@ -15,7 +13,23 @@ const actions = {
uni.$storage.setStorageSync('user', JSON.stringify(res)); uni.$storage.setStorageSync('user', JSON.stringify(res));
return res; return res;
} catch (error) { } catch (error) {
ui.showToast(error.msg || '获取个人信息失败'); uni.$ui.showToast(error.msg || '获取个人信息失败');
throw error;
}
},
/**
* 发送验证码
* @param {ant} commit
* @param {object} params 要提交的数据
* @param {string} params.phone 手机号
*/
sendCode({ commit }, params) {
try{
uni.$u.api.getSmsCode(params);
uni.$ui.showToast('验证码发送成功');
} catch (error) {
uni.$ui.showToast(error.msg || '发送失败');
throw error; throw error;
} }
}, },

Loading…
Cancel
Save